JDK-4030374 - Java Issue Tracker
Feb 5, 1997 ... For example, the following program would fail at runtime: <pre> class SuperInitBug { static class S { void hi() { System.out.println("You ...
Feb 5, 1997 ... For example, the following program would fail at runtime: <pre> class SuperInitBug { static class S { void hi() { System.out.println("You ...
Following example shows that if Long.MAX_VALUE is used as a parameter for this constructor then this constructor creates object with less then 1970 year in the string representation.
If the String passed to the BigInteger(String, int) constructor begins with "-- " (two minus signs), or "-0-" then a BigInteger object is created even though such a String is badly formatted.Example: import java.math.BigInteger
jdk1.4.0beta-b54 java.lang.Class: newInstance() incorrectly throws IllegalAccessException creating an instance of the class from the same package with protected nullary constructor.
It's an error in java.lang.String source code which is the same for all JDK distributions.I have created a more simple example class which demonstrates this behaviour very clearly. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : See bug ID 4637640.
That way the benefits of using such methods would be encouraged. Maybe have the static factory methods grouped after the constructors in the javadoc.For example, "static Integer Integer.valueOf(String)" fits this pattern and is indeed a static factory.