Wrong lexicographical order for 'com.google.common.eventbus.EventBus' import. Should be before 'org.springframework.stereotype.Service'. Open
import com.google.common.eventbus.EventBus;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
Extra separation in import group before 'org.springframework.beans.factory.annotation.Configurable' Open
import org.springframework.beans.factory.annotation.Configurable;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
Extra separation in import group before 'com.google.common.eventbus.EventBus' Open
import com.google.common.eventbus.EventBus;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.
This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.
Private field 'eventBuses' could be made final; it is only initialized in the declaration or constructor. Open
private HashMap<String, EventBus> eventBuses = new HashMap<String, EventBus>();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
ImmutableField
Since: PMD 2.0
Priority: Medium
Categories: Style
Remediation Points: 50000
Identifies private fields whose values never change once they are initialized either in the declaration of the field or by a constructor. This helps in converting existing classes to becoming immutable ones.
Example:
public class Foo {
private int x; // could be final
public Foo() {
x = 7;
}
public void foo() {
int a = x + 2;
}
}
Avoid if (x != y) ..; else ..; Open
if (!eventBusIds.contains(id)) {
EventBus eventBus = new EventBus(id);
eventBusIds.add(id);
eventBuses.put(id, eventBus);
return eventBus;
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
ConfusingTernary
Since: PMD 1.9
Priority: Medium
Categories: Style
Remediation Points: 50000
Avoid negation within an 'if' expression with an 'else' clause. For example, rephrase: if (x != y) diff(); else same();
as: if (x == y) same(); else diff();
. Most 'if (x != y)' cases without an 'else' are often return cases, so consistent use of this rule makes the code easier to read. Also, this resolves trivial ordering problems, such as 'does the error case go first?' or 'does the common case go first?'.
Example:
boolean bar(int x, int y) {
return (x != y) ? diff : same;
}
Private field 'eventBusIds' could be made final; it is only initialized in the declaration or constructor. Open
private HashSet<String> eventBusIds = new HashSet<String>();
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
ImmutableField
Since: PMD 2.0
Priority: Medium
Categories: Style
Remediation Points: 50000
Identifies private fields whose values never change once they are initialized either in the declaration of the field or by a constructor. This helps in converting existing classes to becoming immutable ones.
Example:
public class Foo {
private int x; // could be final
public Foo() {
x = 7;
}
public void foo() {
int a = x + 2;
}
}