Names names = Names.instance( _tp.getContext() ); Symbol.ClassSymbol reflectMethodClassSym = IDynamicJdk.instance().getTypeElement( _tp.getContext(), _tp.getCompilationUnit(), RuntimeMethods.class.getName() ); Symbol.MethodSymbol makeInterfaceProxyMethod = resolveMethod( theCall.pos(), names.fromString( "constructProxy" ), reflectMethodClassSym.type, List.from( new Type[]{symbols.objectType, symbols.classType} ) );
Names names = Names.instance( _tp.getContext() ); Symbol.ClassSymbol reflectMethodClassSym = IDynamicJdk.instance().getTypeElement( _tp.getContext(), _tp.getCompilationUnit(), RuntimeMethods.class.getName() ); Symbol.MethodSymbol makeInterfaceProxyMethod = resolveMethod( theCall.pos(), names.fromString( "constructProxy" ), reflectMethodClassSym.type, List.from( new Type[]{symbols.objectType, symbols.classType} ) );
public void visitApply(JCMethodInvocation tree) { tree.meth = translate(tree.meth, null); Symbol meth = TreeInfo.symbol(tree.meth); Type mt = meth.erasure(types); List<Type> argtypes = mt.getParameterTypes(); if (allowEnums && meth.name==names.init && meth.owner == syms.enumSym) argtypes = argtypes.tail.tail; if (tree.varargsElement != null) tree.varargsElement = types.erasure(tree.varargsElement); else if (tree.args.length() != argtypes.length()) { log.error(tree.pos(), "method.invoked.with.incorrect.number.arguments", tree.args.length(), argtypes.length()); } tree.args = translateArgs(tree.args, argtypes, tree.varargsElement); tree.type = types.erasure(tree.type); // Insert casts of method invocation results as needed. result = retype(tree, mt.getReturnType(), pt); }
public void visitApply(JCMethodInvocation tree) { tree.meth = translate(tree.meth, null); Symbol meth = TreeInfo.symbol(tree.meth); Type mt = meth.erasure(types); List<Type> argtypes = mt.getParameterTypes(); if (allowEnums && meth.name==names.init && meth.owner == syms.enumSym) argtypes = argtypes.tail.tail; if (tree.varargsElement != null) tree.varargsElement = types.erasure(tree.varargsElement); else if (tree.args.length() != argtypes.length()) { log.error(tree.pos(), "method.invoked.with.incorrect.number.arguments", tree.args.length(), argtypes.length()); } tree.args = translateArgs(tree.args, argtypes, tree.varargsElement); tree.type = types.erasure(tree.type); // Insert casts of method invocation results as needed. result = retype(tree, mt.getReturnType(), pt); }
/** Check that given application node appears as first statement * in a constructor call. * @param tree The application node * @param env The environment current at the application. */ boolean checkFirstConstructorStat(JCMethodInvocation tree, Env<AttrContext> env) { JCMethodDecl enclMethod = env.enclMethod; if (enclMethod != null && enclMethod.name == names.init) { JCBlock body = enclMethod.body; if (body.stats.head.hasTag(EXEC) && ((JCExpressionStatement) body.stats.head).expr == tree) return true; } log.error(tree.pos(),"call.must.be.first.stmt.in.ctor", TreeInfo.name(tree.meth)); return false; }
/** Check that given application node appears as first statement * in a constructor call. * @param tree The application node * @param env The environment current at the application. */ boolean checkFirstConstructorStat(JCMethodInvocation tree, Env<AttrContext> env) { JCMethodDecl enclMethod = env.enclMethod; if (enclMethod != null && enclMethod.name == names.init) { JCBlock body = enclMethod.body; if (body.stats.head.hasTag(EXEC) && ((JCExpressionStatement) body.stats.head).expr == tree) return true; } log.error(tree.pos(),"call.must.be.first.stmt.in.ctor", TreeInfo.name(tree.meth)); return false; }
/** Check that given application node appears as first statement * in a constructor call. * @param tree The application node * @param env The environment current at the application. */ boolean checkFirstConstructorStat(JCMethodInvocation tree, Env<AttrContext> env) { JCMethodDecl enclMethod = env.enclMethod; if (enclMethod != null && enclMethod.name == names.init) { JCBlock body = enclMethod.body; if (body.stats.head.getTag() == JCTree.EXEC && ((JCExpressionStatement) body.stats.head).expr == tree) return true; } log.error(tree.pos(),"call.must.be.first.stmt.in.ctor", TreeInfo.name(tree.meth)); return false; }
/** Check that given application node appears as first statement * in a constructor call. * @param tree The application node * @param env The environment current at the application. */ boolean checkFirstConstructorStat(JCMethodInvocation tree, Env<AttrContext> env) { JCMethodDecl enclMethod = env.enclMethod; if (enclMethod != null && enclMethod.name == names.init) { JCBlock body = enclMethod.body; if (body.stats.head.tag == JCTree.EXEC && ((JCExpressionStatement) body.stats.head).expr == tree) return true; } log.error(tree.pos(),"call.must.be.first.stmt.in.ctor", TreeInfo.name(tree.meth)); return false; }