com.sun.tools.javac.comp.Enter Java Examples

The following examples show how to use com.sun.tools.javac.comp.Enter. 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: Template.java    From Refaster with Apache License 2.0 6 votes vote down vote up
/**
 * Returns the inferred method type of the template based on the given actual argument types.
 *
 * @throws NoInstanceException if no instances of the specified type variables would allow the
 *         {@code actualArgTypes} to match the {@code expectedArgTypes}
 */
private Type infer(Warner warner,
    Inliner inliner,
    List<Type> freeTypeVariables,
    List<Type> expectedArgTypes,
    Type returnType,
    List<Type> actualArgTypes) throws NoInstanceException {
  Symtab symtab = inliner.symtab();
  MethodType methodType =
      new MethodType(expectedArgTypes, returnType, List.<Type>nil(), symtab.methodClass);
  Enter enter = inliner.enter();
  MethodSymbol methodSymbol =
      new MethodSymbol(0, inliner.asName("__m__"), methodType, symtab.unknownSymbol);
  return inliner.infer().instantiateMethod(enter.getEnv(methodType.tsym),
      freeTypeVariables,
      methodType,
      methodSymbol,
      actualArgTypes,
      autoboxing(),
      false,
      warner);
}
 
Example #2
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 #3
Source File: ReusableContext.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
void clear() {
    drop(Arguments.argsKey);
    drop(DiagnosticListener.class);
    drop(Log.outKey);
    drop(Log.errKey);
    drop(JavaFileManager.class);
    drop(JavacTask.class);

    if (ht.get(Log.logKey) instanceof ReusableLog) {
        //log already inited - not first round
        ((ReusableLog)Log.instance(this)).clear();
        Enter.instance(this).newRound();
        ((ReusableJavaCompiler)ReusableJavaCompiler.instance(this)).clear();
        Types.instance(this).newRound();
        Check.instance(this).newRound();
        Modules.instance(this).newRound();
        Annotate.instance(this).newRound();
        CompileStates.instance(this).clear();
        MultiTaskListener.instance(this).clear();

        //find if any of the roots have redefined java.* classes
        Symtab syms = Symtab.instance(this);
        pollutionScanner.scan(roots, syms);
        roots.clear();
    }
}
 
Example #4
Source File: Types.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
protected Types(Context context) {
    context.put(typesKey, this);
    syms = Symtab.instance(context);
    names = Names.instance(context);
    Source source = Source.instance(context);
    allowBoxing = source.allowBoxing();
    allowCovariantReturns = source.allowCovariantReturns();
    allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
    allowDefaultMethods = source.allowDefaultMethods();
    reader = ClassReader.instance(context);
    chk = Check.instance(context);
    enter = Enter.instance(context);
    capturedName = names.fromString("<captured wildcard>");
    messages = JavacMessages.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    functionDescriptorLookupError = new FunctionDescriptorLookupError();
    noWarnings = new Warner(null);
}
 
Example #5
Source File: Types.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
protected Types(Context context) {
    context.put(typesKey, this);
    syms = Symtab.instance(context);
    names = Names.instance(context);
    Source source = Source.instance(context);
    allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
    allowDefaultMethods = source.allowDefaultMethods();
    mapCapturesToBounds = source.mapCapturesToBounds();
    chk = Check.instance(context);
    enter = Enter.instance(context);
    capturedName = names.fromString("<captured wildcard>");
    messages = JavacMessages.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    functionDescriptorLookupError = new FunctionDescriptorLookupError();
    noWarnings = new Warner(null);
}
 
Example #6
Source File: Types.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
protected Types(Context context) {
    context.put(typesKey, this);
    syms = Symtab.instance(context);
    names = Names.instance(context);
    Source source = Source.instance(context);
    allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
    allowDefaultMethods = source.allowDefaultMethods();
    mapCapturesToBounds = source.mapCapturesToBounds();
    chk = Check.instance(context);
    enter = Enter.instance(context);
    capturedName = names.fromString("<captured wildcard>");
    messages = JavacMessages.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    functionDescriptorLookupError = new FunctionDescriptorLookupError();
    noWarnings = new Warner(null);
}
 
Example #7
Source File: Types.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
protected Types(Context context) {
    context.put(typesKey, this);
    syms = Symtab.instance(context);
    names = Names.instance(context);
    Source source = Source.instance(context);
    allowBoxing = source.allowBoxing();
    allowCovariantReturns = source.allowCovariantReturns();
    allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
    allowDefaultMethods = source.allowDefaultMethods();
    reader = ClassReader.instance(context);
    chk = Check.instance(context);
    enter = Enter.instance(context);
    capturedName = names.fromString("<captured wildcard>");
    messages = JavacMessages.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    functionDescriptorLookupError = new FunctionDescriptorLookupError();
    noWarnings = new Warner(null);
}
 
Example #8
Source File: JavacTrees.java    From openjdk-jdk9 with GNU General Public License v2.0 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 #9
Source File: Types.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
protected Types(Context context) {
    context.put(typesKey, this);
    syms = Symtab.instance(context);
    names = Names.instance(context);
    Source source = Source.instance(context);
    allowBoxing = source.allowBoxing();
    allowCovariantReturns = source.allowCovariantReturns();
    allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
    allowDefaultMethods = source.allowDefaultMethods();
    reader = ClassReader.instance(context);
    chk = Check.instance(context);
    enter = Enter.instance(context);
    capturedName = names.fromString("<captured wildcard>");
    messages = JavacMessages.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    functionDescriptorLookupError = new FunctionDescriptorLookupError();
    noWarnings = new Warner(null);
}
 
Example #10
Source File: Types.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
protected Types(Context context) {
    context.put(typesKey, this);
    syms = Symtab.instance(context);
    names = Names.instance(context);
    Source source = Source.instance(context);
    allowBoxing = source.allowBoxing();
    allowCovariantReturns = source.allowCovariantReturns();
    allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
    allowDefaultMethods = source.allowDefaultMethods();
    reader = ClassReader.instance(context);
    chk = Check.instance(context);
    enter = Enter.instance(context);
    capturedName = names.fromString("<captured wildcard>");
    messages = JavacMessages.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    functionDescriptorLookupError = new FunctionDescriptorLookupError();
    noWarnings = new Warner(null);
}
 
Example #11
Source File: Types.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
protected Types(Context context) {
    context.put(typesKey, this);
    syms = Symtab.instance(context);
    names = Names.instance(context);
    Source source = Source.instance(context);
    allowBoxing = source.allowBoxing();
    allowCovariantReturns = source.allowCovariantReturns();
    allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
    allowDefaultMethods = source.allowDefaultMethods();
    reader = ClassReader.instance(context);
    chk = Check.instance(context);
    enter = Enter.instance(context);
    capturedName = names.fromString("<captured wildcard>");
    messages = JavacMessages.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    functionDescriptorLookupError = new FunctionDescriptorLookupError();
    noWarnings = new Warner(null);
}
 
Example #12
Source File: Types.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
protected Types(Context context) {
    context.put(typesKey, this);
    syms = Symtab.instance(context);
    names = Names.instance(context);
    Source source = Source.instance(context);
    allowBoxing = source.allowBoxing();
    allowCovariantReturns = source.allowCovariantReturns();
    allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
    allowDefaultMethods = source.allowDefaultMethods();
    reader = ClassReader.instance(context);
    chk = Check.instance(context);
    enter = Enter.instance(context);
    capturedName = names.fromString("<captured wildcard>");
    messages = JavacMessages.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    functionDescriptorLookupError = new FunctionDescriptorLookupError();
    noWarnings = new Warner(null);
}
 
Example #13
Source File: Types.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
protected Types(Context context) {
    context.put(typesKey, this);
    syms = Symtab.instance(context);
    names = Names.instance(context);
    Source source = Source.instance(context);
    allowBoxing = source.allowBoxing();
    allowCovariantReturns = source.allowCovariantReturns();
    allowObjectToPrimitiveCast = source.allowObjectToPrimitiveCast();
    allowDefaultMethods = source.allowDefaultMethods();
    reader = ClassReader.instance(context);
    chk = Check.instance(context);
    enter = Enter.instance(context);
    capturedName = names.fromString("<captured wildcard>");
    messages = JavacMessages.instance(context);
    diags = JCDiagnostic.Factory.instance(context);
    functionDescriptorLookupError = new FunctionDescriptorLookupError();
    noWarnings = new Warner(null);
}
 
Example #14
Source File: JavacTrees.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private void init(Context 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);
    javacTaskImpl = context.get(JavacTaskImpl.class);
}
 
Example #15
Source File: JavacElements.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Use a new context.  May be called from outside to update
 * internal state for a new annotation-processing round.
 */
public void setContext(Context context) {
    context.put(JavacElements.class, this);
    javaCompiler = JavaCompiler.instance(context);
    syms = Symtab.instance(context);
    names = Names.instance(context);
    types = Types.instance(context);
    enter = Enter.instance(context);
}
 
Example #16
Source File: JavacElements.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Use a new context.  May be called from outside to update
 * internal state for a new annotation-processing round.
 */
public void setContext(Context context) {
    context.put(JavacElements.class, this);
    javaCompiler = JavaCompiler.instance(context);
    syms = Symtab.instance(context);
    names = Names.instance(context);
    types = Types.instance(context);
    enter = Enter.instance(context);
}
 
Example #17
Source File: JavadocEnter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void preRegister(Context context) {
    context.put(enterKey, new Context.Factory<Enter>() {
           public Enter make(Context c) {
               return new JavadocEnter(c);
           }
    });
}
 
Example #18
Source File: JavacElements.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected JavacElements(Context context) {
    context.put(JavacElements.class, this);
    javaCompiler = JavaCompiler.instance(context);
    syms = Symtab.instance(context);
    modules = Modules.instance(context);
    names = Names.instance(context);
    types = Types.instance(context);
    enter = Enter.instance(context);
    resolve = Resolve.instance(context);
    JavacTask t = context.get(JavacTask.class);
    javacTaskImpl = t instanceof JavacTaskImpl ? (JavacTaskImpl) t : null;
    log = Log.instance(context);
    Source source = Source.instance(context);
    allowModules = source.allowModules();
}
 
Example #19
Source File: JavacTrees.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void init(Context 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);

    JavacTask t = context.get(JavacTask.class);
    if (t instanceof JavacTaskImpl)
        javacTaskImpl = (JavacTaskImpl) t;
}
 
Example #20
Source File: JavacElements.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Use a new context.  May be called from outside to update
 * internal state for a new annotation-processing round.
 */
public void setContext(Context context) {
    context.put(JavacElements.class, this);
    javaCompiler = JavaCompiler.instance(context);
    syms = Symtab.instance(context);
    names = Names.instance(context);
    types = Types.instance(context);
    enter = Enter.instance(context);
}
 
Example #21
Source File: JavadocEnter.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void preRegister(Context context) {
    context.put(enterKey, new Context.Factory<Enter>() {
           public Enter make(Context c) {
               return new JavadocEnter(c);
           }
    });
}
 
Example #22
Source File: JavacTrees.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void init(Context 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);

    JavacTask t = context.get(JavacTask.class);
    if (t instanceof JavacTaskImpl)
        javacTaskImpl = (JavacTaskImpl) t;
}
 
Example #23
Source File: JavacElements.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Use a new context.  May be called from outside to update
 * internal state for a new annotation-processing round.
 */
public void setContext(Context context) {
    context.put(JavacElements.class, this);
    javaCompiler = JavaCompiler.instance(context);
    syms = Symtab.instance(context);
    names = Names.instance(context);
    types = Types.instance(context);
    enter = Enter.instance(context);
}
 
Example #24
Source File: JavadocEnter.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static void preRegister(Context context) {
    context.put(enterKey, new Context.Factory<Enter>() {
           public Enter make(Context c) {
               return new JavadocEnter(c);
           }
    });
}
 
Example #25
Source File: JavacTrees.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void init(Context 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);

    JavacTask t = context.get(JavacTask.class);
    if (t instanceof JavacTaskImpl)
        javacTaskImpl = (JavacTaskImpl) t;
}
 
Example #26
Source File: JavacElements.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Use a new context.  May be called from outside to update
 * internal state for a new annotation-processing round.
 */
public void setContext(Context context) {
    context.put(JavacElements.class, this);
    javaCompiler = JavaCompiler.instance(context);
    syms = Symtab.instance(context);
    names = Names.instance(context);
    types = Types.instance(context);
    enter = Enter.instance(context);
}
 
Example #27
Source File: JavaParser.java    From rewrite with Apache License 2.0 5 votes vote down vote up
/**
 * Enter symbol definitions into each compilation unit's scope
 */
private void enterAll(Collection<JCTree.JCCompilationUnit> cus) {
    var enter = Enter.instance(context);
    var compilationUnits = com.sun.tools.javac.util.List.from(
            cus.toArray(JCTree.JCCompilationUnit[]::new));
    enter.main(compilationUnits);
}
 
Example #28
Source File: JavadocEnter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void preRegister(Context context) {
    context.put(enterKey, new Context.Factory<Enter>() {
           public Enter make(Context c) {
               return new JavadocEnter(c);
           }
    });
}
 
Example #29
Source File: JavacTrees.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void init(Context 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);

    JavacTask t = context.get(JavacTask.class);
    if (t instanceof JavacTaskImpl)
        javacTaskImpl = (JavacTaskImpl) t;
}
 
Example #30
Source File: JavacElements.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Use a new context.  May be called from outside to update
 * internal state for a new annotation-processing round.
 */
public void setContext(Context context) {
    context.put(JavacElements.class, this);
    javaCompiler = JavaCompiler.instance(context);
    syms = Symtab.instance(context);
    names = Names.instance(context);
    types = Types.instance(context);
    enter = Enter.instance(context);
}