JDK-4988155 : (reflect) incorrect result from Class.isAnnotationType
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 5.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_8
  • CPU: generic
  • Submitted: 2004-02-04
  • Updated: 2012-09-28
  • Resolved: 2004-02-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 b40Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
========================================$ cat -n T.java
     1	interface T extends java.lang.annotation.Annotation {
     2	}
     3	
     4	class Main {
     5	    public static void main(String[] args) {
     6	        if (T.class.isAnnotationType()) throw new Error();
     7	    }
     8	}
========================================$ /java/re/j2se/1.5.0/promoted/latest/binaries/`platform`/bin/java -version
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b36)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b36, mixed mode)
========================================$ /java/re/j2se/1.5.0/promoted/latest/binaries/`platform`/bin/javac T.java
========================================$ /java/re/j2se/1.5.0/promoted/latest/binaries/`platform`/bin/java Main
Exception in thread "main" java.lang.Error
	at Main.main(T.java:6)
========================================$ 

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta2 FIXED IN: tiger-beta2 INTEGRATED IN: tiger-b40 tiger-beta2
14-06-2004

SUGGESTED FIX src/share/classes/java/lang>sccs sccsdiff -r1.171 -r1.172 Class.java ------- Class.java ------- 91a92,93 > private static final int ANNOTATION= 0x00002000; > private static final int ENUM = 0x00004000; 462,466c464 < // XXX Temporary implementation - should use VM flag! < Class[] interfaces = this.getInterfaces(); < < return interfaces.length == 1 && < interfaces[0] == java.lang.annotation.Annotation.class; --- > return (getModifiers() & ANNOTATION) != 0; 2451,2452c2449 < Class zuper = this.getSuperclass(); < return zuper != null && Enum.class.isAssignableFrom(zuper); --- > return (getModifiers() & ENUM) != 0; ###@###.### 2004-02-17
17-02-2004

EVALUATION Should use annotation flag defined by 4975724. ###@###.### 2004-02-05
05-02-2004