Details
-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
b51
-
generic, x86
-
generic, windows_xp
Description
Name: gm110360 Date: 04/26/2004
FULL PRODUCT VERSION :
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b32c)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
getAnnotation() return null and not the annotation
as it should be.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run the class VersionTest
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
1.1
1.0
ACTUAL -
1.1
java.lang.NullPointerException
at VersionTest.main(VersionTest.java:30)
Exception in thread "main"
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.NullPointerException
at VersionTest.main(VersionTest.java:30)
Exception in thread "main"
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
* Created on 26 avr. 2004
*
*/
import java.lang.annotation.*;
import static java.lang.annotation.RetentionPolicy.*;
/**
* @author remi
*
*/
@Version("1.1")
public class VersionTest {
@Retention(RUNTIME)
@Version("1.0")
public @interface Version {
String value();
}
public static void main(String[] args) {
/*for(Annotation ann:Version.class.getAnnotations())
System.out.println(ann);*/
System.out.println(VersionTest.class.getAnnotation(Version.class).value());
System.out.println(Version.class.getAnnotation(Version.class).value());
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
use Version.class.getAnnotations() first !!
(Incident Review ID: 259841)
======================================================================
Attachments
Issue Links
- duplicates
-
JDK-5040401 (ann) Documented class may miss itself in its own annotations list
- Closed