File IdMap.java
has 1422 lines of code (exceeds 250 allowed). Consider refactoring. Open
package de.uniks.networkparser;
import java.beans.PropertyChangeEvent;
import java.util.Collection;
import java.util.ConcurrentModificationException;
Method encode
has a Cognitive Complexity of 184 (exceeds 5 allowed). Consider refactoring. Open
protected Entity encode(Object entity, String className, MapEntity map, BaseItem parentNode) {
if (map == null) {
return null;
}
Grammar grammar = map.getGrammar();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method addI18N
has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring. Open
private boolean addI18N(Object root, TextItems i18n, SimpleSet<Object> items, String key, List<?> subElements) {
if (items == null || i18n == null || items.add(root) == false) {
return false;
}
SendableEntityCreator creator = this.getCreatorClass(root);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
IdMap
has 88 methods (exceeds 20 allowed). Consider refactoring. Open
public class IdMap implements BaseItem, Iterable<SendableEntityCreator>, SendableEntityCreator {
/** The Constant VALUE. */
public static final String VALUE = "value";
/** The Constant ID. */
Method getCloneByEntity
has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring. Open
private Object getCloneByEntity(Object reference, MapEntity map) {
if (map == null || map.contains(reference)) {
return null;
}
SendableEntityCreator creator = getCreatorClass(reference);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method parseValue
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
private boolean parseValue(String property, Object value, String className, SendableEntityCreator valueCreater,
MapEntity map, BaseItem parent) {
if (map == null) {
return false;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method encode
has 197 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected Entity encode(Object entity, String className, MapEntity map, BaseItem parentNode) {
if (map == null) {
return null;
}
Grammar grammar = map.getGrammar();
Method add
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
@Override
public boolean add(Object... values) {
if (values == null) {
return false;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method countMessage
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
private void countMessage(Object message, SimpleList<String> classCounts, SimpleKeyValueList<String, Object> gc) {
if (message instanceof List<?>) {
for (Iterator<?> i = ((List<?>) message).iterator(); i.hasNext();) {
Object obj = i.next();
if (obj instanceof JsonObject) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method encodeList
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
protected EntityList encodeList(Object object, MapEntity map) {
if (map == null || object == null) {
return null;
}
EntityList target = (EntityList) map.getTarget();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method decode
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public Object decode(Object value, Object target, Filter filter) {
if (value == null) {
return null;
}
if (filter == null) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method removeObj
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public boolean removeObj(Object oldValue, boolean destroy) {
String key = getKey(oldValue);
if (destroy) {
SendableEntityCreator creator = getCreatorClass(oldValue);
if (creator != null) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getCreator
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public SendableEntityCreator getCreator(String clazz, boolean fullName, boolean caseSensitive,
SimpleList<SendableEntityCreator> creators) {
if (clazz == null || clazz.length() < 1) {
return null;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method parseValue
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
private boolean parseValue(String property, Object value, String className, SendableEntityCreator valueCreater,
MapEntity map, BaseItem parent) {
if (map == null) {
return false;
}
Method addI18N
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
private boolean addI18N(Object root, TextItems i18n, SimpleSet<Object> items, String key, List<?> subElements) {
if (items == null || i18n == null || items.add(root) == false) {
return false;
}
SendableEntityCreator creator = this.getCreatorClass(root);
Method decode
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Object decode(Object value, Object target, Filter filter) {
if (value == null) {
return null;
}
if (filter == null) {
Method getCloneByEntity
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
private Object getCloneByEntity(Object reference, MapEntity map) {
if (map == null || map.contains(reference)) {
return null;
}
SendableEntityCreator creator = getCreatorClass(reference);
Method add
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public boolean add(Object... values) {
if (values == null) {
return false;
}
Method encodeList
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected EntityList encodeList(Object object, MapEntity map) {
if (map == null || object == null) {
return null;
}
EntityList target = (EntityList) map.getTarget();
Method getCreator
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public SendableEntityCreator getCreator(String clazz, boolean fullName, boolean caseSensitive,
SimpleList<SendableEntityCreator> creators) {
if (clazz == null || clazz.length() < 1) {
return null;
}
Method replaceObject
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public boolean replaceObject(Object newObject) {
String key = getKey(newObject);
if (key != null) {
return false;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method checkforCreating
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private boolean checkforCreating(Object element) {
if (element == null) {
return false;
}
if (element instanceof Entity) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method withCreator
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public IdMap withCreator(SendableEntityCreator... createrClass) {
if (createrClass == null) {
return this;
}
for (SendableEntityCreator creator : createrClass) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method removeObj
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public boolean removeObj(Object oldValue, boolean destroy) {
String key = getKey(oldValue);
if (destroy) {
SendableEntityCreator creator = getCreatorClass(oldValue);
if (creator != null) {
Method countMessage
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void countMessage(Object message, SimpleList<String> classCounts, SimpleKeyValueList<String, Object> gc) {
if (message instanceof List<?>) {
for (Iterator<?> i = ((List<?>) message).iterator(); i.hasNext();) {
Object obj = i.next();
if (obj instanceof JsonObject) {
Method decodingJsonObject
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private Object decodingJsonObject(JsonObject jsonObject, MapEntity map) {
if (jsonObject == null || map == null) {
return null;
}
/* SWITCH FOR JAVAFX THREAD */
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method replaceObject
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public boolean replaceObject(Object newObject) {
String key = getKey(newObject);
if (key != null) {
return false;
}
Method put
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public boolean put(String id, Object item, boolean notification) {
if (this.keyValue.add(id, item) == false) {
return false;
}
if (this.mapListener == null) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
if (map.getDeep() <= ((Deep) filter).getDepth()) {
return item;
}
Avoid deeply nested control flow statements. Open
if (parent.has(property)) {
if (isError(this, "Encode", NetworkParserLog.ERROR_TYP_DUPPLICATE, entity, className)) {
throw new RuntimeException("Property duplicate:" + property + "(" + className + ")");
}
}
Avoid deeply nested control flow statements. Open
if (id != null && id.equals(childEntity.getString(ID))) {
return item;
}
Method parseValue
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private boolean parseValue(String property, Object value, String className, SendableEntityCreator valueCreater,
MapEntity map, BaseItem parent) {
Avoid deeply nested control flow statements. Open
while (i.hasNext()) {
if (creator.setValue(oldValue, prop, i.next(), SendableEntityCreator.REMOVE) == false) {
return false;
}
}
Avoid deeply nested control flow statements. Open
if (notNull) {
Object refValue = creator.getValue(referenceObject, property);
encoding = value.equals(refValue) == false;
} else {
encoding = true;
Method decodingJsonArray
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private Object decodingJsonArray(JsonArray jsonArray, MapEntity map) {
if (jsonArray == null || map == null) {
return null;
}
Object result = null;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method getValue
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@Override
public Object getValue(Object entity, String attribute) {
SendableEntityCreator creator = getCreatorClass(entity);
if (creator == null || attribute == null) {
return null;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
for (Object item : list) {
Object refValue = map.getCloneByEntity(item);
if (refValue != null) {
creator.setValue(newObject, property, refValue, SendableEntityCreator.NEW);
} else {
Avoid deeply nested control flow statements. Open
if (item instanceof Entity) {
Entity subElement = (Entity) item;
for (int i = 0; i < subElement.size(); i++) {
String keyByIndex = subElement.getKeyByIndex(i);
if (property.equalsIgnoreCase(keyByIndex)) {
Avoid deeply nested control flow statements. Open
if (filter.isId(value, className, this)) {
key = tokener.getKey(value);
}
Avoid deeply nested control flow statements. Open
if (value instanceof Entity) {
if (parent instanceof EntityList) {
parent.add(value);
continue;
} else if (parent instanceof Entity) {
Avoid deeply nested control flow statements. Open
if (valueCreater != null && targetList != null) {
if (convert > 0 && contains == false) {
encode(value, className, map, item);
}
Entity child = tokener.createLink(item, fullProp, className, tokener.getId(value));
Avoid deeply nested control flow statements. Open
if (key != null) {
contains = map.contains(key);
}
Method isError
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public boolean isError(Object owner, String method, String type, Object entity, String className) {
Method addI18N
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private boolean addI18N(Object root, TextItems i18n, SimpleSet<Object> items, String key, List<?> subElements) {
Method getTypList
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public SimpleList<Object> getTypList(SendableEntityCreator creator) {
if (creator == null) {
return null;
}
SimpleList<Object> result = new SimpleList<Object>();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method setValue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
public boolean setValue(Object entity, String attribute, Object value, String type) {
SendableEntityCreator creator = getCreatorClass(entity);
if (creator == null || attribute == null) {
return false;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return decoding(valueItem, map);
Avoid too many return
statements within this method. Open
return decodingXMLEntity(tokener, buffer, map);
Avoid too many return
statements within this method. Open
return item;
Avoid too many return
statements within this method. Open
return decode(item);
Avoid too many return
statements within this method. Open
return mf.getValue(entity);
Avoid too many return
statements within this method. Open
return byteTokener.decodeValue((byte) firstChar, buffer, map);
Avoid too many return
statements within this method. Open
return jsonTokener.decoding(jsonObject, map, false);
Avoid too many return
statements within this method. Open
return item;
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return null;
Avoid too many return
statements within this method. Open
return item;
Method getId
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected String getId(SendableEntityCreator creator, MapEntity map, Object entity, String className) {
String id = null;
Object temp = null;
if (creator instanceof SendableEntityCreatorIndexId) {
temp = creator.getValue(entity, IdMap.ID);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
These nested if statements could be combined Open
if (item.getClass().getName().equals(clazzName)) {
result.add(item);
}
- Read upRead up
- Exclude checks
CollapsibleIfStatements
Since: PMD 3.1
Priority: Medium
Categories: Style
Remediation Points: 50000
Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.
Example:
void bar() {
if (x) { // original implementation
if (y) {
// do stuff
}
}
}
void bar() {
if (x && y) { // optimized implementation
// do stuff
}
}
These nested if statements could be combined Open
if (map.getDeep() <= ((Deep) filter).getDepth()) {
return item;
}
- Read upRead up
- Exclude checks
CollapsibleIfStatements
Since: PMD 3.1
Priority: Medium
Categories: Style
Remediation Points: 50000
Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.
Example:
void bar() {
if (x) { // original implementation
if (y) {
// do stuff
}
}
}
void bar() {
if (x && y) { // optimized implementation
// do stuff
}
}
These nested if statements could be combined Open
if (clazzName.startsWith(firstLetter)) {
creators.add(this.creators.getValueByIndex(i));
}
- Read upRead up
- Exclude checks
CollapsibleIfStatements
Since: PMD 3.1
Priority: Medium
Categories: Style
Remediation Points: 50000
Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.
Example:
void bar() {
if (x) { // original implementation
if (y) {
// do stuff
}
}
}
void bar() {
if (x && y) { // optimized implementation
// do stuff
}
}
These nested if statements could be combined Open
if (value instanceof SendableEntityCreator) {
/* SIMPLE CASE */
element = i18n.getLabelValue(fullKey + ":autocreate");
boolean creating;
if (element instanceof Boolean) {
- Read upRead up
- Exclude checks
CollapsibleIfStatements
Since: PMD 3.1
Priority: Medium
Categories: Style
Remediation Points: 50000
Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.
Example:
void bar() {
if (x) { // original implementation
if (y) {
// do stuff
}
}
}
void bar() {
if (x && y) { // optimized implementation
// do stuff
}
}
These nested if statements could be combined Open
if (jsonObject.has(IdMap.ID) == false && jsonObject.has(IdMap.CLASS) == false) {
/* It is a SimpleFormat */
Object target = map.getTarget();
SendableEntityCreator creator = this.getCreatorClass(target);
return jsonTokener.decodingSimple(jsonObject, target, creator);
- Read upRead up
- Exclude checks
CollapsibleIfStatements
Since: PMD 3.1
Priority: Medium
Categories: Style
Remediation Points: 50000
Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.
Example:
void bar() {
if (x) { // original implementation
if (y) {
// do stuff
}
}
}
void bar() {
if (x && y) { // optimized implementation
// do stuff
}
}
These nested if statements could be combined Open
if (filter.convert(item, null, entity, this, map.getDeep()) < 0) {
ObjectCondition propertyRegard = map.getFilter().getPropertyRegard();
if (propertyRegard instanceof MapFilter) {
MapFilter mf = (MapFilter) propertyRegard;
return mf.getValue(entity);
- Read upRead up
- Exclude checks
CollapsibleIfStatements
Since: PMD 3.1
Priority: Medium
Categories: Style
Remediation Points: 50000
Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.
Example:
void bar() {
if (x) { // original implementation
if (y) {
// do stuff
}
}
}
void bar() {
if (x && y) { // optimized implementation
// do stuff
}
}
These nested if statements could be combined Open
if (isError(this, "Encode", NetworkParserLog.ERROR_TYP_DUPPLICATE, entity, className)) {
throw new RuntimeException("Property duplicate:" + property + "(" + className + ")");
}
- Read upRead up
- Exclude checks
CollapsibleIfStatements
Since: PMD 3.1
Priority: Medium
Categories: Style
Remediation Points: 50000
Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.
Example:
void bar() {
if (x) { // original implementation
if (y) {
// do stuff
}
}
}
void bar() {
if (x && y) { // optimized implementation
// do stuff
}
}