Skip to content

Allow empty type parameters in Java code of grammar files.#75

Merged
new-javacc merged 1 commit intojavacc:masterfrom
emspishak:diamond
Sep 22, 2019
Merged

Allow empty type parameters in Java code of grammar files.#75
new-javacc merged 1 commit intojavacc:masterfrom
emspishak:diamond

Conversation

@emspishak
Copy link
Copy Markdown
Contributor

This allows one to use the diamond when constructing a generic class: new ArrayList<>()

This feature of the Java compiler is documented at https://docs.oracle.com/javase/7/docs/technotes/guides/language/type-inference-generic-instance-creation.html

This allows one to use the diamond when constructing a generic class: new ArrayList<>()

This feature of the Java compiler is documented at https://docs.oracle.com/javase/7/docs/technotes/guides/language/type-inference-generic-instance-creation.html
@inponomarev
Copy link
Copy Markdown
Contributor

This one together with my PR #71 introduces another Java7 feature.

However, both your and my changes are missing tests. Maybe some of the maintainers will point out the right way to add demo examples/tests for 'diamond operator' and 'try-with-resources' block.

@zosrothko
Copy link
Copy Markdown
Member

@inponomarev You could add whatever tests you want to the test or example directories, but you would have to add the testing process into teh Ant build.xml like the other tests

@inponomarev
Copy link
Copy Markdown
Contributor

@zosrothko I reworked #71, added all the remaining Java 7 features and added the tests. The proposed @emspishak 's change was cherry-picked into #71 's branch.

@new-javacc
Copy link
Copy Markdown
Contributor

Like I'e been saying the solution is to get rid of checking the java syntax. I want to eventually remove all java grammar elements from the javacc grammar. But may be it's ok for now. Also, it's best to keep grammars simple - not complicate with complex java constructs and features. You should do those in your super/sub classes.

@new-javacc new-javacc merged commit 6975216 into javacc:master Sep 22, 2019
@zosrothko
Copy link
Copy Markdown
Member

@emspishak Could you backport your PR to the 8.0.0 branch? TIA

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

Successfully merging this pull request may close these issues.

4 participants