< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/api/BasicJavacTask.java

Print this page
rev 48934 : 8198552: Multiple javac plugins do not work at the same time.
Summary: Fixing handling of multiple -Xplugin, -Xdoclint: and -Xdoclint/packages: parameters.
Reviewed-by: TBD


 199                     throw new PropagatedException(ex);
 200                 }
 201             }
 202         }
 203 
 204         if (pluginOpts.isEmpty())
 205             return;
 206 
 207         Set<List<String>> pluginsToCall = new LinkedHashSet<>(pluginOpts);
 208         JavacProcessingEnvironment pEnv = JavacProcessingEnvironment.instance(context);
 209         ServiceLoader<Plugin> sl = pEnv.getServiceLoader(Plugin.class);
 210         for (Plugin plugin : sl) {
 211             for (List<String> p : pluginsToCall) {
 212                 if (plugin.getName().equals(p.head)) {
 213                     pluginsToCall.remove(p);
 214                     try {
 215                         plugin.init(this, p.tail.toArray(new String[p.tail.size()]));
 216                     } catch (RuntimeException ex) {
 217                         throw new PropagatedException(ex);
 218                     }

 219                 }
 220             }
 221         }
 222         for (List<String> p: pluginsToCall) {
 223             Log.instance(context).error(Errors.PluginNotFound(p.head));
 224         }
 225     }
 226 
 227     public void initDocLint(List<String> docLintOpts) {
 228         if (docLintOpts.isEmpty())
 229             return;
 230 
 231         new DocLint().init(this, docLintOpts.toArray(new String[docLintOpts.size()]));
 232         JavaCompiler.instance(context).keepComments = true;
 233     }
 234 }


 199                     throw new PropagatedException(ex);
 200                 }
 201             }
 202         }
 203 
 204         if (pluginOpts.isEmpty())
 205             return;
 206 
 207         Set<List<String>> pluginsToCall = new LinkedHashSet<>(pluginOpts);
 208         JavacProcessingEnvironment pEnv = JavacProcessingEnvironment.instance(context);
 209         ServiceLoader<Plugin> sl = pEnv.getServiceLoader(Plugin.class);
 210         for (Plugin plugin : sl) {
 211             for (List<String> p : pluginsToCall) {
 212                 if (plugin.getName().equals(p.head)) {
 213                     pluginsToCall.remove(p);
 214                     try {
 215                         plugin.init(this, p.tail.toArray(new String[p.tail.size()]));
 216                     } catch (RuntimeException ex) {
 217                         throw new PropagatedException(ex);
 218                     }
 219                     break;
 220                 }
 221             }
 222         }
 223         for (List<String> p: pluginsToCall) {
 224             Log.instance(context).error(Errors.PluginNotFound(p.head));
 225         }
 226     }
 227 
 228     public void initDocLint(List<String> docLintOpts) {
 229         if (docLintOpts.isEmpty())
 230             return;
 231 
 232         new DocLint().init(this, docLintOpts.toArray(new String[docLintOpts.size()]));
 233         JavaCompiler.instance(context).keepComments = true;
 234     }
 235 }
< prev index next >