harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r417096 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util: AbstractCollection.java AbstractMap.java ArrayList.java Arrays.java
Date Mon, 26 Jun 2006 00:31:31 GMT
Author: ndbeyer
Date: Sun Jun 25 17:31:30 2006
New Revision: 417096

URL: http://svn.apache.org/viewvc?rev=417096&view=rev
Log:
Add SupressWarnings annotations for unchecked elements.

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractCollection.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractMap.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractCollection.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractCollection.java?rev=417096&r1=417095&r2=417096&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractCollection.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractCollection.java
Sun Jun 25 17:31:30 2006
@@ -249,7 +249,8 @@
 	 *                when the type of an element in this Collection cannot be
 	 *                stored in the type of the specified array
 	 */
-	public <T> T[] toArray(T[] contents) {
+	@SuppressWarnings("unchecked")
+    public <T> T[] toArray(T[] contents) {
 		int size = size(), index = 0;
 		if (size > contents.length) {
             Class<?> ct = contents.getClass().getComponentType();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractMap.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractMap.java?rev=417096&r1=417095&r2=417096&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractMap.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/AbstractMap.java
Sun Jun 25 17:31:30 2006
@@ -409,6 +409,7 @@
      *                if the receiver's class does not implement the interface
      *                Cloneable.
      */
+    @SuppressWarnings("unchecked")
     protected Object clone() throws CloneNotSupportedException {
         AbstractMap<K, V> result = (AbstractMap<K, V>) super.clone();
         result.keySet = null;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java?rev=417096&r1=417095&r2=417096&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ArrayList.java
Sun Jun 25 17:31:30 2006
@@ -76,8 +76,7 @@
 		addAll(collection);
 	}
     
-    //TODO Remove comment when annotations are available
-    //@SuppressWarnings("unused")
+    @SuppressWarnings("unchecked")
     private E[] newElementArray(int size) {
         return (E[])new Object[size];
     }
@@ -245,7 +244,8 @@
 	 * 
 	 * @see java.lang.Cloneable
 	 */
-	public Object clone() {
+	@SuppressWarnings("unchecked")
+    public Object clone() {
 		try {
 			ArrayList<E> newList = (ArrayList<E>) super.clone();
 			newList.array = (E[]) array.clone();
@@ -573,7 +573,8 @@
 	 *                when the type of an element in this ArrayList cannot be
 	 *                stored in the type of the specified array
 	 */
-	public <T> T[] toArray(T[] contents) {
+	@SuppressWarnings("unchecked")
+    public <T> T[] toArray(T[] contents) {
 		int size = size();
 		if (size > contents.length) {
             Class<?> ct = contents.getClass().getComponentType();
@@ -612,7 +613,8 @@
 			stream.writeObject(it.next());
 	}
 
-	private void readObject(ObjectInputStream stream) throws IOException,
+	@SuppressWarnings("unchecked")
+    private void readObject(ObjectInputStream stream) throws IOException,
 			ClassNotFoundException {
 		ObjectInputStream.GetField fields = stream.readFields();
 		lastIndex = fields.get("size", 0); //$NON-NLS-1$

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java?rev=417096&r1=417095&r2=417096&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Arrays.java
Sun Jun 25 17:31:30 2006
@@ -118,11 +118,12 @@
             return a.clone();
         }
 
+        @SuppressWarnings("unchecked")
         public <T> T[] toArray(T[] contents) {
             int size = size();
             if (size > contents.length) {
-                contents = (T[]) Array.newInstance(contents.getClass()
-                        .getComponentType(), size);
+                Class<?> ct = contents.getClass().getComponentType();
+                contents = (T[]) Array.newInstance(ct, size);
             }
             System.arraycopy(a, 0, contents, 0, size);
             if (size < contents.length) {



Mime
View raw message