Open
Description
Describe the bug
Updating an older project from spoon 5.5.x to latest version. Getting exception I have issues understanding the problem with...
Stacktrace:
Exception in thread "main" spoon.SpoonException: CtExecutableReference cannot use CtTypeParameterReference. Use boundingType of CtTypeParameterReference instead.
at spoon.support.reflect.reference.CtExecutableReferenceImpl.checkMethodParameterTypeRef(CtExecutableReferenceImpl.java:184)
at spoon.support.reflect.reference.CtExecutableReferenceImpl.addParameter(CtExecutableReferenceImpl.java:176)
at spoon.support.reflect.reference.CtExecutableReferenceImpl.setParameters(CtExecutableReferenceImpl.java:167)
at spoon.reflect.factory.CodeFactory.createConstructorCall(CodeFactory.java:192)
at spoon.reflect.factory.FactoryImpl.createConstructorCall(FactoryImpl.java:479)
at org.crumbleworks.forge.spoon_openglparser.LwjglOpenGLAPIProcessor.createCustomPointerBufferAndWrapper(LwjglOpenGLAPIProcessor.java:1312)
at org.crumbleworks.forge.spoon_openglparser.LwjglOpenGLAPIProcessor.process(LwjglOpenGLAPIProcessor.java:772)
at spoon.support.QueueProcessingManager.process(QueueProcessingManager.java:115)
at spoon.support.QueueProcessingManager.process(QueueProcessingManager.java:132)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.process(JDTBasedSpoonCompiler.java:194)
at spoon.Launcher.process(Launcher.java:791)
at org.crumbleworks.forge.spoon_openglparser.LwjglOpenGLAPIProcessor.main(LwjglOpenGLAPIProcessor.java:1478)
Code:
CtClass<?> lwjglPB = getFactory().Class().get(PointerBuffer.class);
List<CtMethod<?>> pbMethods = new ArrayList<>();
for(CtMethod<?> method : lwjglPB.getAllMethods()) {
//some code filtering out methods we want/don't want
pbMethods.add(method);
}
}
//populate interface & wrapper
for(CtMethod<?> ctMethod : pbMethods) {
CtMethod<Object> intfMethod = (CtMethod<Object>)ctMethod.clone();
//creating a wrapper method and doing some stuff for the wrapper
.
.
.
//add to interface
cwAPIPointerBuffer.addMethod(intfMethod);
//add to wrapper
CtMethod<Object> wrapMethod = (CtMethod<Object>)intfMethod.clone();
wrapMethod.setComments(null);
wrapMethod.addAnnotation(getFactory().Code().createAnnotation(getFactory().Annotation().createReference(Override.class)));
List<CtExpression<?>> arguments = new LinkedList<CtExpression<?>>();
for(CtParameter<?> param : ctMethod.getParameters()) {
.
.
.
@SuppressWarnings("unchecked")
CtInvocation<Object> methodCall = (CtInvocation<Object>)getFactory().Code().createInvocation(
getFactory().createVariableRead(internalPointerBuffer.getReference(), false),
ctMethod.getReference(),
arguments);
//some more logic happening here, but the following is the only part that interacts with the methodCall object
//AND is the part that throws, the line that throws is marked with '->'
wrapMethod.setBody(getFactory().Core().createReturn().setReturnedExpression(
getFactory().createConstructorCall(
cwEnginePointerBufferWrapper.getReference(),
-> methodCall)
));
cwEnginePointerBufferWrapper.addMethod(wrapMethod);
}
I cannot provide the full sourcecode as of this moment, as there's a bunch of proprietory stuff in there. I am trying to narrow it down to a self-contained executable sample
Source code you are trying to analyze/transform
No response
Source code for your Spoon processing
No response
Actual output
No response
Expected output
No response
Spoon Version
10.1.1
JVM Version
18
What operating system are you using?
Windows 11