Open ted-wq-x opened 3 years ago
i found a solution,When the class is generic, need to modify the class genericSignature.
ClassFile classFile = udf.getClassFile();
SignatureAttribute signature = (SignatureAttribute) classFile.getAttribute("Signature");
SignatureAttribute.ClassSignature toClassSignature = SignatureAttribute.toClassSignature(signature.getSignature());
SignatureAttribute.ClassType[] interfaces = toClassSignature.getInterfaces();
SignatureAttribute.ClassType[] copy = Arrays.copyOf(interfaces, interfaces.length + 1);
copy[interfaces.length] = new SignatureAttribute.ClassType("com.daml.dti.function.Function");
SignatureAttribute.ClassSignature newSignature = new SignatureAttribute.ClassSignature(toClassSignature.getParameters(),
toClassSignature.getSuperClass(), copy);
udf.setGenericSignature(newSignature.encode());
make a class
UDF2
create a interface called
com.daml.dti.function.Function
,MakeUDF2
implement the interfacethe result is wrong:
when i delete the generic
the result is correct.