java/2040: java.util.Hashtable(int,float) is stricter than sun's version

pedro@vis.ethz.ch pedro@vis.ethz.ch
Tue Feb 20 10:26:00 GMT 2001


>Number:         2040
>Category:       java
>Synopsis:       java.util.Hashtable(int,float) is stricter than sun's version
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 20 10:26:02 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     pedro@vis.ethz.ch
>Release:        latest 3.0 snapshot
>Organization:
>Environment:
i686-linux
>Description:
the java.util.Hashtable(initialCapacity,loadFactor) initializer throws an IllegalArgumentException in one of the following cases:

	- initialCapacity is negative
	- loadFactor is negative
	- loadFactor is > 1

although a loadFactor > 1 doesn't make much sense, many people don't realize it and sice sun's jdk won't send you to hell if you do it, many programs (in my case i'm trying to compile kjc - it has about 10-20 of these) do it.
i have no idea what the jls says about this, if anything.
>How-To-Repeat:
public class Test {
	public static void main ( String args[] ) {
		Hashtable h = new java.util.Hashtable(1,1.5f);
		System.out.println(h);
		}
	}
>Fix:
i changed java.util.Hashtable.java to not through an exception but force the parameters into reasonable values if they don't make sense. stupid people shouldn't be playing with these in the first place.
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list