]> source.dussan.org Git - aspectj.git/commitdiff
fix for 125405 - demote raws to simple on incremental compiles when necessary.
authoraclement <aclement>
Fri, 27 Jan 2006 11:34:14 +0000 (11:34 +0000)
committeraclement <aclement>
Fri, 27 Jan 2006 11:34:14 +0000 (11:34 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java
weaver/src/org/aspectj/weaver/ReferenceType.java

index 35eb97dfb749594c714d16c7c00338155c7ddd76..f867241bea8f6ec584b2925eb041094d77679008 100644 (file)
@@ -69,6 +69,7 @@ import org.aspectj.weaver.TypeVariableReference;
 import org.aspectj.weaver.UnresolvedType;
 import org.aspectj.weaver.UnresolvedTypeVariableReferenceType;
 import org.aspectj.weaver.World;
+import org.aspectj.weaver.UnresolvedType.TypeKind;
  
 /**
  * @author Jim Hugunin
@@ -957,7 +958,18 @@ public class EclipseFactory {
                }else {
                        simpleTx  = UnresolvedType.forName(getName(binding)); 
                }
+
                ReferenceType name  = getWorld().lookupOrCreateName(simpleTx);
+               
+               // A type can change from simple > generic > simple across a set of compiles. We need
+               // to ensure the entry in the typemap is promoted and demoted correctly.  The call
+               // to setGenericType() below promotes a simple to a raw. This call demotes it back
+               // to simple
+               // pr125405
+               if (!binding.isRawType() && !binding.isGenericType() && name.getTypekind()==TypeKind.RAW) {
+                       name.demoteToSimpleType();
+               }
+
                EclipseSourceType t = new EclipseSourceType(name, this, binding, decl, unit);
                
                // For generics, go a bit further - build a typex for the generic type
index a17a57a8def41ca5b635fc4cdf58764eeacdfd5a..8eb84ceee912abaaf3a3c8f07d01648691298e08 100644 (file)
@@ -282,6 +282,21 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
                alter("PR85132","inc1");
                build("PR85132");
        }
+
+       // parameterization of generic aspects
+       public void testPr125405() {
+               initialiseProject("PR125405");
+               build("PR125405");
+               checkCompileWeaveCount(1,1);
+               alter("PR125405","inc1");
+               build("PR125405");
+               // "only abstract aspects can have type parameters"
+               checkForError("only abstract aspects can have type parameters");
+               alter("PR125405","inc2");
+               build("PR125405");
+               checkCompileWeaveCount(1,1);
+               assertTrue("Should be no errors, but got "+MyTaskListManager.getErrorMessages(),MyTaskListManager.getErrorMessages().size()==0);                
+       }
        
        public void testPr92837() {
                initialiseProject("PR92837");
@@ -566,6 +581,15 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
                }
        }
        
+       public void checkForError(String anError) {
+               List messages = MyTaskListManager.getErrorMessages();
+               for (Iterator iter = messages.iterator(); iter.hasNext();) {
+                       IMessage element = (IMessage) iter.next();
+                       if (element.getMessage().indexOf(anError)!=-1) return;
+               }
+               fail("Didn't find the error message:\n'"+anError+"'.\nErrors that occurred:\n"+MyTaskListManager.getErrorMessages());
+       }
+
        private void collectUpFiles(File location,File base,List collectionPoint) {
                String contents[] = location.list();
                if (contents==null) return;
index 0cab45745ab42dc2294e26181372f64c3d364507..1e6648f7d286b169fcc45ca2be5feaf64d3935b7 100644 (file)
@@ -660,6 +660,12 @@ public class ReferenceType extends ResolvedType {
                }
        }
        
+       public void demoteToSimpleType() {
+               genericType      = null;
+               typeKind         = TypeKind.SIMPLE;
+               signatureErasure = null;
+       }
+       
        public ResolvedType getGenericType() {
                if (isGenericType()) return this;
                return genericType;