Bug 85538 - [1.5] compiler does not reject cyclic annotation element types
Summary: [1.5] compiler does not reject cyclic annotation element types
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M6   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 81974 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-02-16 14:53 EST by Markus Keller CLA
Modified: 2005-03-31 07:01 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2005-02-16 14:53:28 EST
I20050215-2300

The compiler must reject cyclic annotation element types.
Javac spits out an error for nest(): "cyclic annotation element type".

@Retention(RetentionPolicy.RUNTIME)
@interface Nested {
	String name() default "Hans";
	N2 nest();
}

@interface N2 {
	Nested n2() default @Nested(name="Haus", nest= @N2);
}

Running the following class then gives a StackOverflowError (cyclic annotations
seem to pass through the verifier without problems):

@Nested(name="XY", nest= @N2)
class Test {
	public static void main(String[] args) {
		Nested annotation= Test.class.getAnnotation(Nested.class);
	}
}
Comment 1 Philipe Mulet CLA 2005-02-16 16:08:40 EST
*** Bug 81974 has been marked as a duplicate of this bug. ***
Comment 2 Kent Johnson CLA 2005-02-23 10:24:10 EST
Added to AnnotationTest test003
Comment 3 David Audel CLA 2005-03-31 07:01:21 EST
Verified in I20050330-0500