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

Collapse All | Expand All

(-)src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java (+19 lines)
Lines 89-94 Link Here
89
  		runTest("Override suppressing of warning when advice doesn't match using -Xlint:warning");
89
  		runTest("Override suppressing of warning when advice doesn't match using -Xlint:warning");
90
  	}
90
  	}
91
  	
91
  	
92
  	public void testNonstandardJarFiles() {
93
  		runTest("Nonstandard jar file extensions");  		
94
  	}
95
  	
96
  	public void testOddzipOnClasspath() {  	
97
		runTest("Odd zip on classpath");  		
98
  	}
99
  	
100
  	// separate bugzilla patch has this one... commented out
101
//  	public void testSeparateCompilationDeclareParentsCall() {
102
//  		runTest("Separate compilation with ltw: declare parents and call");
103
//  	}
104
//  	
105
//  	public void testChildAspectDoesntWeaveParentDeclareParentsCall() {
106
//		setSystemProperty(WeavingAdaptor.WEAVING_ADAPTOR_VERBOSE,"true");
107
//		setSystemProperty(WeavingAdaptor.SHOW_WEAVE_INFO_PROPERTY,"true");
108
//  		runTest("Child loader aspect won't weave parent loader: declare parents and call");
109
//  	}
110
  	
92
  	/*
111
  	/*
93
  	 * Allow system properties to be set and restored
112
  	 * Allow system properties to be set and restored
94
  	 * TODO maw move to XMLBasedAjcTestCase or RunSpec
113
  	 * TODO maw move to XMLBasedAjcTestCase or RunSpec
(-)src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml (-2 / +130 lines)
Lines 1-6 Link Here
1
1
2
<!-- Load-time weaving tests -->
2
<!-- Load-time weaving tests -->
3
4
	<ajc-test dir="ltw"
3
	<ajc-test dir="ltw"
5
      title="Ensure 1st aspect is rewoven when weaving 2nd aspect"
4
      title="Ensure 1st aspect is rewoven when weaving 2nd aspect"
6
      keywords="reweavable">
5
      keywords="reweavable">
Lines 339-342 Link Here
339
        	</stderr>
338
        	</stderr>
340
        </run>
339
        </run>
341
    </ajc-test>
340
    </ajc-test>
342
    
341
342
	<!-- based on "Ensure 1st aspect is rewoven when weaving 2nd aspect" -->
343
	<ajc-test dir="ltw"
344
      title="Nonstandard jar file extensions" pr="137235">
345
        <compile
346
        	files="folder.jar/Main.java, folder.jar/Aspect1.aj"
347
			outjar="folder.jar/main1.zip"
348
            options="-showWeaveInfo"
349
        >
350
        	<message kind="weave" text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
351
        </compile>	
352
        <compile
353
        	classpath="$sandbox/folder.jar/main1.zip"
354
        	files="Aspect2.aj"
355
        	outjar="aspect2Jar"
356
            options="-showWeaveInfo"
357
        >
358
        </compile>	
359
        <run class="Main" ltw="aop-ltwreweavable.xml" classpath="$sandbox/folder.jar/main1.zip,$sandbox/aspect2Jar">
360
        	<stdout>
361
                <line text="Main.main"/>
362
                <line text="Main.test1"/>
363
                <line text="Main.test2"/>
364
            </stdout>
365
        	<stderr>
366
	  	    	<line text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
367
				<line text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)"/>
368
                <line text="Aspect1.before_test1"/>
369
                <line text="Aspect2.before_test2"/>
370
            </stderr>
371
        </run>
372
    </ajc-test>
373
374
	<ajc-test dir="ltw"
375
      title="Odd zip on classpath" pr="137235">
376
        <compile
377
        	files="folder.jar/Main.java, folder.jar/Aspect1.aj"
378
			outjar="folder.jar/main1.archive"
379
            options="-showWeaveInfo"
380
        >
381
        	<message kind="weave" text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
382
        </compile>	
383
        <compile
384
        	classpath="$sandbox/folder.jar/main1.archive"
385
        	files="Aspect2.aj"
386
        	outjar="aspect2Jar"
387
            options="-showWeaveInfo"
388
        >
389
        </compile>	
390
        <run class="Main" ltw="aop-ltwreweavable.xml" classpath="$sandbox/folder.jar/main1.archive,$sandbox/aspect2Jar">
391
        	<stdout>
392
                <line text="Main.main"/>
393
                <line text="Main.test1"/>
394
                <line text="Main.test2"/>
395
            </stdout>
396
        	<stderr>
397
	  	    	<line text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
398
				<line text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)"/>
399
                <line text="Aspect1.before_test1"/>
400
                <line text="Aspect2.before_test2"/>
401
            </stderr>
402
        </run>
403
    </ajc-test>
404
405
<!--    
406
commented out: reported in another bugzilla bug...
407
408
	<ajc-test dir="ltw/hier"
409
      title="Separate compilation with ltw: declare parents and call"
410
      keywords="ltw">
411
        <compile
412
        	files="util/A.aj,util/T.aj"
413
        />
414
        <compile
415
        	files="child/Executor.aj,child/Advisor.aj,top/SimpleMain.aj"
416
        >
417
        	<message kind="warning" text="this affected type is not exposed to the weaver: util.A"/>
418
		</compile>        
419
        <run class="top.SimpleMain" ltw="aop-single.xml">
420
        	<stdout>
421
                <line text="T call"/>
422
        	</stdout>
423
        	<stderr>
424
        	    <line text="weaveinfo Extending interface set for type 'util.A' (A.aj) to include 'util.T' (Advisor.aj)"/>
425
	        	< - - TODO: fix up any errors in the expected output when the join point actually matches - - >
426
				<line text="weaveinfo Join point 'method-call(void A.foo())' in Type 'child.Executor' (Executor.aj:19) advised by before advice from 'child.Advisor' (Advisor.aj:20)"/>
427
        	</stderr>
428
        </run>
429
    </ajc-test>
430
431
	<ajc-test dir="ltw/hier"
432
      title="Child loader aspect won't weave parent loader: declare parents and call"
433
      keywords="ltw">
434
        <compile
435
        	files="top/HierMain.aj"
436
        />
437
        <compile
438
        	files="util/A.aj,util/T.aj"
439
			outjar="util.jar"
440
        />
441
        <compile
442
        	files="child/Executor.aj,child/Advisor.aj"
443
        	classpath="util.jar"
444
            options="-outxml"
445
            outjar="child.zip"
446
        >
447
        	<message kind="warning" text="this affected type is not exposed to the weaver: util.A"/>
448
		</compile>        
449
		< - - limitation: to turn on load-time weaving we HAVE to have a top-level aop.xml file
450
		   since we don't want any top-level aspects, we deploy an empty one! 
451
		   the important aop.xml file in this test was created with -outxml and lives in child.jar - - >
452
        <run class="top.HierMain" ltw="null-aop.xml">
453
        	<stdout/>
454
        	<stderr>
455
                <line text="info AspectJ Weaver Version"/>
456
                <line text="info register classloader"/>
457
                <line text="info using"/>
458
	        	<line text="info weaving 'top.HierMain'"/>
459
                <line text="info AspectJ Weaver Version"/>
460
                <line text="info register classloader"/>
461
                <line text="info using"/>
462
                <line text="info using file:"/>
463
                <line text="info register aspect child.Advisor"/>
464
                <line text="info weaving 'child.Executor'"/>
465
                <line text="info weaving 'util.A'"/>
466
        	</stderr>
467
        </run>
468
    </ajc-test>
469
-->
470
    
(-)src/org/aspectj/systemtest/ajc152/Ajc152Tests.java (+2 lines)
Lines 44-49 Link Here
44
// this next one reported as a bug by Rob Harrop, but I can't reproduce the failure yet...
44
// this next one reported as a bug by Rob Harrop, but I can't reproduce the failure yet...
45
//public void testAtAspectWithReferencePCPerClause_pr138220() { runTest("@Aspect with reference pointcut in perclause");}  
45
//public void testAtAspectWithReferencePCPerClause_pr138220() { runTest("@Aspect with reference pointcut in perclause");}  
46
46
47
  public void testJarChecking_pr137235_1() { runTest("directory with .jar extension: source and outjar"); }	    
48
  public void testJarChecking_pr137235_2() { runTest("directory with .jar extension"); }	  
47
  /////////////////////////////////////////
49
  /////////////////////////////////////////
48
  public static Test suite() {
50
  public static Test suite() {
49
    return XMLBasedAjcTestCase.loadSuite(Ajc152Tests.class);
51
    return XMLBasedAjcTestCase.loadSuite(Ajc152Tests.class);
(-)src/org/aspectj/systemtest/ajc152/ajc152.xml (+25 lines)
Lines 192-195 Link Here
192
      </run>
192
      </run>
193
    </ajc-test>
193
    </ajc-test>
194
194
195
    <ajc-test dir="bugs152/pr137235"  pr="137235"
196
		title="directory with .jar extension: source and outjar">
197
	    <compile files="directory.jar/Hello.java" outjar="directory.jar/run.custom"/>
198
        <run class="Hello" classpath="$sandbox/directory.jar/run.custom">
199
          <stdout>
200
            <line text="Hello Java"/>
201
          </stdout>
202
        </run>
203
    </ajc-test>
204
    
205
    <ajc-test dir="bugs152/pr137235"  pr="137235"
206
		title="directory with .jar extension"  >
207
	    <compile files="directory.jar/Before.java" outjar="directory.jar/inOne.custom"/>
208
	    <compile files="directory.jar/BeforeExec.aj" outjar="directory.jar/inTwo"/>
209
	    <compile files="directory.jar/Rename.aj" outjar="directory.jar/weave.jar"/>
210
	    <compile files="directory.jar/Hello.java" inpath="directory.jar/inOne.custom,directory.jar/inTwo" aspectpath="directory.jar/weave.jar" outjar="directory.jar/outJar.jar"/>
211
        <run class="Hello" classpath="$sandbox/directory.jar/outJar.jar,$sandbox/directory.jar/weave.jar">
212
          <stdout>
213
            <line text="Before call"/>
214
            <line text="Before execution"/>
215
            <line text="Hello AspectJ not just Java"/>
216
          </stdout>
217
        </run>
218
    </ajc-test>
219
    
195
</suite>
220
</suite>
(-)src/org/aspectj/systemtest/ajc120/ajc120-tests.xml (-1 / +4 lines)
Lines 467-479 Link Here
467
    <ajc-test dir="bugs"  pr="43714"
467
    <ajc-test dir="bugs"  pr="43714"
468
    	title="weaving using an empty jar in -injars"  >
468
    	title="weaving using an empty jar in -injars"  >
469
        <compile files="notAJar.jar" outjar="outJar.jar"> 
469
        <compile files="notAJar.jar" outjar="outJar.jar"> 
470
        	<message kind="error" line="0"/>
470
        	<message kind="warning" text="build config error: skipping missing, empty or corrupt inpath entry"/>
471
        	<message kind="error" text="no sources specified"/>
472
        	<message kind="fail"/>
471
        </compile>
473
        </compile>
472
    </ajc-test>
474
    </ajc-test>
473
	
475
	
474
	 <ajc-test dir="bugs"  pr="43714"
476
	 <ajc-test dir="bugs"  pr="43714"
475
    	title="weaving using an empty jar in -aspectpath"  >
477
    	title="weaving using an empty jar in -aspectpath"  >
476
        <compile files="WeaveLocal.java" aspectpath="notAJar.jar" outjar="outJar.jar" >         	
478
        <compile files="WeaveLocal.java" aspectpath="notAJar.jar" outjar="outJar.jar" >         	
479
        	<message kind="warning" text="build config error: skipping missing, empty or corrupt aspectpath entry"/>
477
        </compile>
480
        </compile>
478
    </ajc-test>
481
    </ajc-test>
479
    
482
    
(-)bugs152/pr137235/directory.jar/Hello.java (+6 lines)
Added Link Here
1
public class Hello {
2
    public static void main(String argz[]) {
3
        System.out.println("Hello "+getName());
4
    }
5
    public static String getName() { return "Java"; }
6
}
(-)ltw/folder.jar/Main.java (+41 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005 Contributors.
3
 * All rights reserved. 
4
 * This program and the accompanying materials are made available 
5
 * under the terms of the Eclipse Public License v1.0 
6
 * which accompanies this distribution and is available at 
7
 * http://eclipse.org/legal/epl-v10.html 
8
 * 
9
 * Contributors:
10
 *   Matthew Webster         initial implementation
11
 *******************************************************************************/
12
import java.lang.reflect.Method;
13
import java.lang.reflect.Modifier;
14
15
public class Main {
16
17
	public void test1 () {
18
		System.out.println("Main.test1");
19
	}
20
21
	public void test2 () {
22
		System.out.println("Main.test2");
23
	}
24
25
	public void invokeDeclaredMethods () throws Exception {
26
		Method[] methods = getClass().getDeclaredMethods();
27
		for (int i = 0; i < methods.length; i++) {
28
			Method method = methods[i];
29
			int modifiers = method.getModifiers();
30
			if (!Modifier.isStatic(modifiers) && !method.getName().equals("invokeDeclaredMethods")) {
31
				method.invoke(this,new Object[] {});
32
			}
33
		}
34
	}
35
	
36
	public static void main (String[] args) throws Exception {
37
		System.out.println("Main.main");
38
		new Main().test1();
39
		new Main().test2();
40
	}
41
}
(-)bugs152/pr137235/directory.jar/Rename.aj (+5 lines)
Added Link Here
1
public aspect Rename {
2
    String around() : call(* getName()) { 
3
    	return "AspectJ not just "+proceed(); 
4
	}
5
}
(-)ltw/folder.jar/Aspect1.aj (+19 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005 Contributors.
3
 * All rights reserved. 
4
 * This program and the accompanying materials are made available 
5
 * under the terms of the Eclipse Public License v1.0 
6
 * which accompanies this distribution and is available at 
7
 * http://eclipse.org/legal/epl-v10.html 
8
 * 
9
 * Contributors:
10
 *   Matthew Webster         initial implementation
11
 *******************************************************************************/
12
import org.aspectj.lang.JoinPoint;
13
14
public aspect Aspect1 {
15
	
16
		before () : execution(void Main.test1()) {
17
			System.err.println("Aspect1.before_" + thisJoinPoint.getSignature().getName());
18
		}
19
}
(-)ltw/folder.jar/Aspect2.aj (+19 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2005 Contributors.
3
 * All rights reserved. 
4
 * This program and the accompanying materials are made available 
5
 * under the terms of the Eclipse Public License v1.0 
6
 * which accompanies this distribution and is available at 
7
 * http://eclipse.org/legal/epl-v10.html 
8
 * 
9
 * Contributors:
10
 *   Matthew Webster	initial implementation
11
 *******************************************************************************/
12
import org.aspectj.lang.JoinPoint;
13
14
public aspect Aspect2 {
15
	
16
		before () : execution(void Main.test2()){
17
			System.err.println("Aspect2.before_" + thisJoinPoint.getSignature().getName());
18
		}
19
}
(-)bugs152/pr137235/directory.jar/BeforeExec.aj (+5 lines)
Added Link Here
1
public aspect BeforeExec {
2
    before() : execution(* getName()) {
3
        System.out.println("Before execution");
4
    }
5
}
(-)bugs152/pr137235/directory.jar/Before.java (+5 lines)
Added Link Here
1
public aspect Before {
2
    before() : call(* getName()) {
3
        System.out.println("Before call");
4
    }
5
}

Return to bug 137235