JDK-4964952 : javac allows illegal self-reference
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2003-12-08
  • Updated: 2003-12-08
  • Resolved: 2003-12-08
Related Reports
Duplicate :  
Description

Name: viR10068			Date: 12/08/2003


The spec 'A Program Annotation Facility for the Java Programming Language' says:
"
Annotation types must not contain members of the same annotation type,
either directly or indirectly. In other words, this is illegal:

// Illegal self-reference!!
@interface SelfRef {
    SelfRef value();
}
"
But the compiler jdk1.5-b30 compile it successfully.
        
The following JCK tests are failed due to this bug:
lang/ANNOT/annot047/annot04701/annot04701.html

The source code:
-------------------------- test.java ----------------------------
@interface testID {
    testID id();
}
-----------------------------------------------------------------

Execution log (no errors reported):
% jdk1.5.0-b30/solaris-sparc/bin/javac -source 1.5 -target 1.5 -version test.java
javac 1.5.0-beta
% 

======================================================================

Name: viR10068			Date: 12/08/2003


Also for illegal circularity:
"
Annotation types must not contain members of the same annotation type,
either directly or indirectly. In other words, this is illegal:

// Illegal circularity!!
@interface Ping {
    Pong value();
}

@interface Pong {
    Ping value();
}
"
But the compiler jdk1.5-b30 compile it successfully.
        
The following JCK tests are failed due to this bug:
lang/ANNOT/annot048/annot04801/annot04801.html

The source code:
-------------------------- test.java ----------------------------
@interface Ping {
    Pong value();
}

@interface Pong {
    Ping value();
}
-----------------------------------------------------------------

Execution log (no errors reported):
% jdk1.5.0-b30/solaris-sparc/bin/javac -source 1.5 -target 1.5 -version test.java
javac 1.5.0-beta
% 


======================================================================