src/share/classes/javax/naming/directory/BasicAttribute.java

Print this page

        

@@ -89,18 +89,19 @@
      * A flag for recording whether this attribute's values are ordered.
      * @serial
      */
     protected boolean ordered = false;
 
+    @SuppressWarnings("unchecked")
     public Object clone() {
         BasicAttribute attr;
         try {
             attr = (BasicAttribute)super.clone();
         } catch (CloneNotSupportedException e) {
             attr = new BasicAttribute(attrID, ordered);
         }
-        attr.values = (Vector)values.clone();
+        attr.values = (Vector<Object>)values.clone();
         return attr;
     }
 
     /**
       * Determines whether obj is equal to this attribute.

@@ -147,11 +148,11 @@
                                 return false;
                             }
                         }
                     } else {
                         // order is not relevant; check for existence
-                        Enumeration theirs = target.getAll();
+                        Enumeration<?> theirs = target.getAll();
                         while (theirs.hasMoreElements()) {
                             if (find(theirs.nextElement()) < 0)
                                 return false;
                         }
                     }

@@ -213,11 +214,11 @@
         StringBuffer answer = new StringBuffer(attrID + ": ");
         if (values.size() == 0) {
             answer.append("No values");
         } else {
             boolean start = true;
-            for (Enumeration e = values.elements(); e.hasMoreElements(); ) {
+            for (Enumeration<Object> e = values.elements(); e.hasMoreElements(); ) {
                 if (!start)
                     answer.append(", ");
                 answer.append(e.nextElement());
                 start = false;
             }

@@ -252,11 +253,11 @@
       * @param ordered true means the attribute's values will be ordered;
       * false otherwise.
       */
     public BasicAttribute(String id, boolean ordered) {
         attrID = id;
-        values = new Vector();
+        values = new Vector<>();
         this.ordered = ordered;
     }
 
     /**
       * Constructs a new instance of a possibly ordered attribute with a

@@ -325,11 +326,11 @@
     }
 
     // For finding first element that has a null in JDK1.1 Vector.
     // In the Java 2 platform, can just replace this with Vector.indexOf(target);
     private int find(Object target) {
-        Class cl;
+        Class<?> cl;
         if (target == null) {
             int ct = values.size();
             for (int i = 0 ; i < ct ; i++) {
                 if (values.elementAt(i) == null)
                     return i;

@@ -512,19 +513,19 @@
      */
     private void readObject(java.io.ObjectInputStream s)
             throws java.io.IOException, ClassNotFoundException {
         s.defaultReadObject();  // read in the attrID
         int n = s.readInt();    // number of values
-        values = new Vector(n);
+        values = new Vector<>(n);
         while (--n >= 0) {
             values.addElement(s.readObject());
         }
     }
 
 
     class ValuesEnumImpl implements NamingEnumeration<Object> {
-    Enumeration list;
+    Enumeration<Object> list;
 
     ValuesEnumImpl() {
         list = values.elements();
     }