[lworld] RFR: 8199429: [lworld] value type (re)constructors expressions value type should not be discardable [v2]

Chen Liang liach at openjdk.org
Thu Oct 10 22:13:17 UTC 2024


On Thu, 10 Oct 2024 17:01:25 GMT, Jesper Steen Møller <jespersm at openjdk.org> wrote:

>> …be discardable as per https://bugs.openjdk.org/browse/JDK-8199429 .
>> 
>> This is a first stab at it, only with the manual marking on a method, and without the loading of the annotation in ClassReader.
>
> Jesper Steen Møller has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8199429: [lworld] Add error example for CheckExamples test

I think the "reconstrcutor" proposal is out-of-date; the latest approach would be "deconstructors" https://github.com/openjdk/amber/pull/94 and "Derived record creation" https://openjdk.org/jeps/468

For `@MustUse`: in the "CheckReturnValue at Google" presentation in [JVMLS 2024](https://openjdk.org/projects/mlvm/jvmlangsummit/agenda.html), Google finds that the pattern is simple: All builder/fluent methods can have return values ignored by default, and all other methods should have return values "must use" by default. Only a tiny fraction of the methods can have their return value ignored, like `List.add`.

-------------

PR Comment: https://git.openjdk.org/valhalla/pull/1274#issuecomment-2406128892


More information about the valhalla-dev mailing list