Skip to content
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

java: support for special type 'var' #229

Merged
merged 1 commit into from
Feb 23, 2019
Merged

Conversation

dfa1
Copy link
Contributor

@dfa1 dfa1 commented Sep 30, 2018

Hello,

it would be nice to support the new Java type inference "var". According to the spec [1] "var" is not a keyword but rather a special type identifier.

This is why I added var to TYPES rather than to KEYWORDS.

[1] see section "3.9" of The Java Language Specification, Java SE 11 Edition (https://docs.oracle.com/javase/specs/jls/se11/html/jls-3.html#jls-3.9)

@dfa1 dfa1 mentioned this pull request Sep 30, 2018
@korny korny self-assigned this Feb 23, 2019
@korny korny merged commit ca961f8 into rubychan:master Feb 23, 2019
@korny korny added the Scanners label Feb 23, 2019
@korny
Copy link
Member

korny commented Feb 23, 2019

Maybe I was to quick here: It seems var is used as an identifier in the example files on https://github.com/rubychan/coderay-scanner-tests, for example https://raw.githubusercontent.com/rubychan/coderay-scanner-tests/master/java/jruby.in.java:

    public static IRubyObject trace_var(…) {
        …
        String var = args.length > 1 ? args[0].toString() : null;

Here, highlighting var as a type seems wrong. CodeRay can't know which version of Java the code is targeting, so it might be better to leave this word alone.

@dfa1 dfa1 deleted the java10-support branch February 23, 2019 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants