JDK-4030374 - Java Issue Tracker
Feb 5, 1997 ... For example, the following program would fail at runtime: <pre> ... (correct) code. I have filed a bug against the verifier (4408261) but ...
Feb 5, 1997 ... For example, the following program would fail at runtime: <pre> ... (correct) code. I have filed a bug against the verifier (4408261) but ...
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.
SUGGESTED FIX With the fix for 5089202, it's not obvious that simply changing the array growth formula to doubling powers of two would actually improve the situation-- it would seem better to detect overflow explicitly.
The workaround is of course simple: Dont make your fields public. Unfortunately this is difficult when using software that is affected by this bug and for which no source code is available. It simply breaks when changing from Java 6 to Java 7 without giving any error messages.