InstructionHandle end1 = Range.genEnd(body, end);
ExceptionRange er =
- new ExceptionRange(body, BcelWorld.fromBcel(catchType), highPriority);
+ new ExceptionRange(body, (catchType==null?null:BcelWorld.fromBcel(catchType)), highPriority);
er.associateWithTargets(start1, end1, handlerStart);
}
return accessFlags;
}
+ public int getAccessFlagsWithoutSynchronized() {
+ if (isSynchronized()) return accessFlags - Modifier.SYNCHRONIZED;
+ return accessFlags;
+ }
+
+ public boolean isSynchronized() {
+ return (accessFlags & Modifier.SYNCHRONIZED)!=0;
+ }
+
public void setAccessFlags(int newFlags) {
this.accessFlags = newFlags;
}
public MethodGen pack() {
//killNops();
+ int flags = getAccessFlags();
+ if (enclosingClass.getWorld().isJoinpointSynchronizationEnabled()) {
+ flags = getAccessFlagsWithoutSynchronized();
+ }
MethodGen gen =
new MethodGen(
- getAccessFlags(),
+ flags,
getReturnType(),
getArgumentTypes(),
null, //getArgumentNames(),
// IToken possibleTypeVariableToken = tokenSource.peek();
// String[] typeVariables = maybeParseSimpleTypeVariableList();
if (kind.equals("execution") || kind.equals("call") ||
- kind.equals("get") || kind.equals("set")) {
+ kind.equals("get") || kind.equals("set")) {
p = parseKindedPointcut(kind);
} else if (kind.equals("args")) {
p = parseArgsPointcut();
TypePattern typePat = parseTypePattern(false);
eat(")");
p = new HandlerPointcut(typePat);
+ } else if (kind.equals("lock") || kind.equals("unlock")) {
+ p = parseMonitorPointcut(kind);
} else if (kind.equals("initialization")) {
eat("(");
SignaturePattern sig = parseConstructorSignaturePattern();
return new KindedPointcut(shadowKind, sig);
}
+ /** Covers the 'lock()' and 'unlock()' pointcuts */
+ private KindedPointcut parseMonitorPointcut(String kind) {
+ eat("(");
+ TypePattern type = TypePattern.ANY;
+ eat(")");
+
+ if (kind.equals("lock")) {
+ return new KindedPointcut(Shadow.SynchronizationLock,
+ new SignaturePattern(Member.MONITORENTER, ModifiersPattern.ANY,
+ TypePattern.ANY,
+ TypePattern.ANY,
+// type,
+ NamePattern.ANY,
+ TypePatternList.ANY,
+ ThrowsPattern.ANY,
+ AnnotationTypePattern.ANY));
+ } else {
+ return new KindedPointcut(Shadow.SynchronizationUnlock,
+ new SignaturePattern(Member.MONITORENTER, ModifiersPattern.ANY,
+ TypePattern.ANY,
+ TypePattern.ANY,
+// type,
+ NamePattern.ANY,
+ TypePatternList.ANY,
+ ThrowsPattern.ANY,
+ AnnotationTypePattern.ANY));
+ }
+ }
+
public TypePattern parseTypePattern() {
return parseTypePattern(false);
}