-
Bug
-
Resolution: Duplicate
-
P4
-
7u6
-
generic
-
generic
1.7.0_04, 1.7.0_06
ADDITIONAL OS VERSION INFORMATION :
RHEL 5.8
EXTRA RELEVANT SYSTEM CONFIGURATION :
Bug is OS unrelated
A DESCRIPTION OF THE PROBLEM :
Javac denies to compile code containing references to enum types, if the enum type constructor has annotated parameters and the classes were compiled by Eclipse compiler for Java.
Javac complains about " bad class file " and " bad signature " .
It looks like javac expects that enum constructors always have generic signature attribute and tries to use the signature attribute to decode parameter annotations.
Please see the full discussion and code examples here:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=388314
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class MyMain {
public static void main(String[] args){
System.out.println( UseAnnotation.COMPLETE );
}
}
import javax.annotation.Nonnull;
public enum UseAnnotation {
COMPLETE( " finished " );
private final String mString;
UseAnnotation (@Nonnull String aString) {
mString = aString;
}
public @Nonnull String getString() {
return mString;
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
There is no workarounds except to remove annotations from the enum constructor parameters.
- duplicates
-
JDK-8025806 java.lang.reflect.Parameter.getAnnotations() fails for inner classes
- Closed
-
JDK-8038835 Incorrect number of annotations in a nested class constructor after compilation
- Closed
- relates to
-
JDK-8066725 javac produces classfiles it cannot read
- Closed
-
JDK-8026480 Unnecessary Signature attribute generated for enum constructors
- Open
-
JDK-8334870 javac does not accept classfiles with certain permitted RuntimeVisibleParameterAnnotations and RuntimeInvisibleParameterAnnotations attributes
- Resolved
-
JDK-8074977 Constructor.getAnnotatedParameterTypes returns wrong value
- Closed