Skip to content

Commit fc88bea

Browse files
authored
Merge branch 'master' into do_not_suppress_try
2 parents 54e3bbb + 8be8b95 commit fc88bea

File tree

10 files changed

+7
-21
lines changed

10 files changed

+7
-21
lines changed

pmd-exclude.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ com.thealgorithms.datastructures.queues.PriorityQueue=UselessParentheses
2525
com.thealgorithms.datastructures.stacks.NodeStack=UnnecessaryFullyQualifiedName,UnusedFormalParameter
2626
com.thealgorithms.datastructures.stacks.StackArray=UselessParentheses
2727
com.thealgorithms.datastructures.trees.CheckBinaryTreeIsValidBST=UselessParentheses
28-
com.thealgorithms.datastructures.trees.Point=OverrideBothEqualsAndHashcode
2928
com.thealgorithms.datastructures.trees.SegmentTree=UselessParentheses
3029
com.thealgorithms.devutils.nodes.LargeTreeNode=UselessParentheses
3130
com.thealgorithms.devutils.nodes.SimpleNode=UselessParentheses

pom.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,8 @@
7979
<arg>-Xlint:all</arg>
8080
<arg>-Xlint:-auxiliaryclass</arg>
8181
<arg>-Xlint:-rawtypes</arg>
82-
<arg>-Xlint:-serial</arg>
8382
<arg>-Xlint:-unchecked</arg>
8483
<arg>-Xlint:-lossy-conversions</arg>
85-
<arg>-Xlint:-this-escape</arg>
8684
<arg>-Werror</arg>
8785
</compilerArgs>
8886
</configuration>

spotbugs-exclude.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@
8080
<Match>
8181
<Bug pattern="SS_SHOULD_BE_STATIC" />
8282
</Match>
83-
<Match>
84-
<Bug pattern="HE_EQUALS_USE_HASHCODE" />
85-
</Match>
8683
<Match>
8784
<Bug pattern="IT_NO_SUCH_ELEMENT" />
8885
</Match>

src/main/java/com/thealgorithms/ciphers/RSA.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public synchronized BigInteger decrypt(BigInteger encryptedMessage) {
4747
/**
4848
* Generate a new public and private key set.
4949
*/
50-
public synchronized void generateKeys(int bits) {
50+
public final synchronized void generateKeys(int bits) {
5151
SecureRandom r = new SecureRandom();
5252
BigInteger p = new BigInteger(bits / 2, 100, r);
5353
BigInteger q = new BigInteger(bits / 2, 100, r);

src/main/java/com/thealgorithms/datastructures/heaps/MaxHeap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private HeapElement extractMax() {
9191
}
9292

9393
@Override
94-
public void insertElement(HeapElement element) {
94+
public final void insertElement(HeapElement element) {
9595
maxHeap.add(element);
9696
toggleUp(maxHeap.size());
9797
}

src/main/java/com/thealgorithms/datastructures/heaps/MinHeap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private HeapElement extractMin() {
8585
}
8686

8787
@Override
88-
public void insertElement(HeapElement element) {
88+
public final void insertElement(HeapElement element) {
8989
minHeap.add(element);
9090
toggleUp(minHeap.size());
9191
}

src/main/java/com/thealgorithms/datastructures/lists/DoublyLinkedList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* @author Unknown
1515
*/
16-
public class DoublyLinkedList {
16+
public final class DoublyLinkedList {
1717

1818
/**
1919
* Head refers to the front of the list

src/main/java/com/thealgorithms/datastructures/trees/SegmentTree.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public SegmentTree(int n, int[] arr) {
1919
}
2020

2121
/* A function which will create the segment tree*/
22-
public int constructTree(int[] arr, int start, int end, int index) {
22+
public final int constructTree(int[] arr, int start, int end, int index) {
2323
if (start == end) {
2424
this.seg_t[index] = arr[start];
2525
return arr[start];

src/main/java/com/thealgorithms/sorts/TopologicalSort.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ public void addEdge(String label, String... next) {
7373
}
7474
}
7575

76-
static class BackEdgeException extends RuntimeException {
77-
78-
BackEdgeException(String backEdge) {
79-
super("This graph contains a cycle. No linear ordering is possible. " + backEdge);
80-
}
81-
}
82-
8376
/*
8477
* Depth First Search
8578
*
@@ -131,7 +124,7 @@ private static String sort(Graph graph, Vertex u, LinkedList<String> list) {
131124
*
132125
* In many cases, we will not know u.f, but v.color denotes the type of edge
133126
* */
134-
throw new BackEdgeException("Back edge: " + u.label + " -> " + label);
127+
throw new RuntimeException("This graph contains a cycle. No linear ordering is possible. Back edge: " + u.label + " -> " + label);
135128
}
136129
});
137130
u.color = Color.BLACK;

src/test/java/com/thealgorithms/sorts/TopologicalSortTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import static org.junit.jupiter.api.Assertions.assertIterableEquals;
55
import static org.junit.jupiter.api.Assertions.assertThrows;
66

7-
import com.thealgorithms.sorts.TopologicalSort.BackEdgeException;
87
import com.thealgorithms.sorts.TopologicalSort.Graph;
98
import java.util.LinkedList;
109
import org.junit.jupiter.api.Test;
@@ -55,7 +54,7 @@ public void failureTest() {
5554
graph.addEdge("6", "2");
5655
graph.addEdge("7", "");
5756
graph.addEdge("8", "");
58-
Exception exception = assertThrows(BackEdgeException.class, () -> TopologicalSort.sort(graph));
57+
Exception exception = assertThrows(RuntimeException.class, () -> TopologicalSort.sort(graph));
5958
String expected = "This graph contains a cycle. No linear ordering is possible. "
6059
+ "Back edge: 6 -> 2";
6160
assertEquals(exception.getMessage(), expected);

0 commit comments

Comments
 (0)