View | Details | Raw Unified | Return to bug 98901 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/aspectj/systemtest/ajc150/AnnotationsBinaryWeaving.java (+20 lines)
Lines 52-56 Link Here
52
  public void test004_decpOnAnnotationNotAllowed_xlints() {
52
  public void test004_decpOnAnnotationNotAllowed_xlints() {
53
  	runTest("declare parents wildcards matching annotation types");
53
  	runTest("declare parents wildcards matching annotation types");
54
  }
54
  }
55
  
56
  public void test005(){
57
	  runTest("public ITD method with no annotation that has declare @method annotation on it");
58
  }
59
  
60
  public void test006(){
61
	  runTest("public ITD field with annotation on it");
62
  }
63
  
64
  public void test007(){
65
	  runTest("public ITD field with no annotation that has declare @field annotation on it");
66
  }
67
  
68
  public void test008(){
69
	  runTest("public ITD method with annotation on it which is made onto an interface");
70
  }
71
  
72
  public void test009(){
73
	  runTest("public abstract ITD method with annotations on it");
74
  }
55
75
56
}
76
}
(-)src/org/aspectj/systemtest/ajc150/ajc150.xml (+54 lines)
Lines 2370-2373 Link Here
2370
   <!--     End of generics tests                                      -->
2370
   <!--     End of generics tests                                      -->
2371
   <!-- ============================================================== -->
2371
   <!-- ============================================================== -->
2372
   
2372
   
2373
   <ajc-test dir="bugs150/pr98901" title="public ITD method with no annotation that has declare @method annotation on it">
2374
     <compile files="Case1.aj" options="-1.5 -Xlint:warning">
2375
     	<message kind="warning" line="14" text="advice defined in B1 has not been applied [Xlint:adviceDidNotMatch]"/>
2376
     </compile>
2377
     <run class="B1">
2378
         <stdout>
2379
           <line text="@anInterface()"/>
2380
         </stdout>
2381
       </run>
2382
   </ajc-test>
2383
   
2384
   <ajc-test dir="bugs150/pr98901" title="public ITD field with annotation on it">
2385
     <compile files="Case2.aj" options="-1.5 -Xlint:error">
2386
     </compile>
2387
     <run class="B2">
2388
         <stdout>
2389
           <line text="@anInterface()"/>
2390
           <line text="========"/>
2391
           <line text="@anInterface()"/>
2392
           <line text="========"/>
2393
         </stdout>
2394
       </run>
2395
   </ajc-test>
2396
   
2397
   <ajc-test dir="bugs150/pr98901" title="public ITD field with no annotation that has declare @field annotation on it">
2398
     <compile files="Case3.aj" options="-1.5 -Xlint:error">
2399
     </compile>
2400
     <run class="B3">
2401
         <stdout>
2402
           <line text="@anInterface()"/>
2403
         </stdout>
2404
       </run>
2405
   </ajc-test>
2406
   
2407
   <ajc-test dir="bugs150/pr98901" title="public ITD method with annotation on it which is made onto an interface">
2408
     <compile files="Case4.aj" options="-1.5 -Xlint:error">
2409
     </compile>
2410
     <run class="B4">
2411
         <stdout>
2412
           <line text="@anInterface()"/>
2413
         </stdout>
2414
       </run>
2415
   </ajc-test>
2416
   
2417
   <ajc-test dir="bugs150/pr98901" title="public abstract ITD method with annotations on it">
2418
     <compile files="Case5.aj" options="-1.5 -Xlint:error">
2419
     </compile>
2420
     <run class="B5">
2421
         <stdout>
2422
           <line text="@anInterface()"/>
2423
         </stdout>
2424
       </run>
2425
   </ajc-test>
2426
   
2373
</suite>
2427
</suite>
(-)bugs150/pr98901/Case1.aj (+29 lines)
Added Link Here
1
// "public ITD method with no annotation that has declare @method annotation on it"
2
3
import java.lang.annotation.*;
4
import java.lang.reflect.Method;
5
6
@Retention(RetentionPolicy.RUNTIME)
7
@interface anInterface{}
8
9
aspect B1 {
10
	public void B1.a(){}
11
	public void B1.b(){}
12
	declare @method : void B1.b(..) : @anInterface;
13
	
14
	before(anInterface a): execution(void B1.a(..)) && @annotation(a) {} // not applied
15
	before(anInterface a): execution(void B1.b(..)) && @annotation(a) {} // applied
16
	
17
	public static void main(String [] args){
18
		Class B1o = B1.class;
19
		try {
20
		Method bo = B1o.getDeclaredMethod("b", new Class [0]);
21
		Annotation [] boAnns = bo.getDeclaredAnnotations();
22
		for (int i = 0;i < boAnns.length;i++){
23
			System.out.println(boAnns[i]);
24
		}
25
		} catch (Exception e){
26
			System.out.println("exceptional!");
27
		}
28
	}
29
}
(-)bugs150/pr98901/Case2.aj (+35 lines)
Added Link Here
1
// "public ITD field with annotation on it"
2
3
import java.lang.annotation.*;
4
import java.lang.reflect.Field;
5
6
@Retention(RetentionPolicy.RUNTIME)
7
@interface anInterface{}
8
9
aspect B2 {
10
	@anInterface
11
	public int a; // local
12
	
13
	@anInterface
14
	public int B2.b; // inter-type
15
	
16
	public static void main(String [] args){
17
		Class B2o = B2.class; // shurely Aspect c = B1.aspect??
18
		try {
19
		Field ao = B2o.getDeclaredField("a");
20
		Annotation [] aoAnns = ao.getDeclaredAnnotations();
21
		for (int i = 0;i < aoAnns.length;i++){
22
			System.out.println(aoAnns[i]);
23
		}
24
		System.out.println("========");
25
		Field bo = B2o.getDeclaredField("b");
26
		Annotation [] boAnns = bo.getDeclaredAnnotations();
27
		for (int i = 0;i < boAnns.length;i++){
28
			System.out.println(boAnns[i]);
29
		}
30
		System.out.println("========");
31
		} catch (Exception e){
32
			System.out.println("exceptional!");
33
		}
34
	}
35
}
(-)bugs150/pr98901/Case3.aj (+26 lines)
Added Link Here
1
// "public ITD field with no annotation that has declare @field annotation on it"
2
3
import java.lang.annotation.*;
4
import java.lang.reflect.Field;
5
6
@Retention(RetentionPolicy.RUNTIME)
7
@interface anInterface{}
8
9
aspect B3 {
10
	
11
	public int B3.b; // inter-type
12
	declare @field : public int B3.b : @anInterface;
13
	
14
	public static void main(String [] args){
15
		Class B3o = B3.class; // shurely Aspect c = B1.aspect??
16
		try {
17
		Field bo = B3o.getDeclaredField("b");
18
		Annotation [] boAnns = bo.getDeclaredAnnotations();
19
		for (int i = 0;i < boAnns.length;i++){
20
			System.out.println(boAnns[i]);
21
		}
22
		} catch (Exception e){
23
			System.out.println("exceptional!");
24
		}
25
	}
26
}
(-)bugs150/pr98901/Case4.aj (+28 lines)
Added Link Here
1
// "public ITD method with annotation on it which is made onto an interface"
2
3
import java.lang.annotation.*;
4
import java.lang.reflect.Method;
5
6
@Retention(RetentionPolicy.RUNTIME)
7
@interface anInterface{}
8
9
interface A4{}
10
11
aspect B4 {
12
	
13
	@anInterface
14
	public void A4.a() {}
15
	
16
	public static void main(String [] args){
17
		Class A4o = A4.class; // shurely Interface c = B1.interface??
18
		try {
19
		Method ao = A4o.getDeclaredMethod("a", new Class [0]);
20
		Annotation [] aoAnns = ao.getDeclaredAnnotations();
21
		for (int i = 0;i < aoAnns.length;i++){
22
			System.out.println(aoAnns[i]);
23
		}
24
		} catch (Exception e){
25
			System.out.println("exceptional!");
26
		}
27
	}
28
}
(-)bugs150/pr98901/Case5.aj (+28 lines)
Added Link Here
1
// "public abstract ITD method with annotations on it"
2
3
import java.lang.annotation.*;
4
import java.lang.reflect.Method;
5
6
@Retention(RetentionPolicy.RUNTIME)
7
@interface anInterface{}
8
9
abstract class A5{}
10
11
aspect B5 {
12
	
13
	@anInterface
14
	public abstract void A5.a();
15
	
16
	public static void main(String [] args){
17
		Class A5o = A5.class;
18
		try {
19
		Method ao = A5o.getDeclaredMethod("a", new Class [0]);
20
		Annotation [] aoAnns = ao.getDeclaredAnnotations();
21
		for (int i = 0;i < aoAnns.length;i++){
22
			System.out.println(aoAnns[i]);
23
		}
24
		} catch (Exception e){
25
			System.out.println("exceptional!");
26
		}
27
	}
28
}

Return to bug 98901