Handle also Lamba for interfaces

This commit is contained in:
Volker Berlin 2022-05-28 21:36:00 +02:00
parent 97f9fb39a7
commit b4828b4659
No known key found for this signature in database
GPG Key ID: 988423EF815BE4CB
2 changed files with 9 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/*
Copyright 2020 - 2021 Volker Berlin (i-net software)
Copyright 2020 - 2022 Volker Berlin (i-net software)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -29,18 +29,18 @@ public class BootstrapMethod {
/**
* Signature and return type of method to be implemented by the function object.
*/
private String samMethodType;
private String samMethodType;
/**
* A direct method handle describing the implementation method which should be called
*/
private ConstantMethodRef implMethod;
private ConstantRef implMethod;
/**
* The signature and return type that should be enforced dynamically at invocation time. This may be the same as
* {@code samMethodType}, or may be a specialization of it.
*/
private String instantiatedMethodType;
private String instantiatedMethodType;
/**
* Create an instance.
@ -54,7 +54,7 @@ public class BootstrapMethod {
// the 3 values
samMethodType = (String)constantPool.get( input.readUnsignedShort() );
implMethod = (ConstantMethodRef)constantPool.get( input.readUnsignedShort() );
implMethod = (ConstantRef)constantPool.get( input.readUnsignedShort() );
instantiatedMethodType = (String)constantPool.get( input.readUnsignedShort() );
}
@ -71,9 +71,9 @@ public class BootstrapMethod {
/**
* The real method in the parent class that implements the lambda expression
*
* @return the method
* @return the method (ConstantMethodRef or ConstantInterfaceRef)
*/
public ConstantMethodRef getImplMethod() {
public ConstantRef getImplMethod() {
return implMethod;
}
}

View File

@ -39,7 +39,7 @@ import de.inetsoftware.classparser.BootstrapMethod;
import de.inetsoftware.classparser.ClassFile;
import de.inetsoftware.classparser.ClassFile.Type;
import de.inetsoftware.classparser.ConstantClass;
import de.inetsoftware.classparser.ConstantMethodRef;
import de.inetsoftware.classparser.ConstantRef;
import de.inetsoftware.classparser.FieldInfo;
import de.inetsoftware.classparser.MethodInfo;
import de.inetsoftware.jwebassembly.JWebAssembly;
@ -405,7 +405,7 @@ public class TypeManager {
* @return the type
*/
LambdaType lambdaType( @Nonnull BootstrapMethod method, ArrayList<AnyType> params, StructType interfaceType, String interfaceMethodName ) {
ConstantMethodRef implMethod = method.getImplMethod();
ConstantRef implMethod = method.getImplMethod();
FunctionName methodName = new FunctionName( implMethod );
String typeName = implMethod.getClassName() + "$$" + implMethod.getName() + "/" + Math.abs( implMethod.getName().hashCode() );