diff options
Diffstat (limited to 'org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerFromSuper.java')
-rw-r--r-- | org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerFromSuper.java | 110 |
1 files changed, 53 insertions, 57 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerFromSuper.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerFromSuper.java index 13c81fe93..d513d65f7 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerFromSuper.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PerFromSuper.java @@ -10,15 +10,14 @@ * PARC initial implementation * ******************************************************************/ - package org.aspectj.weaver.patterns; -import java.io.DataOutputStream; import java.io.IOException; import java.util.Map; import org.aspectj.bridge.MessageUtil; import org.aspectj.util.FuzzyBoolean; +import org.aspectj.weaver.CompressingDataOutputStream; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.Shadow; @@ -29,15 +28,15 @@ import org.aspectj.weaver.ast.Test; public class PerFromSuper extends PerClause { private PerClause.Kind kind; - + public PerFromSuper(PerClause.Kind kind) { this.kind = kind; } public Object accept(PatternNodeVisitor visitor, Object data) { - return visitor.visit(this,data); + return visitor.visit(this, data); } - + public int couldMatchKinds() { return Shadow.ALL_SHADOW_KINDS_BITS; } @@ -45,70 +44,67 @@ public class PerFromSuper extends PerClause { public FuzzyBoolean fastMatch(FastMatchInfo type) { throw new RuntimeException("unimplemented"); } - - protected FuzzyBoolean matchInternal(Shadow shadow) { - throw new RuntimeException("unimplemented"); - } - public void resolveBindings(IScope scope, Bindings bindings) { - // this method intentionally left blank - } + protected FuzzyBoolean matchInternal(Shadow shadow) { + throw new RuntimeException("unimplemented"); + } - protected Test findResidueInternal(Shadow shadow, ExposedState state) { - throw new RuntimeException("unimplemented"); - } + public void resolveBindings(IScope scope, Bindings bindings) { + // this method intentionally left blank + } + protected Test findResidueInternal(Shadow shadow, ExposedState state) { + throw new RuntimeException("unimplemented"); + } public PerClause concretize(ResolvedType inAspect) { PerClause p = lookupConcretePerClause(inAspect.getSuperclass()); if (p == null) { inAspect.getWorld().getMessageHandler().handleMessage( - MessageUtil.error(WeaverMessages.format(WeaverMessages.MISSING_PER_CLAUSE,inAspect.getSuperclass()), getSourceLocation()) - ); - return new PerSingleton().concretize(inAspect);// AV: fallback on something else NPE in AJDT + MessageUtil.error(WeaverMessages.format(WeaverMessages.MISSING_PER_CLAUSE, inAspect.getSuperclass()), + getSourceLocation())); + return new PerSingleton().concretize(inAspect);// AV: fallback on something else NPE in AJDT } else { - if (p.getKind() != kind) { - inAspect.getWorld().getMessageHandler().handleMessage( - MessageUtil.error(WeaverMessages.format(WeaverMessages.WRONG_PER_CLAUSE,kind,p.getKind()), - getSourceLocation()) - ); - } - return p.concretize(inAspect); - } - } - - public Pointcut parameterizeWith(Map typeVariableMap,World w) { + if (p.getKind() != kind) { + inAspect.getWorld().getMessageHandler().handleMessage( + MessageUtil.error(WeaverMessages.format(WeaverMessages.WRONG_PER_CLAUSE, kind, p.getKind()), + getSourceLocation())); + } + return p.concretize(inAspect); + } + } + + public Pointcut parameterizeWith(Map typeVariableMap, World w) { return this; } - - - + public PerClause lookupConcretePerClause(ResolvedType lookupType) { PerClause ret = lookupType.getPerClause(); - if (ret == null) return null; + if (ret == null) { + return null; + } if (ret instanceof PerFromSuper) { return lookupConcretePerClause(lookupType.getSuperclass()); } return ret; } - - public void write(DataOutputStream s) throws IOException { - FROMSUPER.write(s); - kind.write(s); - writeLocation(s); - } - + public void write(CompressingDataOutputStream s) throws IOException { + FROMSUPER.write(s); + kind.write(s); + writeLocation(s); + } + public static PerClause readPerClause(VersionedDataInputStream s, ISourceContext context) throws IOException { PerFromSuper ret = new PerFromSuper(Kind.read(s)); ret.readLocation(context, s); return ret; } - + public String toString() { return "perFromSuper(" + kind + ", " + inAspect + ")"; } - + public String toDeclarationString() { return ""; } @@ -117,19 +113,19 @@ public class PerFromSuper extends PerClause { return kind; } - public boolean equals(Object other) { - if (!(other instanceof PerFromSuper)) return false; - PerFromSuper pc = (PerFromSuper)other; - return pc.kind.equals(kind) - && ((pc.inAspect == null) ? (inAspect == null) : pc.inAspect.equals(inAspect)); - } - - public int hashCode() { - int result = 17; - result = 37*result + kind.hashCode(); - result = 37*result + ((inAspect == null) ? 0 : inAspect.hashCode()); - return result; - } - - + public boolean equals(Object other) { + if (!(other instanceof PerFromSuper)) { + return false; + } + PerFromSuper pc = (PerFromSuper) other; + return pc.kind.equals(kind) && ((pc.inAspect == null) ? (inAspect == null) : pc.inAspect.equals(inAspect)); + } + + public int hashCode() { + int result = 17; + result = 37 * result + kind.hashCode(); + result = 37 * result + ((inAspect == null) ? 0 : inAspect.hashCode()); + return result; + } + } |