-
Notifications
You must be signed in to change notification settings - Fork 12
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
Full compilation unit parsing errors with recent Java language features #60
Comments
Oh that looks very unfortunate. As short term mitigation I could add a fall back to the "naive" analysis mode for files that can not properly be parsed. In the long run I believe it should/must be possible to find a parser that supports at least the latest LTS language features. |
I have no objection to your suggestion - sounds good. |
I've implemented a draft. Will take some time to finalize this though. Result will then look like this if a file failed to parse:
If line-by-line parsing detects a failure in a file that could not be properly parsed by JavaParser, the message would look like this. (Note the little warning
|
The mitigation is now available in latest snapshot build: |
Mitigation is now released as |
CongoCC is a parser generator that comes with a Java parser that supports up to JDK 20 syntax. You can find more information here. Actually, if you want to try it, here is a magical incantation that should work:
As I said, it is part of CongoCC, which is itself a parser generator, but the Java grammar/parser that is built in can be used perfectly well by 3rd party projects. If you have any question, though, by all means, we're eager to help. The best venue to get your questions is answered is probably our discussion forum. |
That looks quite promising indeed. I will have a deeper look when I have some spare time. Or maybe someone can be found to send a PR to integrate this. This plugin's API is pretty simple and it should be quite straight forward to replace the used parser 😉 |
We have been using
<parseFullCompilationUnit>true</parseFullCompilationUnit>
(#57) smoothly for quite a while.Now we encounter an error after converting an enum to local enum:
(line 298,col 14) Parse error. Found "{", expected one of "," ";" "=" "@" "["
The used JavaParser README states that Java language features up to version 15 are supported. It turns out we are affected by javaparser/javaparser#3990, a Java 16 language feature.
Therefore some improvements could be made:
What do you think?
Corr. stacktrace:
The text was updated successfully, but these errors were encountered: