Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8283891

Add final or sealed modifier to appropriate java.awt.color ICC_Profile API classes

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 19
    • client-libs
    • None
    • 2d
    • source, binary
    • low
    • Hide
      If someone has circumvented package protections to subclass these, then they may no longer be able to do so. However the JDK now enforces strong encapsulation of JDK module internals, so this is not possible anyway without additional steps.

      The compatibility risk is both source and binary since as well as compile time checking of this, the VM enforces it at runtime.
      Show
      If someone has circumvented package protections to subclass these, then they may no longer be able to do so. However the JDK now enforces strong encapsulation of JDK module internals, so this is not possible anyway without additional steps. The compatibility risk is both source and binary since as well as compile time checking of this, the VM enforces it at runtime.
    • Java API
    • SE

      Summary

      Make ICC_Profile API classes sealed or final to indicate application subclassing is not possible.

      Problem

      It is not possible for applications to sub-class ICC_Profile classes since they have no public or protected constructors. This could be made more clear by using sealed and final modifiers

      Solution

      Apply the sealed modifier to the ICC_Profile class listing its only extant subclasses and mark those subclasses final.

      Specification

      java.awt.color.ICC_Profile

      -public class ICC_Profile implements Serializable 
      +public sealed class ICC_Profile implements Serializable
      +    permits ICC_ProfileGray,
      +            ICC_ProfileRGB 
      

      java.awt.color.ICC_ProfileGray

      -public class ICC_ProfileGray extends ICC_Profile 
      +public final class ICC_ProfileGray extends ICC_Profile 
      

      java.awt.color.ICC_ProfileRGB

      -public class ICC_ProfileRGB extends ICC_Profile 
      +public final class ICC_ProfileRGB extends ICC_Profile 
      

            prr Philip Race
            prr Philip Race
            Alexey Ivanov, Brian Burkhalter, Sergey Bylokhov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: