</compile>
</ajc-test>
+ <ajc-test dir="bugs/declarePrecedenceWithClasses" pr="53012"
+ title="declare precedence on a class should be a compile-time error">
+ <compile files="DeclarePrecedenceTestClass.java" >
+ <message kind="error" line="10" text="Non-aspect types can only be specified"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs/declarePrecedenceWithClasses" pr="53012"
+ title="declare precedence on a class should be a compile-time error">
+ <compile files="Priority.aj" />
+ </ajc-test>
+
</suite>
--- /dev/null
+//Bug 53012
+// DP contains a declare precedence statement that mentions classes
+
+public class DeclarePrecedenceTestClass {
+ public static void main(String[] args) {
+ System.out.println("hello");
+ }
+}
+aspect DP {
+ declare precedence: DeclarePrecedenceTestClass, DP;
+
+ before() : staticinitialization(DeclarePrecedenceTestClass) {
+ System.out.println("ok");
+ }
+}
--- /dev/null
+// Bug 53012\r
+// Although the declare precedence mentions interfaces (and not aspects explicitly), it does\r
+// mention with a '+' suffix - this should be allowed.\r
+\r
+public aspect Priority {\r
+ public interface Highest {}\r
+ public interface Lowest {}\r
+ declare precedence: Highest+, *, Lowest+;\r
+}\r
+\r
+aspect Security implements Priority.Highest {}\r
}
ResolvedTypeX exactType = pi.getExactType().resolve(scope.getWorld());
if (exactType == ResolvedTypeX.MISSING) continue;
+
+ // Cannot do a dec prec specifying a non-aspect types unless suffixed with a '+'
+ if (!exactType.isAspect() && !pi.isIncludeSubtypes()) {
+ scope.getWorld().showMessage(IMessage.ERROR,
+ "Non-aspect types can only be specified in a declare precedence statement when subtypes are included. Non-aspect type is : "+exactType.getName(),
+ pi.getSourceLocation(),null);
+ }
+
for (int j=0; j < patterns.size(); j++) {
if (j == i) continue;
TypePattern pj = patterns.get(j);