]> source.dussan.org Git - aspectj.git/commitdiff
fixes and tests for 119570 (member type subaspect)
authoraclement <aclement>
Mon, 12 Dec 2005 19:16:06 +0000 (19:16 +0000)
committeraclement <aclement>
Mon, 12 Dec 2005 19:16:06 +0000 (19:16 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
tests/multiIncremental/PR119570/base/bugs/ParameterizedDP.java
tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java

index 966f2c564a476ad114ea8f92a5bb32b1f28e9706..9174ef4ca8795a6361ac476d0564137659227100 100644 (file)
@@ -289,6 +289,19 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
                
        }
 
+       public void doSupertypesFirst(ReferenceBinding rb,Collection yetToProcess) {
+           if (rb instanceof SourceTypeBinding) {
+                   if (yetToProcess.contains(rb)) {
+                       collectAllITDsAndDeclares((SourceTypeBinding)rb, yetToProcess);
+                   }
+           } else if (rb instanceof ParameterizedTypeBinding) {
+               // If its a PTB we need to pull the SourceTypeBinding out of it.
+               ParameterizedTypeBinding ptb = (ParameterizedTypeBinding)rb;
+               if (ptb.type instanceof SourceTypeBinding && yetToProcess.contains(ptb.type)) {
+                       collectAllITDsAndDeclares((SourceTypeBinding)ptb.type, yetToProcess);
+               }
+           }
+       }
        /**
         * Find all the ITDs and Declares, but it is important we do this from the supertypes
         * down to the subtypes.
@@ -298,18 +311,18 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
        private void collectAllITDsAndDeclares(SourceTypeBinding sourceType, Collection yetToProcess) {
                // Look at the supertype first
                ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.COLLECTING_ITDS_AND_DECLARES, sourceType.sourceName);
-           ReferenceBinding superType = sourceType.superclass();
-           if (superType instanceof SourceTypeBinding) {
-                   if (yetToProcess.contains(superType)) {
-                       collectAllITDsAndDeclares((SourceTypeBinding)superType, yetToProcess);
-                   }
-           } else if (superType instanceof ParameterizedTypeBinding) {
-               // If its a PTB we need to pull the SourceTypeBinding out of it.
-               ParameterizedTypeBinding ptb = (ParameterizedTypeBinding)superType;
-               if (ptb.type instanceof SourceTypeBinding && yetToProcess.contains(ptb.type)) {
-                       collectAllITDsAndDeclares((SourceTypeBinding)ptb.type, yetToProcess);
-               }
-           }
+               
+               // look out our direct supertype
+               doSupertypesFirst(sourceType.superclass(),yetToProcess);
+           
+           // now check our membertypes (pr119570)
+               ReferenceBinding[] memberTypes = sourceType.memberTypes;
+               for (int i = 0, length = memberTypes.length; i < length; i++) {
+                       SourceTypeBinding rb = (SourceTypeBinding)memberTypes[i];
+                       if (!rb.superclass().equals(sourceType))
+                         doSupertypesFirst(rb.superclass(),yetToProcess);
+               }
+               
         buildInterTypeAndPerClause(sourceType.scope);
         addCrosscuttingStructures(sourceType.scope);
         yetToProcess.remove(sourceType);
index e35fbd2070416991aeaf91e5f40750395df6033c..d3210cde7c53e56895da129519c24083bef142de 100644 (file)
@@ -22,6 +22,6 @@ class TaggedTexts {
         // 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>;
+//        declare parents : Tag implements INode<Tag,Tag>;
     }
-}
\ No newline at end of file
+}
index faf86ad29877a7298221beb99baf7f9ae5b1f84c..bba83eeebb60da4d6de71c54d26fe2d557f4d6f4 100644 (file)
@@ -51,6 +51,7 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
   public void testCunningDeclareParents_pr92311() { runTest("cunning declare parents");}
   public void testGenericITDsAndAbstractMethodError_pr102357() { runTest("generic itds and abstract method error");}
   */
+  //public void testIncorrectSignatureMatchingWithExceptions_pr119749() { runTest("incorrect exception signature matching");}
   public void testGeneratingCodeForAnOldRuntime_pr116679_1() { runTest("generating code for a 1.2.1 runtime - 1");}
   public void testGeneratingCodeForAnOldRuntime_pr116679_2() { runTest("generating code for a 1.2.1 runtime - 2");}
   public void testAmbiguousMethod_pr118599_1() { runTest("ambiguous method when binary weaving - 1");}
@@ -86,7 +87,8 @@ 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 testSpuriousOverrideMethodWarning_pr119570_1() { runTest("spurious override method warning");}
+  public void testSpuriousOverrideMethodWarning_pr119570_2() { runTest("spurious override method warning - 2");}
   public void testBrokenSwitch_pr117854() { runTest("broken switch transform");}
   public void testVarargsITD_pr110906() { runTest("ITD varargs problem");}
   public void testBadRenderer_pr86903() { runTest("bcelrenderer bad");}
index 99628ba9beb8ea0657d72d535e92a989569c1dc7..27b59d27f1fc13b414c976a8d2e3fb971cce9797 100644 (file)
     <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/pr119570" pr="119570" title="spurious override method warning - 2">
+     <compile files="ParameterizedDP.java,NodeImpl.java,INode.java" options="-1.5"/>
+     <run class="bugs.ParameterizedDP"/>
     </ajc-test>  
 
     <ajc-test dir="bugs150/pr119210" pr="119210" title="autoboxing around advice - 1">
      <run class="BrokenSwitch"/>
     </ajc-test>  
     
+    <ajc-test dir="bugs150/pr119749" pr="119749" title="incorrect exception signature matching">
+     <compile files="InheritedThrows.java" options="">  
+       <message kind="warning" line="19" text="one"/>
+       <message kind="warning" line="27" text="one"/>
+     </compile>
+    </ajc-test>  
+    
     <ajc-test dir="bugs150/pr118599" pr="118599" title="ambiguous method when binary weaving - 1">
      <!-- separate compilation was failing  -->
      <compile files="Attributable.java" outjar="foo.jar" options="-1.5"/>
index b38feb72b28db21421551085ddf7541e9978ae15..e38ff536bf0ade47017315b0965a71655cb132db 100644 (file)
@@ -293,8 +293,7 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
        public void testPr119570() {
                initialiseProject("PR119570");
                build("PR119570");
-               List l = MyTaskListManager.getWarningMessages();
-               assertTrue("Should be no warnings, but got "+l,l.size()==0);
+               assertTrue("Should be no errors, but got "+MyTaskListManager.getErrorMessages(),MyTaskListManager.getErrorMessages().size()==0);                
        }
        
        public void testPr119570_2() {