typeIsPattern = new TypeCategoryTypePattern(TypeCategoryTypePattern.ANNOTATION);
} else if (category.equals("FinalType")) {
typeIsPattern = new TypeCategoryTypePattern(TypeCategoryTypePattern.FINAL);
+ } else if (category.equals("AbstractType")) {
+ typeIsPattern = new TypeCategoryTypePattern(TypeCategoryTypePattern.ABSTRACT);
}
}
if (typeIsPattern == null) {
public static final int ENUM = 6;
public static final int ANNOTATION = 7;
public static final int FINAL = 8;
+ public static final int ABSTRACT = 9;
private int category;
return type.isAnnotation();
case FINAL:
return Modifier.isFinal(type.getModifiers());
+ case ABSTRACT:
+ return Modifier.isAbstract(type.getModifiers());
}
return false;
}
--- /dev/null
+public class Code {
+ public static void main(String[] argv) {
+ new Code().run();
+ }
+
+ public void run() {
+ new Code3().run();
+ }
+}
+
+abstract class Code2 {
+ public void run() {
+ }
+}
+
+class Code3 extends Code2 {
+}
+
+aspect X {
+ before(): execution(* (!is(AbstractType)).run(..)) {
+ System.out.println(thisJoinPointStaticPart);
+ }
+}
+
--- /dev/null
+public class Code2 {
+ public static void main(String[] argv) {
+ new Code2().run();
+ }
+
+ public void run() {
+ new Helper2().run();
+ }
+}
+
+abstract class Helper {
+ public void run() {
+ }
+}
+
+class Helper2 extends Helper {
+}
+
+aspect X {
+ before(): execution(* (is(AbstractType)).run(..)) {
+ System.out.println(thisJoinPointStaticPart);
+ }
+}
+
*/
public class Ajc193Tests extends XMLBasedAjcTestCaseForJava10OrLater {
+ public void testIsAbstractType() {
+ runTest("is abstract");
+ }
+
+ public void testIsAbstractType2() {
+ runTest("is abstract - 2");
+ }
+
// ---
public static Test suite() {
<suite>
+
+ <ajc-test dir="bugs193/isAbstractType" title="is abstract">
+ <compile files="Code.java" options="-1.8"/>
+ <run class="Code">
+ <stdout>
+ <line text="execution(void Code.run())"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs193/isAbstractType" title="is abstract - 2">
+ <compile files="Code2.java" options="-1.8"/>
+ <run class="Code2">
+ <stdout>
+ <line text="execution(void Helper.run())"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
<!--
<ajc-test dir="bugs191/var" title="var 3">
<compile files="Code3.java" options="-10">