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

The following examples show how to use com.sun.tools.javac.comp.Check. 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: 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 #2
Source File: ManResolve.java    From manifold with Apache License 2.0 6 votes vote down vote up
private void reassignEarlyHolders( Context context )
{
  ReflectUtil.field( _attr, RESOLVE_FIELD ).set( this );
  ReflectUtil.field( DeferredAttr.instance( context ), RESOLVE_FIELD ).set( this );
  ReflectUtil.field( Check.instance( context ), RESOLVE_FIELD ).set( this );
  ReflectUtil.field( Infer.instance( context ), RESOLVE_FIELD ).set( this );
  ReflectUtil.field( Flow.instance( context ), RESOLVE_FIELD ).set( this );
  ReflectUtil.field( LambdaToMethod.instance( context ), RESOLVE_FIELD ).set( this );
  ReflectUtil.field( Lower.instance( context ), RESOLVE_FIELD ).set( this );
  ReflectUtil.field( Gen.instance( context ), RESOLVE_FIELD ).set( this );
  ReflectUtil.field(
    ReflectUtil.method(
      ReflectUtil.type( "com.sun.tools.javac.jvm.StringConcat" ), "instance", Context.class )
      .invokeStatic( context ), RESOLVE_FIELD )
    .set( this );
  ReflectUtil.field( JavacTrees.instance( context ), "resolve" ).set( this );
  ReflectUtil.field( Annotate.instance( context ), "resolve" ).set( this );
  ReflectUtil.field( TransTypes.instance( context ), "resolve" ).set( this );
  ReflectUtil.field( JavacElements.instance( context ), "resolve" ).set( this );
}
 
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: DocEnv.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor
 *
 * @param context      Context for this javadoc instance.
 */
protected DocEnv(Context context) {
    context.put(docEnvKey, this);
    this.context = context;

    messager = Messager.instance0(context);
    syms = Symtab.instance(context);
    finder = JavadocClassFinder.instance(context);
    enter = JavadocEnter.instance(context);
    names = Names.instance(context);
    externalizableSym = syms.enterClass(syms.java_base, names.fromString("java.io.Externalizable"));
    chk = Check.instance(context);
    types = Types.instance(context);
    fileManager = context.get(JavaFileManager.class);
    if (fileManager instanceof JavacFileManager) {
        ((JavacFileManager)fileManager).setSymbolFileEnabled(false);
    }

    // Default.  Should normally be reset with setLocale.
    this.doclocale = new DocLocale(this, "", breakiterator);
    source = Source.instance(context);
}
 
Example #5
Source File: ToolEnvironment.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor
 *
 * @param context      Context for this javadoc instance.
 */
protected ToolEnvironment(Context context) {
    context.put(ToolEnvKey, this);
    this.context = context;

    messager = Messager.instance0(context);
    syms = Symtab.instance(context);
    finder = JavadocClassFinder.instance(context);
    enter = JavadocEnter.instance(context);
    names = Names.instance(context);
    externalizableSym = syms.enterClass(syms.java_base, names.fromString("java.io.Externalizable"));
    chk = Check.instance(context);
    types = com.sun.tools.javac.code.Types.instance(context);
    fileManager = context.get(JavaFileManager.class);
    if (fileManager instanceof JavacFileManager) {
        ((JavacFileManager)fileManager).setSymbolFileEnabled(false);
    }
    docTrees = JavacTrees.instance(context);
    source = Source.instance(context);
    elements =  JavacElements.instance(context);
    typeutils = JavacTypes.instance(context);
    elementToTreePath = new HashMap<>();
}
 
Example #6
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 #7
Source File: ManTypes.java    From manifold with Apache License 2.0 6 votes vote down vote up
private void reassignEarlyHolders8( Context context )
{
  ReflectUtil.field( Annotate.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Attr.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Check.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( DeferredAttr.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Flow.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Gen.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Infer.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( JavaCompiler.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( JavacTrees.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( JavacTypes.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( JavacElements.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( LambdaToMethod.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Lower.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( ManResolve.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( MemberEnter.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( RichDiagnosticFormatter.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( TransTypes.instance( context ), TYPES_FIELD ).set( this );
}
 
Example #8
Source File: DocEnv.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor
 *
 * @param context      Context for this javadoc instance.
 */
protected DocEnv(Context context) {
    context.put(docEnvKey, this);
    this.context = context;

    messager = Messager.instance0(context);
    syms = Symtab.instance(context);
    reader = JavadocClassReader.instance0(context);
    enter = JavadocEnter.instance0(context);
    names = Names.instance(context);
    externalizableSym = reader.enterClass(names.fromString("java.io.Externalizable"));
    chk = Check.instance(context);
    types = Types.instance(context);
    fileManager = context.get(JavaFileManager.class);
    if (fileManager instanceof JavacFileManager) {
        ((JavacFileManager)fileManager).setSymbolFileEnabled(false);
    }

    // Default.  Should normally be reset with setLocale.
    this.doclocale = new DocLocale(this, "", breakiterator);
    source = Source.instance(context);
}
 
Example #9
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 #10
Source File: DocEnv.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor
 *
 * @param context      Context for this javadoc instance.
 */
protected DocEnv(Context context) {
    context.put(docEnvKey, this);
    this.context = context;

    messager = Messager.instance0(context);
    syms = Symtab.instance(context);
    reader = JavadocClassReader.instance0(context);
    enter = JavadocEnter.instance0(context);
    names = Names.instance(context);
    externalizableSym = reader.enterClass(names.fromString("java.io.Externalizable"));
    chk = Check.instance(context);
    types = Types.instance(context);
    fileManager = context.get(JavaFileManager.class);
    if (fileManager instanceof JavacFileManager) {
        ((JavacFileManager)fileManager).setSymbolFileEnabled(false);
    }

    // Default.  Should normally be reset with setLocale.
    this.doclocale = new DocLocale(this, "", breakiterator);
    source = Source.instance(context);
}
 
Example #11
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 #12
Source File: ElementUtils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public static TypeElement getTypeElementByBinaryName(JavacTask task, ModuleElement mod, String name) {
    Context ctx = ((JavacTaskImpl) task).getContext();
    Names names = Names.instance(ctx);
    Symtab syms = Symtab.instance(ctx);
    Check chk = Check.instance(ctx);
    final Name wrappedName = names.fromString(name);
    ClassSymbol clazz = chk.getCompiled((ModuleSymbol) mod, wrappedName);
    if (clazz != null) {
        return clazz;
    }
    clazz = syms.enterClass((ModuleSymbol) mod, wrappedName);
    
    try {
        clazz.complete();
        
        if (clazz.kind == Kind.TYP &&
            clazz.flatName() == wrappedName) {
            return clazz;
        }
    } catch (CompletionFailure cf) {
    }

    return null;
}
 
Example #13
Source File: DocEnv.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor
 *
 * @param context      Context for this javadoc instance.
 */
protected DocEnv(Context context) {
    context.put(docEnvKey, this);
    this.context = context;

    messager = Messager.instance0(context);
    syms = Symtab.instance(context);
    reader = JavadocClassReader.instance0(context);
    enter = JavadocEnter.instance0(context);
    names = Names.instance(context);
    externalizableSym = reader.enterClass(names.fromString("java.io.Externalizable"));
    chk = Check.instance(context);
    types = Types.instance(context);
    fileManager = context.get(JavaFileManager.class);
    if (fileManager instanceof JavacFileManager) {
        ((JavacFileManager)fileManager).setSymbolFileEnabled(false);
    }

    // Default.  Should normally be reset with setLocale.
    this.doclocale = new DocLocale(this, "", breakiterator);
    source = Source.instance(context);
}
 
Example #14
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 #15
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 #16
Source File: DocEnv.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor
 *
 * @param context      Context for this javadoc instance.
 */
protected DocEnv(Context context) {
    context.put(docEnvKey, this);
    this.context = context;

    messager = Messager.instance0(context);
    syms = Symtab.instance(context);
    reader = JavadocClassReader.instance0(context);
    enter = JavadocEnter.instance0(context);
    names = Names.instance(context);
    externalizableSym = reader.enterClass(names.fromString("java.io.Externalizable"));
    chk = Check.instance(context);
    types = Types.instance(context);
    fileManager = context.get(JavaFileManager.class);
    if (fileManager instanceof JavacFileManager) {
        ((JavacFileManager)fileManager).setSymbolFileEnabled(false);
    }

    // Default.  Should normally be reset with setLocale.
    this.doclocale = new DocLocale(this, "", breakiterator);
    source = Source.instance(context);
}
 
Example #17
Source File: DocEnv.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor
 *
 * @param context      Context for this javadoc instance.
 */
protected DocEnv(Context context) {
    context.put(docEnvKey, this);
    this.context = context;

    messager = Messager.instance0(context);
    syms = Symtab.instance(context);
    reader = JavadocClassReader.instance0(context);
    enter = JavadocEnter.instance0(context);
    names = Names.instance(context);
    externalizableSym = reader.enterClass(names.fromString("java.io.Externalizable"));
    chk = Check.instance(context);
    types = Types.instance(context);
    fileManager = context.get(JavaFileManager.class);
    if (fileManager instanceof JavacFileManager) {
        ((JavacFileManager)fileManager).setSymbolFileEnabled(false);
    }

    // Default.  Should normally be reset with setLocale.
    this.doclocale = new DocLocale(this, "", breakiterator);
    source = Source.instance(context);
}
 
Example #18
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 #19
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 #20
Source File: DocEnv.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor
 *
 * @param context      Context for this javadoc instance.
 */
protected DocEnv(Context context) {
    context.put(docEnvKey, this);
    this.context = context;

    messager = Messager.instance0(context);
    syms = Symtab.instance(context);
    reader = JavadocClassReader.instance0(context);
    enter = JavadocEnter.instance0(context);
    names = Names.instance(context);
    externalizableSym = reader.enterClass(names.fromString("java.io.Externalizable"));
    chk = Check.instance(context);
    types = Types.instance(context);
    fileManager = context.get(JavaFileManager.class);
    if (fileManager instanceof JavacFileManager) {
        ((JavacFileManager)fileManager).setSymbolFileEnabled(false);
    }

    // Default.  Should normally be reset with setLocale.
    this.doclocale = new DocLocale(this, "", breakiterator);
    source = Source.instance(context);
}
 
Example #21
Source File: DocEnv.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructor
 *
 * @param context      Context for this javadoc instance.
 */
protected DocEnv(Context context) {
    context.put(docEnvKey, this);
    this.context = context;

    messager = Messager.instance0(context);
    syms = Symtab.instance(context);
    reader = JavadocClassReader.instance0(context);
    enter = JavadocEnter.instance0(context);
    names = Names.instance(context);
    externalizableSym = reader.enterClass(names.fromString("java.io.Externalizable"));
    chk = Check.instance(context);
    types = Types.instance(context);
    fileManager = context.get(JavaFileManager.class);
    if (fileManager instanceof JavacFileManager) {
        ((JavacFileManager)fileManager).setSymbolFileEnabled(false);
    }

    // Default.  Should normally be reset with setLocale.
    this.doclocale = new DocLocale(this, "", breakiterator);
    source = Source.instance(context);
}
 
Example #22
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 #23
Source File: TypeHarness.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected TypeHarness() {
    Context ctx = new Context();
    JavacFileManager.preRegister(ctx);
    types = Types.instance(ctx);
    chk = Check.instance(ctx);
    predef = Symtab.instance(ctx);
    names = Names.instance(ctx);
    fac = new Factory();
}
 
Example #24
Source File: TypeHarness.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected TypeHarness() {
    Context ctx = new Context();
    JavacFileManager.preRegister(ctx);
    types = Types.instance(ctx);
    chk = Check.instance(ctx);
    predef = Symtab.instance(ctx);
    names = Names.instance(ctx);
    fac = new Factory();
}
 
Example #25
Source File: TypeHarness.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
protected TypeHarness() {
    Context ctx = new Context();
    JavacFileManager.preRegister(ctx);
    types = Types.instance(ctx);
    chk = Check.instance(ctx);
    predef = Symtab.instance(ctx);
    names = Names.instance(ctx);
    fac = new Factory();
}
 
Example #26
Source File: ManTypes.java    From manifold with Apache License 2.0 5 votes vote down vote up
private void reassignEarlyHolders( Context context )
{
  ReflectUtil.field(
    ReflectUtil.method( ReflectUtil.type( "com.sun.tools.javac.comp.Analyzer" ), "instance", Context.class )
      .invokeStatic( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Annotate.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Attr.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Check.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( DeferredAttr.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Flow.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Gen.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Infer.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( JavaCompiler.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( JavacElements.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( JavacProcessingEnvironment.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( JavacTrees.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( JavacTypes.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( LambdaToMethod.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( Lower.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( ManResolve.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( MemberEnter.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field(
    ReflectUtil.method( ReflectUtil.type( "com.sun.tools.javac.comp.Modules" ), "instance", Context.class )
      .invokeStatic( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field(
    ReflectUtil.method( ReflectUtil.type( "com.sun.tools.javac.comp.Operators" ), "instance", Context.class )
      .invokeStatic( context ), TYPES_FIELD ).set( this );
  //noinspection ConstantConditions
  ReflectUtil.field(
    ReflectUtil.method( ReflectUtil.type( "com.sun.tools.javac.jvm.StringConcat" ), "instance", Context.class )
      .invokeStatic( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( RichDiagnosticFormatter.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( TransTypes.instance( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field(
    ReflectUtil.method( ReflectUtil.type( "com.sun.tools.javac.comp.TypeEnter" ), "instance", Context.class )
      .invokeStatic( context ), TYPES_FIELD ).set( this );
  ReflectUtil.field( TreeMaker.instance( context ), TYPES_FIELD ).set( this );
}
 
Example #27
Source File: ManCheck.java    From manifold with Apache License 2.0 5 votes vote down vote up
public static Check instance( Context ctx )
{
  Check check = ctx.get( checkKey );
  if( !(check instanceof ManCheck) )
  {
    ctx.put( checkKey, (Check)null );
    check = new ManCheck( ctx );
  }

  return check;
}
 
Example #28
Source File: ManResolve.java    From manifold with Apache License 2.0 5 votes vote down vote up
private void reassignEarlyHolders8( Context context )
{
  ReflectUtil.field( Attr.instance( context ), RESOLVE_FIELD ).set( this );
  ReflectUtil.field( DeferredAttr.instance( context ), RESOLVE_FIELD ).set( this );
  ReflectUtil.field( Check.instance( context ), RESOLVE_FIELD ).set( this );
  ReflectUtil.field( Infer.instance( context ), RESOLVE_FIELD ).set( this );
  ReflectUtil.field( Flow.instance( context ), RESOLVE_FIELD ).set( this );
  ReflectUtil.field( Lower.instance( context ), RESOLVE_FIELD ).set( this );
  ReflectUtil.field( Gen.instance( context ), RESOLVE_FIELD ).set( this );
  ReflectUtil.field( Annotate.instance( context ), RESOLVE_FIELD ).set( this );
  ReflectUtil.field( JavacTrees.instance( context ), "resolve" ).set( this );
  ReflectUtil.field( TransTypes.instance( context ), "resolve" ).set( this );
}
 
Example #29
Source File: TypeHarness.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected TypeHarness() {
    context = new Context();
    JavacFileManager.preRegister(context);
    MyAttr.preRegister(context);
    tool = new ReusableJavaCompiler(context);
    types = Types.instance(context);
    infer = Infer.instance(context);
    chk = Check.instance(context);
    predef = Symtab.instance(context);
    names = Names.instance(context);
    fac = new Factory();
}
 
Example #30
Source File: Types.java    From javaide with GNU General Public License v3.0 5 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();
    reader = ClassReader.instance(context);
    chk = Check.instance(context);
    capturedName = names.fromString("<captured wildcard>");
    messages = JavacMessages.instance(context);
}