-public class pr80571 {
+public class pr80571 implements I{
public static void main(String[] args) {
new pr80571();
System.out.println("after");
return ret;
}
-}
\ No newline at end of file
+}
--- /dev/null
+public aspect Code {
+
+ pointcut init(): initialization(Object+.new(..));
+
+ pointcut staticinit(): staticinitialization(Object+);
+
+ Class around(String className): cflowbelow(init() || staticinit()) &&
+call(Class Class.forName(String)) && args(className) {
+ System.out.println("Test");
+ return proceed(className);
+
+ }
+ public static void main(String[] argv) {
+ new SomeClass();
+ }
+}
+
+class SomeClass implements SomeInterface {
+
+}
+
+interface SomeInterface {
+ Class ADAPTER = SomeInterface.class;
+}
+
--- /dev/null
+interface Foo {
+ public static final Object dummy = new Object();
+}
+
+aspect Code2 {
+ Object around(): call(Object.new(..)) {
+ return proceed();
+ }
+
+ public static void main(String[] args) {
+ System.out.println(Foo.dummy);
+ }
+}
+
</ajc-test>
<ajc-test dir="bugs150" pr="80571" title="around advice on interface initializer">
- <compile files="pr80571.aj"/>
+ <compile files="pr80571.aj">
+ <message kind="warning" text="The joinpoint 'constructor-call(void pr80571.<init>())' cannot be advised"/>
+ </compile>
<run class="pr80571">
<stdout>
<line text="before"/>
public class Ajc163Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+ public void testDontAddMethodBodiesToInterface_pr163005() {
+ runTest("do not add method bodies to an interface");
+ }
+
+ public void testDontAddMethodBodiesToInterface_pr163005_2() {
+ runTest("do not add method bodies to an interface - 2");
+ }
+
+ public void testDontAddMethodBodiesToInterface_pr163005_3() {
+ runTest("do not add method bodies to an interface - 3");
+ }
+
public void testMissingLocalVariableTableEntriesOnAroundAdvice_pr173978() throws Exception {
runTest("missing local variable table on around advice");
JavaClass jc = Utils.getClassFrom(ajc.getSandboxDirectory().getAbsolutePath(), "Test");
<suite>
+
+ <ajc-test dir="bugs163/pr163005" title="do not add method bodies to an interface">
+ <compile files="Code.java" options="-1.4">
+ <message kind="warning" text="The joinpoint 'method-call(java.lang.Class java.lang.Class.forName(java.lang.String))' cannot be advised"/>
+ </compile>
+ <run class="Code"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs163/pr163005" title="do not add method bodies to an interface - 2">
+ <compile files="Code.java" options="-1.4 -XnoInline">
+ <message kind="warning" text="The joinpoint 'method-call(java.lang.Class java.lang.Class.forName(java.lang.String))' cannot be advised"/>
+ </compile>
+ <run class="Code"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs163/pr163005" title="do not add method bodies to an interface - 3">
+ <compile files="Code2.java" options="-1.4">
+ <message kind="warning" text="The joinpoint 'constructor-call(void java.lang.Object.<init>())' cannot be advised"/>
+ </compile>
+ <run class="Code2"/>
+ </ajc-test>
+
<ajc-test dir="bugs163/pr250091" title="itd cce">
<compile files="Demo.java" options="-1.5"/>
<run class="Demo">