Skip to content

style: include ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD #5129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3 changes: 0 additions & 3 deletions spotbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
<Match>
<Bug pattern="EI_EXPOSE_REP2" />
</Match>
<Match>
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD" />
</Match>
<Match>
<Bug pattern="DMI_RANDOM_USED_ONLY_ONCE" />
</Match>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/thealgorithms/sorts/LinkListSort.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class Node {

class Task {

static int[] a;
private int[] a;

public Node sortByMergeSort(Node head) {
if (head == null || head.next == null) return head;
Expand Down Expand Up @@ -245,7 +245,7 @@ static int count(Node head) {

class Task2 {

static int[] a;
private int[] a;

public Node sortByHeapSort(Node head) {
if (head == null || head.next == null) return head;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/thealgorithms/sorts/MergeSort.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
class MergeSort implements SortAlgorithm {

@SuppressWarnings("rawtypes") private static Comparable[] aux;
private Comparable[] aux;

/**
* Generic merge sort algorithm implements.
Expand All @@ -30,7 +30,7 @@ public <T extends Comparable<T>> T[] sort(T[] unsorted) {
* @param left the first index of the array.
* @param right the last index of the array.
*/
private static <T extends Comparable<T>> void doSort(T[] arr, int left, int right) {
private <T extends Comparable<T>> void doSort(T[] arr, int left, int right) {
if (left < right) {
int mid = (left + right) >>> 1;
doSort(arr, left, mid);
Expand All @@ -49,7 +49,7 @@ private static <T extends Comparable<T>> void doSort(T[] arr, int left, int righ
* increasing order.
*/
@SuppressWarnings("unchecked")
private static <T extends Comparable<T>> void merge(T[] arr, int left, int mid, int right) {
private <T extends Comparable<T>> void merge(T[] arr, int left, int mid, int right) {
int i = left, j = mid + 1;
System.arraycopy(arr, left, aux, left, right + 1 - left);

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/com/thealgorithms/sorts/TimSort.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
class TimSort implements SortAlgorithm {
private static final int SUB_ARRAY_SIZE = 32;
@SuppressWarnings("rawtypes") private static Comparable[] aux;
private Comparable[] aux;

@Override
public <T extends Comparable<T>> T[] sort(T[] a) {
Expand All @@ -30,8 +30,7 @@ public <T extends Comparable<T>> T[] sort(T[] a) {
return a;
}

@SuppressWarnings("unchecked")
private static <T extends Comparable<T>> void merge(T[] a, int lo, int mid, int hi) {
private <T extends Comparable<T>> void merge(T[] a, int lo, int mid, int hi) {
int i = lo, j = mid + 1;
System.arraycopy(a, lo, aux, lo, hi + 1 - lo);

Expand Down