use of org.eclipse.ceylon.langtools.tools.javac.code.Symbol.DynamicMethodSymbol in project ceylon by eclipse.
the class LambdaToMethod method makeIndyCall.
/**
* Generate an indy method call with given name, type and static bootstrap
* arguments types
*/
private JCExpression makeIndyCall(DiagnosticPosition pos, Type site, Name bsmName, List<Object> staticArgs, MethodType indyType, List<JCExpression> indyArgs, Name methName) {
int prevPos = make.pos;
try {
make.at(pos);
List<Type> bsm_staticArgs = List.of(syms.methodHandleLookupType, syms.stringType, syms.methodTypeType).appendList(bsmStaticArgToTypes(staticArgs));
Symbol bsm = rs.resolveInternalMethod(pos, attrEnv, site, bsmName, bsm_staticArgs, List.<Type>nil());
DynamicMethodSymbol dynSym = new DynamicMethodSymbol(methName, syms.noSymbol, bsm.isStatic() ? ClassFile.REF_invokeStatic : ClassFile.REF_invokeVirtual, (MethodSymbol) bsm, indyType, staticArgs.toArray());
JCFieldAccess qualifier = make.Select(make.QualIdent(site.tsym), bsmName);
qualifier.sym = dynSym;
qualifier.type = indyType.getReturnType();
JCMethodInvocation proxyCall = make.Apply(List.<JCExpression>nil(), qualifier, indyArgs);
proxyCall.type = indyType.getReturnType();
return proxyCall;
} finally {
make.at(prevPos);
}
}
Aggregations