Primitive Queue<any T> considerations
Michael Hixson
michael.hixson at gmail.com
Thu Nov 19 07:11:04 UTC 2015
On Wed, Nov 18, 2015 at 8:28 PM, John Rose <john.r.rose at oracle.com> wrote:
> On Nov 18, 2015, at 6:18 PM, Vitaly Davidovich <vitalyd at gmail.com> wrote:
>>
>> Also, you can have "lost" writes even with immutable types, e.g.:
>>
>> MyMutableInt x = new ...
>> x.add(...); oops forgot to assign to new local
>>
> *That* needs a linty language feature:
>
> interface ImmList<T> {
> @Unavoidable // do not discard this value without a complaint
> ImmList<T> add(T);
> }
>
It seems like jsr305 / FindBugs have this covered with
@CheckReturnValue, right? Not sure if there is IDE/tooling support
for inferring that annotation on certain JDK methods though, like
there is for nullness.
http://findbugs.sourceforge.net/api/edu/umd/cs/findbugs/annotations/CheckReturnValue.html
-Michael
More information about the valhalla-dev
mailing list