Skip to content

style: enable RedundantModifier in checkstyle #5140

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

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
<!-- Modifier Checks -->
<!-- See https://checkstyle.org/checks/modifier/index.html -->
<module name="ModifierOrder"/>
<!-- TODO <module name="RedundantModifier"/> -->
<module name="RedundantModifier"/>

<!-- Checks for blocks. You know, those {}'s -->
<!-- See https://checkstyle.org/checks/blocks/index.html -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private class ListIterator<Element> implements Iterator<Element> {

private Node<Element> currentElement;

public ListIterator(Node<Element> firstElement) {
ListIterator(Node<Element> firstElement) {
currentElement = firstElement;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private class Hash<T> {

int index;

public Hash(int index) {
Hash(int index) {
this.index = index;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private static class CircularPointer {
private int pointer;
private final int max;

public CircularPointer(int pointer, int max) {
CircularPointer(int pointer, int max) {
this.pointer = pointer;
this.max = max;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ private class Node {
private Node previous;
private Node next;

public Node(K key, V value, int frequency) {
Node(K key, V value, int frequency) {
this.key = key;
this.value = value;
this.frequency = frequency;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ static final class Entry<I, J> {
private I key;
private J value;

public Entry() {
Entry() {
}

public Entry(Entry<I, J> preEntry, Entry<I, J> nextEntry, I key, J value) {
Entry(Entry<I, J> preEntry, Entry<I, J> nextEntry, I key, J value) {
this.preEntry = preEntry;
this.nextEntry = nextEntry;
this.key = key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ static final class Entry<I, J> {
private I key;
private J value;

public Entry() {
Entry() {
}

public Entry(Entry<I, J> preEntry, Entry<I, J> nextEntry, I key, J value) {
Entry(Entry<I, J> preEntry, Entry<I, J> nextEntry, I key, J value) {
this.preEntry = preEntry;
this.nextEntry = nextEntry;
this.key = key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class GCounter {
*
* @param n The number of nodes in the cluster.
*/
public GCounter(int myId, int n) {
GCounter(int myId, int n) {
this.myId = myId;
this.n = n;
this.P = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Element {
* @param timestamp The timestamp associated with the element.
* @param bias The bias of the element (ADDS or REMOVALS).
*/
public Element(String key, int timestamp, Bias bias) {
Element(String key, int timestamp, Bias bias) {
this.key = key;
this.timestamp = timestamp;
this.bias = bias;
Expand All @@ -49,7 +49,7 @@ class LWWElementSet {
/**
* Constructs an empty LWWElementSet.
*/
public LWWElementSet() {
LWWElementSet() {
this.addSet = new HashMap<>();
this.removeSet = new HashMap<>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class PNCounter {
* @param myId The identifier of the current node.
* @param n The number of nodes in the cluster.
*/
public PNCounter(int myId, int n) {
PNCounter(int myId, int n) {
this.myId = myId;
this.n = n;
this.P = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ private static class Graph {
private ArrayList<ArrayList<Edge>> graph;

// Initialise ArrayLists in Constructor
public Graph(int size) {
Graph(int size) {
this.graph = new ArrayList<>();
for (int i = 0; i < size; i++) {
this.graph.add(new ArrayList<>());
Expand All @@ -38,7 +38,7 @@ private static class Edge {
private int to;
private int weight;

public Edge(int from, int to, int weight) {
Edge(int from, int to, int weight) {
this.from = from;
this.to = to;
this.weight = weight;
Expand All @@ -64,7 +64,7 @@ private static class PathAndDistance {
private ArrayList<Integer> path; // list of visited nodes in this path.
private int estimated; // heuristic value associated to the last node od the path (current node).

public PathAndDistance(int distance, ArrayList<Integer> path, int estimated) {
PathAndDistance(int distance, ArrayList<Integer> path, int estimated) {
this.distance = distance;
this.path = path;
this.estimated = estimated;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Edge {
* @param v End vertex
* @param c Weight
*/
public Edge(int a, int b, int c) {
Edge(int a, int b, int c) {
u = a;
v = b;
w = c;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Node {

E name;

public Node(E name) {
Node(E name) {
this.name = name;
}
}
Expand All @@ -24,7 +24,7 @@ class Edge {

Node startNode, endNode;

public Edge(Node startNode, Node endNode) {
Edge(Node startNode, Node endNode) {
this.startNode = startNode;
this.endNode = endNode;
}
Expand All @@ -33,7 +33,7 @@ public Edge(Node startNode, Node endNode) {
ArrayList<Edge> edgeList;
ArrayList<Node> nodeList;

public Graph() {
Graph() {
edgeList = new ArrayList<Edge>();
nodeList = new ArrayList<Node>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Cycle {
private boolean[] visited;
ArrayList<ArrayList<Integer>> cycles = new ArrayList<ArrayList<Integer>>();

public Cycle() {
Cycle() {
Scanner in = new Scanner(System.in);
System.out.print("Enter the no. of nodes: ");
nodes = in.nextInt();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class AdjacencyListGraph<E extends Comparable<E>> {

ArrayList<Vertex> vertices;

public AdjacencyListGraph() {
AdjacencyListGraph() {
vertices = new ArrayList<>();
}

Expand All @@ -15,7 +15,7 @@ private class Vertex {
E data;
ArrayList<Vertex> adjacentVertices;

public Vertex(E data) {
Vertex(E data) {
adjacentVertices = new ArrayList<>();
this.data = data;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ private static class Edge {
private int to;
private int weight;

public Edge(int from, int to, int weight) {
Edge(int from, int to, int weight) {
this.from = from;
this.to = to;
this.weight = weight;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class AdjacencyMatrixGraph {
/**
* Constructor
*/
public AdjacencyMatrixGraph(int givenNumberOfVertices) {
AdjacencyMatrixGraph(int givenNumberOfVertices) {
this.setNumberOfVertices(givenNumberOfVertices);
this.setNumberOfEdges(0);
this.setAdjacency(new int[givenNumberOfVertices][givenNumberOfVertices]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private class Node {
K key;
V val;

public Node(K key, V val) {
Node(K key, V val) {
this.key = key;
this.val = val;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class Link {
*
* @param value Value of node
*/
public Link(int value) {
Link(int value) {
this.value = value;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private static class Node<E> {
private final List<Node<E>> backward;

@SuppressWarnings("unchecked")
public Node(E value, int height) {
Node(E value, int height) {
this.value = value;
this.height = height;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ static class Node<T> {
T data;
Node<T> next;

public Node() {
Node() {
this(null);
}

public Node(T data) {
Node(T data) {
this(data, null);
}

public Node(T data, Node<T> next) {
Node(T data, Node<T> next) {
this.data = data;
this.next = next;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class PriorityQueue {
* Default Constructor
*/

public PriorityQueue() {
PriorityQueue() {
/* If capacity is not defined, default size of 11 would be used
* capacity=max+1 because we cant access 0th element of PQ, and to
* accomodate (max)th elements we need capacity to be max+1.
Expand All @@ -50,7 +50,7 @@ public PriorityQueue() {
* @param size Size of the queue
*/

public PriorityQueue(int size) {
PriorityQueue(int size) {
maxSize = size + 1;
queueArray = new int[maxSize];
nItems = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class Queue {
/**
* init with DEFAULT_CAPACITY
*/
public Queue() {
Queue() {
this(DEFAULT_CAPACITY);
}

Expand All @@ -47,7 +47,7 @@ public Queue() {
*
* @param size Size of the new queue
*/
public Queue(int size) {
Queue(int size) {
maxSize = size;
queueArray = new int[size];
front = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Node {
public int data;
public Node next;

public Node(int data) {
Node(int data) {
this.data = data;
this.next = null;
}
Expand All @@ -60,7 +60,7 @@ class LinkedListStack {
/**
* Init properties
*/
public LinkedListStack() {
LinkedListStack() {
head = null;
size = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static class Node {
*
* @param value Value to put in the node
*/
public Node(int value) {
Node(int value) {
data = value;
left = null;
right = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public int getDimension() {
return coordinates.length;
}

public Point(int[] coordinates) {
Point(int[] coordinates) {
this.coordinates = coordinates;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static class Node {
private int lazy; // lazied value that should be added to children nodes
Node left, right; // left and right children

public Node(int start, int end, int value) {
Node(int start, int end, int value) {
this.start = start;
this.end = end;
this.value = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class TreeNode {
TreeNode left, right;

// Constructor
public TreeNode(int key) {
TreeNode(int key) {
this.key = key;
left = right = null;
}
Expand All @@ -27,7 +27,7 @@ class QItem {
TreeNode node;
int hd;

public QItem(TreeNode n, int h) {
QItem(TreeNode n, int h) {
node = n;
hd = h;
}
Expand All @@ -39,11 +39,11 @@ class Tree {
TreeNode root;

// Constructors
public Tree() {
Tree() {
root = null;
}

public Tree(TreeNode n) {
Tree(TreeNode n) {
root = n;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ class NRKTree {
public NRKTree right;
public int data;

public NRKTree(int x) {
NRKTree(int x) {
this.left = null;
this.right = null;
this.data = x;
}

public NRKTree(NRKTree right, NRKTree left, int x) {
NRKTree(NRKTree right, NRKTree left, int x) {
this.left = left;
this.right = right;
this.data = x;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public int compareTo(Job otherJob) {
return otherJob.profit - this.profit;
}

public Job(char id, int deadline, int profit) {
Job(char id, int deadline, int profit) {
this.id = id;
this.deadline = deadline;
this.profit = profit;
Expand Down
Loading