From ca47cacdacf7da5789446bb3ed9b70e26462206e Mon Sep 17 00:00:00 2001
From: aclement <aclement>
Date: Fri, 9 Dec 2005 09:20:36 +0000
Subject: test from 119570

---
 tests/bugs150/pr119570/INode.java                  |  6 ++++
 tests/bugs150/pr119570/NodeImpl.java               | 21 ++++++++++++++
 tests/bugs150/pr119570/ParameterizedDP.java        | 33 ++++++++++++++++++++++
 .../org/aspectj/systemtest/ajc150/Ajc150Tests.java |  2 +-
 tests/src/org/aspectj/systemtest/ajc150/ajc150.xml |  5 ++++
 5 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100644 tests/bugs150/pr119570/INode.java
 create mode 100644 tests/bugs150/pr119570/NodeImpl.java
 create mode 100644 tests/bugs150/pr119570/ParameterizedDP.java

(limited to 'tests')

diff --git a/tests/bugs150/pr119570/INode.java b/tests/bugs150/pr119570/INode.java
new file mode 100644
index 000000000..2c94ebf60
--- /dev/null
+++ b/tests/bugs150/pr119570/INode.java
@@ -0,0 +1,6 @@
+package bugsOtherPackage;
+
+public interface INode<Parent, Child> {
+    boolean setParent(INode<Parent, Child> p);
+    INode<Parent, Child> getParent();
+}
\ No newline at end of file
diff --git a/tests/bugs150/pr119570/NodeImpl.java b/tests/bugs150/pr119570/NodeImpl.java
new file mode 100644
index 000000000..68c486058
--- /dev/null
+++ b/tests/bugs150/pr119570/NodeImpl.java
@@ -0,0 +1,21 @@
+package bugsOtherPackage;
+
+import java.util.ArrayList;
+
+public abstract aspect NodeImpl<Parent, Child> {
+
+    declare parents : Child implements INode<Parent, Child>;
+    declare parents : Parent implements INode<Parent, Child>;
+
+    private final ArrayList<INode> INode.fChildren = new ArrayList<INode>();
+
+    // are you not supposed to use type parameters here?
+    private INode<Parent, Child> INode.fParent;
+    public final INode<Parent, Child> INode.getParent() {
+        return fParent;
+    }
+    public final boolean INode.setParent(INode<Parent, Child> newParent) {
+        fParent = newParent;
+        return true;
+    }
+}
\ No newline at end of file
diff --git a/tests/bugs150/pr119570/ParameterizedDP.java b/tests/bugs150/pr119570/ParameterizedDP.java
new file mode 100644
index 000000000..1a9e015a4
--- /dev/null
+++ b/tests/bugs150/pr119570/ParameterizedDP.java
@@ -0,0 +1,33 @@
+package bugs;
+
+import bugsOtherPackage.INode;
+import bugsOtherPackage.NodeImpl;
+
+// comments in this bug relate to what happened on AspectJ5 M4
+public class ParameterizedDP {
+
+    public static void main(String[] args) {
+//        // 1) compile-time error here without 
+//        //    {unneeded} subaspect declare-parent
+//        // Tag as INode<Tag, Tag> from PC extends NodeImpl<Tag, Tag>
+//        ((TaggedTexts.Tag) null).getParent();    
+        TaggedTexts.Tag tag1 = new TaggedTexts.Tag();
+        TaggedTexts.Tag tag2 = new TaggedTexts.Tag();
+        tag1.getParent();
+        tag1.setParent(tag2);
+        if (!tag1.getParent().equals(tag2)) throw new RuntimeException("");
+    }
+
+}
+class TaggedTexts {
+
+    public static class Text {  }
+
+    public static class Tag {  }
+    static aspect PC extends NodeImpl<Tag, Tag> {
+//        // unneeded declare-parents duplicates one in NodeImpl
+//        // when here, get spurious error message
+//        // when commented out, d-p fails and get compiler error at 1) above
+//        declare parents : Tag implements INode<Tag,Tag>;
+    }
+}
\ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
index af9e8d3cf..de41a5b81 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
@@ -86,7 +86,7 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
   public void testBadDecp_pr110788_2() { runTest("bad generic decp - 2");}
   public void testBadDecp_pr110788_3() { runTest("bad generic decp - 3");}
   public void testBadDecp_pr110788_4() { runTest("bad generic decp - 4");}
-
+  public void testSpuriousOverrideMethodWarning_pr119570() { runTest("spurious override method warning");}
   public void testBrokenSwitch_pr117854() { runTest("broken switch transform");}
   public void testVarargsITD_pr110906() { runTest("ITD varargs problem");}
   public void testBadRenderer_pr86903() { runTest("bcelrenderer bad");}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
index 19ad305c9..89fe536a1 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
@@ -69,6 +69,11 @@
      <run class="Pr114054"/>
     </ajc-test>  
 
+    <ajc-test dir="bugs150/pr119570" pr="119570" title="spurious override method warning">
+     <compile files="NodeImpl.java,INode.java,ParameterizedDP.java" options="-1.5"/>
+     <run class="bugs.ParameterizedDP"/>
+    </ajc-test>  
+
     <ajc-test dir="bugs150/pr119210" pr="119210" title="autoboxing around advice - 1">
      <compile files="TestLib.java,ThreadAspectLib.java" options="-1.5"/>
      <run class="TestLib">
-- 
cgit v1.2.3