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

[Request] Adding record as keyword to Java #2604

Closed
0xflotus opened this issue Jun 12, 2020 · 4 comments · Fixed by #2685
Closed

[Request] Adding record as keyword to Java #2604

0xflotus opened this issue Jun 12, 2020 · 4 comments · Fixed by #2685
Labels
enhancement An enhancement or new feature good first issue Should be easier for first time contributors help welcome Could use help from community language

Comments

@0xflotus
Copy link
Contributor

0xflotus commented Jun 12, 2020

Is your request related to a specific problem you're having?
According to JEP 359 since Java 14 record is a new kind of type declaration, so it should be a keyword like enum?
Currently record is not in the list of keywords in java.js

See

var KEYWORDS = 'false synchronized int abstract float private char boolean var static null if const ' +
'for true while long strictfp finally protected import native final void ' +
'enum else break transient catch instanceof byte super volatile case assert short ' +
'package default double public try this switch continue throws protected public private ' +
'module requires exports do';

The solution you'd prefer / feature you'd like to see added...
Adding record to list of keywords

Example Code

Added by Josh Goebel

record Range(int lo, int hi) {
  public Range {
    if (lo > hi)  /* referring here to the implicit constructor parameters */
      throw new IllegalArgumentException(String.format("(%d,%d)", lo, hi));
  }
}
@0xflotus 0xflotus added the enhancement An enhancement or new feature label Jun 12, 2020
@joshgoebel
Copy link
Member

Sounds right. PR?

@joshgoebel
Copy link
Member

Probably very similar to #2660

@joshgoebel joshgoebel added good first issue Should be easier for first time contributors help welcome Could use help from community labels Sep 5, 2020
@joshgoebel
Copy link
Member

joshgoebel commented Sep 11, 2020

@0xflotus Can you take a look at this and see what you think?
Screen Shot 2020-09-11 at 10 04 06 AM

@0xflotus
Copy link
Contributor Author

@0xflotus Can you take a look at this and see what you think?
Screen Shot 2020-09-11 at 10 04 06 AM

I think it looks right. record as kind of class, similar to enum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature good first issue Should be easier for first time contributors help welcome Could use help from community language
Projects
None yet
2 participants