From: acolyer Date: Wed, 7 Jan 2004 15:57:25 +0000 (+0000) Subject: fix for pr 47754, itd of static method on interface X-Git-Tag: mostlyLastEclipse2xTree_20040112~27 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7322131ad6d3c5c14114a6b7945757f45d438112;p=aspectj.git fix for pr 47754, itd of static method on interface --- diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java index 2039fd54c..404d74373 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java @@ -73,6 +73,13 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration { } 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"); + } + } } diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 3b834af69..cdeece3b6 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -6835,4 +6835,12 @@ + + + + + + + diff --git a/tests/bugs/StaticInterfaceMethods.java b/tests/bugs/StaticInterfaceMethods.java new file mode 100644 index 000000000..fb08f0db4 --- /dev/null +++ b/tests/bugs/StaticInterfaceMethods.java @@ -0,0 +1,10 @@ +interface StaticInterfaceMethods { + +} + +aspect A { + + static int StaticInterfaceMethods.aMethod() { + return 1; + } +} \ No newline at end of file