This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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



>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]