/** Construct a new compiler from a shared context. */ public AptJavaCompiler(Context context) { super(preRegister(context)); context.put(compilerKey, this); apt = Apt.instance(context); ClassReader classReader = ClassReader.instance(context); classReader.preferSource = true; // TEMPORARY NOTE: bark==log, but while refactoring, we maintain their // original identities, to remember the original intent. log = Log.instance(context); bark = Bark.instance(context); Options options = Options.instance(context); classOutput = options.get("-retrofit") == null; nocompile = options.get("-nocompile") != null; print = options.get("-print") != null; classesAsDecls = options.get("-XclassesAsDecls") != null; genSourceFileNames = new java.util.LinkedHashSet<String>(); genClassFileNames = new java.util.LinkedHashSet<String>(); // this forces a copy of the line map to be kept in the tree, // for use by com.sun.mirror.util.SourcePosition. lineDebugInfo = true; }
@SuppressWarnings("fallthrough") public SimpleConfiguration(Options options, Set<DiagnosticPart> parts) { this(parts); String showSource = null; if ((showSource = options.get("showSource")) != null) { if (showSource.equals("true")) setVisiblePart(DiagnosticPart.SOURCE, true); else if (showSource.equals("false")) setVisiblePart(DiagnosticPart.SOURCE, false); } String diagOpts = options.get("diags"); if (diagOpts != null) { // override -XDshowSource Collection<String> args = Arrays.asList(diagOpts.split(",")); if (args.contains("short")) { setVisiblePart(DiagnosticPart.DETAILS, false); setVisiblePart(DiagnosticPart.SUBDIAGNOSTICS, false); } if (args.contains("source")) setVisiblePart(DiagnosticPart.SOURCE, true); if (args.contains("-source")) setVisiblePart(DiagnosticPart.SOURCE, false); } String multiPolicy = null; if ((multiPolicy = options.get("multilinePolicy")) != null) { if (multiPolicy.equals("disabled")) setVisiblePart(DiagnosticPart.SUBDIAGNOSTICS, false); else if (multiPolicy.startsWith("limit:")) { String limitString = multiPolicy.substring("limit:".length()); String[] limits = limitString.split(":"); try { switch (limits.length) { case 2: { if (!limits[1].equals("*")) setMultilineLimit(MultilineLimit.DEPTH, Integer.parseInt(limits[1])); } case 1: { if (!limits[0].equals("*")) setMultilineLimit(MultilineLimit.LENGTH, Integer.parseInt(limits[0])); } } } catch (NumberFormatException ex) { setMultilineLimit(MultilineLimit.DEPTH, -1); setMultilineLimit(MultilineLimit.LENGTH, -1); } } } String showCaret = null; if (((showCaret = options.get("showCaret")) != null) && showCaret.equals("false")) setCaretEnabled(false); else setCaretEnabled(true); }