From 97ab1e91dfba52187c14f0f7e5fdf6fafd9966c4 Mon Sep 17 00:00:00 2001 From: jhugunin Date: Wed, 7 Jan 2004 17:00:52 +0000 Subject: [PATCH] fix for Bugzilla Bug 41952 XLint warning for call PCD's using subtype of defining type also added extraSourceLocations to IMessage+ for message with multiple source lines --- bridge/src/org/aspectj/bridge/IMessage.java | 2 + bridge/src/org/aspectj/bridge/Message.java | 71 ++++++------ .../src/org/aspectj/bridge/MessageUtil.java | 55 +++++++--- .../org/aspectj/bridge/SourceLocation.java | 2 +- .../src/org/aspectj/tools/ajc/Main.java | 7 +- .../org/aspectj/testing/xml/SoftMessage.java | 8 ++ tests/ajcTests.xml | 54 ++++++++-- tests/bugs/DeclaringTypeWarning.java | 23 ++++ tests/new/CallTypesI.java | 4 +- tests/new/IndeterminateArg.java | 3 +- tests/new/IndeterminateArgType.java | 3 +- weaver/src/org/aspectj/weaver/Checker.java | 4 +- weaver/src/org/aspectj/weaver/Lint.java | 14 ++- .../aspectj/weaver/XlintDefault.properties | 4 +- .../aspectj/weaver/patterns/AndPointcut.java | 4 +- .../weaver/patterns/ExactTypePattern.java | 2 +- .../weaver/patterns/KindedPointcut.java | 101 ++++++++++++++++-- .../aspectj/weaver/patterns/NotPointcut.java | 2 +- .../aspectj/weaver/patterns/OrPointcut.java | 4 +- .../org/aspectj/weaver/patterns/Pointcut.java | 8 +- .../weaver/patterns/ReferencePointcut.java | 7 +- .../weaver/patterns/SignaturePattern.java | 28 +++++ 22 files changed, 323 insertions(+), 87 deletions(-) create mode 100644 tests/bugs/DeclaringTypeWarning.java diff --git a/bridge/src/org/aspectj/bridge/IMessage.java b/bridge/src/org/aspectj/bridge/IMessage.java index 7fddcb089..1848e0e31 100644 --- a/bridge/src/org/aspectj/bridge/IMessage.java +++ b/bridge/src/org/aspectj/bridge/IMessage.java @@ -124,4 +124,6 @@ public interface IMessage { * join point's static part. */ public String getDetails(); + + public List getExtraSourceLocations(); } diff --git a/bridge/src/org/aspectj/bridge/Message.java b/bridge/src/org/aspectj/bridge/Message.java index 408a2d4f3..975d0c70d 100644 --- a/bridge/src/org/aspectj/bridge/Message.java +++ b/bridge/src/org/aspectj/bridge/Message.java @@ -18,6 +18,10 @@ import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; import java.lang.reflect.InvocationTargetException; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; /** @@ -30,6 +34,7 @@ public class Message implements IMessage { // XXX toString or renderer? private final Throwable thrown; private final ISourceLocation sourceLocation; private final String details; + private final List/*SourceLocation*/ extraSourceLocations; /** convenience for constructing failure messages */ public static Message fail(String message, Throwable thrown) { @@ -60,20 +65,19 @@ public class Message implements IMessage { // XXX toString or renderer? * and thrown is null. */ public Message(String message, String details, IMessage.Kind kind, - ISourceLocation sourceLocation) { + ISourceLocation sourceLocation, Throwable thrown, ISourceLocation[] extraSourceLocations) { this.details = details; - this.message = message; + this.message = (message==null) ? thrown.getMessage() : message; this.kind = kind; this.sourceLocation = sourceLocation; - this.thrown = null; - if (null == message) { - if (null != thrown) { - message = thrown.getMessage(); - } - if (null == message) { - throw new IllegalArgumentException("null message"); - } + this.thrown = thrown; + + if (extraSourceLocations != null) { + this.extraSourceLocations = Arrays.asList(extraSourceLocations); } + else { + this.extraSourceLocations = Collections.EMPTY_LIST; + } if (null == kind) { throw new IllegalArgumentException("null kind"); } @@ -92,22 +96,23 @@ public class Message implements IMessage { // XXX toString or renderer? */ public Message(String message, IMessage.Kind kind, Throwable thrown, ISourceLocation sourceLocation) { - this.message = message; - this.kind = kind; - this.thrown = thrown; - this.sourceLocation = sourceLocation; - this.details = ""; - if (null == message) { - if (null != thrown) { - message = thrown.getMessage(); - } - if (null == message) { - throw new IllegalArgumentException("null message"); - } - } - if (null == kind) { - throw new IllegalArgumentException("null kind"); - } + this(message, "", kind, sourceLocation, thrown, null ); +// this.message = message; +// this.kind = kind; +// this.thrown = thrown; +// this.sourceLocation = sourceLocation; +// this.details = ""; +// if (null == message) { +// if (null != thrown) { +// message = thrown.getMessage(); +// } +// if (null == message) { +// throw new IllegalArgumentException("null message"); +// } +// } +// if (null == kind) { +// throw new IllegalArgumentException("null kind"); +// } } /** @return the kind of this message */ @@ -165,16 +170,9 @@ public class Message implements IMessage { // XXX toString or renderer? } public String toString() { - return Message.renderToString(this); + return MessageUtil.renderMessage(this,false); } - public static String renderToString(IMessage message) { - ISourceLocation loc = message.getSourceLocation(); - String locString = (null == loc ? "" : " at " + loc); - Throwable thrown = message.getThrown(); - return message.getKind() + locString + ": " + message.getMessage() - + (null == thrown ? "" : render(thrown)); - } public static String render(Throwable thrown) { // XXX cf LangUtil.debugStr if (null == thrown) return "null throwable"; @@ -200,4 +198,9 @@ public class Message implements IMessage { // XXX toString or renderer? public String getDetails() { return details; } + + public List getExtraSourceLocations() { + return extraSourceLocations; + } + } diff --git a/bridge/src/org/aspectj/bridge/MessageUtil.java b/bridge/src/org/aspectj/bridge/MessageUtil.java index 9dbb09e44..7a3fea2d0 100644 --- a/bridge/src/org/aspectj/bridge/MessageUtil.java +++ b/bridge/src/org/aspectj/bridge/MessageUtil.java @@ -759,28 +759,49 @@ public class MessageUtil { if (null == message) { return "((IMessage) null)"; } - StringBuffer result = new StringBuffer(); - - result.append(message.getKind().toString()); - result.append(" "); + + ISourceLocation loc = message.getSourceLocation(); + String locString = (null == loc ? "" : " at " + loc); - String messageString = message.getMessage(); - if (!LangUtil.isEmpty(messageString)) { - result.append(messageString); - result.append(" "); + String result = message.getKind() + locString + " " + message.getMessage(); + + Throwable thrown = message.getThrown(); + if (thrown != null) { + result += " -- " + LangUtil.renderExceptionShort(thrown); + result += "\n" + LangUtil.renderException(thrown, elide); } - - ISourceLocation loc = message.getSourceLocation(); - if ((null != loc) && (loc != ISourceLocation.EMPTY)) { - result.append("at " + renderSourceLocation(loc)); + + if (message.getExtraSourceLocations().isEmpty()) { + return result; } - Throwable thrown = message.getThrown(); - if (null != thrown) { - result.append(" -- " + LangUtil.renderExceptionShort(thrown)); - result.append("\n" + LangUtil.renderException(thrown, elide)); + else { + return addExtraSourceLocations(message, result); } - return result.toString(); } + + public static String addExtraSourceLocations( + IMessage message, + String baseMessage) + { + StringWriter buf = new StringWriter(); + PrintWriter writer = new PrintWriter(buf); + writer.println(baseMessage); + for (Iterator iter = message.getExtraSourceLocations().iterator(); iter.hasNext();) { + ISourceLocation element = (ISourceLocation) iter.next(); + writer.print("\tsee also: " + element.toString()); + if (iter.hasNext()) { + writer.println(); + } + } + try { buf.close(); } + catch (IOException ioe) {} + return buf.getBuffer().toString(); + } + + + + + /** * Render ISourceLocation to String, ignoring empty elements diff --git a/bridge/src/org/aspectj/bridge/SourceLocation.java b/bridge/src/org/aspectj/bridge/SourceLocation.java index 882d8af1b..c44d0b942 100644 --- a/bridge/src/org/aspectj/bridge/SourceLocation.java +++ b/bridge/src/org/aspectj/bridge/SourceLocation.java @@ -135,7 +135,7 @@ public class SourceLocation implements ISourceLocation, java.io.Serializable { sb.append(sourceFile.getPath()); sb.append(":"); } - sb.append("" + startLine + "-" + endLine); + sb.append(startLine); //"" + startLine + "-" + endLine); if (!noColumn) { sb.append(":" + column); } diff --git a/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java b/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java index 101fef62b..44f730a42 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/tools/ajc/Main.java @@ -432,7 +432,12 @@ public class Main { sb.append(Main.renderExceptionForUser(thrown)); } - return sb.toString(); + if (message.getExtraSourceLocations().isEmpty()) { + return sb.toString(); + } else { + return MessageUtil.addExtraSourceLocations(message, sb.toString()); + } + } public boolean isIgnoring(IMessage.Kind kind) { diff --git a/testing/src/org/aspectj/testing/xml/SoftMessage.java b/testing/src/org/aspectj/testing/xml/SoftMessage.java index e798f8f05..f11e55966 100644 --- a/testing/src/org/aspectj/testing/xml/SoftMessage.java +++ b/testing/src/org/aspectj/testing/xml/SoftMessage.java @@ -15,6 +15,7 @@ package org.aspectj.testing.xml; import java.io.File; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -287,4 +288,11 @@ public class SoftMessage implements IMessage { // XXX mutable dup of Message public void setDetails(String string) { details = string; } + + /* (non-Javadoc) + * @see org.aspectj.bridge.IMessage#getExtraSourceLocations() + */ + public List getExtraSourceLocations() { + return Collections.EMPTY_LIST; + } } diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 1d386867c..5aab76ba8 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -2786,7 +2786,7 @@ - + @@ -3508,7 +3508,7 @@ - + @@ -3531,7 +3531,7 @@ this behavior. --> - + @@ -3698,7 +3698,7 @@ - + @@ -3806,7 +3806,7 @@ - + @@ -4223,14 +4223,14 @@ - + - + @@ -4267,7 +4267,7 @@ - + @@ -5037,7 +5037,7 @@ - + @@ -6821,7 +6821,7 @@ - + @@ -6849,5 +6849,39 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/tests/bugs/DeclaringTypeWarning.java b/tests/bugs/DeclaringTypeWarning.java new file mode 100644 index 000000000..d61e1fbe5 --- /dev/null +++ b/tests/bugs/DeclaringTypeWarning.java @@ -0,0 +1,23 @@ + +class A { void run() {} } +class B extends A {} +aspect C { + before() : runB() { } // warn here + pointcut runB(): call(void B.run()); + before() : call(int B.run()) {} +} +public class DeclaringTypeWarning { + public static void main(String[] args) { + // ok with -1.4; otherwise, becomes A.run in bytecode + new B().run(); + // never works - compile-time type of reference is A, not B + ((A) new B()).run(); + } +} +aspect D { + declare error : call(void B.run()) : // warn here + "This should be the only error"; + + declare error : call(int B.run()) : + "This error should not happen"; +} diff --git a/tests/new/CallTypesI.java b/tests/new/CallTypesI.java index 7ab225106..f9b770ac2 100644 --- a/tests/new/CallTypesI.java +++ b/tests/new/CallTypesI.java @@ -53,7 +53,7 @@ interface I1a extends I0 { } interface I1b extends I0 { } -interface I2 extends I1a, I1b {} +////interface I2 extends I1a, I1b {} class C0 { @@ -74,9 +74,11 @@ aspect A { before(): call(void C0.mC()) { noteAdvice += "static c0, "; } + before(): call(void C1a.mC()) || call(void C1a.mI()) { noteAdvice += "static c1a, "; } + before(): call(void C1b.mC()) || call(void C1b.mI()) { noteAdvice += "static c1b, "; } diff --git a/tests/new/IndeterminateArg.java b/tests/new/IndeterminateArg.java index db54c82de..e0b0bfc36 100644 --- a/tests/new/IndeterminateArg.java +++ b/tests/new/IndeterminateArg.java @@ -120,7 +120,8 @@ aspect A { T.e(name); } - pointcut safe() : (call(C+.new(..)) || call(* C+.*(..))); + pointcut safe() : (call(C+.new(..))) || + (call(* *.*(..)) && target(C)); // XXX should encode slots, range: a0o1 = args(Object); a3o2Start = args(Object, Object, *) pointcut none() : args(); pointcut o1() : args(Object); diff --git a/tests/new/IndeterminateArgType.java b/tests/new/IndeterminateArgType.java index 4beb1301e..6a4c58323 100644 --- a/tests/new/IndeterminateArgType.java +++ b/tests/new/IndeterminateArgType.java @@ -97,7 +97,8 @@ aspect A { T.e(name); } - pointcut safe() : call(Safe+.new(..)) || call(* Safe+.*(..)); + pointcut safe() : (call(Safe+.new(..))) || + (call(* *.*(..)) && target(Safe)); pointcut o1End() : args(.., Object); pointcut s1End() : args(.., String); diff --git a/weaver/src/org/aspectj/weaver/Checker.java b/weaver/src/org/aspectj/weaver/Checker.java index 0e30723b4..3baa45175 100644 --- a/weaver/src/org/aspectj/weaver/Checker.java +++ b/weaver/src/org/aspectj/weaver/Checker.java @@ -49,7 +49,9 @@ public class Checker extends ShadowMunger { msg, shadow.toString(), isError ? IMessage.ERROR : IMessage.WARNING, - shadow.getSourceLocation()); + shadow.getSourceLocation(), + null, + new ISourceLocation[]{this.getSourceLocation()}); world.getMessageHandler().handleMessage(message); AsmRelationshipProvider.checkerMunger(world.getModel(), shadow, this); diff --git a/weaver/src/org/aspectj/weaver/Lint.java b/weaver/src/org/aspectj/weaver/Lint.java index 3b3db4c60..5a2d1c566 100644 --- a/weaver/src/org/aspectj/weaver/Lint.java +++ b/weaver/src/org/aspectj/weaver/Lint.java @@ -46,7 +46,10 @@ public class Lint { public final Kind shadowNotInStructure = new Kind("shadowNotInStructure", "the shadow for this join point is not exposed in the structure model: {0}"); - + + public final Kind unmatchedSuperTypeInCall = + new Kind("unmatchedSuperTypeInCall", "does not match because declaring type is {0}, if match desired use target({1})"); + public Lint(World world) { this.world = world; } @@ -149,5 +152,14 @@ public class Lint { text += " [Xlint:" + name + "]"; world.getMessageHandler().handleMessage(new Message(text, kind, null, location)); } + + public void signal(String[] infos, ISourceLocation location, ISourceLocation[] extraLocations) { + if (kind == null) return; + + String text = MessageFormat.format(message, infos ); + text += " [Xlint:" + name + "]"; + world.getMessageHandler().handleMessage( + new Message(text, "", kind, location, null, extraLocations)); + } } } diff --git a/weaver/src/org/aspectj/weaver/XlintDefault.properties b/weaver/src/org/aspectj/weaver/XlintDefault.properties index 59d6d2f28..10da55a66 100644 --- a/weaver/src/org/aspectj/weaver/XlintDefault.properties +++ b/weaver/src/org/aspectj/weaver/XlintDefault.properties @@ -5,4 +5,6 @@ unresolvableMember = warning typeNotExposedToWeaver = warning -shadowNotInStructure = ignore \ No newline at end of file +shadowNotInStructure = ignore + +unmatchedSuperTypeInCall = warning diff --git a/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java b/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java index 5dc127aaf..b3202774a 100644 --- a/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/AndPointcut.java @@ -85,8 +85,8 @@ public class AndPointcut extends Pointcut { } public Pointcut concretize1(ResolvedTypeX inAspect, IntMap bindings) { - return new AndPointcut(left.concretize1(inAspect, bindings), - right.concretize1(inAspect, bindings)); + return new AndPointcut(left.concretize(inAspect, bindings), + right.concretize(inAspect, bindings)); } public Pointcut getLeft() { diff --git a/weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java index ef5929888..1da25d363 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/ExactTypePattern.java @@ -73,7 +73,7 @@ public class ExactTypePattern extends TypePattern { public String toString() { //Thread.currentThread().dumpStack(); - return "ExactTypePattern(" + type.toString() + (includeSubtypes ? "+" : "") + ")"; + return type.toString() + (includeSubtypes ? "+" : ""); } public TypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding, boolean requireExactType) diff --git a/weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java b/weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java index 8be3671f0..1dca9d036 100644 --- a/weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/KindedPointcut.java @@ -13,23 +13,43 @@ package org.aspectj.weaver.patterns; -import java.io.*; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import org.aspectj.bridge.ISourceLocation; import org.aspectj.util.FuzzyBoolean; -import org.aspectj.weaver.*; +import org.aspectj.weaver.Checker; +import org.aspectj.weaver.ISourceContext; +import org.aspectj.weaver.IntMap; +import org.aspectj.weaver.ResolvedTypeX; +import org.aspectj.weaver.Shadow; +import org.aspectj.weaver.ShadowMunger; +import org.aspectj.weaver.TypeX; +import org.aspectj.weaver.World; import org.aspectj.weaver.ast.Literal; import org.aspectj.weaver.ast.Test; public class KindedPointcut extends Pointcut { Shadow.Kind kind; SignaturePattern signature; + + private ShadowMunger munger = null; // only set after concretization - public KindedPointcut( - Shadow.Kind kind, - SignaturePattern signature) { - this.kind = kind; - this.signature = signature; - } + public KindedPointcut( + Shadow.Kind kind, + SignaturePattern signature) { + this.kind = kind; + this.signature = signature; + } + public KindedPointcut( + Shadow.Kind kind, + SignaturePattern signature, + ShadowMunger munger) + { + this(kind, signature); + this.munger = munger; + } public FuzzyBoolean fastMatch(ResolvedTypeX type) { return FuzzyBoolean.MAYBE; @@ -37,11 +57,70 @@ public class KindedPointcut extends Pointcut { public FuzzyBoolean match(Shadow shadow) { if (shadow.getKind() != kind) return FuzzyBoolean.NO; - if (!signature.matches(shadow.getSignature(), shadow.getIWorld())) return FuzzyBoolean.NO; + if (!signature.matches(shadow.getSignature(), shadow.getIWorld())){ + if(kind == Shadow.MethodCall) { + warnOnConfusingSig(shadow); + } + return FuzzyBoolean.NO; + } return FuzzyBoolean.YES; } + private void warnOnConfusingSig(Shadow shadow) { + // no warnings for declare error/warning + if (munger instanceof Checker) return; + + World world = shadow.getIWorld(); + + // warning never needed if the declaring type is any + TypeX exactDeclaringType = signature.getDeclaringType().getExactType(); + + ResolvedTypeX shadowDeclaringType = + shadow.getSignature().getDeclaringType().resolve(world); + + if (signature.getDeclaringType().isStar() + || exactDeclaringType== ResolvedTypeX.MISSING) + return; + + // warning not needed if match type couldn't ever be the declaring type + if (!shadowDeclaringType.isAssignableFrom(exactDeclaringType)) { + return; + } + + // if the method in the declaring type is *not* visible to the + // exact declaring type then warning not needed. + int shadowModifiers = shadow.getSignature().getModifiers(world); + if (!ResolvedTypeX + .isVisible( + shadowModifiers, + shadowDeclaringType, + exactDeclaringType.resolve(world))) { + return; + } + + SignaturePattern nonConfusingPattern = + new SignaturePattern( + signature.getKind(), + signature.getModifiers(), + signature.getReturnType(), + TypePattern.ANY, + signature.getName(), + signature.getParameterTypes(), + signature.getThrowsPattern()); + + if (nonConfusingPattern + .matches(shadow.getSignature(), shadow.getIWorld())) { + shadow.getIWorld().getLint().unmatchedSuperTypeInCall.signal( + new String[] { + shadow.getSignature().getDeclaringType().toString(), + signature.getDeclaringType().toString() + }, + this.getSourceLocation(), + new ISourceLocation[] {shadow.getSourceLocation()} ); + } + } + public boolean equals(Object other) { if (!(other instanceof KindedPointcut)) return false; KindedPointcut o = (KindedPointcut)other; @@ -102,7 +181,9 @@ public class KindedPointcut extends Pointcut { } public Pointcut concretize1(ResolvedTypeX inAspect, IntMap bindings) { - return new KindedPointcut(kind, signature); + Pointcut ret = new KindedPointcut(kind, signature, bindings.getEnclosingAdvice()); + ret.copyLocationFrom(this); + return ret; } public Shadow.Kind getKind() { diff --git a/weaver/src/org/aspectj/weaver/patterns/NotPointcut.java b/weaver/src/org/aspectj/weaver/patterns/NotPointcut.java index d10eea34f..02884b22c 100644 --- a/weaver/src/org/aspectj/weaver/patterns/NotPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/NotPointcut.java @@ -91,7 +91,7 @@ public class NotPointcut extends Pointcut { } public Pointcut concretize1(ResolvedTypeX inAspect, IntMap bindings) { - return new NotPointcut(body.concretize1(inAspect, bindings)); + return new NotPointcut(body.concretize(inAspect, bindings)); } } diff --git a/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java b/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java index 1e6c2b378..9e4eae4fb 100644 --- a/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/OrPointcut.java @@ -88,8 +88,8 @@ public class OrPointcut extends Pointcut { } public Pointcut concretize1(ResolvedTypeX inAspect, IntMap bindings) { - return new OrPointcut(left.concretize1(inAspect, bindings), - right.concretize1(inAspect, bindings)); + return new OrPointcut(left.concretize(inAspect, bindings), + right.concretize(inAspect, bindings)); } public Pointcut getLeft() { diff --git a/weaver/src/org/aspectj/weaver/patterns/Pointcut.java b/weaver/src/org/aspectj/weaver/patterns/Pointcut.java index 0e1e2ba91..126a43b84 100644 --- a/weaver/src/org/aspectj/weaver/patterns/Pointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/Pointcut.java @@ -122,13 +122,19 @@ public abstract class Pointcut extends PatternNode { public Pointcut concretize(ResolvedTypeX inAspect, IntMap bindings) { - assertState(RESOLVED); + //!!! add this test -- assertState(RESOLVED); Pointcut ret = this.concretize1(inAspect, bindings); + if (shouldCopyLocationForConcretize()) ret.copyLocationFrom(this); ret.state = CONCRETE; return ret; } + protected boolean shouldCopyLocationForConcretize() { + return true; + } + + /** * Resolves and removes ReferencePointcuts, replacing with basic ones * diff --git a/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java b/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java index 1b9848ccf..e73e24e82 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/ReferencePointcut.java @@ -271,7 +271,7 @@ public class ReferencePointcut extends Pointcut { newBindings.copyContext(bindings); newBindings.pushEnclosingDefinition(pointcutDec); try { - return pointcutDec.getPointcut().concretize1(searchStart, newBindings); + return pointcutDec.getPointcut().concretize(searchStart, newBindings); } finally { newBindings.popEnclosingDefinitition(); } @@ -280,6 +280,11 @@ public class ReferencePointcut extends Pointcut { concretizing = false; } } + + // We want to keep the original source location, not the reference location + protected boolean shouldCopyLocationForConcretize() { + return false; + } public boolean equals(Object other) { if (!(other instanceof ReferencePointcut)) return false; diff --git a/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java b/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java index d6db93f10..64a3f66b7 100644 --- a/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java +++ b/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java @@ -238,4 +238,32 @@ public class SignaturePattern extends PatternNode { return ret; } + /** + * @return + */ + public ModifiersPattern getModifiers() { + return modifiers; + } + + /** + * @return + */ + public TypePatternList getParameterTypes() { + return parameterTypes; + } + + /** + * @return + */ + public TypePattern getReturnType() { + return returnType; + } + + /** + * @return + */ + public ThrowsPattern getThrowsPattern() { + return throwsPattern; + } + } -- 2.39.5