chore: suppress unchecked in selected classes (#6262)

This commit is contained in:
Piotr Idzik
2025-06-05 18:13:46 +02:00
committed by GitHub
parent ec6f09c373
commit 7602f1ef4c
15 changed files with 14 additions and 12 deletions

View File

@ -76,7 +76,6 @@
<compilerArgs> <compilerArgs>
<arg>-Xlint:all</arg> <arg>-Xlint:all</arg>
<arg>-Xlint:-auxiliaryclass</arg> <arg>-Xlint:-auxiliaryclass</arg>
<arg>-Xlint:-unchecked</arg>
<arg>-Werror</arg> <arg>-Werror</arg>
</compilerArgs> </compilerArgs>
</configuration> </configuration>

View File

@ -9,7 +9,7 @@ import java.util.List;
* *
* @author <a href="https://github.com/siddhant2002">Siddhant Swarup Mallick</a> * @author <a href="https://github.com/siddhant2002">Siddhant Swarup Mallick</a>
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings({"rawtypes", "unchecked"})
public class AllPathsFromSourceToTarget { public class AllPathsFromSourceToTarget {
// No. of vertices in graph // No. of vertices in graph

View File

@ -10,6 +10,7 @@ import java.util.concurrent.atomic.AtomicInteger;
* *
* @param <Item> The type of elements stored in the circular buffer. * @param <Item> The type of elements stored in the circular buffer.
*/ */
@SuppressWarnings("unchecked")
public class CircularBuffer<Item> { public class CircularBuffer<Item> {
private final Item[] buffer; private final Item[] buffer;
private final CircularPointer putPointer; private final CircularPointer putPointer;

View File

@ -19,7 +19,7 @@ import java.util.PriorityQueue;
* *
* <p><strong>Time Complexity:</strong> O(E log V), where E is the number of edges and V is the number of vertices.</p> * <p><strong>Time Complexity:</strong> O(E log V), where E is the number of edges and V is the number of vertices.</p>
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings({"rawtypes", "unchecked"})
public class Kruskal { public class Kruskal {
/** /**

View File

@ -22,7 +22,7 @@ import java.util.stream.IntStream;
* For more information, see <a href="https://en.wikipedia.org/wiki/Graph_coloring">Graph Coloring</a>. * For more information, see <a href="https://en.wikipedia.org/wiki/Graph_coloring">Graph Coloring</a>.
* </p> * </p>
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings({"rawtypes", "unchecked"})
public final class WelshPowell { public final class WelshPowell {
private static final int BLANK_COLOR = -1; // Constant representing an uncolored state private static final int BLANK_COLOR = -1; // Constant representing an uncolored state

View File

@ -23,7 +23,7 @@ import java.util.LinkedList;
* @param <K> the type of keys maintained by this hash map * @param <K> the type of keys maintained by this hash map
* @param <V> the type of mapped values * @param <V> the type of mapped values
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings({"rawtypes", "unchecked"})
public class GenericHashMapUsingArray<K, V> { public class GenericHashMapUsingArray<K, V> {
private int size; // Total number of key-value pairs private int size; // Total number of key-value pairs

View File

@ -10,7 +10,7 @@ import java.util.Objects;
* *
* @param <T> the type of elements in this list * @param <T> the type of elements in this list
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings({"rawtypes", "unchecked"})
public class CursorLinkedList<T> { public class CursorLinkedList<T> {
/** /**

View File

@ -29,7 +29,7 @@ import java.util.stream.IntStream;
* @param <E> type of elements * @param <E> type of elements
* @see <a href="https://en.wikipedia.org/wiki/Skip_list">Wiki. Skip list</a> * @see <a href="https://en.wikipedia.org/wiki/Skip_list">Wiki. Skip list</a>
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings({"rawtypes", "unchecked"})
public class SkipList<E extends Comparable<E>> { public class SkipList<E extends Comparable<E>> {
/** /**

View File

@ -11,6 +11,7 @@ import java.util.Stack;
* *
* @param <T> The type of elements held in this queue. * @param <T> The type of elements held in this queue.
*/ */
@SuppressWarnings("unchecked")
public class QueueByTwoStacks<T> { public class QueueByTwoStacks<T> {
private final Stack<T> enqueueStk; private final Stack<T> enqueueStk;

View File

@ -2,7 +2,7 @@ package com.thealgorithms.dynamicprogramming;
import java.util.HashMap; import java.util.HashMap;
@SuppressWarnings("rawtypes") @SuppressWarnings({"rawtypes", "unchecked"})
final class LongestArithmeticSubsequence { final class LongestArithmeticSubsequence {
private LongestArithmeticSubsequence() { private LongestArithmeticSubsequence() {
} }

View File

@ -7,6 +7,7 @@ import java.util.concurrent.ThreadLocalRandom;
/** /**
* @author dimgrichr * @author dimgrichr
*/ */
@SuppressWarnings("unchecked")
public class CRCAlgorithm { public class CRCAlgorithm {
private int correctMess; private int correctMess;

View File

@ -15,7 +15,7 @@ import com.thealgorithms.devutils.searches.SearchAlgorithm;
* Note: This algorithm requires that the input array be sorted. * Note: This algorithm requires that the input array be sorted.
* </p> * </p>
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings({"rawtypes", "unchecked"})
public class FibonacciSearch implements SearchAlgorithm { public class FibonacciSearch implements SearchAlgorithm {
/** /**

View File

@ -7,7 +7,7 @@ import static com.thealgorithms.sorts.SortUtils.less;
* <p> * <p>
* For more details @see <a href="https://en.wikipedia.org/wiki/Timsort">TimSort Algorithm</a> * For more details @see <a href="https://en.wikipedia.org/wiki/Timsort">TimSort Algorithm</a>
*/ */
@SuppressWarnings("rawtypes") @SuppressWarnings({"rawtypes", "unchecked"})
class TimSort implements SortAlgorithm { class TimSort implements SortAlgorithm {
private static final int SUB_ARRAY_SIZE = 32; private static final int SUB_ARRAY_SIZE = 32;
private Comparable[] aux; private Comparable[] aux;

View File

@ -10,7 +10,7 @@ import java.util.List;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@SuppressWarnings("rawtypes") @SuppressWarnings({"rawtypes", "unchecked"})
public class KruskalTest { public class KruskalTest {
private Kruskal kruskal; private Kruskal kruskal;

View File

@ -8,7 +8,7 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.MethodSource;
@SuppressWarnings("rawtypes") @SuppressWarnings({"rawtypes", "unchecked"})
public class NumberOfDigitsTest { public class NumberOfDigitsTest {
@ParameterizedTest @ParameterizedTest