aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs1919/github_162/InterfaceWithInnerClass.java32
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java4
-rw-r--r--tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml18
3 files changed, 54 insertions, 0 deletions
diff --git a/tests/bugs1919/github_162/InterfaceWithInnerClass.java b/tests/bugs1919/github_162/InterfaceWithInnerClass.java
new file mode 100644
index 000000000..f26975cc0
--- /dev/null
+++ b/tests/bugs1919/github_162/InterfaceWithInnerClass.java
@@ -0,0 +1,32 @@
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.JoinPoint;
+
+/**
+ * https://github.com/eclipse/org.aspectj/issues/162
+ */
+public interface InterfaceWithInnerClass {
+ public class ImplicitlyStatic {
+ public int getNumber() {
+ return 11;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new ImplicitlyStatic().getNumber());
+ }
+ }
+
+ /*static*/ aspect MyAspect {
+ before() : execution(* main(..)) {
+ System.out.println(thisJoinPoint);
+ }
+ }
+
+ @Aspect
+ /*static*/ class MyAnnotationAspect {
+ @Before("execution(* getNumber(..))")
+ public void myAdvice(JoinPoint thisJoinPoint){
+ System.out.println(thisJoinPoint);
+ }
+ }
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java
index 7a13eaeea..ae3c54398 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java
@@ -27,6 +27,10 @@ public class Bugs1919Tests extends XMLBasedAjcTestCase {
runTest("parenthesised expression with AspectJ keyword");
}
+ public void testInterfaceInnerAspectImplicitlyStatic() {
+ runTest("inner aspect of interface is implicitly static");
+ }
+
public static Test suite() {
return XMLBasedAjcTestCase.loadSuite(Bugs1919Tests.class);
}
diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml
index 8754acd33..f89455941 100644
--- a/tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml
+++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml
@@ -204,4 +204,22 @@
</run>
</ajc-test>
+ <!--
+ 'inner aspects must be static' when compiling an interface with an inner aspect which was not explicitly declared
+ static, see https://github.com/eclipse/org.aspectj/issues/162
+ -->
+ <ajc-test dir="bugs1919/github_162" vm="1.5" title="inner aspect of interface is implicitly static">
+ <compile files="InterfaceWithInnerClass.java" options="-1.5 -showWeaveInfo">
+ <message kind="weave" text="method-execution(int InterfaceWithInnerClass$ImplicitlyStatic.getNumber())' in Type 'InterfaceWithInnerClass$ImplicitlyStatic'"/>
+ <message kind="weave" text="method-execution(void InterfaceWithInnerClass$ImplicitlyStatic.main(java.lang.String[]))' in Type 'InterfaceWithInnerClass$ImplicitlyStatic'"/>
+ </compile>
+ <run class="InterfaceWithInnerClass$ImplicitlyStatic">
+ <stdout>
+ <line text="execution(void InterfaceWithInnerClass.ImplicitlyStatic.main(String[]))"/>
+ <line text="execution(int InterfaceWithInnerClass.ImplicitlyStatic.getNumber())"/>
+ <line text="11"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
</suite>