Closed thomas2123 closed 1 week ago
proof I used eclipse 2024-06
Are you able to provide a small and self contained example to reproduce the problem ?? Screen shots are not very useful.
Can you try and attach a fuller stack trace when the problem shows up ?? Thanks.
As I am a junior developper, I sometime make silly mistakes, sorry for that ^^'.
Every developer makes mistakes, and still the tool should not throw exceptions.
So, if you provide the code that triggered this as text, not picture, then your mistake will help us fix the tool for the benefit of others running into a similar mistake :)
Thank you for your answers So here is a project that will trigger the building error : https://github.com/thomas2123/buildErrorProject And the stack trace ? : Internal compiler error: java.lang.NullPointerException: Cannot invoke "org.eclipse.jdt.internal.compiler.lookup.TypeBinding.isRecord()" because "this.resolvedType" is null at org.eclipse.jdt.internal.compiler.ast.RecordPattern.resolveType(RecordPattern.java:119)
Reproduced. Thanks @thomas2123 for the test case.
Simplified test case:
public class X {
enum EnumError {
TEST(0);
private int value;
private EnumError(int value) {
this.value = value;
}
public int getValue() {
return this.value;
}
}
public static void main(String[] args) {
int bouh = 0;
switch(bouh) {
case EnumError.TEST.getValue() :
break;
}
}
}
JDK-22 reports:
X.java:20: error: cannot find symbol
case EnumError.TEST.getValue() :
^
symbol: class TEST
location: class EnumError
X.java:20: error: deconstruction patterns can only be applied to records, getValue is not a record
case EnumError.TEST.getValue() :
^
2 errors
thanks for the fix ^^
The fix is not merged in - master is not open for development of 4.34 work. Reopening.
In any case, the ticket will be closed automatically when the fix is integrated.
Hi, As I am a junior developper, I sometime make silly mistakes, sorry for that ^^'. As @stephan-herrmann suggested, I'll create a new issue for this one. I got this error in building with 2024-06 : I tried to revert to 2024-03, but I got this error : But when I reverted back to 2023-12, I did not have the error in building anymore. As I went through the error, I found that it was linked to this error : It's a mistake I often make, to use an enum as a Constant in a switch.
When the enum is replaced by a Constant, the error goes away and the building works again. I hope I made this clear, sorry if I didn't. Good luck and thank you for the beautiful software you make.