8055059: JDK9b22 public API exposes package private classes
authordarcy
Mon, 12 Jan 2015 11:46:43 -0800
changeset 28976 8c912c147654
parent 28975 a492b5c5dc53
child 28977 d7609b65606b
8055059: JDK9b22 public API exposes package private classes Reviewed-by: serb, prr, alexsch
jdk/src/java.desktop/share/classes/javax/swing/text/GapContent.java
jdk/src/java.desktop/share/classes/javax/swing/text/StringContent.java
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/GapContent.java	Mon Jan 12 16:26:58 2015 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/GapContent.java	Mon Jan 12 11:46:43 2015 -0800
@@ -710,8 +710,9 @@
      * @param length the length >= 0
      * @return the set of instances
      */
-    protected Vector<UndoPosRef> getPositionsInRange(Vector<UndoPosRef> v,
-                                                     int offset, int length) {
+    @SuppressWarnings({"rawtypes", "unchecked"}) // UndoPosRef type cannot be exposed
+    protected Vector getPositionsInRange(Vector v,
+                                         int offset, int length) {
         int endOffset = offset + length;
         int startIndex;
         int endIndex;
@@ -758,7 +759,8 @@
      *
      * @param positions the UndoPosRef instances to reset
      */
-    protected void updateUndoPositions(Vector<UndoPosRef> positions, int offset,
+    @SuppressWarnings("rawtypes") // UndoPosRef type cannot be exposed
+    protected void updateUndoPositions(Vector positions, int offset,
                                        int length) {
         // Find the indexs of the end points.
         int endOffset = offset + length;
@@ -775,7 +777,7 @@
 
         // Reset the location of the refenences.
         for(int counter = positions.size() - 1; counter >= 0; counter--) {
-            UndoPosRef ref = positions.elementAt(counter);
+            UndoPosRef ref = (UndoPosRef) positions.elementAt(counter);
             ref.resetLocation(endOffset, g1);
         }
         // We have to resort the marks in the range startIndex to endIndex.
@@ -902,7 +904,8 @@
         protected String string;
         /** An array of instances of UndoPosRef for the Positions in the
          * range that was removed, valid after undo. */
-        protected Vector<UndoPosRef> posRefs;
+        @SuppressWarnings("rawtypes") // UndoPosRef type cannot be exposed
+        protected Vector posRefs;
     } // GapContent.InsertUndo
 
 
@@ -911,6 +914,7 @@
      */
     @SuppressWarnings("serial") // JDK-implementation class
     class RemoveUndo extends AbstractUndoableEdit {
+        @SuppressWarnings("unchecked")
         protected RemoveUndo(int offset, String string) {
             super();
             this.offset = offset;
@@ -934,6 +938,7 @@
             }
         }
 
+        @SuppressWarnings("unchecked")
         public void redo() throws CannotRedoException {
             super.redo();
             try {
--- a/jdk/src/java.desktop/share/classes/javax/swing/text/StringContent.java	Mon Jan 12 16:26:58 2015 +0300
+++ b/jdk/src/java.desktop/share/classes/javax/swing/text/StringContent.java	Mon Jan 12 11:46:43 2015 -0800
@@ -271,11 +271,12 @@
      * @param length the length &gt;= 0
      * @return the set of instances
      */
-    protected Vector<UndoPosRef> getPositionsInRange(Vector<UndoPosRef> v, int offset,
-                                                      int length) {
+    @SuppressWarnings({"rawtypes", "unchecked"}) // UndoPosRef type cannot be exposed
+    protected Vector getPositionsInRange(Vector v, int offset,
+                                         int length) {
         int n = marks.size();
         int end = offset + length;
-        Vector<UndoPosRef> placeIn = (v == null) ? new Vector<>() : v;
+        Vector placeIn = (v == null) ? new Vector() : v;
         for (int i = 0; i < n; i++) {
             PosRec mark = marks.elementAt(i);
             if (mark.unused) {
@@ -298,9 +299,10 @@
      *
      * @param positions the positions of the instances
      */
-    protected void updateUndoPositions(Vector<UndoPosRef> positions) {
+    @SuppressWarnings("rawtypes") // UndoPosRef type cannot be exposed
+    protected void updateUndoPositions(Vector positions) {
         for(int counter = positions.size() - 1; counter >= 0; counter--) {
-            UndoPosRef ref = positions.elementAt(counter);
+            UndoPosRef ref = (UndoPosRef) positions.elementAt(counter);
             // Check if the Position is still valid.
             if(ref.rec.unused) {
                 positions.removeElementAt(counter);
@@ -437,7 +439,8 @@
         protected String string;
         // An array of instances of UndoPosRef for the Positions in the
         // range that was removed, valid after undo.
-        protected Vector<UndoPosRef> posRefs;
+        @SuppressWarnings("rawtypes") // UndoPosRef type cannot be exposed
+        protected Vector posRefs;
     }
 
 
@@ -445,6 +448,7 @@
      * UndoableEdit created for removes.
      */
     class RemoveUndo extends AbstractUndoableEdit {
+        @SuppressWarnings("unchecked")
         protected RemoveUndo(int offset, String string) {
             super();
             this.offset = offset;
@@ -471,6 +475,7 @@
             }
         }
 
+        @SuppressWarnings("unchecked")
         public void redo() throws CannotRedoException {
             super.redo();
             try {