]> source.dussan.org Git - aspectj.git/commitdiff
fix and tests for
authorjhugunin <jhugunin>
Sun, 27 Apr 2003 23:31:06 +0000 (23:31 +0000)
committerjhugunin <jhugunin>
Sun, 27 Apr 2003 23:31:06 +0000 (23:31 +0000)
Bugzilla Bug 30663
   lame error message: "negation doesn't allow binding"
and
Bugzilla Bug 36329
   The compiler crashes when using aspect libraries created without using -noweave

tests/ajcTests.xml
tests/bugs/BadBindingError.java [new file with mode: 0644]
tests/jimTests.xml
weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java
weaver/src/org/aspectj/weaver/patterns/TypePattern.java
weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java

index ebaedd66c401197d92a93f71f36f3fb5060630bb..6b952b04ae91a139c97ea66005f236f70cc85838 100644 (file)
         <run class="CflowConcrete"/>
     </ajc-test>
     
+   <ajc-test dir="new/options11"  pr="36329"
+         comment="the line number might change, we're really interested only in the files here"
+      title="The compiler crashes when using aspect libraries created without using -noweave">
+        <compile files="Main.java,injar.jar,Aspect.java,aspectlib1.jar,aspectlib2.jar">
+            <message kind="error" line="0"/>
+        </compile>
+   </ajc-test>
+   
+    <ajc-test dir="bugs" title="lame error message: negation doesn't allow binding"
+      pr="30663">
+        <compile files="BadBindingError.java">
+            <message kind="error" line="7"/>
+        </compile>
+    </ajc-test>
+    
+    <ajc-test dir="bugs/interSpecials" pr="36936"
+      title="Error when introducing members of type Class">
+        <compile files="Trg.java,Asp.java"/>
+        <run class="Trg"/>
+    </ajc-test>
 </suite>
diff --git a/tests/bugs/BadBindingError.java b/tests/bugs/BadBindingError.java
new file mode 100644 (file)
index 0000000..0f1e111
--- /dev/null
@@ -0,0 +1,8 @@
+// Bugzilla Bug 30663  
+//lame error message: "negation doesn't allow binding" 
+
+import org.aspectj.testing.Tester;
+
+public aspect BadBindingError {
+  pointcut p(int i): call(void f(i));
+}
index 6de1c507c9825f540d8e19264947815c7896e8bf..0ebd8cd50c8f256d6c78a065f057f2107e3fbe3c 100644 (file)
@@ -1,11 +1,16 @@
 <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd">
-<suite>    
+<suite> 
 
 
 
     <!--
   
-
+    <ajc-test dir="options/injars/simple" 
+      title="options -injars">
+        <compile files="Simple.java,main.jar"
+               options="!eclipse"/>
+        <run class="Main"/>
+    </ajc-test>
 
     
     <ajc-test dir="new" pr="885"
index 4cb41ad1caddb5873ad56c059f4ba05911f4578d..a2d3aedc65736a1c363cad36c5a5d5a633c427e0 100644 (file)
@@ -46,6 +46,7 @@ import org.apache.bcel.generic.RET;
 import org.apache.bcel.generic.ReturnInstruction;
 import org.apache.bcel.generic.Select;
 import org.apache.bcel.generic.Type;
+import org.aspectj.bridge.IMessage;
 import org.aspectj.util.PartialOrder;
 import org.aspectj.weaver.AjAttribute;
 import org.aspectj.weaver.AjcMemberMaker;
@@ -241,7 +242,10 @@ class BcelClassWeaver implements IClassWeaver {
     
     public boolean weave() {
         if (clazz.getWeaverState().isWoven()) {
-               throw new RuntimeException("already woven: " + clazz);
+               world.showMessage(IMessage.ERROR, 
+                               "class \'" + clazz.getType().getName() + "\' is already woven",
+                               ty.getSourceLocation(), null);
+               return false;
         }
         
         boolean isChanged = false;
index 1cada03d558f5b2c3198202bbeb8788231462c60..1202ccc45d9bd3b2784a3b4e211a5561de4fca4f 100644 (file)
@@ -67,6 +67,9 @@ public abstract class TypePattern extends PatternNode {
        
        
        public final FuzzyBoolean matches(ResolvedTypeX type, MatchKind kind) {
+               //??? This is part of gracefully handling missing references
+               if (type == ResolvedTypeX.MISSING) return FuzzyBoolean.NO;
+               
                if (kind == STATIC) {
                        return FuzzyBoolean.fromBoolean(matchesStatically(type));
                } else if (kind == DYNAMIC) {
index 3b1da45ed97b179f3cf2275891f5630199185102..e6003191d1daa995cfc2396b5e301f344ecbb767 100644 (file)
@@ -306,10 +306,16 @@ public class WildTypePattern extends TypePattern {
                if (simpleName != null) {
                        FormalBinding formalBinding = scope.lookupFormal(simpleName);
                        if (formalBinding != null) {
-                               if (!allowBinding || bindings == null) {
+                               if (bindings == null) {
                                        scope.message(IMessage.ERROR, this, "negation doesn't allow binding");
                                        return this;
                                }
+                               if (!allowBinding) {
+                                       scope.message(IMessage.ERROR, this, 
+                                               "name binding only allowed in target, this, and args pcds");
+                                       return this;
+                               }
+                               
                                BindingTypePattern binding = new BindingTypePattern(formalBinding);
                                binding.copyLocationFrom(this);
                                bindings.register(binding, scope);