Object modulesUtil = ReflectUtil.method( ReflectUtil.type( "com.sun.tools.javac.comp.Modules" ), "instance", Context.class ).invokeStatic( getContext() );
int kind = (int)attribArgs.invoke( this, VAL, tree.args, localEnv, argtypesBuf ); argtypes = argtypesBuf.toList(); typeargtypes = attribAnyTypes( tree.typeargs, localEnv ); Type mtype = (Type)attribTree.invoke( this, tree.meth, localEnv, resultInfoCtor.newInstance( this, kind, mpt, ReflectUtil.field( resultInfo, "checkContext" ).get() ) ); restype = (Type)adjustMethodReturnType.invoke( this, qualifier, methName, argtypes, restype ); checkRefTypes.invoke( _chk, tree.typeargs, typeargtypes ); Type captured = (Type)capture.invoke( this, restype ); restype = (Type)check.invoke( this, tree, captured, VAL, resultInfo); ReflectUtil.field( this, "result" ).set( restype ); validate.invoke( _chk, tree.typeargs, localEnv );
Object /*Module*/ manifoldModule = ReflectUtil.method( Class.class, "getModule" ).invoke( NecessaryEvilUtil.class ); Object /*Module*/ javaBaseModule = ReflectUtil.method( Class.class, "getModule" ).invoke( String.class ); addExportsOrOpens.invoke( javaBaseModule, "jdk.internal.loader", manifoldModule, true, true ); addExportsOrOpens.invoke( javaBaseModule, "java.lang.reflect", manifoldModule, true, true ); // for jailbreak addExportsOrOpens.invoke( javaBaseModule, "java.net", manifoldModule, true, true ); Object /*Module*/ jdkCompilerModule = ReflectUtil.method( Class.class, "getModule" ).invoke( ReflectUtil.type( "com.sun.tools.javac.code.Symbol" ) ); addExportsOrOpens.invoke( jdkCompilerModule, "com.sun.tools.javac.api", manifoldModule, true, true ); addExportsOrOpens.invoke( jdkCompilerModule, "com.sun.tools.javac.code", manifoldModule, true, true ); addExportsOrOpens.invoke( jdkCompilerModule, "com.sun.tools.javac.comp", manifoldModule, true, true ); addExportsOrOpens.invoke( jdkCompilerModule, "com.sun.tools.javac.file", manifoldModule, true, true ); addExportsOrOpens.invoke( jdkCompilerModule, "com.sun.tools.javac.jvm", manifoldModule, true, true ); addExportsOrOpens.invoke( jdkCompilerModule, "com.sun.tools.javac.main", manifoldModule, true, true ); addExportsOrOpens.invoke( jdkCompilerModule, "com.sun.tools.javac.model", manifoldModule, true, true ); addExportsOrOpens.invoke( jdkCompilerModule, "com.sun.tools.javac.parser", manifoldModule, true, true ); addExportsOrOpens.invoke( jdkCompilerModule, "com.sun.tools.javac.platform", manifoldModule, true, true ); addExportsOrOpens.invoke( jdkCompilerModule, "com.sun.tools.javac.processing", manifoldModule, true, true ); addExportsOrOpens.invoke( jdkCompilerModule, "com.sun.tools.javac.resources", manifoldModule, true, true ); addExportsOrOpens.invoke( jdkCompilerModule, "com.sun.tools.javac.tree", manifoldModule, true, true ); addExportsOrOpens.invoke( jdkCompilerModule, "com.sun.tools.javac.util", manifoldModule, true, true ); Object /*Module*/ jdkJavadoc = ReflectUtil.method( Class.class, "getModule" ).invoke( ReflectUtil.type( "jdk.javadoc.internal.doclets.formats.html.HtmlDoclet" ) ); addExportsOrOpens.invoke( jdkJavadoc, "jdk.javadoc.internal.doclets.formats.html", manifoldModule, true, true ); addExportsOrOpens.invoke( jdkJavadoc, "com.sun.tools.doclets.standard", manifoldModule, true, true ); addExportsOrOpens.invoke( jdkJavadoc, "com.sun.tools.javadoc.main", manifoldModule, true, true );
return ReflectUtil.method( iface, "proxy", Bindings.class ).invokeStatic( root );
? ReflectUtil.method( "manifold.internal.javac.ManAttr_8", "instance", Context.class ).invokeStatic( getContext() ) : ReflectUtil.method( "manifold.internal.javac.ManAttr_9", "instance", Context.class ).invokeStatic( getContext() )); ReflectUtil.field( JavaCompiler.instance( getContext() ), "attr" ).set( manAttr ); ReflectUtil.method( ReflectUtil.type( "manifold.internal.javac.ManClassFinder_9" ), "instance", Context.class ).invokeStatic( getContext() );
ReflectUtil.method( ReflectUtil.type( "com.sun.tools.javac.comp.Modules" ), "instance", Context.class ).invokeStatic( context ), "allModules" ).get();
return ReflectUtil.method( iface, "proxy", Bindings.class ).invokeStatic( root );
ReflectUtil.method( ReflectUtil.type( "com.sun.tools.javac.comp.Modules" ), "instance", Context.class ).invokeStatic( context ), "allModules" ).get();
Object classFinder = ReflectUtil.method( CLASSFINDER_CLASS, "instance", Context.class ).invokeStatic( getContext() ); ReflectUtil.field( classFinder, "fileManager" ).set( _manFileManager ); ReflectUtil.field( classFinder, "preferSource" ).set( true ); Object modules = ReflectUtil.method( MODULES_CLASS, "instance", Context.class ).invokeStatic( getContext() ); ReflectUtil.field( modules, "fileManager" ).set( _manFileManager ); Object moduleFinder = ReflectUtil.method( MODULEFINDER_CLASS, "instance", Context.class ).invokeStatic( getContext() ); ReflectUtil.field( moduleFinder, "fileManager" ).set( _manFileManager ); Object classFinder = ReflectUtil.method( CLASSFINDER_CLASS, "instance", Context.class ).invokeStatic( getContext() ); ReflectUtil.field( classFinder, "fileManager" ).set( _manFileManager ); Object modules = ReflectUtil.method( MODULES_CLASS, "instance", Context.class ).invokeStatic( getContext() ); ReflectUtil.field( modules, "fileManager" ).set( _manFileManager ); Object moduleFinder = ReflectUtil.method( MODULEFINDER_CLASS, "instance", Context.class ).invokeStatic( getContext() ); ReflectUtil.field( moduleFinder, "fileManager" ).set( _manFileManager );
.invokeStatic( tree ); if( !isJailbreak ) .invokeStatic( select );
private void getIncrementalCompileDrivers( JCTree.JCAnnotation anno, Set<Object> drivers ) { Attribute.Compound attribute = anno.attribute; if( attribute == null ) { return; } String fqnDriver = null; Integer driverId = null; for( com.sun.tools.javac.util.Pair<Symbol.MethodSymbol, Attribute> pair: attribute.values ) { Name argName = pair.fst.getSimpleName(); if( argName.toString().equals( "driverInstance" ) ) { driverId = (int)pair.snd.getValue(); } else if( argName.toString().equals( "driverClass" ) ) { fqnDriver = (String)pair.snd.getValue(); } } if( driverId != null ) { Object driver = ReflectUtil.method( fqnDriver, "getInstance", int.class ).invokeStatic( driverId ); drivers.add( driver ); } }
private void getIncrementalCompileDrivers( JCTree.JCAnnotation anno, Set<Object> drivers ) { Attribute.Compound attribute = anno.attribute; if( attribute == null ) { return; } String fqnDriver = null; Integer driverId = null; for( com.sun.tools.javac.util.Pair<Symbol.MethodSymbol, Attribute> pair: attribute.values ) { Name argName = pair.fst.getSimpleName(); if( argName.toString().equals( "driverInstance" ) ) { driverId = (int)pair.snd.getValue(); } else if( argName.toString().equals( "driverClass" ) ) { fqnDriver = (String)pair.snd.getValue(); } } if( driverId != null ) { Object driver = ReflectUtil.method( fqnDriver, "getInstance", int.class ).invokeStatic( driverId ); drivers.add( driver ); } }
private Object coerceEnum( Object value, Class<?> type ) { if( type.isEnum() && IBindingType.class.isAssignableFrom( type ) ) { if( IBindingType.class.isAssignableFrom( type ) ) { //noinspection ConstantConditions IBindingType[] values = (IBindingType[])ReflectUtil.method( type, "values" ).invokeStatic(); for( IBindingType enumConst: values ) { Object jsonValue = enumConst.toBindingValue(); Object coercedValue = RuntimeMethods.coerce( value, jsonValue.getClass() ); if( jsonValue.equals( coercedValue ) ) { return enumConst; } } } } return UNHANDLED; } }
private void reassignEarlyHolders( Context context ) { ReflectUtil.field( _attr, "rs" ).set( this ); ReflectUtil.field( DeferredAttr.instance( context ), "rs" ).set( this ); ReflectUtil.field( Check.instance( context ), "rs" ).set( this ); ReflectUtil.field( Infer.instance( context ), "rs" ).set( this ); ReflectUtil.field( Flow.instance( context ), "rs" ).set( this ); ReflectUtil.field( LambdaToMethod.instance( context ), "rs" ).set( this ); ReflectUtil.field( Lower.instance( context ), "rs" ).set( this ); ReflectUtil.field( Gen.instance( context ), "rs" ).set( this ); ReflectUtil.field( ReflectUtil.method( ReflectUtil.type( "com.sun.tools.javac.jvm.StringConcat" ), "instance", Context.class ) .invokeStatic( context ), "rs" ) .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 ); }
public static boolean isJava9Modular_compiler( Object/*Context*/ ctx ) { if( _modular == null ) { if( isJava8() ) { _modular = false; } else { //noinspection ConstantConditions Object modulesUtil = ReflectUtil.method( ReflectUtil.type( "com.sun.tools.javac.comp.Modules" ), "instance", ReflectUtil.type( "com.sun.tools.javac.util.Context" ) ).invokeStatic( ctx ); Object defModule = ReflectUtil.method( modulesUtil, "getDefaultModule" ).invoke(); _modular = defModule != null && !(boolean)ReflectUtil.method( defModule, "isNoModule" ).invoke() && !(boolean)ReflectUtil.method( defModule, "isUnnamed" ).invoke(); } } return _modular; }
public static boolean isJava9Modular_runtime() { if( _modularRuntime == null ) { if( isJava8() ) { _modularRuntime = false; } else { //noinspection ConstantConditions Object /*Module*/ manifoldModule = ReflectUtil.method( Class.class, "getModule" ).invoke( JreUtil.class ); _modularRuntime = (boolean)ReflectUtil.method( manifoldModule, "isNamed" ).invoke(); } } return _modularRuntime; } }
private TypeAnnotationPosition getTypeAnnotationPosition( List<TypeAnnotationPosition.TypePathEntry> attrLocationCopy ) { TypeAnnotationPosition posCopy; //noinspection ConstantConditions if( isJava8() ) { posCopy = (TypeAnnotationPosition)ReflectUtil.constructor( "com.sun.tools.javac.code.TypeAnnotationPosition" ).newInstance(); ReflectUtil.field( posCopy, "location" ).set( attrLocationCopy ); } else { posCopy = (TypeAnnotationPosition)ReflectUtil .method( TypeAnnotationPosition.class, "methodReceiver", List.class ).invokeStatic( attrLocationCopy ); } return posCopy; }
private static MethodRef getMethodFromCache( Class cls, String name, Class... params ) { Method m = getRawMethodFromCache( cls, name, params ); if( m != null ) { return new MethodRef( m ); } return null; }
private static MethodRef addMethodToCache( Class cls, Method m ) { setAccessible( m ); addRawMethodToCache( cls, m ); return new MethodRef( m ); }
public static Object invokeStatic_Object( Class cls, String name, Class[] paramTypes, Object[] args ) { //noinspection ConstantConditions return ReflectUtil.method( cls, name, paramTypes ).invokeStatic( args ); }