< prev index next >

src/java.desktop/share/classes/javax/swing/text/GapContent.java

Print this page

        

@@ -708,11 +708,12 @@
      * @param v the Vector to use, with a new one created on null
      * @param offset the starting offset &gt;= 0
      * @param length the length &gt;= 0
      * @return the set of instances
      */
-    protected Vector<UndoPosRef> getPositionsInRange(Vector<UndoPosRef> v,
+    @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;
         int g0 = getGapStart();

@@ -756,11 +757,12 @@
      * This is meant for internal usage, and is generally not of interest
      * to subclasses.
      *
      * @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;
         int g1 = getGapEnd();
         int startIndex;

@@ -773,11 +775,11 @@
             startIndex = 0;
         }
 
         // 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.
         // We can take advantage of the fact that it will be in
         // increasing order, accept there will be a bunch of MarkData's with

@@ -900,19 +902,21 @@
         /** The string that was inserted. This will only be valid after an
          * undo. */
         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
 
 
     /**
      * UndoableEdit created for removes.
      */
     @SuppressWarnings("serial") // JDK-implementation class
     class RemoveUndo extends AbstractUndoableEdit {
+        @SuppressWarnings("unchecked")
         protected RemoveUndo(int offset, String string) {
             super();
             this.offset = offset;
             this.string = string;
             this.length = string.length();

@@ -932,10 +936,11 @@
             } catch (BadLocationException bl) {
               throw new CannotUndoException();
             }
         }
 
+        @SuppressWarnings("unchecked")
         public void redo() throws CannotRedoException {
             super.redo();
             try {
                 string = getString(offset, length);
                 // Get the Positions in the range being removed.
< prev index next >