aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs150/pr114005/Declaration1.java
blob: 787be727b5b27cd8443157fd9757c5849b17a147 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.lang.annotation.*;
import java.lang.reflect.*;

@Retention(RetentionPolicy.RUNTIME)
@interface SampleAnnotation { }

interface TestInterface { }

class Test implements TestInterface{}

// First case: the ITD on the interface is annotated, it should make it through 
// to the member added to the implementor
public aspect Declaration1 {

	// ITD directly on the implementor
    @SampleAnnotation 
	public String Test.firstProperty;
	
    // ITD on the interface
	@SampleAnnotation
	public String TestInterface.secondProperty;

	public static void main(String[] args) {
		for (Field field: Test.class.getFields()) {
			StringBuffer sb = new StringBuffer();
			sb.append(field.toString());
			boolean b = field.isAnnotationPresent(SampleAnnotation.class);
			sb.append(" has annotation:").append(b);
			System.out.println(sb.toString());
		}
	}
}