8000 Java 8 syntax not supported in actions · Issue #258 · javacc/javacc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Java 8 syntax not supported in actions #258

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

Open
JeromeA opened this issue Mar 26, 2023 · 3 comments
Open

Java 8 syntax not supported in actions #258

JeromeA opened this issue Mar 26, 2023 · 3 comments

Comments

@JeromeA
Copy link
JeromeA commented Mar 26, 2023

Using a method reference (Class::method) in an action raises an exception with Javacc 7.0.12:
org.javacc.parser.ParseException: Encountered " "::" ":: "" at line 36, column 21.
Was expecting one of:
"instanceof" ...
")" ...
"," ...
"<" ...
"?" ...
"==" ...
"<=" ...
">=" ...
"!=" ...
"||" ...
"&&" ...
"++" ...
"--" ...
"+" ...
"-" ...
"*" ...
"/" ...
"&" ...
"|" ...
"^" ...
"%" ...
">" ...
"<" ...
Are there any plans to support Java 8 in the near future?

@new-javacc
Copy link
Contributor
new-javacc commented Mar 26, 2023 via email

@revusky
Copy link
revusky commented Apr 8, 2023

You should really do yourself a favor and check out the more evolved version of JavaCC, which is CongoCC. The Java parser that is built into the tool parses all the syntax (stable features mind you, not necessarily all the preview features) up through JDK 20, so that obviously includes lambdas and method references, which were introduced in JDK 8.

Are there any plans to support Java 8 in the near future?

Well, really, the truth of the matter is that the legacy JavaCC project has no plans of any sort. It is not being actively developed. Just look at their commit record. Just page back some years and see if you can find anything resembling a new feature.

In any case, CongoCC is basically committed to supporting the latest stable version of Java on an ongoing basis. See here for some more information. If you have any further questions, it is better to take it up here because, almost certainly, the owners of this project are not very keen on my participation here.

@revusky
Copy link
revusky commented Apr 8, 2023

If you use javacc 8 I think it does

You think so, eh? Well, that's a very confident, authoritative answer. Well, I guess you're free to think that it does, but I just checked and it doesn't. I just looked here and here, and, scanning over the thing, it is quite obvious that there is nothing in either grammar to handle lambdas or method references. Also, one should note that the last commit on either file is from June 2021, nearly 2 years ago. Actually, the last meaningful change to the file was a patch by iponomarev from March 16, 2019. That patch did take the Java support in code actions to JDK 7 level. However, Ponomarev's changes were not applied to JJTree.jjt so you can use JDK 7 features like try-with-resources if you use plain JavaCC, but not if you use JJTree.

That is a rather strange design decision, is it not? Could you clarify that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0