}
public void resolveStatements() {
if (!Modifier.isAbstract(declaredModifiers)) super.resolveStatements();
+ if (Modifier.isStatic(declaredModifiers)) {
+ // Check the target for ITD is not an interface
+ if (onTypeBinding.isInterface()) {
+ scope.problemReporter().signalError(sourceStart, sourceEnd,
+ "methods in interfaces cannot be declared static");
+ }
+ }
}
<message kind="error" line="6" text="Unhandled exception"/>
</compile>
</ajc-test>
+
+ <ajc-test dir="bugs" pr="47754"
+ title="static method introduction on interfaces, should not be allowed">
+ <compile files="StaticInterfaceMethods.java">
+ <message kind="error" line="7" text="methods in interfaces cannot be declared static"/>
+ </compile>
+ </ajc-test>
+
</suite>
--- /dev/null
+interface StaticInterfaceMethods {
+
+}
+
+aspect A {
+
+ static int StaticInterfaceMethods.aMethod() {
+ return 1;
+ }
+}
\ No newline at end of file