aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs150/pr98901/Case23.aj
blob: 53a11271934732bb3db04390b1fe77560aaf2a12 (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
// "public field with declare @field"

import java.lang.annotation.*;
import java.lang.reflect.Field;

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

class A23 {
	public int a;
}

aspect B23 {
	
	declare @field : int A23.a : @anInterface;
	
	public static void main(String [] args){
		Class c = A23.class;
		try {
			Field m = c.getDeclaredField("a");
			Annotation [] anns = m.getDeclaredAnnotations();
			for (int i = 0;i < anns.length;i++){
				System.out.println(anns[i]);
			}
		} catch (Exception e){
			System.out.println("exceptional!");
		}
	}
}