-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Sealed Types] Strange error from ECJ: Syntax error on token "permits", permits expected #2672
Comments
This is the extra error now. It can be seen by pasting the given code snippet in an old I-build vs the latest I-build. |
Another test failure is coming from Bug 567770 - [15] ASTResolving#ASTResolving.getPossibleTypeKinds() should handle sealed classes.
For the above code, the AST generated by parser is coming as:
resulting in the test failure. I see the same additional compile error, "Syntax error on token "permits", permits expected" in the given code snippet also. |
permits expected * Fixes eclipse-jdt#2672
For completeness can you share the original AST expected ? Thanks |
I am not sure how to get that. With the given PR, 6 tests related to \n are fixed but no difference is seen for this UtilitiesTest#testGetPossibleTypeKindsForTypes test failure. |
Meaning the test is continuing to fail - right ? although the additional error goes away ? |
Yes, with the PR, the test is still failing. The additional error has gone away. The AST being generated is still the same. |
permits expected * Fixes eclipse-jdt#2672
Thanks, alternate fix for the same PR under test that retains all the grammar simplifications but reverses the scanner simplifications made in #2652 - The scanner simplifications are not incorrect, they simply don't play well when the CU has syntax errors - in terms of recovery and repair. |
The test is still failing. I see the AST being generated is also the same. Adding @rgrunber who added this test and related code to see if he has any comments. |
FTR, @noopur2507 and I discussed this and found out that there is a problem on JDT/UI side also. The offending test is running at JDK16 - Sealed types entered with JDK17. |
I have released the JDT UI change via eclipse-jdt/eclipse.jdt.ui#1489. |
It makes sense to have compiler compliance at 17 if we're dealing with sealed classes. The feature was in preview for 15 & 16. |
FWIW I ran into similar issues on JDT-LS, where a compiler compliance of 16 seemed to be enough to use sealed classes. Bumping to 17 fixed the issue. The only slightly annoying part is the (nicer) error message that informs about the lack of support for sealed classes seems to have changed. |
See test failures in JDT UI in I20240703-1800 in QuickFixTest17 and UtilitiesTest:
https://download.eclipse.org/eclipse/downloads/drops4/I20240703-1800/testresults/html/org.eclipse.jdt.ui.tests_ep433I-unit-mac64-java17_macosx.cocoa.x86_64_17.html
Looks like one additional compile error is being reported now. For example, in QuickFixTest17#testAddSealedAsDirectSuperInterface1:
was expecting 2 errors but is getting 3 errors now:
The text was updated successfully, but these errors were encountered: