Bug 535877 - ctw then ltw when annotation style aspects misbehaving
Summary: ctw then ltw when annotation style aspects misbehaving
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.9.1   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-13 16:14 EDT by Andrew Clement CLA
Modified: 2018-06-13 16:14 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Clement CLA 2018-06-13 16:14:51 EDT
Reported by Eric on the mailing list but here is a crafted testcase:

--- Code.java
import org.aspectj.lang.annotation.*;

public class Code {
	public static void main(String[]argv) {
		fo();
		Boo.fo();
	}

	public static void fo() {
		System.out.println("xyz");
	}
}

@Aspect
class X {
	@Before("execution(* Code.fo())")
	public void foo() {}
	//before(): execution(* Code.fo()) { }
}

class Boo {
	public static void fo() {
		System.out.println("xyz");
	}
}
---

--- Y.java ---
aspect Y {
	before(): execution(* Bo*.*(..)) {

	}
}
---

ajc -1.8 Code.java -d out

ajc -1.8 Y.java -d out2

--- out2/META-INF/aop-ajc.xml ---
<aspectj>
<aspects>
<aspect name="Y"/>
</aspects>
<weaver options="-verbose -showWeaveInfo">
</weaver>
</aspectj>
---

java -javaagent:$ASPECTJ_HOME/lib/aspectjweaver.jar -classpath out:out2:$ASPECTJ_HOME/lib/aspectjrt.jar Code

gives:

[AppClassLoader@18b4aac2] info AspectJ Weaver Version 1.9.1 built on Friday Apr 20, 2018 at 16:47:33 GMT
[AppClassLoader@18b4aac2] info register classloader sun.misc.Launcher$AppClassLoader@18b4aac2
[AppClassLoader@18b4aac2] info using configuration /Users/aclement/gits/org.eclipse.ajdt/org.eclipse.ajdt-feature/eric/out2/META-INF/aop-ajc.xml
[AppClassLoader@18b4aac2] info register aspect Y
[AppClassLoader@18b4aac2] info processing reweavable type Code: /Code.java
[AppClassLoader@18b4aac2] error aspect 'X' woven into 'Code' must be defined to the weaver (placed on the aspectpath, or defined in an aop.xml file if using LTW).
[AppClassLoader@18b4aac2] info processing reweavable type X: /Code.java
[AppClassLoader@18b4aac2] error aspect 'X' woven into 'X' must be defined to the weaver (placed on the aspectpath, or defined in an aop.xml file if using LTW).
Exception in thread "main" java.lang.NoSuchMethodError: X.aspectOf()LX;
	at Code.fo(Code.java:10)
	at Code.main(Code.java:5)

Doesn't happen if it is a code style aspect (X)