RFR (14): JDK-8236715: Records with errors are not properly corraled
Jan Lahoda
jan.lahoda at oracle.com
Wed Jan 8 19:34:35 UTC 2020
FWIW, the behavior with the patch is:
---
jshell> record R(int i) { public int g() { return unknown; } }
| created record R, however, it cannot be instantiated or its methods
invoked until variable unknown is declared
jshell> new R(1)
| attempted to use record R which cannot be instantiated or its methods
invoked until variable unknown is declared
---
Jan
On 08. 01. 20 18:13, Vicente Romero wrote:
> looks good,
> Vicente
>
> On 1/8/20 11:25 AM, Jan Lahoda wrote:
>> Consider a record that e.g.:
>>
>> record R(int i) { public int g() { return unknown; } }
>>
>> putting this into jshell (which was started with --enable-preview)
>> will lead to no response and "R" won't be declared:
>> ---
>> jshell> record R(int i) { public int g() { return unknown; } }
>>
>> jshell> new R(1)
>> | Error:
>> | cannot find symbol
>> | symbol: class R
>> | new R(1)
>> | ^
>> ---
>>
>> This is because the records are not properly corralled, and when
>> corralled, the note to the user is not printed properly. The proposed
>> patch strives to fix that.
>>
>> Proposed change:
>> http://cr.openjdk.java.net/~jlahoda/8236715/webrev.00/
>>
>> JBS: https://bugs.openjdk.java.net/browse/JDK-8236715
>>
>> How does this look?
>>
>> Thanks,
>> Jan
>
More information about the kulla-dev
mailing list