]> granicus.if.org Git - icu/commitdiff
ICU-11918 Fixed compiler warnings.
authorYoshito Umaoka <y.umaoka@gmail.com>
Tue, 22 Sep 2015 00:32:25 +0000 (00:32 +0000)
committerYoshito Umaoka <y.umaoka@gmail.com>
Tue, 22 Sep 2015 00:32:25 +0000 (00:32 +0000)
X-SVN-Rev: 37977

icu4j/main/classes/collate/src/com/ibm/icu/impl/coll/CollationTailoring.java
icu4j/main/classes/core/build.properties
icu4j/main/classes/core/src/com/ibm/icu/impl/Relation.java
icu4j/main/classes/core/src/com/ibm/icu/text/UCharacterIterator.java
icu4j/main/tests/core/src/com/ibm/icu/dev/test/util/LocaleMatcherTest.java
icu4j/tools/build/src/com/ibm/icu/dev/tool/docs/ICUTagletAdapter.java

index 583c4b7fdfde97a0ddfbeb11a32082bdac6c78fe..b46b5194e3bf7bd091aa241f6d5dfa232abc538c 100644 (file)
@@ -12,7 +12,6 @@
 package com.ibm.icu.impl.coll;
 
 import java.util.Map;
-import java.util.MissingResourceException;
 
 import com.ibm.icu.impl.Norm2AllModes;
 import com.ibm.icu.impl.Normalizer2Impl;
index f72f4c4ce45e5e9027827d4ae2aa01049135a6ef..935b89e19d1cd7e62da0bc4fbd138fe04b2673d5 100644 (file)
@@ -1,6 +1,6 @@
 #*******************************************************************************
-#* Copyright (C) 2009-2012, International Business Machines Corporation and    *
+#* Copyright (C) 2009-2015, International Business Machines Corporation and    *
 #* others. All Rights Reserved.                                                *
 #*******************************************************************************
 shared.dir = ../../shared
-javac.compilerarg = -Xlint:all,-deprecation,-dep-ann,-options
+javac.compilerarg = -Xlint:all,-deprecation,-dep-ann,-options,-overrides
index 657d993ff480f71c9df228ef8662c0b4325aea3b..b12446e292b991a9a7d6df0bcc60d9bff186c69b 100644 (file)
@@ -31,32 +31,33 @@ import com.ibm.icu.util.Freezable;
 public class Relation<K, V> implements Freezable<Relation<K,V>> { // TODO: add , Map<K, Collection<V>>, but requires API changes
     private Map<K, Set<V>> data;
 
-    Constructor<Set<V>> setCreator;
+    Constructor<? extends Set<V>> setCreator;
     Object[] setComparatorParam;
 
-    public static <K,V> Relation<K, V> of(Map<K, Set<V>> map, Class<?> setCreator) {
-        return new Relation(map, setCreator);
+    public static <K, V> Relation<K, V> of(Map<K, Set<V>> map, Class<?> setCreator) {
+        return new Relation<K, V>(map, setCreator);
     }
 
-    public static <K,V> Relation<K, V> of(Map<K, Set<V>> map, Class setCreator, Comparator<V> setComparator) {
-        return new Relation(map, setCreator, setComparator);
+    public static <K,V> Relation<K, V> of(Map<K, Set<V>> map, Class<?> setCreator, Comparator<V> setComparator) {
+        return new Relation<K, V>(map, setCreator, setComparator);
     }
 
-    public Relation(Map<K, Set<V>> map, Class<Set<V>> setCreator) {
+    public Relation(Map<K, Set<V>> map, Class<?> setCreator) {
         this(map, setCreator, null);
     }
 
-    public Relation(Map<K, Set<V>> map, Class<Set<V>> setCreator, Comparator<V> setComparator) {
+    @SuppressWarnings("unchecked")
+    public Relation(Map<K, Set<V>> map, Class<?> setCreator, Comparator<V> setComparator) {
         try {
             setComparatorParam = setComparator == null ? null : new Object[]{setComparator};
             if (setComparator == null) {
-                this.setCreator = setCreator.getConstructor();
+                this.setCreator = ((Class<? extends Set<V>>)setCreator).getConstructor();
                 this.setCreator.newInstance(setComparatorParam); // check to make sure compiles
             } else {
-                this.setCreator = setCreator.getConstructor(Comparator.class);
+                this.setCreator = ((Class<? extends Set<V>>)setCreator).getConstructor(Comparator.class);
                 this.setCreator.newInstance(setComparatorParam); // check to make sure compiles        
             }
-            data = map == null ? new HashMap() : map;     
+            data = map == null ? new HashMap<K, Set<V>>() : map;
         } catch (Exception e) {
             throw (RuntimeException) new IllegalArgumentException("Can't create new set").initCause(e);
         }
@@ -88,10 +89,10 @@ public class Relation<K, V> implements Freezable<Relation<K,V>> { // TODO: add ,
     }
     
     public Set<Entry<K, V>> keyValueSet() {
-        Set<Entry<K, V>> result = new LinkedHashSet();
+        Set<Entry<K, V>> result = new LinkedHashSet<Entry<K, V>>();
         for (K key : data.keySet()) {
             for (V value : data.get(key)) {
-                result.add(new SimpleEntry(key, value));
+                result.add(new SimpleEntry<K, V>(key, value));
             }
         }
         return result;
@@ -102,7 +103,7 @@ public class Relation<K, V> implements Freezable<Relation<K,V>> { // TODO: add ,
             return false;
         if (o.getClass() != this.getClass())
             return false;
-        return data.equals(((Relation) o).data);
+        return data.equals(((Relation<?, ?>) o).data);
     }
 
     //  public V get(Object key) {
@@ -209,7 +210,7 @@ public class Relation<K, V> implements Freezable<Relation<K,V>> { // TODO: add ,
     }
 
     public Set<V> values() {
-        return values(new LinkedHashSet());
+        return values(new LinkedHashSet<V>());
     }
 
     public <C extends Collection<V>> C values(C result) {
@@ -321,7 +322,7 @@ public class Relation<K, V> implements Freezable<Relation<K,V>> { // TODO: add ,
     }
 
     public Set<V> removeAll(Collection<K> toBeRemoved) {
-        Set<V> result = new LinkedHashSet();
+        Set<V> result = new LinkedHashSet<V>();
         for (K key : toBeRemoved) {
             try {
                 final Set<V> removals = data.remove(key);
index c3b46406c67f1d83b7cf5f5c7cdff9243f81fa9a..24ad7788fc78ab327476e428467f0dd9231cb6a5 100644 (file)
@@ -13,7 +13,6 @@ import com.ibm.icu.impl.CharacterIteratorWrapper;
 import com.ibm.icu.impl.ReplaceableUCharacterIterator;
 import com.ibm.icu.impl.UCharArrayIterator;
 import com.ibm.icu.impl.UCharacterIteratorWrapper;
-import com.ibm.icu.impl.UCharacterProperty;
 
 
 /**
index 2634a580f2abb3c33eef50fd9256a5d2dad50595..35743493d5320ef375e93d9c01fa15935f99cbee 100644 (file)
@@ -579,7 +579,9 @@ public class LocaleMatcherTest extends TestFmwk {
             int iterations = i == 0 ? 1000 : 100000;
             boolean showMessage = i != 0;
             long timeShort = timeLocaleMatcher("Duration (few  supported):\t", desired, matcherShort, showMessage, iterations, 0);
+            @SuppressWarnings("unused")
             long timeMedium = timeLocaleMatcher("Duration (med. supported):\t", desired, matcherLong, showMessage, iterations, timeShort);
+            @SuppressWarnings("unused")
             long timeLong = timeLocaleMatcher("Duration (many supported):\t", desired, matcherVeryLong, showMessage, iterations, timeShort);
         }
     }
index f2d5bc1d9d0848867a296e89748eead69a653265..9e02ce738a6a262750428c5700522303f9799158 100644 (file)
@@ -8,51 +8,40 @@ package com.ibm.icu.dev.tool.docs;
 
 import com.sun.javadoc.Doc;
 import com.sun.javadoc.Tag;
-import com.sun.tools.doclets.formats.html.markup.RawHtml;
-import com.sun.tools.doclets.internal.toolkit.Content;
 import com.sun.tools.doclets.internal.toolkit.taglets.Taglet;
+import com.sun.tools.doclets.internal.toolkit.taglets.TagletOutput;
 import com.sun.tools.doclets.internal.toolkit.taglets.TagletWriter;
 
 /**
  * The ICUTagletAdapter class is the abstract base class that adapts the ICUTaglet class to different implementations of the JavaDoc API. 
  * The methods in this class are meant to minimize the dual maintenance nature of supporting multiple JavaDoc APIs.
  * 
- * This adapter supports the v8 JavaDoc API
+ * This adapter supports the v7 and earlier JavaDoc API
  */
 public abstract class ICUTagletAdapter implements Taglet {
-    
+
     public abstract String toString(Tag tag);
 
     public abstract String toString(Tag[] tags);
 
-    public Content getTagletOutput(Tag tag, TagletWriter writer)
-        throws IllegalArgumentException {
-
-        // addContext doesn't except nulls so filter them out
-        String encodedText = toString(tag);
-        if(encodedText == null) return null;
-           
-        Content out = writer.getOutputInstance();
-        out.addContent(new RawHtml(encodedText));
-         
-        return out;
-    }
-
-    public Content getTagletOutput(Doc holder, TagletWriter writer)
-        throws IllegalArgumentException {
-
-        Content out = writer.getOutputInstance();
-        Tag[] tags = holder.tags(getName());
-        if (tags.length == 0) {
-            return null;
+    public TagletOutput getTagletOutput(Tag tag, TagletWriter writer)
+            throws IllegalArgumentException {
+
+            TagletOutput out = writer.getTagletOutputInstance();
+            out.setOutput(toString(tag));
+            return out;
         }
 
-        // addContext doesn't except nulls so filter them out
-        String encodedText = toString(tags[0]);
-        if(encodedText == null) return null;
+        public TagletOutput getTagletOutput(Doc holder, TagletWriter writer)
+            throws IllegalArgumentException {
 
-        out.addContent(new RawHtml(encodedText));
-        return out;
-    }
+            TagletOutput out = writer.getTagletOutputInstance();
+            Tag[] tags = holder.tags(getName());
+            if (tags.length == 0) {
+                return null;
+            }
+            out.setOutput(toString(tags[0]));
+            return out;
+        }
 
 }