Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 1.5.6, 1.5.7, 1.6-beta-2
-
Fix Version/s: 1.6-rc-1, 1.5.8, 1.7-beta-1
-
Component/s: None
-
Labels:None
-
Environment:Gentoo Linux, SUN JVM 1.6.0.10
-
Testcase included:yes
-
Number of attachments :
Description
In an enum declaration, i'm using a static list that holds references to the enum values. The list is not initialized correctly, all values are set to null instead of the expected enum.
Hi,
Attaching the patch for 1.5.8 as a partial fix. In 1.6, the same fix is resulting in
some errors and I am looking into them. If I am able to resolve them, I'll update the patches.
The issue is related to Verifier pushing the static enum fields defined by user to the
beginning of the static init block of the enum class (before the enum values are initialized).
When EnumVisitor visits an enum class node, it creates a <clinit>(static init) block
in which it defines the enum values. But when Verifier visits this class node later, if
it sees some static fields, it adds their AST statements to the beginning of the <clinit> block.
Here is the test case with which I have verified this partial fix: