JDK-6800516 : sun.java2d.pipe.Region should be immutable
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6u14
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: generic
  • CPU: generic
  • Submitted: 2009-02-03
  • Updated: 2018-09-05
Related Reports
Relates :  
Description
Fixing 6797587, it was discovered that the Region instances should be immutable. As a temporary solution there was introduced a private static inner class Region.ImmutableRegion for two constant regions declared in the class (EMPTY_REGION and WHOLE_REGION). However, it seems that all the methods that may mutate the object should be private, since mutation is appropriate whithin the factory methods Region.getInstance() only.

There's currently only one location where the mutation happens outside of the object: sun.java2d.SunGraphics2D.validateCompClip(). The code should be slightly factored to enable using immutable regions.