Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9cef2ae
Remove unnecessary @SuppressWarnings annotations.
archiecobbs Oct 31, 2024
cea7078
Merge branch 'master' into SuppressWarningsCleanup-core-libs
archiecobbs Nov 2, 2024
d7144fc
Merge branch 'master' into SuppressWarningsCleanup-core-libs
archiecobbs Nov 3, 2024
7842dfe
Update copyright years.
archiecobbs Nov 3, 2024
fdfab47
Remove a few more @SuppressWarnings annotations.
archiecobbs Nov 7, 2024
cc72f1e
Remove a few more @SuppressWarnings annotations.
archiecobbs Nov 7, 2024
a2e9b9c
Update copyright years.
archiecobbs Nov 7, 2024
a64d559
Merge branch 'master' into SuppressWarningsCleanup-core-libs
archiecobbs Nov 8, 2024
9137373
Put back @SuppressWarnings annotations to be fixed by JDK-8343286.
archiecobbs Nov 8, 2024
300c0f9
Merge branch 'master' into SuppressWarningsCleanup-core-libs
archiecobbs Nov 13, 2024
378ca60
Remove more unnecessary warning suppressions.
archiecobbs Nov 13, 2024
10a6ff8
Merge branch 'master' into SuppressWarningsCleanup-core-libs
archiecobbs Nov 19, 2024
1905d6e
Remove more unnecessary @SuppressWarnings annotations.
archiecobbs Nov 19, 2024
027f669
Merge branch 'master' into SuppressWarningsCleanup-core-libs
archiecobbs Dec 9, 2024
ee2862e
Remove more unnecessary suppressions.
archiecobbs Dec 9, 2024
32a2277
Merge branch 'master' into SuppressWarningsCleanup-core-libs
archiecobbs Jan 2, 2025
40b143c
Bump copyright year to 2025.
archiecobbs Jan 2, 2025
1102421
Revert changes under src/java.desktop (to be moved into a separate PR).
archiecobbs Jan 2, 2025
2049463
Update @LastModified tags.
archiecobbs Jan 2, 2025
14ce198
Merge branch 'master' into SuppressWarningsCleanup-core-libs
archiecobbs Jan 8, 2025
c3e077b
Remove a few more unnecessary suppressions.
archiecobbs Jan 8, 2025
340ca51
Merge branch 'master' into SuppressWarningsCleanup-core-libs to fix c…
archiecobbs Feb 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions make/jdk/src/classes/build/tools/cldrconverter/Bundle.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -198,7 +198,6 @@ Map<String, Object> getTargetMap() throws Exception {
String[] cldrBundles = getCLDRPath().split(",");

// myMap contains resources for id.
@SuppressWarnings("unchecked")
Map<String, Object> myMap = new HashMap<>();
int index;
for (index = 0; index < cldrBundles.length; index++) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -1079,7 +1079,6 @@ private String getTarget(String path, String calType, String context, String wid
}

@Override
@SuppressWarnings("fallthrough")
public void endElement(String uri, String localName, String qName) throws SAXException {
assert qName.equals(currentContainer.getqName()) : "current=" + currentContainer.getqName() + ", param=" + qName;
switch (qName) {
Expand Down
1 change: 0 additions & 1 deletion src/java.base/share/classes/java/io/File.java
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,6 @@ public URL toURL() throws MalformedURLException {
if (isInvalid()) {
throw new MalformedURLException("Invalid file path");
}
@SuppressWarnings("deprecation")
var result = new URL("file", "", slashify(getAbsolutePath(), isDirectory()));
return result;
}
Expand Down
3 changes: 1 addition & 2 deletions src/java.base/share/classes/java/io/FileDescriptor.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -340,7 +340,6 @@ synchronized void attach(Closeable c) {
*
* The caller closeable gets to call close0().
*/
@SuppressWarnings("try")
synchronized void closeAll(Closeable releaser) throws IOException {
if (!closed) {
closed = true;
Expand Down
1 change: 0 additions & 1 deletion src/java.base/share/classes/java/lang/Package.java
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ public boolean isCompatibleWith(String desired)
*/
@CallerSensitive
@Deprecated(since="9")
@SuppressWarnings("deprecation")
public static Package getPackage(String name) {
ClassLoader l = ClassLoader.getClassLoader(Reflection.getCallerClass());
return l != null ? l.getPackage(name) : BootLoader.getDefinedPackage(name);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -142,7 +142,7 @@ public String toString() {
return buf.toString();
}

@SuppressWarnings({"rawtypes", "unchecked"})
@SuppressWarnings("unchecked")
public LambdaForm get() {
if (cache instanceof LambdaForm lf) {
return lf;
Expand Down
4 changes: 2 additions & 2 deletions src/java.base/share/classes/java/lang/invoke/MemberName.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -711,7 +711,7 @@ public MemberName getDefinition() {
}

@Override
@SuppressWarnings({"deprecation", "removal"})
@SuppressWarnings("removal")
public int hashCode() {
// Avoid autoboxing getReferenceKind(), since this is used early and will force
// early initialization of Byte$ByteCache
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -110,7 +110,7 @@ public MethodType basicType() {
return basicType;
}

@SuppressWarnings({"rawtypes", "unchecked"})
@SuppressWarnings("unchecked")
public MethodHandle cachedMethodHandle(int which) {
Object entry = methodHandles[which];
if (entry == null) {
Expand All @@ -136,7 +136,7 @@ public synchronized MethodHandle setCachedMethodHandle(int which, MethodHandle m
return mh;
}

@SuppressWarnings({"rawtypes", "unchecked"})
@SuppressWarnings("unchecked")
public LambdaForm cachedLambdaForm(int which) {
Object entry = lambdaForms[which];
if (entry == null) {
Expand Down Expand Up @@ -167,7 +167,6 @@ public synchronized LambdaForm setCachedLambdaForm(int which, LambdaForm form) {
* This MTF will stand for that type and all un-erased variations.
* Eagerly compute some basic properties of the type, common to all variations.
*/
@SuppressWarnings({"rawtypes", "unchecked"})
protected MethodTypeForm(MethodType erasedType) {
this.erasedType = erasedType;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -240,7 +240,7 @@ public int getModifiers() {
* @since 1.5
*/
@Override
@SuppressWarnings({"rawtypes", "unchecked"})
@SuppressWarnings("unchecked")
public TypeVariable<Constructor<T>>[] getTypeParameters() {
if (getSignature() != null) {
return (TypeVariable<Constructor<T>>[])getGenericInfo().getTypeParameters();
Expand Down
4 changes: 2 additions & 2 deletions src/java.base/share/classes/java/lang/reflect/Method.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -231,7 +231,7 @@ public int getModifiers() {
* @jls 8.4.4 Generic Methods
*/
@Override
@SuppressWarnings({"rawtypes", "unchecked"})
@SuppressWarnings("unchecked")
public TypeVariable<Method>[] getTypeParameters() {
if (getGenericSignature() != null)
return (TypeVariable<Method>[])getGenericInfo().getTypeParameters();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -202,7 +202,6 @@ private ProxyGenerator(String className, List<Class<?>> interfaces,
* @param interfaces proxy interfaces
* @param accessFlags access flags of the proxy class
*/
@SuppressWarnings("removal")
static byte[] generateProxyClass(ClassLoader loader,
final String name,
List<Class<?>> interfaces,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -652,7 +652,6 @@ default String format(DateTimeFormatter formatter) {
* @param localTime the local time to use, not null
* @return the local date-time formed from this date and the specified time, not null
*/
@SuppressWarnings("unchecked")
default ChronoLocalDateTime<?> atTime(LocalTime localTime) {
return ChronoLocalDateTimeImpl.of(this, localTime);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -269,7 +269,6 @@ public long getLong(TemporalField field) {
}

//-----------------------------------------------------------------------
@SuppressWarnings("unchecked")
@Override
public ChronoLocalDateTimeImpl<D> with(TemporalAdjuster adjuster) {
if (adjuster instanceof ChronoLocalDate) {
Expand Down
2 changes: 1 addition & 1 deletion src/java.base/share/classes/java/util/Arrays.java
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ private static void legacyMergeSort(Object[] a,
* off is the offset to generate corresponding low, high in src
* To be removed in a future release.
*/
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings("unchecked")
private static void mergeSort(Object[] src,
Object[] dest,
int low,
Expand Down
3 changes: 0 additions & 3 deletions src/java.base/share/classes/java/util/Collections.java
Original file line number Diff line number Diff line change
Expand Up @@ -3363,7 +3363,6 @@ static class CheckedCollection<E> implements Collection<E>, Serializable {
@SuppressWarnings("serial") // Conditionally serializable
final Collection<E> c;
/** @serial */
@SuppressWarnings("serial") // Conditionally serializable
final Class<E> type;

@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -3926,10 +3925,8 @@ private static class CheckedMap<K,V>
@SuppressWarnings("serial") // Conditionally serializable
private final Map<K, V> m;
/** @serial */
@SuppressWarnings("serial") // Conditionally serializable
final Class<K> keyType;
/** @serial */
@SuppressWarnings("serial") // Conditionally serializable
final Class<V> valueType;

private void typeCheck(Object key, Object value) {
Expand Down
10 changes: 5 additions & 5 deletions src/java.base/share/classes/java/util/ComparableTimSort.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright 2009 Google Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -309,7 +309,7 @@ private static void binarySort(Object[] a, int lo, int hi, int start) {
* @return the length of the run beginning at the specified position in
* the specified array
*/
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings("unchecked")
private static int countRunAndMakeAscending(Object[] a, int lo, int hi) {
assert lo < hi;
int runHi = lo + 1;
Expand Down Expand Up @@ -648,7 +648,7 @@ private static int gallopRight(Comparable<Object> key, Object[] a,
* (must be aBase + aLen)
* @param len2 length of second run to be merged (must be > 0)
*/
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings("unchecked")
private void mergeLo(int base1, int len1, int base2, int len2) {
assert len1 > 0 && len2 > 0 && base1 + len1 == base2;

Expand Down Expand Up @@ -765,7 +765,7 @@ private void mergeLo(int base1, int len1, int base2, int len2) {
* (must be aBase + aLen)
* @param len2 length of second run to be merged (must be > 0)
*/
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings("unchecked")
private void mergeHi(int base1, int len1, int base2, int len2) {
assert len1 > 0 && len2 > 0 && base1 + len1 == base2;

Expand Down Expand Up @@ -895,7 +895,7 @@ private Object[] ensureCapacity(int minCapacity) {
else
newSize = Math.min(newSize, a.length >>> 1);

@SuppressWarnings({"unchecked", "UnnecessaryLocalVariable"})
@SuppressWarnings("UnnecessaryLocalVariable")
Object[] newArray = new Object[newSize];
tmp = newArray;
tmpLen = newSize;
Expand Down
4 changes: 2 additions & 2 deletions src/java.base/share/classes/java/util/HashMap.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -365,7 +365,7 @@ static Class<?> comparableClassFor(Object x) {
* Returns k.compareTo(x) if x matches kc (k's screened comparable
* class), else 0.
*/
@SuppressWarnings({"rawtypes","unchecked"}) // for cast to Comparable
@SuppressWarnings("unchecked") // for cast to Comparable
static int compareComparables(Class<?> kc, Object k, Object x) {
return (x == null || x.getClass() != kc ? 0 :
((Comparable)k).compareTo(x));
Expand Down
3 changes: 1 addition & 2 deletions src/java.base/share/classes/java/util/LinkedHashSet.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -226,7 +226,6 @@ public static <T> LinkedHashSet<T> newLinkedHashSet(int numElements) {
return new LinkedHashSet<>(HashMap.calculateHashMapCapacity(numElements));
}

@SuppressWarnings("unchecked")
LinkedHashMap<E, Object> map() {
return (LinkedHashMap<E, Object>) map;
}
Expand Down
4 changes: 2 additions & 2 deletions src/java.base/share/classes/java/util/List.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -501,7 +501,7 @@ default void replaceAll(UnaryOperator<E> operator) {
* contract
* @since 1.8
*/
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings("unchecked")
default void sort(Comparator<? super E> c) {
Object[] a = this.toArray();
Arrays.sort(a, (Comparator) c);
Expand Down
3 changes: 1 addition & 2 deletions src/java.base/share/classes/java/util/Map.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -1658,7 +1658,6 @@ static <K, V> Map<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5,
* @since 9
*/
@SafeVarargs
@SuppressWarnings("varargs")
static <K, V> Map<K, V> ofEntries(Entry<? extends K, ? extends V>... entries) {
if (entries.length == 0) { // implicit null check of entries array
@SuppressWarnings("unchecked")
Expand Down
3 changes: 1 addition & 2 deletions src/java.base/share/classes/java/util/PrimitiveIterator.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -84,7 +84,6 @@ public interface PrimitiveIterator<T, T_CONS> extends Iterator<T> {
* @param action The action to be performed for each element
* @throws NullPointerException if the specified action is null
*/
@SuppressWarnings("overloads")
void forEachRemaining(T_CONS action);

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -163,7 +163,6 @@ public class PropertyResourceBundle extends ResourceBundle {
* {@code java.util.PropertyResourceBundle.encoding} is set to "UTF-8"
* and {@code stream} contains an unmappable UTF-8 byte sequence.
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public PropertyResourceBundle (InputStream stream) throws IOException {
this(new InputStreamReader(stream,
"ISO-8859-1".equals(encoding) ?
Expand Down
3 changes: 1 addition & 2 deletions src/java.base/share/classes/java/util/ResourceBundle.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -3511,7 +3511,6 @@ private static class ResourceBundleProviderHelper {
*/
static ResourceBundle newResourceBundle(Class<? extends ResourceBundle> bundleClass) {
try {
@SuppressWarnings("unchecked")
Constructor<? extends ResourceBundle> ctor =
bundleClass.getConstructor();
if (!Modifier.isPublic(ctor.getModifiers())) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -161,7 +161,6 @@ public Object[] toArray() {
return ArraysSupport.reverse(base.toArray());
}

@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
return ArraysSupport.toArrayReversed(base, a);
}
Expand Down
Loading