public MaskedFileManager() { this(new Context()); }
private RefasterRuleBuilderScanner(Context context) { this.context = new SubContext(context); if (context.get(PLACEHOLDER_METHODS_KEY) == null) { this.placeholderMethods = new HashMap<>(); context.put(PLACEHOLDER_METHODS_KEY, placeholderMethods); } else { this.placeholderMethods = context.get(PLACEHOLDER_METHODS_KEY); } this.beforeTemplates = new ArrayList<>(); this.afterTemplates = new ArrayList<>(); }
Context next = new Context(); next.put(Options.optionsKey, options); PrintWriter out = context.get(Log.outKey); assert out != null; next.put(Log.outKey, out); next.put(Name.Table.namesKey, names); DiagnosticListener dl = context.get(DiagnosticListener.class); if (dl != null) next.put(DiagnosticListener.class, dl); TaskListener tl = context.get(TaskListener.class); if (tl != null) next.put(TaskListener.class, tl); JavaFileManager jfm = context.get(JavaFileManager.class); assert jfm != null; next.put(JavaFileManager.class, jfm); if (jfm instanceof JavacFileManager) { ((JavacFileManager)jfm).setContext(next); next.put(Name.Table.namesKey, names); next.put(Keywords.keywordsKey, keywords); JavacTaskImpl task = context.get(JavacTaskImpl.class);
static JavahFileManager create(final DiagnosticListener<? super JavaFileObject> dl, PrintWriter log) { Context javac_context = new Context(); if (dl != null) javac_context.put(DiagnosticListener.class, dl); javac_context.put(com.sun.tools.javac.util.Log.outKey, log); return new JavahFileManager(javac_context, null); } }
/** * An alternative to {@link JavacFileManager#preRegister(Context)} that installs a {@link * MaskedClassLoader}. */ public static void preRegisterFileManager(Context context) { context.put( JavaFileManager.class, new Context.Factory<JavaFileManager>() { @Override public JavaFileManager make(Context c) { return new MaskedFileManager(c); } }); }
ManifoldJavaFileManager( IManifoldHost host, JavaFileManager fileManager, Context ctx, boolean fromJavaC ) { super( fileManager, ctx == null ? ctx = new Context() : ctx ); _host = host; _ctx = ctx; _fromJavaC = fromJavaC; _classFiles = new FqnCache<>(); _generatedFiles = new FqnCache<>(); if( ctx.get(JavaFileManager.class) == null ) { ctx.put( JavaFileManager.class, fileManager ); } _host.addTypeSystemListenerAsWeakRef( null, this ); }
BasicJavacTask javacTask = (BasicJavacTask) state.context.get(JavacTask.class); if (javacTask == null) { throw new IllegalArgumentException("No JavacTask in context."); Context context = new Context(); Options options = Options.instance(context); Options originalOptions = Options.instance(javacTask.getContext()); .getTask( CharStreams.nullWriter(), state.context.get(JavaFileManager.class), diagnosticListener, ImmutableList.of(),
private <T> Key<T> key(Class<T> clss) { checkState(kt); Key<T> k = uncheckedCast(kt.get(clss)); if (k == null) { k = new Key<T>(); kt.put(clss, k); } return k; }
/** Set the factory for the key in this context. */ public <T> void put(Key<T> key, Factory<T> fac) { checkState(ht); Object old = ht.put(key, fac); if (old != null) throw new AssertionError("duplicate context value"); checkState(ft); ft.put(key, fac); // cannot be duplicate if unique in ht }
Context next = new Context(); next.put(Options.optionsKey, options); PrintWriter out = context.get(Log.outKey); assert out != null; next.put(Log.outKey, out); next.put(Name.Table.namesKey, names); DiagnosticListener dl = context.get(DiagnosticListener.class); if (dl != null) next.put(DiagnosticListener.class, dl); TaskListener tl = context.get(TaskListener.class); if (tl != null) next.put(TaskListener.class, tl); JavaFileManager jfm = context.get(JavaFileManager.class); assert jfm != null; next.put(JavaFileManager.class, jfm); if (jfm instanceof JavacFileManager) { ((JavacFileManager)jfm).setContext(next); next.put(Name.Table.namesKey, names); next.put(Keywords.keywordsKey, keywords); JavacTaskImpl task = context.get(JavacTaskImpl.class);
public static JavapFileManager create(final DiagnosticListener<? super JavaFileObject> dl, PrintWriter log) { Context javac_context = new Context(); if (dl != null) javac_context.put(DiagnosticListener.class, dl); javac_context.put(com.sun.tools.javac.util.Log.outKey, log); return new JavapFileManager(javac_context, null); } }
public static void bind(Context context, ImportPolicy policy) { context.put(ImportPolicy.class, checkNotNull(policy)); }
private <T> Key<T> key(Class<T> clss) { checkState(kt); Key<T> k = uncheckedCast(kt.get(clss)); if (k == null) { k = new Key<T>(); kt.put(clss, k); } return k; }
/** Set the factory for the key in this context. */ public <T> void put(Key<T> key, Factory<T> fac) { checkState(ht); Object old = ht.put(key, fac); if (old != null) throw new AssertionError("duplicate context value"); checkState(ft); ft.put(key, fac); // cannot be duplicate if unique in ht }