diff options
author | jhugunin <jhugunin> | 2003-04-27 23:31:06 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2003-04-27 23:31:06 +0000 |
commit | 7d144321837cac05cdbe2a30323d670dfcc9809a (patch) | |
tree | ee2b57fa204391a285b371c4d6a1c57515964ba1 | |
parent | 8d793a3f9960f101a4cae59b959ce612f3fef4c9 (diff) | |
download | aspectj-7d144321837cac05cdbe2a30323d670dfcc9809a.tar.gz aspectj-7d144321837cac05cdbe2a30323d670dfcc9809a.zip |
fix and tests for
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
-rw-r--r-- | tests/ajcTests.xml | 20 | ||||
-rw-r--r-- | tests/bugs/BadBindingError.java | 8 | ||||
-rw-r--r-- | tests/jimTests.xml | 9 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java | 6 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/patterns/TypePattern.java | 3 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java | 8 |
6 files changed, 50 insertions, 4 deletions
diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index ebaedd66c..6b952b04a 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -5878,4 +5878,24 @@ <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 index 000000000..0f1e111e4 --- /dev/null +++ b/tests/bugs/BadBindingError.java @@ -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)); +} diff --git a/tests/jimTests.xml b/tests/jimTests.xml index 6de1c507c..0ebd8cd50 100644 --- a/tests/jimTests.xml +++ b/tests/jimTests.xml @@ -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" diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java index 4cb41ad1c..a2d3aedc6 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java @@ -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; diff --git a/weaver/src/org/aspectj/weaver/patterns/TypePattern.java b/weaver/src/org/aspectj/weaver/patterns/TypePattern.java index 1cada03d5..1202ccc45 100644 --- a/weaver/src/org/aspectj/weaver/patterns/TypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/TypePattern.java @@ -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) { diff --git a/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java index 3b1da45ed..e6003191d 100644 --- a/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java @@ -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); |