options.put(key, value);
options = Options.instance(context); if (classPath != null) { options.put(Option.CLASSPATH, classPath); for (String s : classPath.split(File.pathSeparator)) { if (s.contains(JSweetConfig.MAVEN_JAVA_OVERRIDE_ARTIFACT)) { context.strictMode = true; options.put(Option.BOOTCLASSPATH, s); options.put(Option.ENCODING, encoding); options.put(Option.XLINT, "path"); JavacFileManager.preRegister(context); fileManager = context.get(JavaFileManager.class);
/** * Creates a new compilation environment with the given options and * classpath. */ public static JavaCompilationEnvironment create(JSweetOptions jsweetOptions, String classPath) { JSweetContext context = new JSweetContext(jsweetOptions); Options options = Options.instance(context); options.put(Option.CLASSPATH, classPath); options.put(Option.XLINT, "path"); context.put(Log.outKey, new PrintWriter(System.out)); // options.put(Option.XLINT_CUSTOM.text + "-" + // LintCategory.OPTIONS.option, "true"); // options.remove(Option.XLINT_CUSTOM.text + // LintCategory.OPTIONS.option); options.put(Option.XLINT_CUSTOM.text + "-" + LintCategory.OVERRIDES.option, "true"); JavacFileManager.preRegister(context); JavaFileManager fileManager = context.get(JavaFileManager.class); Log log = Log.instance(context); log.emitWarnings = false; log.suppressNotes = true; Types javacTypes = Types.instance(context); JavaCompiler compiler = JavaCompiler.instance(context); compiler.attrParseOnly = true; compiler.verbose = false; compiler.genEndPos = true; compiler.keepComments = true; Names names = Names.instance(context); Symtab symtab = Symtab.instance(context); return new JavaCompilationEnvironment(fileManager, compiler, options, context, log, javacTypes, names, symtab); }
public boolean process(Options options, String option) { options.put("-Xlint:deprecation", option); return false; } },
public boolean process(Options options, String option) { options.put("-Xlint:unchecked", option); return false; } },
/** Process the option (with arg). Return true if error detected. */ public boolean process(Options options, String option, String arg) { if (options != null) options.put(option, arg); return false; }
public boolean process(Options options, String option) { options.put("-Xlint:none", option); return false; } },
public boolean process(Options options, String option) { options.put("-g:", "none"); return false; } },
public boolean process(Options options, String option) { String suboptions = option.substring(7); options.put("-Xlint:", suboptions); // enter all the -Xlint suboptions as "-Xlint:suboption" for (StringTokenizer t = new StringTokenizer(suboptions, ","); t.hasMoreTokens(); ) { String tok = t.nextToken(); String opt = "-Xlint:" + tok; options.put(opt, opt); } return false; } },
public boolean process(Options options, String option) { s = s.substring(name.optionName.length()); int eq = s.indexOf('='); String key = (eq < 0) ? s : s.substring(0, eq); String value = (eq < 0) ? s : s.substring(eq+1); options.put(key, value); return false; } },
public boolean process(Options options, String option) { if (option.equals("-proc:none")) { options.remove("-proc:only"); } else { options.remove("-proc:none"); } options.put(option, option); return false; } },
public boolean process(Options options, String option) { if (option.equals("-proc:none")) { options.remove("-proc:only"); } else { options.remove("-proc:none"); } options.put(option, option); return false; } },
private void setCompilerOpt(String opt, String arg) { if (compOpts.get(opt) != null) { usageError("main.option.already.seen", opt); } compOpts.put(opt, arg); } }
@Override public JCCompilationUnit process(Source in, Void irrelevant) throws ConversionProblem { Context context = new Context(); Options.instance(context).put(OptionName.ENCODING, charset.name()); JavaCompiler compiler = new JavaCompiler(context); compiler.genEndPos = true; compiler.keepComments = true; JCCompilationUnit cu = compiler.parse(new ContentBasedJavaFileObject(in.getName(), in.getRawInput())); return cu; } };
@Override public JCCompilationUnit process(Source in, Void irrelevant) throws ConversionProblem { Context context = new Context(); Options.instance(context).put(OptionName.ENCODING, charset.name()); JavaCompiler compiler = new JavaCompiler(context); compiler.genEndPos = true; compiler.keepComments = true; JCCompilationUnit cu = compiler.parse(new ContentBasedJavaFileObject(in.getName(), in.getRawInput())); return cu; } };