</row>
<row>
<entry>
- <literal>-Xlint, -Xlint:ignore, ...</literal>
+ <literal>-Xlintfile:pathToAResource</literal>
</entry>
- <entry>Configure lint messages</entry><!--FIXME AV - default to blabla, see link X -->
+ <entry>Configure lint messages as specified in the given resource (visible from this aop.xml file' classloader)</entry>
+ </row>
+ <row>
+ <entry>
+ <literal>-Xlint:default, -Xlint:ignore, ...</literal>
+ </entry>
+ <entry>Configure lint messages, refer to documentation for meaningfull values</entry>
</row>
<row>
<entry>
import org.aspectj.weaver.tools.WeavingAdaptor;
import java.io.File;
+import java.io.InputStream;
+import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
+import java.util.Properties;
/**
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
MessageUtil.info(messageHandler, "using " + xml.getFile());
definitions.add(DocumentParser.parse(xml));
}
-
+
// still go thru if definitions is empty since we will configure
// the default message handler in there
registerOptions(weaver, loader, definitions);
weaver.setReweavableMode(weaverOption.reWeavable, false);
world.setXnoInline(weaverOption.noInline);
world.setBehaveInJava5Way(weaverOption.java5);//TODO should be autodetected ?
+ //-Xlintfile: first so that lint wins
+ if (weaverOption.lintFile != null) {
+ InputStream resource = null;
+ try {
+ resource = loader.getResourceAsStream(weaverOption.lintFile);
+ Exception failure = null;
+ if (resource != null) {
+ try {
+ Properties properties = new Properties();
+ properties.load(resource);
+ world.getLint().setFromProperties(properties);
+ } catch (IOException e) {
+ failure = e;
+ }
+ }
+ if (failure != null || resource == null) {
+ world.getMessageHandler().handleMessage(new Message(
+ "Cannot access resource for -Xlintfile:"+weaverOption.lintFile,
+ IMessage.WARNING,
+ failure,
+ null));
+ }
+ } finally {
+ try { resource.close(); } catch (Throwable t) {;}
+ }
+ }
+ if (weaverOption.lint != null) {
+ if (weaverOption.lint.equals("default")) {//FIXME should be AjBuildConfig.AJLINT_DEFAULT but yetanother deps..
+ bcelWorld.getLint().loadDefaultProperties();
+ } else {
+ bcelWorld.getLint().setAll(weaverOption.lint);
+ }
+ }
//TODO proceedOnError option
}
private final static String OPTION_noinline = "-Xnoinline";
private final static String OPTION_showWeaveInfo = "-showWeaveInfo";
private final static String OPTIONVALUED_messageHandler = "-XmessageHandlerClass:";
+ private static final String OPTIONVALUED_Xlintfile = "-Xlintfile:";
+ private static final String OPTIONVALUED_Xlint = "-Xlint:";
+
public static WeaverOption parse(String options, ClassLoader laoder) {
if (LangUtil.isEmpty(options)) {
weaverOption.verbose = true;
} else if (arg.startsWith(OPTIONVALUED_messageHandler)) {
;// handled in first round
+ } else if (arg.startsWith(OPTIONVALUED_Xlintfile)) {
+ if (arg.length() > OPTIONVALUED_Xlintfile.length()) {
+ weaverOption.lintFile = arg.substring(OPTIONVALUED_Xlintfile.length()).trim();
+ }
+ } else if (arg.startsWith(OPTIONVALUED_Xlint)) {
+ if (arg.length() > OPTIONVALUED_Xlint.length()) {
+ weaverOption.lint = arg.substring(OPTIONVALUED_Xlint.length()).trim();
+ }
} else {
weaverOption.messageHandler.handleMessage(
new Message(
boolean noInline;
boolean showWeaveInfo;
IMessageHandler messageHandler;
+ String lint;
+ String lintFile;
public WeaverOption() {
messageHandler = new DefaultMessageHandler();//default