Open boris-petrov opened 6 months ago
Hi @boris-petrov Thank you very much for reporting this issue. The code you provided is written with features specifically introduced in java 21 and it seems that Java parser has support for java up to 18
language levels. Unfortunately we cannot resolve this issue at this moment, unless javaparser adds the support for java 21. Let's keep this issue open so we can think more on this and find a solution for this in near future.
That would be great if you report the issue on their GitHub. If it helps you can provide the code snippet below as a unit test that the code compiles successfully with java 21 and fails with java parser
public static void main(String[] args){
StaticJavaParser.parse("public class Main {" +
" boolean run(Object object, ImmutableEntry<?, ?> entry) {" +
" return object instanceof ImmutableEntry<?, ?>(var entry1) && entry1.equals(entry);" +
" }" +
" record ImmutableEntry<K, V>(K key) {}" +
"}");
}
@nimakarimipour I think they already have an issue for that so probably no need to open a new one.
As for my case - I'll try to rewrite this code to not use Java 21 features (I don't have that many cases) and then revert it once NullAwayAnnotator
has done its job.
Record Patterns is now supported on Javaparser.
Describe the bug That's probably not an issue with this project but rather with
javaparser
but I promised to write here @nimakarimipour. :smile:I get the following exception:
The parsing error is on
(
but I managed to find the culprit! The code in question is as follows:Let me know if I should report the issue to the other project or you will. Thanks!
To Reproduce See the Java code above.
Expected behavior No exception.
Stack trace See above.
OS (please complete the following information):