There are a few valid use cases where `new WeakReference<>(null)` makes
some sense. So, we shouldn't forbid nulls.
`new WeakReference<>(null, queue)` makes less sense but I bet someone is
using this too for some reason.
My initial message was not about changing the behavior but only about
changin
On 7/10/18 4:04 PM, Éamonn McManus wrote:
Do you know any other example?
Here's an example from the JDK itself:
http://hg.openjdk.java.net/jdk/jdk11/file/2a89e80301b1/src/java.desktop/share/classes/sun/font/Type1Font.java#l101
Thanks Eamonn.
I also found a few other similar usages in JDK
On 7/9/18 11:59 PM, Peter Levart wrote:
There are situations where being able to create a XxxReference without a
referent is useful. For example, imagine a doubly-linked list of
WeakReference subclasses - a special instance without a referent can be
used as the head of such list that neve
Hi Mandy,
On 07/10/2018 12:18 AM, mandy chung wrote:
On 7/9/18 12:59 PM, Per Liden wrote:
On 2018-07-09 20:49, mandy chung wrote:
On 7/9/18 11:31 AM, Zheka Kozlov wrote:
It is possible to create a
WeakReference/SoftReference/PhantomReference
with a null value in which case the Reference
I also created an issue in IDEA bug tracker:
https://youtrack.jetbrains.com/issue/IDEA-195298. This at least should be
handled by an IDE.
On 7/9/18 12:59 PM, Per Liden wrote:
On 2018-07-09 20:49, mandy chung wrote:
On 7/9/18 11:31 AM, Zheka Kozlov wrote:
It is possible to create a WeakReference/SoftReference/PhantomReference
with a null value in which case the Reference will never be enqueued.
This
is quite obvious (since
Hi,
After so many years of accepting null, throwing NPE would an
incompatible change
and break existing uses.
Documenting it as ill advised or useless is would be a useful caution.
Regards, Roger
On 7/9/18 3:59 PM, Per Liden wrote:
On 2018-07-09 20:49, mandy chung wrote:
On 7/9/18 11:31
On 2018-07-09 20:49, mandy chung wrote:
On 7/9/18 11:31 AM, Zheka Kozlov wrote:
It is possible to create a WeakReference/SoftReference/PhantomReference
with a null value in which case the Reference will never be enqueued.
This
is quite obvious (since null cannot be weakly/softly/phantom re
On 7/9/18 11:31 AM, Zheka Kozlov wrote:
It is possible to create a WeakReference/SoftReference/PhantomReference
with a null value in which case the Reference will never be enqueued. This
is quite obvious (since null cannot be weakly/softly/phantom reachable).
But I think it's worth being menti