<Swing Dev> JDK 9 RFR of JDK-8055059: JDK9b22 public API exposes package private classes

joe darcy joe.darcy at oracle.com
Wed Dec 3 18:52:08 UTC 2014


Hi Petr,

On 11/25/2014 12:50 AM, Petr Pchelko wrote:
> Hello, Joe.
>
> The fix looks good.
>
> With best regards. Petr.

Thanks for the review. While I wouldn't mind pushing this version, Phil 
and Anthony previously raised concerns that these types shouldn't be 
exposed at all:

http://mail.openjdk.java.net/pipermail/swing-dev/2014-August/003829.html
http://mail.openjdk.java.net/pipermail/swing-dev/2014-August/003830.html

I haven't gotten around to preparing an alternate version using raw 
types, but I intend to do so.

Cheers,

-Joe

>
> On 19 авг. 2014 г., at 5:33, Joe Darcy <joe.darcy at oracle.com> wrote:
>
>> Hello,
>>
>> Please review my proposed changes to address:
>>
>>     JDK-8055059: JDK9b22 public API exposes package private classes
>>     http://cr.openjdk.java.net/~darcy/8055059.0/
>>
>> Bug JDK-8055059 that the generification of swing added package-private types to the signatures of several protected methods. The solution is to the make the formerly package-private types also be protected.
>>
>> Patch below.
>>
>> Thanks,
>>
>> -Joe
>>
>> --- old/src/share/classes/javax/swing/text/GapContent.java 2014-08-18 18:27:50.000000000 -0700
>> +++ new/src/share/classes/javax/swing/text/GapContent.java 2014-08-18 18:27:49.000000000 -0700
>> @@ -826,7 +826,7 @@
>>       * Used to hold a reference to a Mark that is being reset as the
>>       * result of removing from the content.
>>       */
>> -    final class UndoPosRef {
>> +    protected final class UndoPosRef {
>>          UndoPosRef(MarkData rec) {
>>              this.rec = rec;
>>              this.undoLocation = rec.getOffset();
>> @@ -839,7 +839,7 @@
>>           * @param endOffset end location of inserted string.
>>           * @param g1 resulting end of gap.
>>           */
>> -        protected void resetLocation(int endOffset, int g1) {
>> +        void resetLocation(int endOffset, int g1) {
>>              if (undoLocation != endOffset) {
>>                  this.rec.index = undoLocation;
>>              }
>> @@ -849,9 +849,9 @@
>>          }
>>
>>          /** Previous Offset of rec. */
>> -        protected int undoLocation;
>> +        private int undoLocation;
>>          /** Mark to reset offset. */
>> -        protected MarkData rec;
>> +        private MarkData rec;
>>      } // End of GapContent.UndoPosRef
>>
>>
>> --- old/src/share/classes/javax/swing/text/StringContent.java 2014-08-18 18:27:50.000000000 -0700
>> +++ new/src/share/classes/javax/swing/text/StringContent.java 2014-08-18 18:27:50.000000000 -0700
>> @@ -366,7 +366,7 @@
>>       * Used to hold a reference to a Position that is being reset as the
>>       * result of removing from the content.
>>       */
>> -    final class UndoPosRef {
>> +    protected final class UndoPosRef {
>>          UndoPosRef(PosRec rec) {
>>              this.rec = rec;
>>              this.undoLocation = rec.offset;
>> @@ -376,14 +376,14 @@
>>           * Resets the location of the Position to the offset when the
>>           * receiver was instantiated.
>>           */
>> -        protected void resetLocation() {
>> +        void resetLocation() {
>>              rec.offset = undoLocation;
>>          }
>>
>>          /** Location to reset to when resetLocatino is invoked. */
>> -        protected int undoLocation;
>> +        private int undoLocation;
>>          /** Position to reset offset. */
>> -        protected PosRec rec;
>> +        private PosRec rec;
>>      }
>>
>>      /**
>>




More information about the swing-dev mailing list