use of org.codehaus.groovy.ast.builder.AstStringCompiler in project groovy by apache.
the class StaticTypesLambdaWriter method addDeserializeLambdaMethod.
private void addDeserializeLambdaMethod() {
ClassNode enclosingClass = controller.getClassNode();
Parameter[] parameters = createDeserializeLambdaMethodParams();
if (enclosingClass.hasMethod("$deserializeLambda$", parameters)) {
return;
}
Statement code = block(declS(localVarX("enclosingClass", OBJECT_TYPE), classX(enclosingClass)), ((BlockStatement) new AstStringCompiler().compile("return enclosingClass" + ".getDeclaredMethod(\"\\$deserializeLambda_${serializedLambda.getImplClass().replace('/', '$')}\\$\", serializedLambda.getClass())" + ".invoke(null, serializedLambda)").get(0)).getStatements().get(0));
enclosingClass.addSyntheticMethod("$deserializeLambda$", ACC_PRIVATE | ACC_STATIC, OBJECT_TYPE, parameters, ClassNode.EMPTY_ARRAY, code);
}
Aggregations