Open
Description
Describe the bug
When entering illegal Java code, the result is usually transformed to a different (but still illegal) code. However, in some cases it get transformed / deleted.
Source code you are trying to analyze/transform
0;
0++;
int a = 0++;
MCVE
package my.spoon.code;
import spoon.Launcher;
import spoon.support.compiler.VirtualFile;
public class Main {
public static void main(String[] args) {
Launcher launcher = new Launcher();
launcher.addInputResource(new VirtualFile(
"""
package the.pkg.name;
class ClassName {
void methodName() {
0;
0++;
int a = 0++;
}
}
"""
));
System.out.println(launcher.buildModel().getAllTypes());
}
}
Actual output
0 = the.pkg.name.$missing$; // <- `0;`
// <- `0++;`
int a = 0; // <- `int a = 0++;`
Expected output
// The same output. Illegal code shouldn't get transformed
0;
0++;
int a = 0++;
Spoon Version
11.2.0
JVM Version
17
What operating system are you using?
Windows 10
Activity