--- /dev/null
+
+public aspect AnnotatedMethodImpl {
+
+ @PresentAnnotation
+ public String AnnotatedMethodInterface.getSomething() {
+ return "meth";
+ }
+
+}
--- /dev/null
+
+public interface AnnotatedMethodInterface {
+
+ @PresentAnnotation
+ public String getSomething();
+}
--- /dev/null
+
+public aspect AspectToMatch {
+
+ //declare parents : ((@Entity *) && !hasmethod(@SearchAnnotation public * get*()) && !hasfield(@SearchAnnotations * *)) implements InterfaceToAdd;
+ declare parents : ((@Entity *) && !hasmethod(@SearchAnnotation public * get*()) &&
+ !hasfield(@SearchAnnotation * *)) implements InterfaceToAdd;
+
+ /*
+ declare warning :
+ staticinitialization(
+ !hasmethod(* getMamma())
+ ) : "Not found";
+ */
+ /*
+ before() : handler(
+ (@Entity *) && !(hasmethod(@SearchAnnotation public * get*())) && !(hasfield(@SearchAnnotations * *))
+ ) {
+
+
+ }
+ */
+
+ /*
+ before() : execution(!@(org.aspectj.bug*) public * get*()) {
+
+ }
+ */
+
+}
--- /dev/null
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Entity {
+
+}
--- /dev/null
+
+@Entity
+public class EntityClass implements AnnotatedMethodInterface {
+
+}
--- /dev/null
+interface InterfaceToAdd {}
--- /dev/null
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PresentAnnotation {
+
+}
--- /dev/null
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+//@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface SearchAnnotation {
+
+}
public class Ajc166Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+ public void testHasMember_284862() {
+ runTest("npe hasmember");
+ }
+
+ public void testHasMember_284862_2() {
+ runTest("npe hasmember - 2");
+ }
+
+ public void testHasMember_284862_3() {
+ runTest("npe hasmember - 3");
+ }
+
// fix is too disruptive for 1.6.5
public void testGenericsBridge_pr279983() {
runTest("generics bridge");
<suite>
+ <ajc-test dir="bugs166/pr284862" title="npe hasmember">
+ <compile files="InterfaceToAdd.java AnnotatedMethodImpl.aj AspectToMatch.aj AnnotatedMethodInterface.java Entity.java EntityClass.java PresentAnnotation.java SearchAnnotation.java" options="-1.5 -XhasMember"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs166/pr284862" title="npe hasmember - 2">
+ <compile files="AnnotatedMethodInterface.java InterfaceToAdd.java AnnotatedMethodImpl.aj AspectToMatch.aj Entity.java EntityClass.java PresentAnnotation.java SearchAnnotation.java" options="-1.5 -XhasMember"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs166/pr284862" title="npe hasmember - 3">
+ <compile files="AnnotatedMethodInterface.java InterfaceToAdd.java AnnotatedMethodImpl.aj AspectToMatch.aj Entity.java EntityClass.java PresentAnnotation.java SearchAnnotation.java" options="-Xset:pipelineCompilation=false -1.5 -XhasMember"/>
+ </ajc-test>
+
<ajc-test dir="bugs165/pr279983" title="generics bridge">
<compile files="X.java" options="-1.5"/>
<run class="X"/>