diff options
author | avasseur <avasseur> | 2005-07-18 11:23:32 +0000 |
---|---|---|
committer | avasseur <avasseur> | 2005-07-18 11:23:32 +0000 |
commit | de064586adce1a43081832aefa88d27e883cb81e (patch) | |
tree | d7ca71ffa5b93c81f962fcde6eea9c480b3b18ee /loadtime | |
parent | 2ef8599677b00f02ddbe130ec65db7e7cdef9efb (diff) | |
download | aspectj-de064586adce1a43081832aefa88d27e883cb81e.tar.gz aspectj-de064586adce1a43081832aefa88d27e883cb81e.zip |
fix LTW for JMX stuff, rename messageHolder, some doc on that + dump
Diffstat (limited to 'loadtime')
-rw-r--r-- | loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java | 7 | ||||
-rw-r--r-- | loadtime/src/org/aspectj/weaver/loadtime/Options.java | 12 |
2 files changed, 11 insertions, 8 deletions
diff --git a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java index 9414819b4..ee0783088 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java @@ -15,6 +15,7 @@ import org.aspectj.asm.IRelationship; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.ISourceLocation; import org.aspectj.bridge.Message; +import org.aspectj.bridge.MessageUtil; import org.aspectj.weaver.ICrossReferenceHandler; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.UnresolvedType; @@ -87,6 +88,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { // register the definitions registerDefinitions(weaver, loader); + messageHandler = bcelWorld.getMessageHandler(); // after adding aspects weaver.prepareForWeave(); @@ -100,20 +102,23 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { */ private void registerDefinitions(final BcelWeaver weaver, final ClassLoader loader) { try { + MessageUtil.info(messageHandler, "register classloader " + ((loader!=null)?loader.getClass().getName()+"@"+loader.hashCode():"null")); //TODO av underoptimized: we will parse each XML once per CL that see it Enumeration xmls = loader.getResources(AOP_XML); List definitions = new ArrayList(); //TODO av dev mode needed ? TBD -Daj5.def=... - if (loader != null && loader != ClassLoader.getSystemClassLoader().getParent()) { + if (ClassLoader.getSystemClassLoader().equals(loader)) { String file = System.getProperty("aj5.def", null); if (file != null) { + MessageUtil.info(messageHandler, "using (-Daj5.def) " + file); definitions.add(DocumentParser.parse((new File(file)).toURL())); } } while (xmls.hasMoreElements()) { URL xml = (URL) xmls.nextElement(); + MessageUtil.info(messageHandler, "using " + xml.getFile()); definitions.add(DocumentParser.parse(xml)); } diff --git a/loadtime/src/org/aspectj/weaver/loadtime/Options.java b/loadtime/src/org/aspectj/weaver/loadtime/Options.java index 429adc209..e6c502d10 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/Options.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/Options.java @@ -38,9 +38,7 @@ public class Options { private final static String OPTION_reweavable = "-Xreweavable"; private final static String OPTION_noinline = "-Xnoinline"; private final static String OPTION_showWeaveInfo = "-showWeaveInfo"; - private final static String OPTIONVALUED_messageHolder = "-XmessageHolderClass:";//TODO rename to Handler - - //FIXME dump option - dump what - dump before/after ? + private final static String OPTIONVALUED_messageHandler = "-XmessageHandlerClass:"; public static WeaverOption parse(String options, ClassLoader laoder) { if (LangUtil.isEmpty(options)) { @@ -55,9 +53,9 @@ public class Options { // do a first round on the message handler since it will report the options themselves for (Iterator iterator = flags.iterator(); iterator.hasNext();) { String arg = (String) iterator.next(); - if (arg.startsWith(OPTIONVALUED_messageHolder)) { - if (arg.length() > OPTIONVALUED_messageHolder.length()) { - String handlerClass = arg.substring(OPTIONVALUED_messageHolder.length()).trim(); + if (arg.startsWith(OPTIONVALUED_messageHandler)) { + if (arg.length() > OPTIONVALUED_messageHandler.length()) { + String handlerClass = arg.substring(OPTIONVALUED_messageHandler.length()).trim(); try { Class handler = Class.forName(handlerClass, false, laoder); weaverOption.messageHandler = ((IMessageHandler) handler.newInstance()); @@ -94,7 +92,7 @@ public class Options { weaverOption.showWeaveInfo = true; } else if (arg.equalsIgnoreCase(OPTION_verbose)) { weaverOption.verbose = true; - } else if (arg.startsWith(OPTIONVALUED_messageHolder)) { + } else if (arg.startsWith(OPTIONVALUED_messageHandler)) { ;// handled in first round } else { weaverOption.messageHandler.handleMessage( |