import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen;
import org.aspectj.apache.bcel.classfile.annotation.ArrayElementValue;
import org.aspectj.apache.bcel.classfile.annotation.ClassElementValue;
-import org.aspectj.apache.bcel.classfile.annotation.NameValuePair;
import org.aspectj.apache.bcel.classfile.annotation.ElementValue;
+import org.aspectj.apache.bcel.classfile.annotation.NameValuePair;
import org.aspectj.apache.bcel.classfile.annotation.RuntimeAnnos;
import org.aspectj.apache.bcel.classfile.annotation.RuntimeVisAnnos;
import org.aspectj.apache.bcel.generic.Type;
}
}
}
- if (!containsAnnotationClassReference)
+ if (!containsAnnotationClassReference) {
return NO_ATTRIBUTES;
+ }
AjAttributeStruct struct = new AjAttributeStruct(type, context, msgHandler);
Attribute[] attributes = javaClass.getAttributes();
for (int i = 0; i < javaClass.getMethods().length; i++) {
Method method = javaClass.getMethods()[i];
- if (method.getName().startsWith(NameMangler.PREFIX))
+ if (method.getName().startsWith(NameMangler.PREFIX)) {
continue; // already dealt with by ajc...
+ }
// FIXME alex optimize, this method struct will gets recreated for
// advice extraction
AjAttributeMethodStruct mstruct = null;
Field[] fs = javaClass.getFields();
for (int i = 0; i < fs.length; i++) {
Field field = fs[i];
- if (field.getName().startsWith(NameMangler.PREFIX))
+ if (field.getName().startsWith(NameMangler.PREFIX)) {
continue; // already dealt with by ajc...
+ }
// FIXME alex optimize, this method struct will gets recreated for
// advice extraction
AjAttributeFieldStruct fstruct = new AjAttributeFieldStruct(field, null, type, context, msgHandler);
*/
public static List<AjAttribute> readAj5MethodAttributes(Method method, BcelMethod bMethod, ResolvedType type,
ResolvedPointcutDefinition preResolvedPointcut, ISourceContext context, IMessageHandler msgHandler) {
- if (method.getName().startsWith(NameMangler.PREFIX))
+ if (method.getName().startsWith(NameMangler.PREFIX)) {
return Collections.emptyList(); // already dealt with by ajc...
+ }
AjAttributeMethodStruct struct = new AjAttributeMethodStruct(method, bMethod, type, context, msgHandler);
Attribute[] attributes = method.getAttributes();
// pc.resolve(binding);
} else {
pc = parsePointcut(beforeAdvice.getValue().stringifyValue(), struct, false);
- if (pc == null)
+ if (pc == null) {
return false;// parse error
+ }
pc = pc.resolve(binding);
}
setIgnoreUnboundBindingNames(pc, bindings);
pc = preResolvedPointcut.getPointcut();
} else {
pc = parsePointcut(afterAdvice.getValue().stringifyValue(), struct, false);
- if (pc == null)
+ if (pc == null) {
return false;// parse error
+ }
pc.resolve(binding);
}
setIgnoreUnboundBindingNames(pc, bindings);
pc = preResolvedPointcut.getPointcut();
} else {
pc = parsePointcut(pointcut, struct, false);
- if (pc == null)
+ if (pc == null) {
return false;// parse error
+ }
pc.resolve(binding);
}
setIgnoreUnboundBindingNames(pc, bindings);
pc = preResolvedPointcut.getPointcut();
} else {
pc = parsePointcut(pointcut, struct, false);
- if (pc == null)
+ if (pc == null) {
return false;// parse error
+ }
pc.resolve(binding);
}
setIgnoreUnboundBindingNames(pc, bindings);
pc = preResolvedPointcut.getPointcut();
} else {
pc = parsePointcut(aroundAdvice.getValue().stringifyValue(), struct, false);
- if (pc == null)
+ if (pc == null) {
return false;// parse error
+ }
pc.resolve(binding);
}
setIgnoreUnboundBindingNames(pc, bindings);
*/
private static boolean handlePointcutAnnotation(RuntimeAnnos runtimeAnnotations, AjAttributeMethodStruct struct) {
AnnotationGen pointcut = getAnnotation(runtimeAnnotations, AjcMemberMaker.POINTCUT_ANNOTATION);
- if (pointcut == null)
+ if (pointcut == null) {
return false;
+ }
NameValuePair pointcutExpr = getAnnotationElement(pointcut, VALUE);
// semantic check: the method must return void, or be
// since for it to be resolved, we will need other pointcuts to
// be registered as well
pc = parsePointcut(pointcutExpr.getValue().stringifyValue(), struct, true);
- if (pc == null)
+ if (pc == null) {
return false;// parse error
+ }
pc.setLocation(struct.context, -1, -1);// FIXME AVASM !! bMethod
// is null here..
// } else {
private static String lastbit(String fqname) {
int i = fqname.lastIndexOf(".");
- if (i == -1)
+ if (i == -1) {
return fqname;
- else
+ } else {
return fqname.substring(i + 1);
+ }
}
/**
shortString.append("(");
for (int i = 0; i < method.getArgumentTypes().length; i++) {
shortString.append(lastbit(method.getArgumentTypes()[i].toString()));
- if ((i + 1) < method.getArgumentTypes().length)
+ if ((i + 1) < method.getArgumentTypes().length) {
shortString.append(",");
+ }
}
shortString.append(")");
@Override
public Pointcut getPointcut() {
+ if (m_lazyPointcut == null && m_pointcutUnresolved == null) {
+ m_lazyPointcut = Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
+ }
if (m_lazyPointcut == null && m_pointcutUnresolved != null) {
m_lazyPointcut = m_pointcutUnresolved.resolve(m_binding);
m_lazyPointcut.copyLocationFrom(m_pointcutUnresolved);