Re: Records are called „methods“ in JShell
Michel Trudeau
michel.trudeau at oracle.com
Mon Jul 13 22:04:44 UTC 2020
[Moving this to kulla-dev]
On Jul 12, 2020, at 4:35 PM, Lingo Coder <plugins at lingocoder.com> wrote:
java -version
openjdk version "15-ea" 2020-09-15
OpenJDK Runtime Environment (build 15-ea+31-1502)
OpenJDK 64-Bit Server VM (build 15-ea+31-1502, mixed mode, sharing)
OS: Windows amd64
Steps to reproduce
1. Create some records...
jshell>public record ConstExpr(Expr e) implements Expr{}
jshell>public record PlusExpr(Expr a, Expr b) implements Expr{}
jshell>public record TimesExpr(Expr x, Expr y) implements Expr{}
jshell>public record NegExpr(Expr n) implements Expr{}
2. Observe that JShell calls the records you just created,
„methods“...
jshell> ...
| created method ConstExpr() ...
| created method PlusExpr() ...
| created method TimesExpr() ...
| created method NegExpr() ...
3. Delete those records. JShell says they're „methods“...
jshell> /drop ConstExpr
| dropped method ConstExpr()
jshell> /drop PlusExpr
| dropped method PlusExpr()
jshell> /drop TimesExpr
| dropped method TimesExpr()
jshell> /drop NegExpr
| dropped method NegExpr()
Same deal with /edit. I did a screen recording if it's any help. [1]
I couldn't reproduce this in Linux with the same JDK release/build. It
only happens on Windows.
----
[1] https://i.imgur.com/ee8sJMf.gif
More information about the amber-dev
mailing list