Skip to content

Commit

Permalink
Fix or supress some PMD warnings (Useless parens, unused params, etc)
Browse files Browse the repository at this point in the history
  • Loading branch information
joelittlejohn committed Feb 22, 2014
1 parent 4daed6c commit e1e3ab7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public JsonNode getContent() {
}

public boolean isGenerated() {
return (javaType != null);
return javaType != null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ private URI removeFragment(URI id) {
* schema's id)
* @return a schema object containing the contents of the given path
*/
@SuppressWarnings("PMD.UselessParentheses")
public Schema create(Schema parent, String path) {

if (path.equals("#")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

package org.jsonschema2pojo.rules;

import static org.jsonschema2pojo.rules.PrimitiveTypes.*;
import static java.util.Arrays.*;
import static org.apache.commons.lang3.StringUtils.*;
import static org.jsonschema2pojo.rules.PrimitiveTypes.*;

import java.util.ArrayList;
import java.util.HashMap;
Expand All @@ -28,11 +28,12 @@

import javax.annotation.Generated;

import com.fasterxml.jackson.databind.JsonNode;
import org.jsonschema2pojo.Schema;
import org.jsonschema2pojo.SchemaMapper;
import org.jsonschema2pojo.exception.ClassAlreadyExistsException;
import org.jsonschema2pojo.exception.GenerationException;

import com.fasterxml.jackson.databind.JsonNode;
import com.sun.codemodel.ClassType;
import com.sun.codemodel.JAnnotationUse;
import com.sun.codemodel.JBlock;
Expand Down Expand Up @@ -109,7 +110,7 @@ public JType apply(String nodeName, JsonNode node, JClassContainer container, Sc
JFieldVar valueField = addValueField(_enum);
addToString(_enum, valueField);
addEnumConstants(node.path("enum"), _enum);
addFactoryMethod(node.path("enum"), _enum);
addFactoryMethod(_enum);

return _enum;
}
Expand Down Expand Up @@ -144,7 +145,7 @@ private JDefinedClass createEnum(JsonNode node, String nodeName, JClassContainer
}
}

private void addFactoryMethod(JsonNode node, JDefinedClass _enum) {
private void addFactoryMethod(JDefinedClass _enum) {
JFieldVar quickLookupMap = addQuickLookupMap(_enum);

JMethod fromValue = _enum.method(JMod.PUBLIC | JMod.STATIC, _enum, "fromValue");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
import static javax.lang.model.SourceVersion.*;
import static org.apache.commons.lang3.StringUtils.*;

import com.fasterxml.jackson.databind.JsonNode;
import org.jsonschema2pojo.Schema;

import com.fasterxml.jackson.databind.JsonNode;
import com.sun.codemodel.JBlock;
import com.sun.codemodel.JDefinedClass;
import com.sun.codemodel.JExpr;
Expand Down Expand Up @@ -207,7 +208,7 @@ private String getBuilderName(String propertyName) {
}

private String getGetterName(String propertyName, JType type) {
String prefix = (type.equals(type.owner()._ref(boolean.class))) ? "is" : "get";
String prefix = type.equals(type.owner()._ref(boolean.class)) ? "is" : "get";
propertyName = ruleFactory.getNameHelper().replaceIllegalCharacters(propertyName);
String getterName = prefix + capitalize(ruleFactory.getNameHelper().capitalizeTrailingWords(propertyName));

Expand Down

0 comments on commit e1e3ab7

Please sign in to comment.