7193406: Clean-up JDK Build Warnings in java.util, java.io
Clean-up JDK Build Warnings in java.util, java.io Packages Reviewed-by: smarks, darcy, khazra, dholmes, forax, dl, andrew, aph, omajid, ulfzibis, christos, mduigou
This commit is contained in:
parent
366a5c5175
commit
b6bee3c9e9
@ -883,7 +883,7 @@ class PackageWriter extends BandStructure {
|
|||||||
avHiBits &= (1L<<attrIndexLimit[i])-1;
|
avHiBits &= (1L<<attrIndexLimit[i])-1;
|
||||||
int nextLoBit = 0;
|
int nextLoBit = 0;
|
||||||
Map<Attribute.Layout, int[]> defMap = allLayouts.get(i);
|
Map<Attribute.Layout, int[]> defMap = allLayouts.get(i);
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
Map.Entry<Attribute.Layout, int[]>[] layoutsAndCounts =
|
Map.Entry<Attribute.Layout, int[]>[] layoutsAndCounts =
|
||||||
new Map.Entry[defMap.size()];
|
new Map.Entry[defMap.size()];
|
||||||
defMap.entrySet().toArray(layoutsAndCounts);
|
defMap.entrySet().toArray(layoutsAndCounts);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -31,10 +31,6 @@ import java.util.List;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.io.ObjectStreamField;
|
|
||||||
import java.io.ObjectOutputStream;
|
|
||||||
import java.io.ObjectInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import sun.security.util.SecurityConstants;
|
import sun.security.util.SecurityConstants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -424,7 +420,7 @@ public final class FilePermission extends Permission implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* Converts an actions String to an actions mask.
|
* Converts an actions String to an actions mask.
|
||||||
*
|
*
|
||||||
* @param action the action string.
|
* @param actions the action string.
|
||||||
* @return the actions mask.
|
* @return the actions mask.
|
||||||
*/
|
*/
|
||||||
private static int getMask(String actions) {
|
private static int getMask(String actions) {
|
||||||
@ -435,7 +431,9 @@ public final class FilePermission extends Permission implements Serializable {
|
|||||||
if (actions == null) {
|
if (actions == null) {
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
// Check against use of constants (used heavily within the JDK)
|
|
||||||
|
// Use object identity comparison against known-interned strings for
|
||||||
|
// performance benefit (these values are used heavily within the JDK).
|
||||||
if (actions == SecurityConstants.FILE_READ_ACTION) {
|
if (actions == SecurityConstants.FILE_READ_ACTION) {
|
||||||
return READ;
|
return READ;
|
||||||
} else if (actions == SecurityConstants.FILE_WRITE_ACTION) {
|
} else if (actions == SecurityConstants.FILE_WRITE_ACTION) {
|
||||||
@ -531,7 +529,7 @@ public final class FilePermission extends Permission implements Serializable {
|
|||||||
switch(a[i-matchlen]) {
|
switch(a[i-matchlen]) {
|
||||||
case ',':
|
case ',':
|
||||||
seencomma = true;
|
seencomma = true;
|
||||||
/*FALLTHROUGH*/
|
break;
|
||||||
case ' ': case '\r': case '\n':
|
case ' ': case '\r': case '\n':
|
||||||
case '\f': case '\t':
|
case '\f': case '\t':
|
||||||
break;
|
break;
|
||||||
@ -798,7 +796,7 @@ implements Serializable {
|
|||||||
* @return an enumeration of all the FilePermission objects.
|
* @return an enumeration of all the FilePermission objects.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public Enumeration elements() {
|
public Enumeration<Permission> elements() {
|
||||||
// Convert Iterator into Enumeration
|
// Convert Iterator into Enumeration
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
return Collections.enumeration(perms);
|
return Collections.enumeration(perms);
|
||||||
@ -843,7 +841,6 @@ implements Serializable {
|
|||||||
/*
|
/*
|
||||||
* Reads in a Vector of FilePermissions and saves them in the perms field.
|
* Reads in a Vector of FilePermissions and saves them in the perms field.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private void readObject(ObjectInputStream in) throws IOException,
|
private void readObject(ObjectInputStream in) throws IOException,
|
||||||
ClassNotFoundException {
|
ClassNotFoundException {
|
||||||
// Don't call defaultReadObject()
|
// Don't call defaultReadObject()
|
||||||
@ -852,6 +849,7 @@ implements Serializable {
|
|||||||
ObjectInputStream.GetField gfields = in.readFields();
|
ObjectInputStream.GetField gfields = in.readFields();
|
||||||
|
|
||||||
// Get the one we want
|
// Get the one we want
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
Vector<Permission> permissions = (Vector<Permission>)gfields.get("permissions", null);
|
Vector<Permission> permissions = (Vector<Permission>)gfields.get("permissions", null);
|
||||||
perms = new ArrayList<>(permissions.size());
|
perms = new ArrayList<>(permissions.size());
|
||||||
perms.addAll(permissions);
|
perms.addAll(permissions);
|
||||||
|
@ -182,7 +182,7 @@ public final class Constructor<T> extends Executable {
|
|||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public TypeVariable<Constructor<T>>[] getTypeParameters() {
|
public TypeVariable<Constructor<T>>[] getTypeParameters() {
|
||||||
if (getSignature() != null) {
|
if (getSignature() != null) {
|
||||||
return (TypeVariable<Constructor<T>>[])getGenericInfo().getTypeParameters();
|
return (TypeVariable<Constructor<T>>[])getGenericInfo().getTypeParameters();
|
||||||
|
@ -194,7 +194,7 @@ public final class Method extends Executable {
|
|||||||
* @since 1.5
|
* @since 1.5
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public TypeVariable<Method>[] getTypeParameters() {
|
public TypeVariable<Method>[] getTypeParameters() {
|
||||||
if (getGenericSignature() != null)
|
if (getGenericSignature() != null)
|
||||||
return (TypeVariable<Method>[])getGenericInfo().getTypeParameters();
|
return (TypeVariable<Method>[])getGenericInfo().getTypeParameters();
|
||||||
|
@ -467,7 +467,6 @@ implements java.io.Serializable
|
|||||||
* @param action the action string
|
* @param action the action string
|
||||||
* @return the action mask
|
* @return the action mask
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("fallthrough")
|
|
||||||
private static int getMask(String action) {
|
private static int getMask(String action) {
|
||||||
|
|
||||||
if (action == null) {
|
if (action == null) {
|
||||||
@ -480,7 +479,8 @@ implements java.io.Serializable
|
|||||||
|
|
||||||
int mask = NONE;
|
int mask = NONE;
|
||||||
|
|
||||||
// Check against use of constants (used heavily within the JDK)
|
// Use object identity comparison against known-interned strings for
|
||||||
|
// performance benefit (these values are used heavily within the JDK).
|
||||||
if (action == SecurityConstants.SOCKET_RESOLVE_ACTION) {
|
if (action == SecurityConstants.SOCKET_RESOLVE_ACTION) {
|
||||||
return RESOLVE;
|
return RESOLVE;
|
||||||
} else if (action == SecurityConstants.SOCKET_CONNECT_ACTION) {
|
} else if (action == SecurityConstants.SOCKET_CONNECT_ACTION) {
|
||||||
@ -568,7 +568,7 @@ implements java.io.Serializable
|
|||||||
switch(a[i-matchlen]) {
|
switch(a[i-matchlen]) {
|
||||||
case ',':
|
case ',':
|
||||||
seencomma = true;
|
seencomma = true;
|
||||||
/*FALLTHROUGH*/
|
break;
|
||||||
case ' ': case '\r': case '\n':
|
case ' ': case '\r': case '\n':
|
||||||
case '\f': case '\t':
|
case '\f': case '\t':
|
||||||
break;
|
break;
|
||||||
|
@ -248,7 +248,7 @@ public abstract class AsynchronousFileChannel
|
|||||||
return provider.newAsynchronousFileChannel(file, options, executor, attrs);
|
return provider.newAsynchronousFileChannel(file, options, executor, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" }) // generic array construction
|
@SuppressWarnings({"unchecked", "rawtypes"}) // generic array construction
|
||||||
private static final FileAttribute<?>[] NO_ATTRIBUTES = new FileAttribute[0];
|
private static final FileAttribute<?>[] NO_ATTRIBUTES = new FileAttribute[0];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -287,7 +287,7 @@ public abstract class FileChannel
|
|||||||
return provider.newFileChannel(path, options, attrs);
|
return provider.newFileChannel(path, options, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" }) // generic array construction
|
@SuppressWarnings({"unchecked", "rawtypes"}) // generic array construction
|
||||||
private static final FileAttribute<?>[] NO_ATTRIBUTES = new FileAttribute[0];
|
private static final FileAttribute<?>[] NO_ATTRIBUTES = new FileAttribute[0];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,6 +121,7 @@ public class ArrayDeque<E> extends AbstractCollection<E>
|
|||||||
*
|
*
|
||||||
* @param numElements the number of elements to hold
|
* @param numElements the number of elements to hold
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private void allocateElements(int numElements) {
|
private void allocateElements(int numElements) {
|
||||||
int initialCapacity = MIN_INITIAL_CAPACITY;
|
int initialCapacity = MIN_INITIAL_CAPACITY;
|
||||||
// Find the best power of two to hold elements.
|
// Find the best power of two to hold elements.
|
||||||
@ -152,10 +153,11 @@ public class ArrayDeque<E> extends AbstractCollection<E>
|
|||||||
int newCapacity = n << 1;
|
int newCapacity = n << 1;
|
||||||
if (newCapacity < 0)
|
if (newCapacity < 0)
|
||||||
throw new IllegalStateException("Sorry, deque too big");
|
throw new IllegalStateException("Sorry, deque too big");
|
||||||
Object[] a = new Object[newCapacity];
|
@SuppressWarnings("unchecked")
|
||||||
|
E[] a = (E[]) new Object[newCapacity];
|
||||||
System.arraycopy(elements, p, a, 0, r);
|
System.arraycopy(elements, p, a, 0, r);
|
||||||
System.arraycopy(elements, 0, a, r, p);
|
System.arraycopy(elements, 0, a, r, p);
|
||||||
elements = (E[])a;
|
elements = a;
|
||||||
head = 0;
|
head = 0;
|
||||||
tail = n;
|
tail = n;
|
||||||
}
|
}
|
||||||
@ -182,6 +184,7 @@ public class ArrayDeque<E> extends AbstractCollection<E>
|
|||||||
* Constructs an empty array deque with an initial capacity
|
* Constructs an empty array deque with an initial capacity
|
||||||
* sufficient to hold 16 elements.
|
* sufficient to hold 16 elements.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public ArrayDeque() {
|
public ArrayDeque() {
|
||||||
elements = (E[]) new Object[16];
|
elements = (E[]) new Object[16];
|
||||||
}
|
}
|
||||||
@ -793,6 +796,7 @@ public class ArrayDeque<E> extends AbstractCollection<E>
|
|||||||
* this deque
|
* this deque
|
||||||
* @throws NullPointerException if the specified array is null
|
* @throws NullPointerException if the specified array is null
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public <T> T[] toArray(T[] a) {
|
public <T> T[] toArray(T[] a) {
|
||||||
int size = size();
|
int size = size();
|
||||||
if (a.length < size)
|
if (a.length < size)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -560,7 +560,7 @@ public class Arrays {
|
|||||||
* off is the offset to generate corresponding low, high in src
|
* off is the offset to generate corresponding low, high in src
|
||||||
* To be removed in a future release.
|
* To be removed in a future release.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
private static void mergeSort(Object[] src,
|
private static void mergeSort(Object[] src,
|
||||||
Object[] dest,
|
Object[] dest,
|
||||||
int low,
|
int low,
|
||||||
@ -747,7 +747,7 @@ public class Arrays {
|
|||||||
* off is the offset into src corresponding to low in dest
|
* off is the offset into src corresponding to low in dest
|
||||||
* To be removed in a future release.
|
* To be removed in a future release.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
private static void mergeSort(Object[] src,
|
private static void mergeSort(Object[] src,
|
||||||
Object[] dest,
|
Object[] dest,
|
||||||
int low, int high, int off,
|
int low, int high, int off,
|
||||||
@ -2832,6 +2832,7 @@ public class Arrays {
|
|||||||
* @return a list view of the specified array
|
* @return a list view of the specified array
|
||||||
*/
|
*/
|
||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
|
@SuppressWarnings("varargs")
|
||||||
public static <T> List<T> asList(T... a) {
|
public static <T> List<T> asList(T... a) {
|
||||||
return new ArrayList<>(a);
|
return new ArrayList<>(a);
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ public class Collections {
|
|||||||
* @throws IllegalArgumentException (optional) if the comparator is
|
* @throws IllegalArgumentException (optional) if the comparator is
|
||||||
* found to violate the {@link Comparator} contract
|
* found to violate the {@link Comparator} contract
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public static <T> void sort(List<T> list, Comparator<? super T> c) {
|
public static <T> void sort(List<T> list, Comparator<? super T> c) {
|
||||||
Object[] a = list.toArray();
|
Object[] a = list.toArray();
|
||||||
Arrays.sort(a, (Comparator)c);
|
Arrays.sort(a, (Comparator)c);
|
||||||
@ -418,7 +418,7 @@ public class Collections {
|
|||||||
* @throws UnsupportedOperationException if the specified list or
|
* @throws UnsupportedOperationException if the specified list or
|
||||||
* its list-iterator does not support the <tt>set</tt> operation.
|
* its list-iterator does not support the <tt>set</tt> operation.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public static void reverse(List<?> list) {
|
public static void reverse(List<?> list) {
|
||||||
int size = list.size();
|
int size = list.size();
|
||||||
if (size < REVERSE_THRESHOLD || list instanceof RandomAccess) {
|
if (size < REVERSE_THRESHOLD || list instanceof RandomAccess) {
|
||||||
@ -497,7 +497,7 @@ public class Collections {
|
|||||||
* @throws UnsupportedOperationException if the specified list or its
|
* @throws UnsupportedOperationException if the specified list or its
|
||||||
* list-iterator does not support the <tt>set</tt> operation.
|
* list-iterator does not support the <tt>set</tt> operation.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public static void shuffle(List<?> list, Random rnd) {
|
public static void shuffle(List<?> list, Random rnd) {
|
||||||
int size = list.size();
|
int size = list.size();
|
||||||
if (size < SHUFFLE_THRESHOLD || list instanceof RandomAccess) {
|
if (size < SHUFFLE_THRESHOLD || list instanceof RandomAccess) {
|
||||||
@ -535,7 +535,7 @@ public class Collections {
|
|||||||
* || j < 0 || j >= list.size()).
|
* || j < 0 || j >= list.size()).
|
||||||
* @since 1.4
|
* @since 1.4
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public static void swap(List<?> list, int i, int j) {
|
public static void swap(List<?> list, int i, int j) {
|
||||||
// instead of using a raw type here, it's possible to capture
|
// instead of using a raw type here, it's possible to capture
|
||||||
// the wildcard but it will require a call to a supplementary
|
// the wildcard but it will require a call to a supplementary
|
||||||
@ -669,7 +669,7 @@ public class Collections {
|
|||||||
* @throws NoSuchElementException if the collection is empty.
|
* @throws NoSuchElementException if the collection is empty.
|
||||||
* @see Comparable
|
* @see Comparable
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public static <T> T min(Collection<? extends T> coll, Comparator<? super T> comp) {
|
public static <T> T min(Collection<? extends T> coll, Comparator<? super T> comp) {
|
||||||
if (comp==null)
|
if (comp==null)
|
||||||
return (T)min((Collection) coll);
|
return (T)min((Collection) coll);
|
||||||
@ -740,7 +740,7 @@ public class Collections {
|
|||||||
* @throws NoSuchElementException if the collection is empty.
|
* @throws NoSuchElementException if the collection is empty.
|
||||||
* @see Comparable
|
* @see Comparable
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public static <T> T max(Collection<? extends T> coll, Comparator<? super T> comp) {
|
public static <T> T max(Collection<? extends T> coll, Comparator<? super T> comp) {
|
||||||
if (comp==null)
|
if (comp==null)
|
||||||
return (T)max((Collection) coll);
|
return (T)max((Collection) coll);
|
||||||
@ -1403,7 +1403,7 @@ public class Collections {
|
|||||||
extends UnmodifiableSet<Map.Entry<K,V>> {
|
extends UnmodifiableSet<Map.Entry<K,V>> {
|
||||||
private static final long serialVersionUID = 7854390611657943733L;
|
private static final long serialVersionUID = 7854390611657943733L;
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
UnmodifiableEntrySet(Set<? extends Map.Entry<? extends K, ? extends V>> s) {
|
UnmodifiableEntrySet(Set<? extends Map.Entry<? extends K, ? extends V>> s) {
|
||||||
// Need to cast to raw in order to work around a limitation in the type system
|
// Need to cast to raw in order to work around a limitation in the type system
|
||||||
super((Set)s);
|
super((Set)s);
|
||||||
@ -3172,7 +3172,7 @@ public class Collections {
|
|||||||
*
|
*
|
||||||
* @see #emptySet()
|
* @see #emptySet()
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("rawtypes")
|
||||||
public static final Set EMPTY_SET = new EmptySet<>();
|
public static final Set EMPTY_SET = new EmptySet<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3271,10 +3271,13 @@ public class Collections {
|
|||||||
return new EmptySortedSet<>();
|
return new EmptySortedSet<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Comparator comparator() {
|
@Override
|
||||||
|
public Comparator<? super E> comparator() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public SortedSet<E> subSet(Object fromElement, Object toElement) {
|
public SortedSet<E> subSet(Object fromElement, Object toElement) {
|
||||||
Objects.requireNonNull(fromElement);
|
Objects.requireNonNull(fromElement);
|
||||||
Objects.requireNonNull(toElement);
|
Objects.requireNonNull(toElement);
|
||||||
@ -3294,6 +3297,7 @@ public class Collections {
|
|||||||
return emptySortedSet();
|
return emptySortedSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public SortedSet<E> headSet(Object toElement) {
|
public SortedSet<E> headSet(Object toElement) {
|
||||||
Objects.requireNonNull(toElement);
|
Objects.requireNonNull(toElement);
|
||||||
|
|
||||||
@ -3304,6 +3308,7 @@ public class Collections {
|
|||||||
return emptySortedSet();
|
return emptySortedSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public SortedSet<E> tailSet(Object fromElement) {
|
public SortedSet<E> tailSet(Object fromElement) {
|
||||||
Objects.requireNonNull(fromElement);
|
Objects.requireNonNull(fromElement);
|
||||||
|
|
||||||
@ -3314,10 +3319,12 @@ public class Collections {
|
|||||||
return emptySortedSet();
|
return emptySortedSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public E first() {
|
public E first() {
|
||||||
throw new NoSuchElementException();
|
throw new NoSuchElementException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public E last() {
|
public E last() {
|
||||||
throw new NoSuchElementException();
|
throw new NoSuchElementException();
|
||||||
}
|
}
|
||||||
@ -3328,7 +3335,7 @@ public class Collections {
|
|||||||
*
|
*
|
||||||
* @see #emptyList()
|
* @see #emptyList()
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("rawtypes")
|
||||||
public static final List EMPTY_LIST = new EmptyList<>();
|
public static final List EMPTY_LIST = new EmptyList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3402,7 +3409,7 @@ public class Collections {
|
|||||||
* @see #emptyMap()
|
* @see #emptyMap()
|
||||||
* @since 1.3
|
* @since 1.3
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("rawtypes")
|
||||||
public static final Map EMPTY_MAP = new EmptyMap<>();
|
public static final Map EMPTY_MAP = new EmptyMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3685,6 +3692,7 @@ public class Collections {
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public <T> T[] toArray(T[] a) {
|
public <T> T[] toArray(T[] a) {
|
||||||
final int n = this.n;
|
final int n = this.n;
|
||||||
if (a.length < n) {
|
if (a.length < n) {
|
||||||
@ -3731,6 +3739,7 @@ public class Collections {
|
|||||||
* the <tt>Comparable</tt> interface.
|
* the <tt>Comparable</tt> interface.
|
||||||
* @see Comparable
|
* @see Comparable
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public static <T> Comparator<T> reverseOrder() {
|
public static <T> Comparator<T> reverseOrder() {
|
||||||
return (Comparator<T>) ReverseComparator.REVERSE_ORDER;
|
return (Comparator<T>) ReverseComparator.REVERSE_ORDER;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ class ComparableTimSort {
|
|||||||
* @param start the index of the first element in the range that is
|
* @param start the index of the first element in the range that is
|
||||||
* not already known to be sorted ({@code lo <= start <= hi})
|
* not already known to be sorted ({@code lo <= start <= hi})
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "fallthrough", "rawtypes", "unchecked" })
|
@SuppressWarnings({"fallthrough", "rawtypes", "unchecked"})
|
||||||
private static void binarySort(Object[] a, int lo, int hi, int start) {
|
private static void binarySort(Object[] a, int lo, int hi, int start) {
|
||||||
assert lo <= start && start <= hi;
|
assert lo <= start && start <= hi;
|
||||||
if (start == lo)
|
if (start == lo)
|
||||||
@ -277,7 +277,7 @@ class ComparableTimSort {
|
|||||||
* @return the length of the run beginning at the specified position in
|
* @return the length of the run beginning at the specified position in
|
||||||
* the specified array
|
* the specified array
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
private static int countRunAndMakeAscending(Object[] a, int lo, int hi) {
|
private static int countRunAndMakeAscending(Object[] a, int lo, int hi) {
|
||||||
assert lo < hi;
|
assert lo < hi;
|
||||||
int runHi = lo + 1;
|
int runHi = lo + 1;
|
||||||
@ -612,7 +612,7 @@ class ComparableTimSort {
|
|||||||
* (must be aBase + aLen)
|
* (must be aBase + aLen)
|
||||||
* @param len2 length of second run to be merged (must be > 0)
|
* @param len2 length of second run to be merged (must be > 0)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
private void mergeLo(int base1, int len1, int base2, int len2) {
|
private void mergeLo(int base1, int len1, int base2, int len2) {
|
||||||
assert len1 > 0 && len2 > 0 && base1 + len1 == base2;
|
assert len1 > 0 && len2 > 0 && base1 + len1 == base2;
|
||||||
|
|
||||||
@ -729,7 +729,7 @@ class ComparableTimSort {
|
|||||||
* (must be aBase + aLen)
|
* (must be aBase + aLen)
|
||||||
* @param len2 length of second run to be merged (must be > 0)
|
* @param len2 length of second run to be merged (must be > 0)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
private void mergeHi(int base1, int len1, int base2, int len2) {
|
private void mergeHi(int base1, int len1, int base2, int len2) {
|
||||||
assert len1 > 0 && len2 > 0 && base1 + len1 == base2;
|
assert len1 > 0 && len2 > 0 && base1 + len1 == base2;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -230,7 +230,7 @@ public class HashMap<K,V>
|
|||||||
|
|
||||||
this.loadFactor = loadFactor;
|
this.loadFactor = loadFactor;
|
||||||
threshold = (int)Math.min(capacity * loadFactor, MAXIMUM_CAPACITY + 1);
|
threshold = (int)Math.min(capacity * loadFactor, MAXIMUM_CAPACITY + 1);
|
||||||
table = new Entry[capacity];
|
table = new Entry<?,?>[capacity];
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1078,7 +1078,7 @@ public class HashMap<K,V>
|
|||||||
capacity <<= 1;
|
capacity <<= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
table = new Entry[capacity];
|
table = new Entry<?,?>[capacity];
|
||||||
threshold = (int) Math.min(capacity * loadFactor, MAXIMUM_CAPACITY + 1);
|
threshold = (int) Math.min(capacity * loadFactor, MAXIMUM_CAPACITY + 1);
|
||||||
init(); // Give subclass a chance to do its thing.
|
init(); // Give subclass a chance to do its thing.
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -121,6 +121,7 @@ class JumboEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
|||||||
unseen = elements[0];
|
unseen = elements[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
while (unseen == 0 && unseenIndex < elements.length - 1)
|
while (unseen == 0 && unseenIndex < elements.length - 1)
|
||||||
unseen = elements[++unseenIndex];
|
unseen = elements[++unseenIndex];
|
||||||
@ -128,6 +129,7 @@ class JumboEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public E next() {
|
public E next() {
|
||||||
if (!hasNext())
|
if (!hasNext())
|
||||||
throw new NoSuchElementException();
|
throw new NoSuchElementException();
|
||||||
@ -138,6 +140,7 @@ class JumboEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
|||||||
+ Long.numberOfTrailingZeros(lastReturned)];
|
+ Long.numberOfTrailingZeros(lastReturned)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void remove() {
|
public void remove() {
|
||||||
if (lastReturned == 0)
|
if (lastReturned == 0)
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -330,6 +330,7 @@ public class PriorityQueue<E> extends AbstractQueue<E>
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public E peek() {
|
public E peek() {
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
return null;
|
return null;
|
||||||
|
@ -246,7 +246,8 @@ public final class PropertyPermission extends BasicPermission {
|
|||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check against use of constants (used heavily within the JDK)
|
// Use object identity comparison against known-interned strings for
|
||||||
|
// performance benefit (these values are used heavily within the JDK).
|
||||||
if (actions == SecurityConstants.PROPERTY_READ_ACTION) {
|
if (actions == SecurityConstants.PROPERTY_READ_ACTION) {
|
||||||
return READ;
|
return READ;
|
||||||
} if (actions == SecurityConstants.PROPERTY_WRITE_ACTION) {
|
} if (actions == SecurityConstants.PROPERTY_WRITE_ACTION) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -125,6 +125,7 @@ public class PropertyResourceBundle extends ResourceBundle {
|
|||||||
* @throws IOException if an I/O error occurs
|
* @throws IOException if an I/O error occurs
|
||||||
* @throws NullPointerException if <code>stream</code> is null
|
* @throws NullPointerException if <code>stream</code> is null
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public PropertyResourceBundle (InputStream stream) throws IOException {
|
public PropertyResourceBundle (InputStream stream) throws IOException {
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.load(stream);
|
properties.load(stream);
|
||||||
@ -143,6 +144,7 @@ public class PropertyResourceBundle extends ResourceBundle {
|
|||||||
* @throws NullPointerException if <code>reader</code> is null
|
* @throws NullPointerException if <code>reader</code> is null
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
public PropertyResourceBundle (Reader reader) throws IOException {
|
public PropertyResourceBundle (Reader reader) throws IOException {
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
properties.load(reader);
|
properties.load(reader);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -325,6 +325,7 @@ class JarVerifier {
|
|||||||
* the given file in the jar.
|
* the given file in the jar.
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public java.security.cert.Certificate[] getCerts(String name)
|
public java.security.cert.Certificate[] getCerts(String name)
|
||||||
{
|
{
|
||||||
return mapSignersToCertArray(getCodeSigners(name));
|
return mapSignersToCertArray(getCodeSigners(name));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003,2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003,2012, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -726,13 +726,13 @@ public abstract class Pack200 {
|
|||||||
private static final String PACK_PROVIDER = "java.util.jar.Pack200.Packer";
|
private static final String PACK_PROVIDER = "java.util.jar.Pack200.Packer";
|
||||||
private static final String UNPACK_PROVIDER = "java.util.jar.Pack200.Unpacker";
|
private static final String UNPACK_PROVIDER = "java.util.jar.Pack200.Unpacker";
|
||||||
|
|
||||||
private static Class packerImpl;
|
private static Class<?> packerImpl;
|
||||||
private static Class unpackerImpl;
|
private static Class<?> unpackerImpl;
|
||||||
|
|
||||||
private synchronized static Object newInstance(String prop) {
|
private synchronized static Object newInstance(String prop) {
|
||||||
String implName = "(unknown)";
|
String implName = "(unknown)";
|
||||||
try {
|
try {
|
||||||
Class impl = (PACK_PROVIDER.equals(prop))? packerImpl: unpackerImpl;
|
Class<?> impl = (PACK_PROVIDER.equals(prop))? packerImpl: unpackerImpl;
|
||||||
if (impl == null) {
|
if (impl == null) {
|
||||||
// The first time, we must decide which class to use.
|
// The first time, we must decide which class to use.
|
||||||
implName = java.security.AccessController.doPrivileged(
|
implName = java.security.AccessController.doPrivileged(
|
||||||
|
@ -126,7 +126,7 @@ public abstract class PreHashedMap<V>
|
|||||||
*/
|
*/
|
||||||
protected abstract void init(Object[] ht);
|
protected abstract void init(Object[] ht);
|
||||||
|
|
||||||
// @SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private V toV(Object x) {
|
private V toV(Object x) {
|
||||||
return (V)x;
|
return (V)x;
|
||||||
}
|
}
|
||||||
@ -259,8 +259,7 @@ public abstract class PreHashedMap<V>
|
|||||||
return true;
|
return true;
|
||||||
if (!(ob instanceof Map.Entry))
|
if (!(ob instanceof Map.Entry))
|
||||||
return false;
|
return false;
|
||||||
Map.Entry<String,V> that
|
Map.Entry<?,?> that = (Map.Entry<?,?>)ob;
|
||||||
= (Map.Entry<String,V>)ob;
|
|
||||||
return ((this.getKey() == null
|
return ((this.getKey() == null
|
||||||
? that.getKey() == null
|
? that.getKey() == null
|
||||||
: this.getKey()
|
: this.getKey()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user