ReflectUtil.ConstructorRef constructor = ReflectUtil.constructor( BaseConstructor.class.getTypeName() + inner, Object.class, Object.class ); Object recursiveTuple = constructor.newInstance( key, value ); Object element = constructor.newInstance( mapping, recursiveTuple ); List maps2fill = this.jailbreak().maps2fill; maps2fill.add( 0, element );
Object addedRequires = ReflectUtil.constructor( "com.sun.tools.javac.code.Directive$RequiresDirective", ReflectUtil.type( "com.sun.tools.javac.code.Symbol$ModuleSymbol" ) ).newInstance( moduleToOpen ); newRequires.add( addedRequires ); requires = com.sun.tools.javac.util.List.from( newRequires ); Object exp = ReflectUtil.constructor( "com.sun.tools.javac.code.Directive$ExportsDirective", Symbol.PackageSymbol.class, com.sun.tools.javac.util.List.class ).newInstance( pkg, com.sun.tools.javac.util.List.of( rootModule ) ); exports.add( exp );
Object addedRequires = ReflectUtil.constructor( "com.sun.tools.javac.code.Directive$RequiresDirective", ReflectUtil.type( "com.sun.tools.javac.code.Symbol$ModuleSymbol" ) ).newInstance( moduleToOpen ); newRequires.add( addedRequires ); requires = com.sun.tools.javac.util.List.from( newRequires ); Object exp = ReflectUtil.constructor( "com.sun.tools.javac.code.Directive$ExportsDirective", Symbol.PackageSymbol.class, com.sun.tools.javac.util.List.class ).newInstance( pkg, com.sun.tools.javac.util.List.of( rootModule ) ); exports.add( exp );
ReflectUtil.field( localEnv.info, "pendingResolutionPhase" ).set( null ); Type mtype = (Type)attribTree.invoke( this, tree.meth, localEnv, resultInfoCtor.newInstance( this, kind, mpt, ReflectUtil.field( resultInfo, "checkContext" ).get() ) );
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; }
public static Object construct( Class type, Class[] paramTypes, Object[] args ) { //noinspection ConstantConditions return ReflectUtil.constructor( type, paramTypes ).newInstance( args ); } }
public static Object construct( Class type, Class[] paramTypes, Object[] args ) { //noinspection ConstantConditions return ReflectUtil.constructor( type, paramTypes ).newInstance( args ); } }
private static Object makeUrlLoader( ClassLoader cl, URL url ) throws IOException { Class cls = defineClass( cl, "/com/intellij/util/lang/UrlLoader.class" ); defineClass( cl, "/com/intellij/util/lang/UrlLoader$JavaResource.class" ); defineClass( cl, "/com/intellij/util/lang/UrlLoader$IjResource.class" ); //noinspection ConstantConditions return ReflectUtil.constructor( cls, URL.class, int.class ).newInstance( url, 0 ); }