public ClassLoaderWeavingAdaptor() {
super();
- if (trace.isTraceEnabled())
+ if (trace.isTraceEnabled()) {
trace.enter("<init>", this);
- if (trace.isTraceEnabled())
+ }
+ if (trace.isTraceEnabled()) {
trace.exit("<init>");
+ }
}
/**
*/
public ClassLoaderWeavingAdaptor(final ClassLoader deprecatedLoader, final IWeavingContext deprecatedContext) {
super();
- if (trace.isTraceEnabled())
+ if (trace.isTraceEnabled()) {
trace.enter("<init>", this, new Object[] { deprecatedLoader, deprecatedContext });
- if (trace.isTraceEnabled())
+ }
+ if (trace.isTraceEnabled()) {
trace.exit("<init>");
+ }
}
class SimpleGeneratedClassHandler implements GeneratedClassHandler {
}
protected void initialize(final ClassLoader classLoader, IWeavingContext context) {
- if (initialized)
+ if (initialized) {
return;
+ }
boolean success = true;
// if (trace.isTraceEnabled()) trace.enter("initialize",this,new Object[] { classLoader, context });
List definitions = weavingContext.getDefinitions(classLoader, this);
if (definitions.isEmpty()) {
disable(); // TODO maw Needed to ensure messages are flushed
- if (trace.isTraceEnabled())
+ if (trace.isTraceEnabled()) {
trace.exit("initialize", definitions);
+ }
return;
}
}
initialized = true;
- if (trace.isTraceEnabled())
+ if (trace.isTraceEnabled()) {
trace.exit("initialize", isEnabled());
+ }
}
/**
* @param loader
*/
List parseDefinitions(final ClassLoader loader) {
- if (trace.isTraceEnabled())
+ if (trace.isTraceEnabled()) {
trace.enter("parseDefinitions", this);
+ }
List definitions = new ArrayList();
try {
}
String resourcePath = System.getProperty("org.aspectj.weaver.loadtime.configuration", AOP_XML);
- if (trace.isTraceEnabled())
+ if (trace.isTraceEnabled()) {
trace.event("parseDefinitions", this, resourcePath);
+ }
StringTokenizer st = new StringTokenizer(resourcePath, ";");
Set seenBefore = new HashSet();
while (xmls.hasMoreElements()) {
URL xml = (URL) xmls.nextElement();
- if (trace.isTraceEnabled())
+ if (trace.isTraceEnabled()) {
trace.event("parseDefinitions", this, xml);
+ }
if (!seenBefore.contains(xml)) {
info("using configuration " + weavingContext.getFile(xml));
definitions.add(DocumentParser.parse(xml));
warn("parse definitions failed", e);
}
- if (trace.isTraceEnabled())
+ if (trace.isTraceEnabled()) {
trace.exit("parseDefinitions", definitions);
+ }
return definitions;
}
private boolean registerDefinitions(final BcelWeaver weaver, final ClassLoader loader, List definitions) {
- if (trace.isTraceEnabled())
+ if (trace.isTraceEnabled()) {
trace.enter("registerDefinitions", this, definitions);
+ }
boolean success = true;
try {
warn("register definition failed", (ex instanceof AbortException) ? null : ex);
}
- if (trace.isTraceEnabled())
+ if (trace.isTraceEnabled()) {
trace.exit("registerDefinitions", success);
+ }
return success;
}
setMessageHandler(weaverOption.messageHandler);
world.setXlazyTjp(weaverOption.lazyTjp);
world.setXHasMemberSupportEnabled(weaverOption.hasMember);
+ world.setTiming(weaverOption.timers);
world.setOptionalJoinpoints(weaverOption.optionalJoinpoints);
world.setPinpointMode(weaverOption.pinpoint);
weaver.setReweavableMode(weaverOption.notReWeavable);
* @param definitions
*/
private boolean registerAspects(final BcelWeaver weaver, final ClassLoader loader, final List definitions) {
- if (trace.isTraceEnabled())
+ if (trace.isTraceEnabled()) {
trace.enter("registerAspects", this, new Object[] { weaver, loader, definitions });
+ }
boolean success = true;
// TODO: the exclude aspect allow to exclude aspect defined upper in the CL hierarchy - is it what we want ??
info("no aspects registered. Disabling weaver for class loader " + getClassLoaderName(loader));
}
- if (trace.isTraceEnabled())
+ if (trace.isTraceEnabled()) {
trace.exit("registerAspects", success);
+ }
return success;
}
private boolean weaveAndDefineConceteAspects() {
- if (trace.isTraceEnabled())
+ if (trace.isTraceEnabled()) {
trace.enter("weaveAndDefineConceteAspects", this, concreteAspects);
+ }
boolean success = true;
for (Iterator iterator = concreteAspects.iterator(); iterator.hasNext();) {
}
}
- if (trace.isTraceEnabled())
+ if (trace.isTraceEnabled()) {
trace.exit("weaveAndDefineConceteAspects", success);
+ }
return success;
}
public String getNamespace() {
// System.out.println("ClassLoaderWeavingAdaptor.getNamespace() classloader=" + weavingContext.getClassLoaderName() +
// ", namespace=" + namespace);
- if (namespace == null)
+ if (namespace == null) {
return "";
- else
+ } else {
return new String(namespace);
+ }
}
/**
public boolean generatedClassesExistFor(String className) {
// System.err.println("? ClassLoaderWeavingAdaptor.generatedClassesExist() classname=" + className + ", size=" +
// generatedClasses);
- if (className == null)
+ if (className == null) {
return !generatedClasses.isEmpty();
- else
+ } else {
return generatedClasses.containsKey(className);
+ }
}
/**
}
private void defineClass(ClassLoader loader, String name, byte[] bytes) {
- if (trace.isTraceEnabled())
+ if (trace.isTraceEnabled()) {
trace.enter("defineClass", this, new Object[] { loader, name, bytes });
+ }
Object clazz = null;
debug("generating class '" + name + "'");
warn("define generated class failed", e);
}
- if (trace.isTraceEnabled())
+ if (trace.isTraceEnabled()) {
trace.exit("defineClass", clazz);
+ }
}
}
\ No newline at end of file
private static final String OPTIONVALUED_Xlint = "-Xlint:";
private static final String OPTIONVALUED_joinpoints = "-Xjoinpoints:";
private static final String OPTIONVALUED_Xset = "-Xset:";
+ private static final String OPTION_timers = "-timers";
public static WeaverOption parse(String options, ClassLoader laoder, IMessageHandler imh) {
WeaverOption weaverOption = new WeaverOption(imh);
} else if (arg.equalsIgnoreCase(OPTION_hasMember)) {
weaverOption.hasMember = true;
} else if (arg.startsWith(OPTIONVALUED_joinpoints)) {
- if (arg.length() > OPTIONVALUED_joinpoints.length())
+ if (arg.length() > OPTIONVALUED_joinpoints.length()) {
weaverOption.optionalJoinpoints = arg.substring(OPTIONVALUED_joinpoints.length()).trim();
+ }
} else if (arg.equalsIgnoreCase(OPTION_verbose)) {
weaverOption.verbose = true;
} else if (arg.equalsIgnoreCase(OPTION_debug)) {
if (arg.length() > OPTIONVALUED_Xlint.length()) {
weaverOption.xSet = arg.substring(OPTIONVALUED_Xset.length()).trim();
}
+ } else if (arg.equalsIgnoreCase(OPTION_timers)) {
+ weaverOption.timers = true;
} else {
weaverOption.messageHandler.handleMessage(new Message("Cannot configure weaver with option '" + arg
+ "': unknown option", IMessage.WARNING, null, null));
boolean java5;
boolean lazyTjp;
boolean hasMember;
+ boolean timers = false;
String optionalJoinpoints;
boolean noWarn;
boolean proceedOnError;