com.sun.tools.javac.tree.TreeMaker Java Examples

The following examples show how to use com.sun.tools.javac.tree.TreeMaker. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExtensionTransformer.java    From manifold with Apache License 2.0 6 votes vote down vote up
private JCExpression classForNameCall( Type type, JCTree tree )
{
  TreeMaker make = _tp.getTreeMaker();
  JavacElements javacElems = _tp.getElementUtil();

  JCTree.JCMethodInvocation typeCall = make.Apply( List.nil(),
    memberAccess( make, javacElems, ReflectUtil.class.getName() + ".type" ),
    List.of( make.Literal( makeLiteralName( type ) ) ) );
  typeCall.setPos( Position.NOPOS );
  typeCall.type = _tp.getSymtab().classType;
  JCTree.JCFieldAccess newMethodSelect = (JCTree.JCFieldAccess)typeCall.getMethodSelect();

  Symbol.ClassSymbol reflectMethodClassSym =
    IDynamicJdk.instance().getTypeElement( _tp.getContext(), _tp.getCompilationUnit(), ReflectUtil.class.getName() );
  Symbol.MethodSymbol typeMethodSymbol = resolveMethod( tree.pos(),
    Names.instance( _tp.getContext() ).fromString( "type" ),
    reflectMethodClassSym.type, List.of( _tp.getSymtab().stringType ) );
  newMethodSelect.sym = typeMethodSymbol;
  newMethodSelect.type = typeMethodSymbol.type;
  newMethodSelect.pos = tree.pos;
  assignTypes( newMethodSelect.selected, reflectMethodClassSym );

  return typeCall;
}
 
Example #2
Source File: LambdaToMethod.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private LambdaToMethod(Context context) {
    context.put(unlambdaKey, this);
    diags = JCDiagnostic.Factory.instance(context);
    log = Log.instance(context);
    lower = Lower.instance(context);
    names = Names.instance(context);
    syms = Symtab.instance(context);
    rs = Resolve.instance(context);
    make = TreeMaker.instance(context);
    types = Types.instance(context);
    transTypes = TransTypes.instance(context);
    analyzer = new LambdaAnalyzerPreprocessor();
    Options options = Options.instance(context);
    dumpLambdaToMethodStats = options.isSet("dumpLambdaToMethodStats");
    attr = Attr.instance(context);
}
 
Example #3
Source File: MakeLiteralTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
void run() throws Exception {
    Context context = new Context();
    JavacFileManager.preRegister(context);
    Symtab syms = Symtab.instance(context);
    maker = TreeMaker.instance(context);
    types = Types.instance(context);

    test("abc",                     CLASS,      syms.stringType,    "abc");
    test(Boolean.FALSE,             BOOLEAN,    syms.booleanType,   Integer.valueOf(0));
    test(Boolean.TRUE,              BOOLEAN,    syms.booleanType,   Integer.valueOf(1));
    test(Byte.valueOf((byte) 1),    BYTE,       syms.byteType,      Byte.valueOf((byte) 1));
    test(Character.valueOf('a'),    CHAR,       syms.charType,      Integer.valueOf('a'));
    test(Double.valueOf(1d),        DOUBLE,     syms.doubleType,    Double.valueOf(1d));
    test(Float.valueOf(1f),         FLOAT,      syms.floatType,     Float.valueOf(1f));
    test(Integer.valueOf(1),        INT,        syms.intType,       Integer.valueOf(1));
    test(Long.valueOf(1),           LONG,       syms.longType,      Long.valueOf(1));
    test(Short.valueOf((short) 1),  SHORT,      syms.shortType,     Short.valueOf((short) 1));

    if (errors > 0)
        throw new Exception(errors + " errors found");
}
 
Example #4
Source File: Enter.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
protected Enter(Context context) {
    context.put(enterKey, this);

    log = Log.instance(context);
    reader = ClassReader.instance(context);
    make = TreeMaker.instance(context);
    syms = Symtab.instance(context);
    chk = Check.instance(context);
    memberEnter = MemberEnter.instance(context);
    types = Types.instance(context);
    annotate = Annotate.instance(context);
    lint = Lint.instance(context);
    names = Names.instance(context);

    predefClassDef = make.ClassDef(
        make.Modifiers(PUBLIC),
        syms.predefClass.name, null, null, null, null);
    predefClassDef.sym = syms.predefClass;
    todo = Todo.instance(context);
    fileManager = context.get(JavaFileManager.class);

    Options options = Options.instance(context);
    pkginfoOpt = PkgInfo.get(options);
}
 
Example #5
Source File: MakeLiteralTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
void run() throws Exception {
    Context context = new Context();
    JavacFileManager.preRegister(context);
    Symtab syms = Symtab.instance(context);
    maker = TreeMaker.instance(context);
    types = Types.instance(context);

    test("abc",                     CLASS,      syms.stringType,    "abc");
    test(Boolean.FALSE,             BOOLEAN,    syms.booleanType,   Integer.valueOf(0));
    test(Boolean.TRUE,              BOOLEAN,    syms.booleanType,   Integer.valueOf(1));
    test(Byte.valueOf((byte) 1),    BYTE,       syms.byteType,      Byte.valueOf((byte) 1));
    test(Character.valueOf('a'),    CHAR,       syms.charType,      Integer.valueOf('a'));
    test(Double.valueOf(1d),        DOUBLE,     syms.doubleType,    Double.valueOf(1d));
    test(Float.valueOf(1f),         FLOAT,      syms.floatType,     Float.valueOf(1f));
    test(Integer.valueOf(1),        INT,        syms.intType,       Integer.valueOf(1));
    test(Long.valueOf(1),           LONG,       syms.longType,      Long.valueOf(1));
    test(Short.valueOf((short) 1),  SHORT,      syms.shortType,     Short.valueOf((short) 1));

    if (errors > 0)
        throw new Exception(errors + " errors found");
}
 
Example #6
Source File: MakeLiteralTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
void run() throws Exception {
    Context context = new Context();
    JavacFileManager.preRegister(context);
    Symtab syms = Symtab.instance(context);
    maker = TreeMaker.instance(context);
    types = Types.instance(context);

    test("abc",                     CLASS,      syms.stringType,    "abc");
    test(Boolean.FALSE,             BOOLEAN,    syms.booleanType,   Integer.valueOf(0));
    test(Boolean.TRUE,              BOOLEAN,    syms.booleanType,   Integer.valueOf(1));
    test(Byte.valueOf((byte) 1),    BYTE,       syms.byteType,      Byte.valueOf((byte) 1));
    test(Character.valueOf('a'),    CHAR,       syms.charType,      Integer.valueOf('a'));
    test(Double.valueOf(1d),        DOUBLE,     syms.doubleType,    Double.valueOf(1d));
    test(Float.valueOf(1f),         FLOAT,      syms.floatType,     Float.valueOf(1f));
    test(Integer.valueOf(1),        INT,        syms.intType,       Integer.valueOf(1));
    test(Long.valueOf(1),           LONG,       syms.longType,      Long.valueOf(1));
    test(Short.valueOf((short) 1),  SHORT,      syms.shortType,     Short.valueOf((short) 1));

    if (errors > 0)
        throw new Exception(errors + " errors found");
}
 
Example #7
Source File: Analyzer.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
protected Analyzer(Context context) {
    context.put(analyzerKey, this);
    types = Types.instance(context);
    log = Log.instance(context);
    attr = Attr.instance(context);
    deferredAttr = DeferredAttr.instance(context);
    argumentAttr = ArgumentAttr.instance(context);
    make = TreeMaker.instance(context);
    copier = new AnalyzerCopier();
    Options options = Options.instance(context);
    String findOpt = options.get("find");
    //parse modes
    Source source = Source.instance(context);
    allowDiamondWithAnonymousClassCreation = source.allowDiamondWithAnonymousClassCreation();
    analyzerModes = AnalyzerMode.getAnalyzerModes(findOpt, source);
}
 
Example #8
Source File: LambdaToMethod.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private LambdaToMethod(Context context) {
    context.put(unlambdaKey, this);
    diags = JCDiagnostic.Factory.instance(context);
    log = Log.instance(context);
    lower = Lower.instance(context);
    names = Names.instance(context);
    syms = Symtab.instance(context);
    rs = Resolve.instance(context);
    operators = Operators.instance(context);
    make = TreeMaker.instance(context);
    types = Types.instance(context);
    transTypes = TransTypes.instance(context);
    analyzer = new LambdaAnalyzerPreprocessor();
    Options options = Options.instance(context);
    dumpLambdaToMethodStats = options.isSet("debug.dumpLambdaToMethodStats");
    attr = Attr.instance(context);
    forceSerializable = options.isSet("forceSerializable");
}
 
Example #9
Source File: ExtensionTransformer.java    From manifold with Apache License 2.0 6 votes vote down vote up
private JCExpression replaceStringLiteral( Symbol.ClassSymbol fragSym, JCTree tree, String methodName, String type )
{
  TreeMaker make = _tp.getTreeMaker();
  Names names = Names.instance( _tp.getContext() );

  Symbol.MethodSymbol fragmentValueMethod = resolveMethod( tree.pos(), names.fromString( methodName ),
    fragSym.type, List.nil() );

  JCTree.JCMethodInvocation fragmentValueCall = make.Apply( List.nil(),
    memberAccess( make, _tp.getElementUtil(), fragSym.getQualifiedName() + "." + methodName ), List.nil() );
  fragmentValueCall.type = fragmentValueMethod.getReturnType(); // type
  fragmentValueCall.setPos( tree.pos );
  JCTree.JCFieldAccess newMethodSelect = (JCTree.JCFieldAccess)fragmentValueCall.getMethodSelect();
  newMethodSelect.sym = fragmentValueMethod;
  newMethodSelect.type = fragmentValueMethod.type;
  assignTypes( newMethodSelect.selected, fragSym );

  return fragmentValueCall;
}
 
Example #10
Source File: TwrAvoidNullCheck.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public List<JCTree> translateTopLevelClass(Env<AttrContext> env, JCTree cdef, TreeMaker make) {
    List<JCTree> result = super.translateTopLevelClass(env, cdef, make);

    new TreeScanner() {
        @Override
        public void visitBinary(JCBinary tree) {
            hasNullCheck |= tree.operator.getSimpleName().contentEquals("!=") &&
                            "resource".equals(String.valueOf(TreeInfo.name(tree.lhs))) &&
                            TreeInfo.isNull(tree.rhs);
            super.visitBinary(tree);
        }
    }.scan(result);

    return result;
}
 
Example #11
Source File: LambdaToMethod.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private LambdaToMethod(Context context) {
    context.put(unlambdaKey, this);
    diags = JCDiagnostic.Factory.instance(context);
    log = Log.instance(context);
    lower = Lower.instance(context);
    names = Names.instance(context);
    syms = Symtab.instance(context);
    rs = Resolve.instance(context);
    make = TreeMaker.instance(context);
    types = Types.instance(context);
    transTypes = TransTypes.instance(context);
    analyzer = new LambdaAnalyzerPreprocessor();
    Options options = Options.instance(context);
    dumpLambdaToMethodStats = options.isSet("dumpLambdaToMethodStats");
    attr = Attr.instance(context);
    forceSerializable = options.isSet("forceSerializable");
}
 
Example #12
Source File: Annotate.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected Annotate(Context context) {
    context.put(annotateKey, this);

    attr = Attr.instance(context);
    chk = Check.instance(context);
    cfolder = ConstFold.instance(context);
    deferredLintHandler = DeferredLintHandler.instance(context);
    enter = Enter.instance(context);
    log = Log.instance(context);
    lint = Lint.instance(context);
    make = TreeMaker.instance(context);
    names = Names.instance(context);
    resolve = Resolve.instance(context);
    syms = Symtab.instance(context);
    typeEnvs = TypeEnvs.instance(context);
    types = Types.instance(context);

    theUnfinishedDefaultValue =  new Attribute.Error(syms.errType);

    Source source = Source.instance(context);
    allowRepeatedAnnos = source.allowRepeatedAnnotations();
    sourceName = source.name;

    blockCount = 1;
}
 
Example #13
Source File: MakeLiteralTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
void run() throws Exception {
    Context context = new Context();
    JavacFileManager.preRegister(context);
    Symtab syms = Symtab.instance(context);
    maker = TreeMaker.instance(context);
    types = Types.instance(context);

    test("abc",                     CLASS,      syms.stringType,    "abc");
    test(Boolean.FALSE,             BOOLEAN,    syms.booleanType,   Integer.valueOf(0));
    test(Boolean.TRUE,              BOOLEAN,    syms.booleanType,   Integer.valueOf(1));
    test(Byte.valueOf((byte) 1),    BYTE,       syms.byteType,      Byte.valueOf((byte) 1));
    test(Character.valueOf('a'),    CHAR,       syms.charType,      Integer.valueOf('a'));
    test(Double.valueOf(1d),        DOUBLE,     syms.doubleType,    Double.valueOf(1d));
    test(Float.valueOf(1f),         FLOAT,      syms.floatType,     Float.valueOf(1f));
    test(Integer.valueOf(1),        INT,        syms.intType,       Integer.valueOf(1));
    test(Long.valueOf(1),           LONG,       syms.longType,      Long.valueOf(1));
    test(Short.valueOf((short) 1),  SHORT,      syms.shortType,     Short.valueOf((short) 1));

    if (errors > 0)
        throw new Exception(errors + " errors found");
}
 
Example #14
Source File: JavacTrees.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void init(Context context) {
    modules = Modules.instance(context);
    attr = Attr.instance(context);
    enter = Enter.instance(context);
    elements = JavacElements.instance(context);
    log = Log.instance(context);
    resolve = Resolve.instance(context);
    treeMaker = TreeMaker.instance(context);
    memberEnter = MemberEnter.instance(context);
    names = Names.instance(context);
    types = Types.instance(context);
    docTreeMaker = DocTreeMaker.instance(context);
    parser = ParserFactory.instance(context);
    syms = Symtab.instance(context);
    fileManager = context.get(JavaFileManager.class);
    JavacTask t = context.get(JavacTask.class);
    if (t instanceof JavacTaskImpl)
        javacTaskImpl = (JavacTaskImpl) t;
}
 
Example #15
Source File: ExtensionTransformer.java    From manifold with Apache License 2.0 6 votes vote down vote up
/** Unbox an object to a primitive value. */
private JCExpression unbox( Types types, TreeMaker make, Names names, JCExpression tree, Type primitive ) {
  Type unboxedType = types.unboxedType(tree.type);
  if (unboxedType.hasTag(NONE)) {
    unboxedType = primitive;
    if (!unboxedType.isPrimitive())
      throw new AssertionError(unboxedType);
    make.at(tree.pos());
    tree = make.TypeCast(types.boxedClass(unboxedType).type, tree);
  } else {
    // There must be a conversion from unboxedType to primitive.
    if (!types.isSubtype(unboxedType, primitive))
      throw new AssertionError(tree);
  }
  make.at(tree.pos());
  Symbol valueSym = resolveMethod(tree.pos(),
    unboxedType.tsym.name.append(names.Value), // x.intValue()
    tree.type,
    List.<Type>nil());
  return make.App(make.Select(tree, valueSym));
}
 
Example #16
Source File: LambdaToMethod.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private LambdaToMethod(Context context) {
    context.put(unlambdaKey, this);
    diags = JCDiagnostic.Factory.instance(context);
    log = Log.instance(context);
    lower = Lower.instance(context);
    names = Names.instance(context);
    syms = Symtab.instance(context);
    rs = Resolve.instance(context);
    make = TreeMaker.instance(context);
    types = Types.instance(context);
    transTypes = TransTypes.instance(context);
    analyzer = new LambdaAnalyzerPreprocessor();
    Options options = Options.instance(context);
    dumpLambdaToMethodStats = options.isSet("dumpLambdaToMethodStats");
    attr = Attr.instance(context);
    forceSerializable = options.isSet("forceSerializable");
}
 
Example #17
Source File: SampleJavacPlugin.java    From tutorials with MIT License 6 votes vote down vote up
private static JCTree.JCBlock createIfBlock(TreeMaker factory, Names symbolsTable, VariableTree parameter) {
    String parameterName = parameter.getName().toString();
    Name parameterId = symbolsTable.fromString(parameterName);
    
    String errorMessagePrefix = String.format("Argument '%s' of type %s is marked by @%s but got '", 
      parameterName, parameter.getType(), Positive.class.getSimpleName());
    String errorMessageSuffix = "' for it";
    
    return factory.Block(0, com.sun.tools.javac.util.List.of(
      factory.Throw(
        factory.NewClass(null, nil(), 
          factory.Ident(symbolsTable.fromString(IllegalArgumentException.class.getSimpleName())),
            com.sun.tools.javac.util.List.of(factory.Binary(JCTree.Tag.PLUS, 
              factory.Binary(JCTree.Tag.PLUS, factory.Literal(TypeTag.CLASS, errorMessagePrefix), 
                factory.Ident(parameterId)), 
                factory.Literal(TypeTag.CLASS, errorMessageSuffix))), null))));
}
 
Example #18
Source File: LambdaToMethod.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private LambdaToMethod(Context context) {
    context.put(unlambdaKey, this);
    diags = JCDiagnostic.Factory.instance(context);
    log = Log.instance(context);
    lower = Lower.instance(context);
    names = Names.instance(context);
    syms = Symtab.instance(context);
    rs = Resolve.instance(context);
    make = TreeMaker.instance(context);
    types = Types.instance(context);
    transTypes = TransTypes.instance(context);
    analyzer = new LambdaAnalyzerPreprocessor();
    Options options = Options.instance(context);
    dumpLambdaToMethodStats = options.isSet("dumpLambdaToMethodStats");
    attr = Attr.instance(context);
}
 
Example #19
Source File: MakeLiteralTest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
void run() throws Exception {
    Context context = new Context();
    JavacFileManager.preRegister(context);
    Symtab syms = Symtab.instance(context);
    maker = TreeMaker.instance(context);
    types = Types.instance(context);

    test("abc",                     CLASS,      syms.stringType,    "abc");
    test(Boolean.FALSE,             BOOLEAN,    syms.booleanType,   Integer.valueOf(0));
    test(Boolean.TRUE,              BOOLEAN,    syms.booleanType,   Integer.valueOf(1));
    test(Byte.valueOf((byte) 1),    BYTE,       syms.byteType,      Byte.valueOf((byte) 1));
    test(Character.valueOf('a'),    CHAR,       syms.charType,      Integer.valueOf('a'));
    test(Double.valueOf(1d),        DOUBLE,     syms.doubleType,    Double.valueOf(1d));
    test(Float.valueOf(1f),         FLOAT,      syms.floatType,     Float.valueOf(1f));
    test(Integer.valueOf(1),        INT,        syms.intType,       Integer.valueOf(1));
    test(Long.valueOf(1),           LONG,       syms.longType,      Long.valueOf(1));
    test(Short.valueOf((short) 1),  SHORT,      syms.shortType,     Short.valueOf((short) 1));

    if (errors > 0)
        throw new Exception(errors + " errors found");
}
 
Example #20
Source File: LambdaToMethod.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public JCTree translateTopLevelClass(Env<AttrContext> env, JCTree cdef, TreeMaker make) {
    this.make = make;
    this.attrEnv = env;
    this.context = null;
    this.contextMap = new HashMap<JCTree, TranslationContext<?>>();
    return translate(cdef);
}
 
Example #21
Source File: GenStubs.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
ImportCleaner(JavaFileManager fm) {
    // ImportCleaner itself doesn't require a filemanager, but instantiating
    // a TreeMaker does, indirectly (via ClassReader, sigh)
    Context c = new Context();
    c.put(JavaFileManager.class, fm);
    m = TreeMaker.instance(c);
}
 
Example #22
Source File: MakeQualIdent.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String... args) throws Exception {
    JavacTool tool = JavacTool.create();
    JavacTask task = tool.getTask(null, null, null, new ArrayList<String>(), null, null);
    Context ctx = ((JavacTaskImpl)task).getContext();
    TreeMaker treeMaker = TreeMaker.instance(ctx);
    Symtab syms = Symtab.instance(ctx);

    String stringTree = printTree(treeMaker.QualIdent(syms.stringType.tsym));

    if (!"java.lang.String".equals(stringTree)) {
        throw new IllegalStateException(stringTree);
    }
}
 
Example #23
Source File: NBTreeMaker.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static void preRegister(Context context) {
    context.put(treeMakerKey, new Context.Factory<TreeMaker>() {
        public TreeMaker make(Context c) {
            return new NBTreeMaker(c);
        }
    });
}
 
Example #24
Source File: StringConcat.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected StringConcat(Context context) {
    context.put(concatKey, this);
    gen = Gen.instance(context);
    syms = Symtab.instance(context);
    types = Types.instance(context);
    names = Names.instance(context);
    make = TreeMaker.instance(context);
    rs = Resolve.instance(context);
    sbAppends = new HashMap<>();
}
 
Example #25
Source File: T8024415.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public T8024415() {
    Context ctx = new Context();
    JavacFileManager.preRegister(ctx);
    maker = TreeMaker.instance(ctx);
    Names names = Names.instance(ctx);
    x = maker.Ident(names.fromString("x"));
}
 
Example #26
Source File: TransTypes.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** Translate a toplevel class definition.
 *  @param cdef    The definition to be translated.
 */
public JCTree translateTopLevelClass(JCTree cdef, TreeMaker make) {
    // note that this method does NOT support recursion.
    this.make = make;
    pt = null;
    return translate(cdef, null);
}
 
Example #27
Source File: PackageGenerator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public PackageGenerator() {
    JavacTool jt = JavacTool.create();
    JavacTask task = jt.getTask(null, null, null, null, null, null);
    Context ctx = ((JavacTaskImpl)task).getContext();

    make = TreeMaker.instance(ctx);
    names = Names.instance(ctx);
    syms = Symtab.instance(ctx);
    factory = DocumentBuilderFactory.newInstance();

    documentifier = Documentifier.instance(ctx);
}
 
Example #28
Source File: Inliner.java    From Refaster with Apache License 2.0 5 votes vote down vote up
@Override
public JCExpression visitWildcardType(WildcardType type, Inliner inliner) {
  TreeMaker maker = inliner.maker();
  return maker.Wildcard(
      maker.TypeBoundKind(type.kind),
      visit(type.baseType(), inliner));
}
 
Example #29
Source File: ParserFactory.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected ParserFactory(Context context) {
    super();
    context.put(parserFactoryKey, this);
    this.F = TreeMaker.instance(context);
    this.docTreeMaker = DocTreeMaker.instance(context);
    this.log = Log.instance(context);
    this.names = Names.instance(context);
    this.tokens = Tokens.instance(context);
    this.source = Source.instance(context);
    this.options = Options.instance(context);
    this.scannerFactory = ScannerFactory.instance(context);
    this.locale = context.get(Locale.class);
}
 
Example #30
Source File: GenStubs.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
ImportCleaner(JavaFileManager fm) {
    // ImportCleaner itself doesn't require a filemanager, but instantiating
    // a TreeMaker does, indirectly (via ClassReader, sigh)
    Context c = new Context();
    c.put(JavaFileManager.class, fm);
    m = TreeMaker.instance(c);
}