1.1 --- a/src/share/classes/com/sun/tools/javac/main/Main.java Tue Dec 18 18:15:47 2012 -0800 1.2 +++ b/src/share/classes/com/sun/tools/javac/main/Main.java Wed Dec 19 11:29:56 2012 +0000 1.3 @@ -44,6 +44,8 @@ 1.4 1.5 import com.sun.source.util.JavacTask; 1.6 import com.sun.source.util.Plugin; 1.7 +import com.sun.tools.doclint.DocLint; 1.8 +import com.sun.tools.javac.api.BasicJavacTask; 1.9 import com.sun.tools.javac.code.Source; 1.10 import com.sun.tools.javac.file.CacheFSInfo; 1.11 import com.sun.tools.javac.file.JavacFileManager; 1.12 @@ -428,6 +430,7 @@ 1.13 if (batchMode) 1.14 CacheFSInfo.preRegister(context); 1.15 1.16 + // FIXME: this code will not be invoked if using JavacTask.parse/analyze/generate 1.17 // invoke any available plugins 1.18 String plugins = options.get(PLUGIN); 1.19 if (plugins != null) { 1.20 @@ -464,11 +467,32 @@ 1.21 } 1.22 } 1.23 1.24 + comp = JavaCompiler.instance(context); 1.25 + 1.26 + // FIXME: this code will not be invoked if using JavacTask.parse/analyze/generate 1.27 + String xdoclint = options.get(XDOCLINT); 1.28 + String xdoclintCustom = options.get(XDOCLINT_CUSTOM); 1.29 + if (xdoclint != null || xdoclintCustom != null) { 1.30 + Set<String> doclintOpts = new LinkedHashSet<String>(); 1.31 + if (xdoclint != null) 1.32 + doclintOpts.add(DocLint.XMSGS_OPTION); 1.33 + if (xdoclintCustom != null) { 1.34 + for (String s: xdoclintCustom.split("\\s+")) { 1.35 + if (s.isEmpty()) 1.36 + continue; 1.37 + doclintOpts.add(s.replace(XDOCLINT_CUSTOM.text, DocLint.XMSGS_CUSTOM_PREFIX)); 1.38 + } 1.39 + } 1.40 + if (!(doclintOpts.size() == 1 1.41 + && doclintOpts.iterator().next().equals(DocLint.XMSGS_CUSTOM_PREFIX + "none"))) { 1.42 + JavacTask t = BasicJavacTask.instance(context); 1.43 + new DocLint().init(t, doclintOpts.toArray(new String[doclintOpts.size()])); 1.44 + comp.keepComments = true; 1.45 + } 1.46 + } 1.47 + 1.48 fileManager = context.get(JavaFileManager.class); 1.49 1.50 - comp = JavaCompiler.instance(context); 1.51 - if (comp == null) return Result.SYSERR; 1.52 - 1.53 if (!files.isEmpty()) { 1.54 // add filenames to fileObjects 1.55 comp = JavaCompiler.instance(context);