JDK-8022449 : Can we get rid of sun.misc.SoftCache?
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7,8,9
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2013-08-06
  • Updated: 2018-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
When generifying SoftCache I discovered two potential type problems in it: I don't think it has worked properly ever. There appears to be only one place in the entire JDK where this class is used: sun.awt.SunToolKit. 

If this could be replaced by say just a WeakHashMap or equivalent with SoftReferences we could be able to get rid of more than 440 lines of SoftCache implementation in sun.misc, which currently is the root of most warnings in said package.
Comments
8154539 relocated SoftCache to the java.desktop module as sun.awt.SoftCache So sun.misc no longer has to worry about the 440 lines of code. So I think we can defer this to another release.
20-05-2016

May be it is better to replace the SoftCache by sun.awt.image.ImageCache.
10-05-2016

Added started generification effort. I've found two inconsistensies so far: ValueCell and V are used interchangibly as Object in one function. Entries, which seem to be meant to hold value calls get values (V) instead in the iterator
06-08-2013