@SuppressWarnings("fallthrough") public RichConfiguration(Options options, AbstractDiagnosticFormatter formatter) { super(formatter.getConfiguration()); features = formatter.isRaw() ? EnumSet.noneOf(RichFormatterFeature.class) : EnumSet.of( RichFormatterFeature.SIMPLE_NAMES, RichFormatterFeature.WHERE_CLAUSES, RichFormatterFeature.UNIQUE_TYPEVAR_NAMES); String diagOpts = options.get("diags"); if (diagOpts != null) { for (String args : diagOpts.split(",")) { if (args.equals("-where")) { features.remove(RichFormatterFeature.WHERE_CLAUSES); } else if (args.equals("where")) { features.add(RichFormatterFeature.WHERE_CLAUSES); } if (args.equals("-simpleNames")) { features.remove(RichFormatterFeature.SIMPLE_NAMES); } else if (args.equals("simpleNames")) { features.add(RichFormatterFeature.SIMPLE_NAMES); } if (args.equals("-disambiguateTvars")) { features.remove(RichFormatterFeature.UNIQUE_TYPEVAR_NAMES); } else if (args.equals("disambiguateTvars")) { features.add(RichFormatterFeature.UNIQUE_TYPEVAR_NAMES); } } } }
protected RichDiagnosticFormatter(Context context) { super((AbstractDiagnosticFormatter) Log.instance(context).getDiagnosticFormatter()); setRichPrinter(new RichPrinter()); this.syms = Symtab.instance(context); this.diags = JCDiagnostic.Factory.instance(context); this.types = Types.instance(context); this.messages = JavacMessages.instance(context); whereClauses = new LinkedHashMap<WhereClauseKind, Map<Type, JCDiagnostic>>(); configuration = new RichConfiguration(Options.instance(context), formatter); for (WhereClauseKind kind : WhereClauseKind.values()) whereClauses.put(kind, new LinkedHashMap<Type, JCDiagnostic>()); }
/** 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; }