Question

After using the now essentially defunct Java Web Start (as the latest Java update has just essentially killed it), I found a situation which required me to call urlConn.setDefaultUseCaches(false).

However, I had to first construct I found that while the variable was clearly "sticky" and upon further inspection of the source code, I found that the variable is indeed a static boolean. So why is the variable accessed through a non-static method?

After all, even the getter method for the static boolean is non-static? Is this intentional? I mean isn't it convention that static variables be accessed by static methods?

Was it helpful?

Solution

It was a bug. Quote directly from the bug ticket: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4851466

setDefaultUseCaches() should have been made static, but it can't be changed now without impacting binary compatibility. The effect of it being non static is just that you need to create an instance before invoking it, which is not such a severe problem. In other words, there is not sufficient justification for adding a new static method that does it exactly the right way. So we will not be able to fix this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top