/* *******************************************************************
- * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
- * 2005 Contributors
+ * Copyright (c) 2002,2010
* All rights reserved.
* This program and the accompanying materials are made available
* under the terms of the Eclipse Public License v1.0
*
* Contributors:
* PARC initial implementation
- * Adrian Colyer many updates since....
+ * Adrian Colyer, IBM
+ * Andy Clement, IBM, SpringSource
* ******************************************************************/
package org.aspectj.weaver.patterns;
import org.aspectj.weaver.tools.ContextBasedMatcher;
import org.aspectj.weaver.tools.PointcutDesignatorHandler;
-//XXX doesn't handle errors for extra tokens very well (sometimes ignores)
+/**
+ * @author PARC
+ * @author Adrian Colyer
+ * @author Andy Clement
+ */
+// XXX doesn't handle errors for extra tokens very well (sometimes ignores)
public class PatternParser {
private ITokenSource tokenSource;
ret = parseSoft();
} else {
throw new ParserException(
- "expected one of error, warning, parents, soft, precedence, @type, @method, @constructor, @field", tokenSource
- .peek(-1));
+ "expected one of error, warning, parents, soft, precedence, @type, @method, @constructor, @field",
+ tokenSource.peek(-1));
}
int endPos = tokenSource.peek(-1).getEnd();
ret.setLocation(sourceContext, startPos, endPos);
private Pointcut parseNotOrPointcut() {
Pointcut p = parseAtomicPointcut();
if (maybeEat("&&")) {
- p = new AndPointcut(p, parsePointcut());
+ p = new AndPointcut(p, parseNotOrPointcut());
}
return p;
}
// if (maybeEat("&&")) {
// ap = new AndAnnotationTypePattern(ap, parseNotOrAnnotationPattern());
// }
- //
+ //
// if (maybeEat("||")) {
// ap = new OrAnnotationTypePattern(ap, parseAnnotationTypePattern());
// }
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.Shadow;
import org.aspectj.weaver.ShadowMunger;
+import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.VersionedDataInputStream;
import org.aspectj.weaver.World;
import org.aspectj.weaver.ast.Literal;
}
@Override
- public Pointcut parameterizeWith(Map typeVariableMap, World w) {
+ public Pointcut parameterizeWith(Map<String, UnresolvedType> typeVariableMap, World w) {
return this;
}
}
}
}
- public abstract Pointcut parameterizeWith(Map typeVariableMap, World w);
+ public abstract Pointcut parameterizeWith(Map<String, UnresolvedType> typeVariableMap, World w);
}
/**
*/
-
// XXX needs check that arguments contains no WildTypePatterns
public class ReferencePointcut extends Pointcut {
public UnresolvedType onType;
/**
* if this is non-null then when the pointcut is concretized the result will be parameterized too.
*/
- private Map typeVariableMap;
+ private Map<String, UnresolvedType> typeVariableMap;
// public ResolvedPointcut binding;
if (onType.isParameterizedType()) {
// build a type map mapping type variable names in the generic type to
// the type parameters presented
- typeVariableMap = new HashMap();
+ typeVariableMap = new HashMap<String, UnresolvedType>();
ResolvedType underlyingGenericType = ((ResolvedType) onType).getGenericType();
TypeVariable[] tVars = underlyingGenericType.getTypeVariables();
ResolvedType[] typeParams = ((ResolvedType) onType).getResolvedTypeParameters();
public Pointcut concretize1(ResolvedType searchStart, ResolvedType declaringType, IntMap bindings) {
if (concretizing) {
// Thread.currentThread().dumpStack();
- searchStart.getWorld().getMessageHandler().handleMessage(
- MessageUtil.error(WeaverMessages.format(WeaverMessages.CIRCULAR_POINTCUT, this), getSourceLocation()));
+ searchStart
+ .getWorld()
+ .getMessageHandler()
+ .handleMessage(
+ MessageUtil.error(WeaverMessages.format(WeaverMessages.CIRCULAR_POINTCUT, this), getSourceLocation()));
Pointcut p = Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
p.sourceContext = sourceContext;
return p;
if (!foundMatchingPointcut) {
pointcutDec = searchStart.findPointcut(name);
if (pointcutDec == null) {
- searchStart.getWorld().getMessageHandler().handleMessage(
- MessageUtil.error(
- WeaverMessages.format(WeaverMessages.CANT_FIND_POINTCUT, name, searchStart.getName()),
- getSourceLocation()));
+ searchStart
+ .getWorld()
+ .getMessageHandler()
+ .handleMessage(
+ MessageUtil.error(
+ WeaverMessages.format(WeaverMessages.CANT_FIND_POINTCUT, name, searchStart.getName()),
+ getSourceLocation()));
return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
}
}
if (searchStart.isParameterizedType()) {
// build a type map mapping type variable names in the generic type to
// the type parameters presented
- typeVariableMap = new HashMap();
+ typeVariableMap = new HashMap<String, UnresolvedType>();
ResolvedType underlyingGenericType = searchStart.getGenericType();
TypeVariable[] tVars = underlyingGenericType.getTypeVariables();
ResolvedType[] typeParams = searchStart.getResolvedTypeParameters();
* do this at the point in time this method will be called, so we make a version that will parameterize the pointcut it
* ultimately resolves to.
*/
- public Pointcut parameterizeWith(Map typeVariableMap, World w) {
+ public Pointcut parameterizeWith(Map<String, UnresolvedType> typeVariableMap, World w) {
ReferencePointcut ret = new ReferencePointcut(onType, name, arguments);
ret.onTypeSymbolic = onTypeSymbolic;
ret.typeVariableMap = typeVariableMap;