Hi! I'm using 3.26.1, I set language level to ParserConfiguration.LanguageLevel.BLEEDING_EDGE and I'm getting this exception:
Exception in thread "main" com.github.javaparser.ParseProblemException: (line 3,col 26) Parse error. Found "(", expected one of "!=" "%=" "&" "&&" "&=" ")" "*=" "+=" "-=" "->" "/=" "::" "<<=" "=" "==" ">>=" ">>>=" "?" "^" "^=" "|" "|=" "||"
Problem stacktrace :
com.github.javaparser.GeneratedJavaParser.generateParseException(GeneratedJavaParser.java:14457)
com.github.javaparser.GeneratedJavaParser.jj_consume_token(GeneratedJavaParser.java:14302)
com.github.javaparser.GeneratedJavaParser.IfStatement(GeneratedJavaParser.java:6704)
com.github.javaparser.GeneratedJavaParser.Statement(GeneratedJavaParser.java:5832)
com.github.javaparser.GeneratedJavaParser.BlockStatement(GeneratedJavaParser.java:6079)
com.github.javaparser.GeneratedJavaParser.Statements(GeneratedJavaParser.java:2811)
com.github.javaparser.GeneratedJavaParser.Block(GeneratedJavaParser.java:5955)
com.github.javaparser.GeneratedJavaParser.MethodDeclaration(GeneratedJavaParser.java:2201)
com.github.javaparser.GeneratedJavaParser.ClassOrInterfaceBodyDeclaration(GeneratedJavaParser.java:1796)
com.github.javaparser.GeneratedJavaParser.ClassOrInterfaceBody(GeneratedJavaParser.java:1286)
com.github.javaparser.GeneratedJavaParser.ClassOrInterfaceDeclaration(GeneratedJavaParser.java:538)
com.github.javaparser.GeneratedJavaParser.CompilationUnit(GeneratedJavaParser.java:156)
com.github.javaparser.JavaParser.parse(JavaParser.java:125)
com.github.javaparser.utils.SourceRoot.tryToParse(SourceRoot.java:134)
com.github.javaparser.utils.SourceRoot.tryToParse(SourceRoot.java:149)
com.github.javaparser.utils.SourceRoot.parse(SourceRoot.java:265)
when trying to parse something like this:
class Test {
void foo(Object o) {
if (o instanceof RecordType(int i)) {
}
}
}
While this gets parsed without any issues:
class Test {
void foo(Object o) {
if (o instanceof RecordType(Int i)) {
}
}
}
Among other things, that means the example
// As of Java 21
static void printSum(Object obj) {
if (obj instanceof Point(int x, int y)) {
System.out.println(x+y);
}
}
provided here https://openjdk.org/jeps/440 fails the same way.
From what I could see with my limited knowledge of javaparser, the problem is probably that java.com.github.javaparser.ast.expr.PatternExpr.type is ReferenceType.
Hi! I'm using 3.26.1, I set language level to ParserConfiguration.LanguageLevel.BLEEDING_EDGE and I'm getting this exception:
when trying to parse something like this:
While this gets parsed without any issues:
Among other things, that means the example
provided here https://openjdk.org/jeps/440 fails the same way.
From what I could see with my limited knowledge of javaparser, the problem is probably that java.com.github.javaparser.ast.expr.PatternExpr.type is ReferenceType.