diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java index 6510ca455e6..368774c0075 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java @@ -638,19 +638,39 @@ public String toDefaultValue(Property p) { if (ap.getItems() == null) { return null; } - return String.format(pattern, getTypeDeclaration(ap.getItems())); + + String typeDeclaration = getTypeDeclaration(ap.getItems()); + Object java8obj = additionalProperties.get("java8"); + if (java8obj != null) { + Boolean java8 = Boolean.valueOf(java8obj.toString()); + if (java8 != null && java8) { + typeDeclaration = ""; + } + } + + return String.format(pattern, typeDeclaration); } else if (p instanceof MapProperty) { final MapProperty ap = (MapProperty) p; final String pattern; if (fullJavaUtil) { - pattern = "new java.util.HashMap()"; + pattern = "new java.util.HashMap<%s>()"; } else { - pattern = "new HashMap()"; + pattern = "new HashMap<%s>()"; } if (ap.getAdditionalProperties() == null) { return null; } - return String.format(pattern, getTypeDeclaration(ap.getAdditionalProperties())); + + String typeDeclaration = String.format("String, %s", getTypeDeclaration(ap.getAdditionalProperties())); + Object java8obj = additionalProperties.get("java8"); + if (java8obj != null) { + Boolean java8 = Boolean.valueOf(java8obj.toString()); + if (java8 != null && java8) { + typeDeclaration = ""; + } + } + + return String.format(pattern, typeDeclaration); } else if (p instanceof IntegerProperty) { IntegerProperty dp = (IntegerProperty) p; if (dp.getDefault() != null) { diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaPlayFrameworkCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaPlayFrameworkCodegen.java index fe44a70ad6c..452bfdd29e9 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaPlayFrameworkCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/JavaPlayFrameworkCodegen.java @@ -51,7 +51,7 @@ public JavaPlayFrameworkCodegen() { additionalProperties.put(CONFIG_PACKAGE, configPackage); additionalProperties.put(BASE_PACKAGE, basePackage); - + additionalProperties.put("java8", true); additionalProperties.put("jackson", "true"); cliOptions.add(new CliOption(TITLE, "server title name or client service name")); @@ -263,7 +263,7 @@ public Map postProcessOperations(Map objs) { } } - Pattern pathVariableMatcher = Pattern.compile("\\{(.+)}"); + Pattern pathVariableMatcher = Pattern.compile("\\{([^}]+)}"); Matcher match = pathVariableMatcher.matcher(operation.path); while (match.find()) { String completeMatch = match.group(); diff --git a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/conversionBegin.mustache b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/conversionBegin.mustache index 6bf3e446810..93b5e5b3773 100644 --- a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/conversionBegin.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/conversionBegin.mustache @@ -1 +1 @@ -{{#isBoolean}}Boolean.valueOf({{/isBoolean}}{{#isInteger}}Integer.parseInt({{/isInteger}}{{#isDouble}}Double.parseDouble({{/isDouble}}{{#isLong}}Long.parseLong({{/isLong}}{{#isFloat}}Float.parseFloat({{/isFloat}}{{#isString}}(String){{/isString}}{{#isDateTime}}OffsetDateTime.parse({{/isDateTime}} \ No newline at end of file +{{#isBoolean}}Boolean.valueOf({{/isBoolean}}{{#isInteger}}Integer.parseInt({{/isInteger}}{{#isDouble}}Double.parseDouble({{/isDouble}}{{#isLong}}Long.parseLong({{/isLong}}{{#isFloat}}Float.parseFloat({{/isFloat}}{{#isDateTime}}OffsetDateTime.parse({{/isDateTime}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/conversionEnd.mustache b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/conversionEnd.mustache index 8fe80ab2578..fa7478462bf 100644 --- a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/conversionEnd.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/conversionEnd.mustache @@ -1 +1 @@ -{{#isBoolean}}){{/isBoolean}}{{#isInteger}}){{/isInteger}}{{#isDouble}}){{/isDouble}}{{#isLong}}){{/isLong}}{{#isFloat}}){{/isFloat}}{{#isString}}{{/isString}}{{#isDateTime}}){{/isDateTime}} \ No newline at end of file +{{#isBoolean}}){{/isBoolean}}{{#isInteger}}){{/isInteger}}{{#isDouble}}){{/isDouble}}{{#isLong}}){{/isLong}}{{#isFloat}}){{/isFloat}}{{#isDateTime}}){{/isDateTime}} \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/enumClass.mustache b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/enumClass.mustache index c5c3143cb94..5d5086497d9 100644 --- a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/enumClass.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/enumClass.mustache @@ -20,7 +20,7 @@ {{/allowableValues}} {{/gson}} - private {{{datatype}}} value; + private final {{{datatype}}} value; {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{{datatype}}} value) { this.value = value; diff --git a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/enumOuterClass.mustache b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/enumOuterClass.mustache index 76c2cbf5a76..4bd1206fd55 100644 --- a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/enumOuterClass.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/enumOuterClass.mustache @@ -18,7 +18,7 @@ public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}} {{/gson}} - private {{{dataType}}} value; + private final {{{dataType}}} value; {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}}({{{dataType}}} value) { this.value = value; diff --git a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/model.mustache b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/model.mustache index d18cc328e88..2f149aac0a1 100644 --- a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/model.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/model.mustache @@ -1,17 +1,13 @@ package {{package}}; -import java.util.Objects; {{#imports}}import {{import}}; {{/imports}} {{#serializableModel}} import java.io.Serializable; {{/serializableModel}} import com.fasterxml.jackson.annotation.*; -{{#useBeanValidation}} import java.util.Set; import javax.validation.*; -import javax.validation.constraints.*; -{{/useBeanValidation}} {{#models}} {{#model}} {{#isEnum}} diff --git a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/newApiController.mustache b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/newApiController.mustache index 6ac7f8558cb..518d3ea5f9f 100644 --- a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/newApiController.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/newApiController.mustache @@ -12,7 +12,10 @@ import java.util.ArrayList; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; +import java.io.File; +{{^handleExceptions}} import java.io.IOException; +{{/handleExceptions}} import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -90,7 +93,8 @@ public class {{classname}}Controller extends Controller { {{#formParams}} {{^notFile}} {{{dataType}}} {{paramName}} = request().body().asMultipartFormData().getFile("{{baseName}}"); - {{#required}}if (({{paramName}} == null || ((File) {{paramName}}.getFile()).length() == 0)) { + {{#required}} + if (({{paramName}} == null || ((File) {{paramName}}.getFile()).length() == 0)) { throw new RuntimeException("File cannot be empty"); } {{/required}} @@ -148,10 +152,21 @@ public class {{classname}}Controller extends Controller { entry.getValue().validate(); } {{/isMapContainer}}{{^returnContainer}}obj.validate();{{/returnContainer}}{{/useBeanValidation}}{{/returnTypeIsPrimitive}}{{/isResponseFile}}{{/returnType}} - {{#returnType}}{{^isResponseFile}}JsonNode result = mapper.valueToTree(obj); - return ok(result);{{/isResponseFile}}{{#isResponseFile}}return ok(obj);{{/isResponseFile}}{{/returnType}} - {{^returnType}}return ok();{{/returnType}}{{/controllerOnly}} - {{#controllerOnly}}return ok();{{/controllerOnly}} + {{#returnType}} + {{^isResponseFile}}JsonNode result = mapper.valueToTree(obj); + return ok(result); + {{/isResponseFile}} + {{#isResponseFile}} + return ok(obj); + {{/isResponseFile}} + {{/returnType}} + {{^returnType}} + return ok(); + {{/returnType}} + {{/controllerOnly}} + {{#controllerOnly}} + return ok(); + {{/controllerOnly}} } {{/operation}} } diff --git a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/newApiInterface.mustache b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/newApiInterface.mustache index 37800943816..918ee1f85b1 100644 --- a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/newApiInterface.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/newApiInterface.mustache @@ -13,6 +13,7 @@ import javax.validation.constraints.*; {{/useBeanValidation}} {{#operations}} +@SuppressWarnings("RedundantThrows") public interface {{classname}}ControllerImpInterface { {{#operation}} {{>returnTypes}} {{operationId}}({{#allParams}}{{>pathParams}}{{>queryParams}}{{>bodyParams}}{{>formParams}}{{>headerParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {{#handleExceptions}}throws Exception{{/handleExceptions}}; diff --git a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/pojo.mustache b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/pojo.mustache index d806092b08a..25bb4e49c4a 100644 --- a/modules/swagger-codegen/src/main/resources/JavaPlayFramework/pojo.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaPlayFramework/pojo.mustache @@ -1,7 +1,12 @@ +import java.util.Objects; +{{#useBeanValidation}} +import javax.validation.constraints.*; +{{/useBeanValidation}} /** * {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}} */ {{>generatedAnnotation}} +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} { {{#vars}} {{#isEnum}} @@ -39,11 +44,11 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali public {{classname}} add{{nameInCamelCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { {{^required}} - if (this.{{name}} == null) { - this.{{name}} = {{{defaultValue}}}; + if ({{name}} == null) { + {{name}} = {{{defaultValue}}}; } {{/required}} - this.{{name}}.add({{name}}Item); + {{name}}.add({{name}}Item); return this; } {{/isListContainer}} @@ -97,7 +102,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali return false; }{{#hasVars}} {{classname}} {{classVarName}} = ({{classname}}) o; - return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} && + return {{#vars}}Objects.equals({{name}}, {{classVarName}}.{{name}}){{#hasMore}} && {{/hasMore}}{{/vars}}{{#parent}} && super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} return true;{{/hasVars}} @@ -108,6 +113,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Category.java b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Category.java index d820c9d7365..fb9207f4b5d 100644 --- a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Category.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A category for a pet */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Category { @JsonProperty("id") private Long id = null; @@ -60,8 +61,8 @@ public boolean equals(java.lang.Object o) { return false; } Category category = (Category) o; - return Objects.equals(this.id, category.id) && - Objects.equals(this.name, category.name); + return Objects.equals(id, category.id) && + Objects.equals(name, category.name); } @Override @@ -69,6 +70,7 @@ public int hashCode() { return Objects.hash(id, name); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/ModelApiResponse.java index 4f9f27efb66..05911012313 100644 --- a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/ModelApiResponse.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Describes the result of uploading an image resource */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelApiResponse { @JsonProperty("code") private Integer code = null; @@ -80,9 +81,9 @@ public boolean equals(java.lang.Object o) { return false; } ModelApiResponse _apiResponse = (ModelApiResponse) o; - return Objects.equals(this.code, _apiResponse.code) && - Objects.equals(this.type, _apiResponse.type) && - Objects.equals(this.message, _apiResponse.message); + return Objects.equals(code, _apiResponse.code) && + Objects.equals(type, _apiResponse.type) && + Objects.equals(message, _apiResponse.message); } @Override @@ -90,6 +91,7 @@ public int hashCode() { return Objects.hash(code, type, message); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Order.java b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Order.java index acabaabd0ba..987ef07d460 100644 --- a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Order.java @@ -1,15 +1,16 @@ package apimodels; -import java.util.Objects; import java.time.OffsetDateTime; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * An order for a pets from the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Order { @JsonProperty("id") private Long id = null; @@ -33,7 +34,7 @@ public enum StatusEnum { DELIVERED("delivered"); - private String value; + private final String value; StatusEnum(String value) { this.value = value; @@ -175,12 +176,12 @@ public boolean equals(java.lang.Object o) { return false; } Order order = (Order) o; - return Objects.equals(this.id, order.id) && - Objects.equals(this.petId, order.petId) && - Objects.equals(this.quantity, order.quantity) && - Objects.equals(this.shipDate, order.shipDate) && - Objects.equals(this.status, order.status) && - Objects.equals(this.complete, order.complete); + return Objects.equals(id, order.id) && + Objects.equals(petId, order.petId) && + Objects.equals(quantity, order.quantity) && + Objects.equals(shipDate, order.shipDate) && + Objects.equals(status, order.status) && + Objects.equals(complete, order.complete); } @Override @@ -188,6 +189,7 @@ public int hashCode() { return Objects.hash(id, petId, quantity, shipDate, status, complete); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Pet.java index 69bae933aa5..430bbe805ce 100644 --- a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Pet.java @@ -1,6 +1,5 @@ package apimodels; -import java.util.Objects; import apimodels.Category; import apimodels.Tag; import java.util.ArrayList; @@ -8,11 +7,13 @@ import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A pet for sale in the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Pet { @JsonProperty("id") private Long id = null; @@ -24,7 +25,7 @@ public class Pet { private String name = null; @JsonProperty("photoUrls") - private List photoUrls = new ArrayList(); + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") private List tags = null; @@ -39,7 +40,7 @@ public enum StatusEnum { SOLD("sold"); - private String value; + private final String value; StatusEnum(String value) { this.value = value; @@ -124,7 +125,7 @@ public Pet photoUrls(List photoUrls) { } public Pet addPhotoUrlsItem(String photoUrlsItem) { - this.photoUrls.add(photoUrlsItem); + photoUrls.add(photoUrlsItem); return this; } @@ -147,10 +148,10 @@ public Pet tags(List tags) { } public Pet addTagsItem(Tag tagsItem) { - if (this.tags == null) { - this.tags = new ArrayList(); + if (tags == null) { + tags = new ArrayList<>(); } - this.tags.add(tagsItem); + tags.add(tagsItem); return this; } @@ -194,12 +195,12 @@ public boolean equals(java.lang.Object o) { return false; } Pet pet = (Pet) o; - return Objects.equals(this.id, pet.id) && - Objects.equals(this.category, pet.category) && - Objects.equals(this.name, pet.name) && - Objects.equals(this.photoUrls, pet.photoUrls) && - Objects.equals(this.tags, pet.tags) && - Objects.equals(this.status, pet.status); + return Objects.equals(id, pet.id) && + Objects.equals(category, pet.category) && + Objects.equals(name, pet.name) && + Objects.equals(photoUrls, pet.photoUrls) && + Objects.equals(tags, pet.tags) && + Objects.equals(status, pet.status); } @Override @@ -207,6 +208,7 @@ public int hashCode() { return Objects.hash(id, category, name, photoUrls, tags, status); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Tag.java index 02b787be589..709fef2cf11 100644 --- a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/Tag.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A tag for a pet */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Tag { @JsonProperty("id") private Long id = null; @@ -60,8 +61,8 @@ public boolean equals(java.lang.Object o) { return false; } Tag tag = (Tag) o; - return Objects.equals(this.id, tag.id) && - Objects.equals(this.name, tag.name); + return Objects.equals(id, tag.id) && + Objects.equals(name, tag.name); } @Override @@ -69,6 +70,7 @@ public int hashCode() { return Objects.hash(id, name); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/User.java b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/User.java index b9fd299724f..ba41fb76f80 100644 --- a/samples/server/petstore/java-play-framework-controller-only/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework-controller-only/app/apimodels/User.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A User who is purchasing from the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class User { @JsonProperty("id") private Long id = null; @@ -180,14 +181,14 @@ public boolean equals(java.lang.Object o) { return false; } User user = (User) o; - return Objects.equals(this.id, user.id) && - Objects.equals(this.username, user.username) && - Objects.equals(this.firstName, user.firstName) && - Objects.equals(this.lastName, user.lastName) && - Objects.equals(this.email, user.email) && - Objects.equals(this.password, user.password) && - Objects.equals(this.phone, user.phone) && - Objects.equals(this.userStatus, user.userStatus); + return Objects.equals(id, user.id) && + Objects.equals(username, user.username) && + Objects.equals(firstName, user.firstName) && + Objects.equals(lastName, user.lastName) && + Objects.equals(email, user.email) && + Objects.equals(password, user.password) && + Objects.equals(phone, user.phone) && + Objects.equals(userStatus, user.userStatus); } @Override @@ -195,6 +196,7 @@ public int hashCode() { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-controller-only/app/controllers/PetApiController.java b/samples/server/petstore/java-play-framework-controller-only/app/controllers/PetApiController.java index 2c251dd32a0..57c67da82ac 100644 --- a/samples/server/petstore/java-play-framework-controller-only/app/controllers/PetApiController.java +++ b/samples/server/petstore/java-play-framework-controller-only/app/controllers/PetApiController.java @@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -40,7 +40,6 @@ public Result addPet() throws Exception { body = mapper.readValue(nodebody.toString(), Pet.class); body.validate(); - return ok(); } @@ -49,12 +48,11 @@ public Result deletePet(Long petId) throws Exception { String valueapiKey = request().getHeader("api_key"); String apiKey; if (valueapiKey != null) { - apiKey = (String)valueapiKey; + apiKey = valueapiKey; } else { apiKey = null; } - return ok(); } @@ -66,7 +64,6 @@ public Result findPetsByStatus() throws Exception { //noinspection UseBulkOperation status.add(curParam); } - return ok(); } @@ -78,13 +75,11 @@ public Result findPetsByTags() throws Exception { //noinspection UseBulkOperation tags.add(curParam); } - return ok(); } @ApiAction public Result getPetById(Long petId) throws Exception { - return ok(); } @@ -96,7 +91,6 @@ public Result updatePet() throws Exception { body = mapper.readValue(nodebody.toString(), Pet.class); body.validate(); - return ok(); } @@ -105,7 +99,7 @@ public Result updatePetWithForm(Long petId) throws Exception { String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0]; String name; if (valuename != null) { - name = (String)valuename; + name = valuename; } else { name = null; @@ -113,12 +107,11 @@ public Result updatePetWithForm(Long petId) throws Exception { String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0]; String status; if (valuestatus != null) { - status = (String)valuestatus; + status = valuestatus; } else { status = null; } - return ok(); } @@ -127,13 +120,12 @@ public Result uploadFile(Long petId) throws Exception { String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0]; String additionalMetadata; if (valueadditionalMetadata != null) { - additionalMetadata = (String)valueadditionalMetadata; + additionalMetadata = valueadditionalMetadata; } else { additionalMetadata = null; } Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file"); - return ok(); } } diff --git a/samples/server/petstore/java-play-framework-controller-only/app/controllers/StoreApiController.java b/samples/server/petstore/java-play-framework-controller-only/app/controllers/StoreApiController.java index 6708d634f1b..566bf84526c 100644 --- a/samples/server/petstore/java-play-framework-controller-only/app/controllers/StoreApiController.java +++ b/samples/server/petstore/java-play-framework-controller-only/app/controllers/StoreApiController.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -33,19 +33,16 @@ private StoreApiController() { @ApiAction public Result deleteOrder(String orderId) throws Exception { - return ok(); } @ApiAction public Result getInventory() throws Exception { - return ok(); } @ApiAction public Result getOrderById( @Min(1) @Max(5)Long orderId) throws Exception { - return ok(); } @@ -57,7 +54,6 @@ public Result placeOrder() throws Exception { body = mapper.readValue(nodebody.toString(), Order.class); body.validate(); - return ok(); } } diff --git a/samples/server/petstore/java-play-framework-controller-only/app/controllers/UserApiController.java b/samples/server/petstore/java-play-framework-controller-only/app/controllers/UserApiController.java index 4c003646ef8..7d93808f3af 100644 --- a/samples/server/petstore/java-play-framework-controller-only/app/controllers/UserApiController.java +++ b/samples/server/petstore/java-play-framework-controller-only/app/controllers/UserApiController.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -39,7 +39,6 @@ public Result createUser() throws Exception { body = mapper.readValue(nodebody.toString(), User.class); body.validate(); - return ok(); } @@ -53,7 +52,6 @@ public Result createUsersWithArrayInput() throws Exception { curItem.validate(); } - return ok(); } @@ -67,19 +65,16 @@ public Result createUsersWithListInput() throws Exception { curItem.validate(); } - return ok(); } @ApiAction public Result deleteUser(String username) throws Exception { - return ok(); } @ApiAction public Result getUserByName(String username) throws Exception { - return ok(); } @@ -88,20 +83,18 @@ public Result loginUser() throws Exception { String valueusername = request().getQueryString("username"); String username; - username = (String)valueusername; + username = valueusername; String valuepassword = request().getQueryString("password"); String password; - password = (String)valuepassword; - + password = valuepassword; return ok(); } @ApiAction public Result logoutUser() throws Exception { - return ok(); } @@ -113,7 +106,6 @@ public Result updateUser(String username) throws Exception { body = mapper.readValue(nodebody.toString(), User.class); body.validate(); - return ok(); } } diff --git a/samples/server/petstore/java-play-framework-controller-only/logs/application.log b/samples/server/petstore/java-play-framework-controller-only/logs/application.log deleted file mode 100644 index c5049f8787d..00000000000 --- a/samples/server/petstore/java-play-framework-controller-only/logs/application.log +++ /dev/null @@ -1 +0,0 @@ -2017-08-08 12:56:15,882 [INFO] from play.api.Play in ForkJoinPool-1-worker-1 - Application started (Dev) diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesClass.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesClass.java index afcee2d951d..7ad3b29d780 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesClass.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AdditionalPropertiesClass.java @@ -1,17 +1,18 @@ package apimodels; -import java.util.Objects; import java.util.HashMap; import java.util.List; import java.util.Map; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * AdditionalPropertiesClass */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class AdditionalPropertiesClass { @JsonProperty("map_property") private Map mapProperty = null; @@ -26,7 +27,7 @@ public AdditionalPropertiesClass mapProperty(Map mapProperty) { public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { if (this.mapProperty == null) { - this.mapProperty = new HashMap(); + this.mapProperty = new HashMap<>(); } this.mapProperty.put(key, mapPropertyItem); return this; @@ -51,7 +52,7 @@ public AdditionalPropertiesClass mapOfMapProperty(Map mapOfMapPropertyItem) { if (this.mapOfMapProperty == null) { - this.mapOfMapProperty = new HashMap>(); + this.mapOfMapProperty = new HashMap<>(); } this.mapOfMapProperty.put(key, mapOfMapPropertyItem); return this; @@ -80,8 +81,8 @@ public boolean equals(java.lang.Object o) { return false; } AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; - return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) && - Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); + return Objects.equals(mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); } @Override @@ -89,6 +90,7 @@ public int hashCode() { return Objects.hash(mapProperty, mapOfMapProperty); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Animal.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Animal.java index badb26dee82..0b52bbf6382 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Animal.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Animal.java @@ -1,16 +1,17 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Animal */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Animal { @JsonProperty("className") private String className = null; @@ -63,8 +64,8 @@ public boolean equals(java.lang.Object o) { return false; } Animal animal = (Animal) o; - return Objects.equals(this.className, animal.className) && - Objects.equals(this.color, animal.color); + return Objects.equals(className, animal.className) && + Objects.equals(color, animal.color); } @Override @@ -72,6 +73,7 @@ public int hashCode() { return Objects.hash(className, color); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AnimalFarm.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AnimalFarm.java index 443063f6caa..44f4227ba5d 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AnimalFarm.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/AnimalFarm.java @@ -1,17 +1,18 @@ package apimodels; -import java.util.Objects; import apimodels.Animal; import java.util.ArrayList; import java.util.List; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * AnimalFarm */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class AnimalFarm extends ArrayList { @Override @@ -30,6 +31,7 @@ public int hashCode() { return Objects.hash(super.hashCode()); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayOfArrayOfNumberOnly.java index 9c70c34ed79..19f3a4841b4 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayOfArrayOfNumberOnly.java @@ -1,17 +1,18 @@ package apimodels; -import java.util.Objects; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * ArrayOfArrayOfNumberOnly */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ArrayOfArrayOfNumberOnly { @JsonProperty("ArrayArrayNumber") private List> arrayArrayNumber = null; @@ -22,10 +23,10 @@ public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArr } public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { - if (this.arrayArrayNumber == null) { - this.arrayArrayNumber = new ArrayList>(); + if (arrayArrayNumber == null) { + arrayArrayNumber = new ArrayList<>(); } - this.arrayArrayNumber.add(arrayArrayNumberItem); + arrayArrayNumber.add(arrayArrayNumberItem); return this; } @@ -52,7 +53,7 @@ public boolean equals(java.lang.Object o) { return false; } ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o; - return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); + return Objects.equals(arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); } @Override @@ -60,6 +61,7 @@ public int hashCode() { return Objects.hash(arrayArrayNumber); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayOfNumberOnly.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayOfNumberOnly.java index 38bd0a065ef..4d232db89ef 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayOfNumberOnly.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayOfNumberOnly.java @@ -1,17 +1,18 @@ package apimodels; -import java.util.Objects; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * ArrayOfNumberOnly */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ArrayOfNumberOnly { @JsonProperty("ArrayNumber") private List arrayNumber = null; @@ -22,10 +23,10 @@ public ArrayOfNumberOnly arrayNumber(List arrayNumber) { } public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { - if (this.arrayNumber == null) { - this.arrayNumber = new ArrayList(); + if (arrayNumber == null) { + arrayNumber = new ArrayList<>(); } - this.arrayNumber.add(arrayNumberItem); + arrayNumber.add(arrayNumberItem); return this; } @@ -52,7 +53,7 @@ public boolean equals(java.lang.Object o) { return false; } ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; - return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber); + return Objects.equals(arrayNumber, arrayOfNumberOnly.arrayNumber); } @Override @@ -60,6 +61,7 @@ public int hashCode() { return Objects.hash(arrayNumber); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayTest.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayTest.java index 1ef6f579e95..3fc13073c1a 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayTest.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ArrayTest.java @@ -1,17 +1,18 @@ package apimodels; -import java.util.Objects; import apimodels.ReadOnlyFirst; import java.util.ArrayList; import java.util.List; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * ArrayTest */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ArrayTest { @JsonProperty("array_of_string") private List arrayOfString = null; @@ -28,10 +29,10 @@ public ArrayTest arrayOfString(List arrayOfString) { } public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { - if (this.arrayOfString == null) { - this.arrayOfString = new ArrayList(); + if (arrayOfString == null) { + arrayOfString = new ArrayList<>(); } - this.arrayOfString.add(arrayOfStringItem); + arrayOfString.add(arrayOfStringItem); return this; } @@ -53,10 +54,10 @@ public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { } public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { - if (this.arrayArrayOfInteger == null) { - this.arrayArrayOfInteger = new ArrayList>(); + if (arrayArrayOfInteger == null) { + arrayArrayOfInteger = new ArrayList<>(); } - this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); + arrayArrayOfInteger.add(arrayArrayOfIntegerItem); return this; } @@ -79,10 +80,10 @@ public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) } public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { - if (this.arrayArrayOfModel == null) { - this.arrayArrayOfModel = new ArrayList>(); + if (arrayArrayOfModel == null) { + arrayArrayOfModel = new ArrayList<>(); } - this.arrayArrayOfModel.add(arrayArrayOfModelItem); + arrayArrayOfModel.add(arrayArrayOfModelItem); return this; } @@ -109,9 +110,9 @@ public boolean equals(java.lang.Object o) { return false; } ArrayTest arrayTest = (ArrayTest) o; - return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && - Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && - Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + return Objects.equals(arrayOfString, arrayTest.arrayOfString) && + Objects.equals(arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(arrayArrayOfModel, arrayTest.arrayArrayOfModel); } @Override @@ -119,6 +120,7 @@ public int hashCode() { return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Capitalization.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Capitalization.java index b69203972be..1469630f874 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Capitalization.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Capitalization.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Capitalization */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Capitalization { @JsonProperty("smallCamel") private String smallCamel = null; @@ -140,12 +141,12 @@ public boolean equals(java.lang.Object o) { return false; } Capitalization capitalization = (Capitalization) o; - return Objects.equals(this.smallCamel, capitalization.smallCamel) && - Objects.equals(this.capitalCamel, capitalization.capitalCamel) && - Objects.equals(this.smallSnake, capitalization.smallSnake) && - Objects.equals(this.capitalSnake, capitalization.capitalSnake) && - Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && - Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); + return Objects.equals(smallCamel, capitalization.smallCamel) && + Objects.equals(capitalCamel, capitalization.capitalCamel) && + Objects.equals(smallSnake, capitalization.smallSnake) && + Objects.equals(capitalSnake, capitalization.capitalSnake) && + Objects.equals(scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(ATT_NAME, capitalization.ATT_NAME); } @Override @@ -153,6 +154,7 @@ public int hashCode() { return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Cat.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Cat.java index d7885f9326d..ad587a0540e 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Cat.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Cat.java @@ -1,15 +1,16 @@ package apimodels; -import java.util.Objects; import apimodels.Animal; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Cat */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Cat extends Animal { @JsonProperty("declawed") private Boolean declawed = null; @@ -41,7 +42,7 @@ public boolean equals(java.lang.Object o) { return false; } Cat cat = (Cat) o; - return Objects.equals(this.declawed, cat.declawed) && + return Objects.equals(declawed, cat.declawed) && super.equals(o); } @@ -50,6 +51,7 @@ public int hashCode() { return Objects.hash(declawed, super.hashCode()); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Category.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Category.java index ec77f1f7eda..572cd6ef3d2 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Category.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Category */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Category { @JsonProperty("id") private Long id = null; @@ -60,8 +61,8 @@ public boolean equals(java.lang.Object o) { return false; } Category category = (Category) o; - return Objects.equals(this.id, category.id) && - Objects.equals(this.name, category.name); + return Objects.equals(id, category.id) && + Objects.equals(name, category.name); } @Override @@ -69,6 +70,7 @@ public int hashCode() { return Objects.hash(id, name); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ClassModel.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ClassModel.java index e41801ae212..37313d2860b 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ClassModel.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ClassModel.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Model for testing model with \"_class\" property */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ClassModel { @JsonProperty("_class") private String propertyClass = null; @@ -40,7 +41,7 @@ public boolean equals(java.lang.Object o) { return false; } ClassModel classModel = (ClassModel) o; - return Objects.equals(this.propertyClass, classModel.propertyClass); + return Objects.equals(propertyClass, classModel.propertyClass); } @Override @@ -48,6 +49,7 @@ public int hashCode() { return Objects.hash(propertyClass); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Client.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Client.java index ddc948e3f02..8e4618db6b6 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Client.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Client.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Client */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Client { @JsonProperty("client") private String client = null; @@ -40,7 +41,7 @@ public boolean equals(java.lang.Object o) { return false; } Client client = (Client) o; - return Objects.equals(this.client, client.client); + return Objects.equals(client, client.client); } @Override @@ -48,6 +49,7 @@ public int hashCode() { return Objects.hash(client); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Dog.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Dog.java index 5beffde3c70..bd7ad700daa 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Dog.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Dog.java @@ -1,15 +1,16 @@ package apimodels; -import java.util.Objects; import apimodels.Animal; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Dog */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Dog extends Animal { @JsonProperty("breed") private String breed = null; @@ -41,7 +42,7 @@ public boolean equals(java.lang.Object o) { return false; } Dog dog = (Dog) o; - return Objects.equals(this.breed, dog.breed) && + return Objects.equals(breed, dog.breed) && super.equals(o); } @@ -50,6 +51,7 @@ public int hashCode() { return Objects.hash(breed, super.hashCode()); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumArrays.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumArrays.java index 4f9f61cdc6a..a8f126b5124 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumArrays.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumArrays.java @@ -1,16 +1,17 @@ package apimodels; -import java.util.Objects; import java.util.ArrayList; import java.util.List; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * EnumArrays */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class EnumArrays { /** * Gets or Sets justSymbol @@ -20,7 +21,7 @@ public enum JustSymbolEnum { DOLLAR("$"); - private String value; + private final String value; JustSymbolEnum(String value) { this.value = value; @@ -54,7 +55,7 @@ public enum ArrayEnumEnum { CRAB("crab"); - private String value; + private final String value; ArrayEnumEnum(String value) { this.value = value; @@ -103,10 +104,10 @@ public EnumArrays arrayEnum(List arrayEnum) { } public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { - if (this.arrayEnum == null) { - this.arrayEnum = new ArrayList(); + if (arrayEnum == null) { + arrayEnum = new ArrayList<>(); } - this.arrayEnum.add(arrayEnumItem); + arrayEnum.add(arrayEnumItem); return this; } @@ -132,8 +133,8 @@ public boolean equals(java.lang.Object o) { return false; } EnumArrays enumArrays = (EnumArrays) o; - return Objects.equals(this.justSymbol, enumArrays.justSymbol) && - Objects.equals(this.arrayEnum, enumArrays.arrayEnum); + return Objects.equals(justSymbol, enumArrays.justSymbol) && + Objects.equals(arrayEnum, enumArrays.arrayEnum); } @Override @@ -141,6 +142,7 @@ public int hashCode() { return Objects.hash(justSymbol, arrayEnum); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumClass.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumClass.java index 36f9f81ad15..c0f2b0ad97e 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumClass.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumClass.java @@ -1,10 +1,8 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; -import javax.validation.constraints.*; import com.fasterxml.jackson.annotation.JsonCreator; /** @@ -18,7 +16,7 @@ public enum EnumClass { _XYZ_("(xyz)"); - private String value; + private final String value; EnumClass(String value) { this.value = value; diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumTest.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumTest.java index c36dae6158d..165a4b02a0e 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumTest.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/EnumTest.java @@ -1,15 +1,16 @@ package apimodels; -import java.util.Objects; import apimodels.OuterEnum; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * EnumTest */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class EnumTest { /** * Gets or Sets enumString @@ -21,7 +22,7 @@ public enum EnumStringEnum { EMPTY(""); - private String value; + private final String value; EnumStringEnum(String value) { this.value = value; @@ -55,7 +56,7 @@ public enum EnumIntegerEnum { NUMBER_MINUS_1(-1); - private Integer value; + private final Integer value; EnumIntegerEnum(Integer value) { this.value = value; @@ -89,7 +90,7 @@ public enum EnumNumberEnum { NUMBER_MINUS_1_DOT_2(-1.2); - private Double value; + private final Double value; EnumNumberEnum(Double value) { this.value = value; @@ -197,10 +198,10 @@ public boolean equals(java.lang.Object o) { return false; } EnumTest enumTest = (EnumTest) o; - return Objects.equals(this.enumString, enumTest.enumString) && - Objects.equals(this.enumInteger, enumTest.enumInteger) && - Objects.equals(this.enumNumber, enumTest.enumNumber) && - Objects.equals(this.outerEnum, enumTest.outerEnum); + return Objects.equals(enumString, enumTest.enumString) && + Objects.equals(enumInteger, enumTest.enumInteger) && + Objects.equals(enumNumber, enumTest.enumNumber) && + Objects.equals(outerEnum, enumTest.outerEnum); } @Override @@ -208,6 +209,7 @@ public int hashCode() { return Objects.hash(enumString, enumInteger, enumNumber, outerEnum); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/FormatTest.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/FormatTest.java index 786822e16cb..b3293abc73b 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/FormatTest.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/FormatTest.java @@ -1,6 +1,5 @@ package apimodels; -import java.util.Objects; import java.math.BigDecimal; import java.time.LocalDate; import java.time.OffsetDateTime; @@ -8,11 +7,13 @@ import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * FormatTest */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class FormatTest { @JsonProperty("integer") private Integer integer = null; @@ -315,19 +316,19 @@ public boolean equals(java.lang.Object o) { return false; } FormatTest formatTest = (FormatTest) o; - return Objects.equals(this.integer, formatTest.integer) && - Objects.equals(this.int32, formatTest.int32) && - Objects.equals(this.int64, formatTest.int64) && - Objects.equals(this.number, formatTest.number) && - Objects.equals(this._float, formatTest._float) && - Objects.equals(this._double, formatTest._double) && - Objects.equals(this.string, formatTest.string) && - Objects.equals(this._byte, formatTest._byte) && - Objects.equals(this.binary, formatTest.binary) && - Objects.equals(this.date, formatTest.date) && - Objects.equals(this.dateTime, formatTest.dateTime) && - Objects.equals(this.uuid, formatTest.uuid) && - Objects.equals(this.password, formatTest.password); + return Objects.equals(integer, formatTest.integer) && + Objects.equals(int32, formatTest.int32) && + Objects.equals(int64, formatTest.int64) && + Objects.equals(number, formatTest.number) && + Objects.equals(_float, formatTest._float) && + Objects.equals(_double, formatTest._double) && + Objects.equals(string, formatTest.string) && + Objects.equals(_byte, formatTest._byte) && + Objects.equals(binary, formatTest.binary) && + Objects.equals(date, formatTest.date) && + Objects.equals(dateTime, formatTest.dateTime) && + Objects.equals(uuid, formatTest.uuid) && + Objects.equals(password, formatTest.password); } @Override @@ -335,6 +336,7 @@ public int hashCode() { return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/HasOnlyReadOnly.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/HasOnlyReadOnly.java index f20c9dc7d79..bc1644d165c 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/HasOnlyReadOnly.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/HasOnlyReadOnly.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * HasOnlyReadOnly */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class HasOnlyReadOnly { @JsonProperty("bar") private String bar = null; @@ -60,8 +61,8 @@ public boolean equals(java.lang.Object o) { return false; } HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; - return Objects.equals(this.bar, hasOnlyReadOnly.bar) && - Objects.equals(this.foo, hasOnlyReadOnly.foo); + return Objects.equals(bar, hasOnlyReadOnly.bar) && + Objects.equals(foo, hasOnlyReadOnly.foo); } @Override @@ -69,6 +70,7 @@ public int hashCode() { return Objects.hash(bar, foo); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/MapTest.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/MapTest.java index aeadde88370..3d8ced1fc41 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/MapTest.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/MapTest.java @@ -1,17 +1,18 @@ package apimodels; -import java.util.Objects; import java.util.HashMap; import java.util.List; import java.util.Map; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * MapTest */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class MapTest { @JsonProperty("map_map_of_string") private Map> mapMapOfString = null; @@ -24,7 +25,7 @@ public enum InnerEnum { LOWER("lower"); - private String value; + private final String value; InnerEnum(String value) { this.value = value; @@ -57,7 +58,7 @@ public MapTest mapMapOfString(Map> mapMapOfString) { public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { if (this.mapMapOfString == null) { - this.mapMapOfString = new HashMap>(); + this.mapMapOfString = new HashMap<>(); } this.mapMapOfString.put(key, mapMapOfStringItem); return this; @@ -83,7 +84,7 @@ public MapTest mapOfEnumString(Map mapOfEnumString) { public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { if (this.mapOfEnumString == null) { - this.mapOfEnumString = new HashMap(); + this.mapOfEnumString = new HashMap<>(); } this.mapOfEnumString.put(key, mapOfEnumStringItem); return this; @@ -111,8 +112,8 @@ public boolean equals(java.lang.Object o) { return false; } MapTest mapTest = (MapTest) o; - return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) && - Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString); + return Objects.equals(mapMapOfString, mapTest.mapMapOfString) && + Objects.equals(mapOfEnumString, mapTest.mapOfEnumString); } @Override @@ -120,6 +121,7 @@ public int hashCode() { return Objects.hash(mapMapOfString, mapOfEnumString); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/MixedPropertiesAndAdditionalPropertiesClass.java index 1802cfd1b8a..3d8314f1e1c 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/MixedPropertiesAndAdditionalPropertiesClass.java @@ -1,6 +1,5 @@ package apimodels; -import java.util.Objects; import apimodels.Animal; import java.time.OffsetDateTime; import java.util.HashMap; @@ -10,11 +9,13 @@ import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * MixedPropertiesAndAdditionalPropertiesClass */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") private UUID uuid = null; @@ -68,7 +69,7 @@ public MixedPropertiesAndAdditionalPropertiesClass map(Map map) public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { if (this.map == null) { - this.map = new HashMap(); + this.map = new HashMap<>(); } this.map.put(key, mapItem); return this; @@ -97,9 +98,9 @@ public boolean equals(java.lang.Object o) { return false; } MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; - return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && - Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && - Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + return Objects.equals(uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(map, mixedPropertiesAndAdditionalPropertiesClass.map); } @Override @@ -107,6 +108,7 @@ public int hashCode() { return Objects.hash(uuid, dateTime, map); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Model200Response.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Model200Response.java index e6f2523f4a3..7e63d2a2ab9 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Model200Response.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Model200Response.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Model for testing model name starting with number */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Model200Response { @JsonProperty("name") private Integer name = null; @@ -60,8 +61,8 @@ public boolean equals(java.lang.Object o) { return false; } Model200Response _200Response = (Model200Response) o; - return Objects.equals(this.name, _200Response.name) && - Objects.equals(this.propertyClass, _200Response.propertyClass); + return Objects.equals(name, _200Response.name) && + Objects.equals(propertyClass, _200Response.propertyClass); } @Override @@ -69,6 +70,7 @@ public int hashCode() { return Objects.hash(name, propertyClass); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ModelApiResponse.java index 9cc1771faf7..bdb4c3b1a35 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ModelApiResponse.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * ModelApiResponse */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelApiResponse { @JsonProperty("code") private Integer code = null; @@ -80,9 +81,9 @@ public boolean equals(java.lang.Object o) { return false; } ModelApiResponse _apiResponse = (ModelApiResponse) o; - return Objects.equals(this.code, _apiResponse.code) && - Objects.equals(this.type, _apiResponse.type) && - Objects.equals(this.message, _apiResponse.message); + return Objects.equals(code, _apiResponse.code) && + Objects.equals(type, _apiResponse.type) && + Objects.equals(message, _apiResponse.message); } @Override @@ -90,6 +91,7 @@ public int hashCode() { return Objects.hash(code, type, message); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ModelReturn.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ModelReturn.java index ed822af5b34..cab65161aae 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ModelReturn.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ModelReturn.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Model for testing reserved words */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelReturn { @JsonProperty("return") private Integer _return = null; @@ -40,7 +41,7 @@ public boolean equals(java.lang.Object o) { return false; } ModelReturn _return = (ModelReturn) o; - return Objects.equals(this._return, _return._return); + return Objects.equals(_return, _return._return); } @Override @@ -48,6 +49,7 @@ public int hashCode() { return Objects.hash(_return); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Name.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Name.java index d14f6802a5c..94466b89fbf 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Name.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Name.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Model for testing model name same as property name */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Name { @JsonProperty("name") private Integer name = null; @@ -101,10 +102,10 @@ public boolean equals(java.lang.Object o) { return false; } Name name = (Name) o; - return Objects.equals(this.name, name.name) && - Objects.equals(this.snakeCase, name.snakeCase) && - Objects.equals(this.property, name.property) && - Objects.equals(this._123Number, name._123Number); + return Objects.equals(name, name.name) && + Objects.equals(snakeCase, name.snakeCase) && + Objects.equals(property, name.property) && + Objects.equals(_123Number, name._123Number); } @Override @@ -112,6 +113,7 @@ public int hashCode() { return Objects.hash(name, snakeCase, property, _123Number); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/NumberOnly.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/NumberOnly.java index 19c44d387b0..4c56adea5c6 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/NumberOnly.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/NumberOnly.java @@ -1,15 +1,16 @@ package apimodels; -import java.util.Objects; import java.math.BigDecimal; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * NumberOnly */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class NumberOnly { @JsonProperty("JustNumber") private BigDecimal justNumber = null; @@ -42,7 +43,7 @@ public boolean equals(java.lang.Object o) { return false; } NumberOnly numberOnly = (NumberOnly) o; - return Objects.equals(this.justNumber, numberOnly.justNumber); + return Objects.equals(justNumber, numberOnly.justNumber); } @Override @@ -50,6 +51,7 @@ public int hashCode() { return Objects.hash(justNumber); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Order.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Order.java index 0d42f4749b7..ba0144ec429 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Order.java @@ -1,15 +1,16 @@ package apimodels; -import java.util.Objects; import java.time.OffsetDateTime; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Order */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Order { @JsonProperty("id") private Long id = null; @@ -33,7 +34,7 @@ public enum StatusEnum { DELIVERED("delivered"); - private String value; + private final String value; StatusEnum(String value) { this.value = value; @@ -175,12 +176,12 @@ public boolean equals(java.lang.Object o) { return false; } Order order = (Order) o; - return Objects.equals(this.id, order.id) && - Objects.equals(this.petId, order.petId) && - Objects.equals(this.quantity, order.quantity) && - Objects.equals(this.shipDate, order.shipDate) && - Objects.equals(this.status, order.status) && - Objects.equals(this.complete, order.complete); + return Objects.equals(id, order.id) && + Objects.equals(petId, order.petId) && + Objects.equals(quantity, order.quantity) && + Objects.equals(shipDate, order.shipDate) && + Objects.equals(status, order.status) && + Objects.equals(complete, order.complete); } @Override @@ -188,6 +189,7 @@ public int hashCode() { return Objects.hash(id, petId, quantity, shipDate, status, complete); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/OuterComposite.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/OuterComposite.java index 954202ade9c..78288a15e3b 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/OuterComposite.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/OuterComposite.java @@ -1,15 +1,16 @@ package apimodels; -import java.util.Objects; import java.math.BigDecimal; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * OuterComposite */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class OuterComposite { @JsonProperty("my_number") private BigDecimal myNumber = null; @@ -82,9 +83,9 @@ public boolean equals(java.lang.Object o) { return false; } OuterComposite outerComposite = (OuterComposite) o; - return Objects.equals(this.myNumber, outerComposite.myNumber) && - Objects.equals(this.myString, outerComposite.myString) && - Objects.equals(this.myBoolean, outerComposite.myBoolean); + return Objects.equals(myNumber, outerComposite.myNumber) && + Objects.equals(myString, outerComposite.myString) && + Objects.equals(myBoolean, outerComposite.myBoolean); } @Override @@ -92,6 +93,7 @@ public int hashCode() { return Objects.hash(myNumber, myString, myBoolean); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/OuterEnum.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/OuterEnum.java index 851f0792f70..f5026996917 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/OuterEnum.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/OuterEnum.java @@ -1,10 +1,8 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; -import javax.validation.constraints.*; import com.fasterxml.jackson.annotation.JsonCreator; /** @@ -18,7 +16,7 @@ public enum OuterEnum { DELIVERED("delivered"); - private String value; + private final String value; OuterEnum(String value) { this.value = value; diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Pet.java index 8030c634419..d1abd7c48aa 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Pet.java @@ -1,6 +1,5 @@ package apimodels; -import java.util.Objects; import apimodels.Category; import apimodels.Tag; import java.util.ArrayList; @@ -8,11 +7,13 @@ import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Pet */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Pet { @JsonProperty("id") private Long id = null; @@ -24,7 +25,7 @@ public class Pet { private String name = null; @JsonProperty("photoUrls") - private List photoUrls = new ArrayList(); + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") private List tags = null; @@ -39,7 +40,7 @@ public enum StatusEnum { SOLD("sold"); - private String value; + private final String value; StatusEnum(String value) { this.value = value; @@ -124,7 +125,7 @@ public Pet photoUrls(List photoUrls) { } public Pet addPhotoUrlsItem(String photoUrlsItem) { - this.photoUrls.add(photoUrlsItem); + photoUrls.add(photoUrlsItem); return this; } @@ -147,10 +148,10 @@ public Pet tags(List tags) { } public Pet addTagsItem(Tag tagsItem) { - if (this.tags == null) { - this.tags = new ArrayList(); + if (tags == null) { + tags = new ArrayList<>(); } - this.tags.add(tagsItem); + tags.add(tagsItem); return this; } @@ -194,12 +195,12 @@ public boolean equals(java.lang.Object o) { return false; } Pet pet = (Pet) o; - return Objects.equals(this.id, pet.id) && - Objects.equals(this.category, pet.category) && - Objects.equals(this.name, pet.name) && - Objects.equals(this.photoUrls, pet.photoUrls) && - Objects.equals(this.tags, pet.tags) && - Objects.equals(this.status, pet.status); + return Objects.equals(id, pet.id) && + Objects.equals(category, pet.category) && + Objects.equals(name, pet.name) && + Objects.equals(photoUrls, pet.photoUrls) && + Objects.equals(tags, pet.tags) && + Objects.equals(status, pet.status); } @Override @@ -207,6 +208,7 @@ public int hashCode() { return Objects.hash(id, category, name, photoUrls, tags, status); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ReadOnlyFirst.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ReadOnlyFirst.java index 56f1d6993d8..1a3e4e7fcc2 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ReadOnlyFirst.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/ReadOnlyFirst.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * ReadOnlyFirst */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ReadOnlyFirst { @JsonProperty("bar") private String bar = null; @@ -60,8 +61,8 @@ public boolean equals(java.lang.Object o) { return false; } ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; - return Objects.equals(this.bar, readOnlyFirst.bar) && - Objects.equals(this.baz, readOnlyFirst.baz); + return Objects.equals(bar, readOnlyFirst.bar) && + Objects.equals(baz, readOnlyFirst.baz); } @Override @@ -69,6 +70,7 @@ public int hashCode() { return Objects.hash(bar, baz); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/SpecialModelName.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/SpecialModelName.java index 0916d0bf5d6..fa827dbd77f 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/SpecialModelName.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/SpecialModelName.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * SpecialModelName */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class SpecialModelName { @JsonProperty("$special[property.name]") private Long specialPropertyName = null; @@ -40,7 +41,7 @@ public boolean equals(java.lang.Object o) { return false; } SpecialModelName specialModelName = (SpecialModelName) o; - return Objects.equals(this.specialPropertyName, specialModelName.specialPropertyName); + return Objects.equals(specialPropertyName, specialModelName.specialPropertyName); } @Override @@ -48,6 +49,7 @@ public int hashCode() { return Objects.hash(specialPropertyName); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Tag.java index 64c4cd72395..033f9d61bd7 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/Tag.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Tag */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Tag { @JsonProperty("id") private Long id = null; @@ -60,8 +61,8 @@ public boolean equals(java.lang.Object o) { return false; } Tag tag = (Tag) o; - return Objects.equals(this.id, tag.id) && - Objects.equals(this.name, tag.name); + return Objects.equals(id, tag.id) && + Objects.equals(name, tag.name); } @Override @@ -69,6 +70,7 @@ public int hashCode() { return Objects.hash(id, name); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/User.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/User.java index 2c2f38e222d..a479bb5e5f0 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/apimodels/User.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * User */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class User { @JsonProperty("id") private Long id = null; @@ -180,14 +181,14 @@ public boolean equals(java.lang.Object o) { return false; } User user = (User) o; - return Objects.equals(this.id, user.id) && - Objects.equals(this.username, user.username) && - Objects.equals(this.firstName, user.firstName) && - Objects.equals(this.lastName, user.lastName) && - Objects.equals(this.email, user.email) && - Objects.equals(this.password, user.password) && - Objects.equals(this.phone, user.phone) && - Objects.equals(this.userStatus, user.userStatus); + return Objects.equals(id, user.id) && + Objects.equals(username, user.username) && + Objects.equals(firstName, user.firstName) && + Objects.equals(lastName, user.lastName) && + Objects.equals(email, user.email) && + Objects.equals(password, user.password) && + Objects.equals(phone, user.phone) && + Objects.equals(userStatus, user.userStatus); } @Override @@ -195,6 +196,7 @@ public int hashCode() { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/FakeApiController.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/FakeApiController.java index 619bfad98b6..dfa826fb7e6 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/FakeApiController.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/FakeApiController.java @@ -15,7 +15,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -50,8 +50,6 @@ public Result fakeOuterBooleanSerialize() throws Exception { Boolean obj = imp.fakeOuterBooleanSerialize(body); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -69,8 +67,6 @@ public Result fakeOuterCompositeSerialize() throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -88,8 +84,6 @@ public Result fakeOuterNumberSerialize() throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -106,8 +100,6 @@ public Result fakeOuterStringSerialize() throws Exception { String obj = imp.fakeOuterStringSerialize(body); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -122,8 +114,6 @@ public Result testClientModel() throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -173,7 +163,7 @@ public Result testEndpointParameters() throws Exception { String valuestring = (request().body().asMultipartFormData().asFormUrlEncoded().get("string"))[0]; String string; if (valuestring != null) { - string = (String)valuestring; + string = valuestring; } else { string = null; @@ -181,12 +171,12 @@ public Result testEndpointParameters() throws Exception { String valuepatternWithoutDelimiter = (request().body().asMultipartFormData().asFormUrlEncoded().get("pattern_without_delimiter"))[0]; String patternWithoutDelimiter; - patternWithoutDelimiter = (String)valuepatternWithoutDelimiter; + patternWithoutDelimiter = valuepatternWithoutDelimiter; String value_byte = (request().body().asMultipartFormData().asFormUrlEncoded().get("byte"))[0]; byte[] _byte; - _byte = (String)value_byte; + _byte = value_byte; String valuebinary = (request().body().asMultipartFormData().asFormUrlEncoded().get("binary"))[0]; byte[] binary; @@ -215,7 +205,7 @@ public Result testEndpointParameters() throws Exception { String valuepassword = (request().body().asMultipartFormData().asFormUrlEncoded().get("password"))[0]; String password; if (valuepassword != null) { - password = (String)valuepassword; + password = valuepassword; } else { password = null; @@ -223,15 +213,13 @@ public Result testEndpointParameters() throws Exception { String valueparamCallback = (request().body().asMultipartFormData().asFormUrlEncoded().get("callback"))[0]; String paramCallback; if (valueparamCallback != null) { - paramCallback = (String)valueparamCallback; + paramCallback = valueparamCallback; } else { paramCallback = null; } imp.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); - return ok(); - } @ApiAction @@ -245,7 +233,7 @@ public Result testEnumParameters() throws Exception { String valueenumQueryString = request().getQueryString("enumQueryString"); String enumQueryString; if (valueenumQueryString != null) { - enumQueryString = (String)valueenumQueryString; + enumQueryString = valueenumQueryString; } else { enumQueryString = "-efg"; @@ -267,7 +255,7 @@ public Result testEnumParameters() throws Exception { String valueenumFormString = (request().body().asMultipartFormData().asFormUrlEncoded().get("enum_form_string"))[0]; String enumFormString; if (valueenumFormString != null) { - enumFormString = (String)valueenumFormString; + enumFormString = valueenumFormString; } else { enumFormString = "-efg"; @@ -289,15 +277,13 @@ public Result testEnumParameters() throws Exception { String valueenumHeaderString = request().getHeader("enum_header_string"); String enumHeaderString; if (valueenumHeaderString != null) { - enumHeaderString = (String)valueenumHeaderString; + enumHeaderString = valueenumHeaderString; } else { enumHeaderString = "-efg"; } imp.testEnumParameters(enumFormStringArray, enumFormString, enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble); - return ok(); - } @ApiAction @@ -305,16 +291,14 @@ public Result testJsonFormData() throws Exception { String valueparam = (request().body().asMultipartFormData().asFormUrlEncoded().get("param"))[0]; String param; - param = (String)valueparam; + param = valueparam; String valueparam2 = (request().body().asMultipartFormData().asFormUrlEncoded().get("param2"))[0]; String param2; - param2 = (String)valueparam2; + param2 = valueparam2; imp.testJsonFormData(param, param2); - return ok(); - } } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/FakeApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/FakeApiControllerImpInterface.java index 09ee51bf0f7..210755319d2 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/FakeApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/FakeApiControllerImpInterface.java @@ -13,6 +13,7 @@ import javax.validation.constraints.*; +@SuppressWarnings("RedundantThrows") public interface FakeApiControllerImpInterface { Boolean fakeOuterBooleanSerialize(Boolean body) throws Exception; diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/FakeClassnameTags123ApiController.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/FakeClassnameTags123ApiController.java index cd902704e64..2a2716d673b 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/FakeClassnameTags123ApiController.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/FakeClassnameTags123ApiController.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -44,7 +44,5 @@ public Result testClassname() throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/FakeClassnameTags123ApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/FakeClassnameTags123ApiControllerImpInterface.java index f921b45bd14..8ea6e6598f1 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/FakeClassnameTags123ApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/FakeClassnameTags123ApiControllerImpInterface.java @@ -9,6 +9,7 @@ import javax.validation.constraints.*; +@SuppressWarnings("RedundantThrows") public interface FakeClassnameTags123ApiControllerImpInterface { Client testClassname(Client body) throws Exception; diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/PetApiController.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/PetApiController.java index 74731b82cdb..6ea11161da1 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/PetApiController.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/PetApiController.java @@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -43,9 +43,7 @@ public Result addPet() throws Exception { body.validate(); imp.addPet(body); - return ok(); - } @ApiAction @@ -53,15 +51,13 @@ public Result deletePet(Long petId) throws Exception { String valueapiKey = request().getHeader("api_key"); String apiKey; if (valueapiKey != null) { - apiKey = (String)valueapiKey; + apiKey = valueapiKey; } else { apiKey = null; } imp.deletePet(petId, apiKey); - return ok(); - } @ApiAction @@ -78,8 +74,6 @@ public Result findPetsByStatus() throws Exception { } JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -96,8 +90,6 @@ public Result findPetsByTags() throws Exception { } JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -106,8 +98,6 @@ public Result getPetById(Long petId) throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -119,9 +109,7 @@ public Result updatePet() throws Exception { body.validate(); imp.updatePet(body); - return ok(); - } @ApiAction @@ -129,7 +117,7 @@ public Result updatePetWithForm(Long petId) throws Exception { String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0]; String name; if (valuename != null) { - name = (String)valuename; + name = valuename; } else { name = null; @@ -137,15 +125,13 @@ public Result updatePetWithForm(Long petId) throws Exception { String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0]; String status; if (valuestatus != null) { - status = (String)valuestatus; + status = valuestatus; } else { status = null; } imp.updatePetWithForm(petId, name, status); - return ok(); - } @ApiAction @@ -153,17 +139,15 @@ public Result uploadFile(Long petId) throws Exception { String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0]; String additionalMetadata; if (valueadditionalMetadata != null) { - additionalMetadata = (String)valueadditionalMetadata; + additionalMetadata = valueadditionalMetadata; } else { additionalMetadata = null; } Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file"); - ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); + ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/PetApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/PetApiControllerImpInterface.java index df027c27920..307c6c18cfb 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/PetApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/PetApiControllerImpInterface.java @@ -11,6 +11,7 @@ import javax.validation.constraints.*; +@SuppressWarnings("RedundantThrows") public interface PetApiControllerImpInterface { void addPet(Pet body) throws Exception; diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/StoreApiController.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/StoreApiController.java index 0be3ecc4276..92fafa4b746 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/StoreApiController.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/StoreApiController.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -36,9 +36,7 @@ private StoreApiController(StoreApiControllerImpInterface imp) { @ApiAction public Result deleteOrder(String orderId) throws Exception { imp.deleteOrder(orderId); - return ok(); - } @ApiAction @@ -46,8 +44,6 @@ public Result getInventory() throws Exception { Map obj = imp.getInventory(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -56,8 +52,6 @@ public Result getOrderById( @Min(1) @Max(5)Long orderId) throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -72,7 +66,5 @@ public Result placeOrder() throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/StoreApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/StoreApiControllerImpInterface.java index 766a29c4f17..b42e4d6d3d0 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/StoreApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/StoreApiControllerImpInterface.java @@ -10,6 +10,7 @@ import javax.validation.constraints.*; +@SuppressWarnings("RedundantThrows") public interface StoreApiControllerImpInterface { void deleteOrder(String orderId) throws Exception; diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiController.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiController.java index eeab90cf178..c084e050fa2 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiController.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiController.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -42,9 +42,7 @@ public Result createUser() throws Exception { body.validate(); imp.createUser(body); - return ok(); - } @ApiAction @@ -58,9 +56,7 @@ public Result createUsersWithArrayInput() throws Exception { } imp.createUsersWithArrayInput(body); - return ok(); - } @ApiAction @@ -74,17 +70,13 @@ public Result createUsersWithListInput() throws Exception { } imp.createUsersWithListInput(body); - return ok(); - } @ApiAction public Result deleteUser(String username) throws Exception { imp.deleteUser(username); - return ok(); - } @ApiAction @@ -93,8 +85,6 @@ public Result getUserByName(String username) throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -102,26 +92,22 @@ public Result loginUser() throws Exception { String valueusername = request().getQueryString("username"); String username; - username = (String)valueusername; + username = valueusername; String valuepassword = request().getQueryString("password"); String password; - password = (String)valuepassword; + password = valuepassword; String obj = imp.loginUser(username, password); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction public Result logoutUser() throws Exception { imp.logoutUser(); - return ok(); - } @ApiAction @@ -133,8 +119,6 @@ public Result updateUser(String username) throws Exception { body.validate(); imp.updateUser(username, body); - return ok(); - } } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiControllerImpInterface.java index 474905c2b2e..1290c84835f 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/controllers/UserApiControllerImpInterface.java @@ -10,6 +10,7 @@ import javax.validation.constraints.*; +@SuppressWarnings("RedundantThrows") public interface UserApiControllerImpInterface { void createUser(User body) throws Exception; diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Category.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Category.java index e7f5c89e686..399a6f2646a 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Category.java @@ -1,11 +1,14 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; +import java.util.Set; +import javax.validation.*; +import java.util.Objects; /** * A category for a pet */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Category { @JsonProperty("id") private Long id = null; @@ -57,8 +60,8 @@ public boolean equals(java.lang.Object o) { return false; } Category category = (Category) o; - return Objects.equals(this.id, category.id) && - Objects.equals(this.name, category.name); + return Objects.equals(id, category.id) && + Objects.equals(name, category.name); } @Override @@ -66,6 +69,7 @@ public int hashCode() { return Objects.hash(id, name); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/ModelApiResponse.java index 5567677f037..9b3b2fc7e92 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/ModelApiResponse.java @@ -1,11 +1,14 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; +import java.util.Set; +import javax.validation.*; +import java.util.Objects; /** * Describes the result of uploading an image resource */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelApiResponse { @JsonProperty("code") private Integer code = null; @@ -77,9 +80,9 @@ public boolean equals(java.lang.Object o) { return false; } ModelApiResponse _apiResponse = (ModelApiResponse) o; - return Objects.equals(this.code, _apiResponse.code) && - Objects.equals(this.type, _apiResponse.type) && - Objects.equals(this.message, _apiResponse.message); + return Objects.equals(code, _apiResponse.code) && + Objects.equals(type, _apiResponse.type) && + Objects.equals(message, _apiResponse.message); } @Override @@ -87,6 +90,7 @@ public int hashCode() { return Objects.hash(code, type, message); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Order.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Order.java index b4d05aee29e..873a6aebd25 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Order.java @@ -1,12 +1,15 @@ package apimodels; -import java.util.Objects; import java.time.OffsetDateTime; import com.fasterxml.jackson.annotation.*; +import java.util.Set; +import javax.validation.*; +import java.util.Objects; /** * An order for a pets from the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Order { @JsonProperty("id") private Long id = null; @@ -30,7 +33,7 @@ public enum StatusEnum { DELIVERED("delivered"); - private String value; + private final String value; StatusEnum(String value) { this.value = value; @@ -171,12 +174,12 @@ public boolean equals(java.lang.Object o) { return false; } Order order = (Order) o; - return Objects.equals(this.id, order.id) && - Objects.equals(this.petId, order.petId) && - Objects.equals(this.quantity, order.quantity) && - Objects.equals(this.shipDate, order.shipDate) && - Objects.equals(this.status, order.status) && - Objects.equals(this.complete, order.complete); + return Objects.equals(id, order.id) && + Objects.equals(petId, order.petId) && + Objects.equals(quantity, order.quantity) && + Objects.equals(shipDate, order.shipDate) && + Objects.equals(status, order.status) && + Objects.equals(complete, order.complete); } @Override @@ -184,6 +187,7 @@ public int hashCode() { return Objects.hash(id, petId, quantity, shipDate, status, complete); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Pet.java index 7b55935643a..e6adacc5d5c 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Pet.java @@ -1,15 +1,18 @@ package apimodels; -import java.util.Objects; import apimodels.Category; import apimodels.Tag; import java.util.ArrayList; import java.util.List; import com.fasterxml.jackson.annotation.*; +import java.util.Set; +import javax.validation.*; +import java.util.Objects; /** * A pet for sale in the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Pet { @JsonProperty("id") private Long id = null; @@ -21,7 +24,7 @@ public class Pet { private String name = null; @JsonProperty("photoUrls") - private List photoUrls = new ArrayList(); + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") private List tags = null; @@ -36,7 +39,7 @@ public enum StatusEnum { SOLD("sold"); - private String value; + private final String value; StatusEnum(String value) { this.value = value; @@ -119,7 +122,7 @@ public Pet photoUrls(List photoUrls) { } public Pet addPhotoUrlsItem(String photoUrlsItem) { - this.photoUrls.add(photoUrlsItem); + photoUrls.add(photoUrlsItem); return this; } @@ -141,10 +144,10 @@ public Pet tags(List tags) { } public Pet addTagsItem(Tag tagsItem) { - if (this.tags == null) { - this.tags = new ArrayList(); + if (tags == null) { + tags = new ArrayList<>(); } - this.tags.add(tagsItem); + tags.add(tagsItem); return this; } @@ -187,12 +190,12 @@ public boolean equals(java.lang.Object o) { return false; } Pet pet = (Pet) o; - return Objects.equals(this.id, pet.id) && - Objects.equals(this.category, pet.category) && - Objects.equals(this.name, pet.name) && - Objects.equals(this.photoUrls, pet.photoUrls) && - Objects.equals(this.tags, pet.tags) && - Objects.equals(this.status, pet.status); + return Objects.equals(id, pet.id) && + Objects.equals(category, pet.category) && + Objects.equals(name, pet.name) && + Objects.equals(photoUrls, pet.photoUrls) && + Objects.equals(tags, pet.tags) && + Objects.equals(status, pet.status); } @Override @@ -200,6 +203,7 @@ public int hashCode() { return Objects.hash(id, category, name, photoUrls, tags, status); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Tag.java index 80a08bfc27f..cc8a86828f0 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/Tag.java @@ -1,11 +1,14 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; +import java.util.Set; +import javax.validation.*; +import java.util.Objects; /** * A tag for a pet */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Tag { @JsonProperty("id") private Long id = null; @@ -57,8 +60,8 @@ public boolean equals(java.lang.Object o) { return false; } Tag tag = (Tag) o; - return Objects.equals(this.id, tag.id) && - Objects.equals(this.name, tag.name); + return Objects.equals(id, tag.id) && + Objects.equals(name, tag.name); } @Override @@ -66,6 +69,7 @@ public int hashCode() { return Objects.hash(id, name); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/User.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/User.java index 2d48dcc7de8..5fc613edfbe 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/apimodels/User.java @@ -1,11 +1,14 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; +import java.util.Set; +import javax.validation.*; +import java.util.Objects; /** * A User who is purchasing from the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class User { @JsonProperty("id") private Long id = null; @@ -177,14 +180,14 @@ public boolean equals(java.lang.Object o) { return false; } User user = (User) o; - return Objects.equals(this.id, user.id) && - Objects.equals(this.username, user.username) && - Objects.equals(this.firstName, user.firstName) && - Objects.equals(this.lastName, user.lastName) && - Objects.equals(this.email, user.email) && - Objects.equals(this.password, user.password) && - Objects.equals(this.phone, user.phone) && - Objects.equals(this.userStatus, user.userStatus); + return Objects.equals(id, user.id) && + Objects.equals(username, user.username) && + Objects.equals(firstName, user.firstName) && + Objects.equals(lastName, user.lastName) && + Objects.equals(email, user.email) && + Objects.equals(password, user.password) && + Objects.equals(phone, user.phone) && + Objects.equals(userStatus, user.userStatus); } @Override @@ -192,6 +195,7 @@ public int hashCode() { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/PetApiController.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/PetApiController.java index e47e374653b..93298749857 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/PetApiController.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/PetApiController.java @@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -41,9 +41,7 @@ public Result addPet() throws Exception { body = mapper.readValue(nodebody.toString(), Pet.class); imp.addPet(body); - return ok(); - } @ApiAction @@ -51,15 +49,13 @@ public Result deletePet(Long petId) throws Exception { String valueapiKey = request().getHeader("api_key"); String apiKey; if (valueapiKey != null) { - apiKey = (String)valueapiKey; + apiKey = valueapiKey; } else { apiKey = null; } imp.deletePet(petId, apiKey); - return ok(); - } @ApiAction @@ -73,8 +69,6 @@ public Result findPetsByStatus() throws Exception { List obj = imp.findPetsByStatus(status); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -88,8 +82,6 @@ public Result findPetsByTags() throws Exception { List obj = imp.findPetsByTags(tags); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -97,8 +89,6 @@ public Result getPetById(Long petId) throws Exception { Pet obj = imp.getPetById(petId); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -109,9 +99,7 @@ public Result updatePet() throws Exception { body = mapper.readValue(nodebody.toString(), Pet.class); imp.updatePet(body); - return ok(); - } @ApiAction @@ -119,7 +107,7 @@ public Result updatePetWithForm(Long petId) throws Exception { String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0]; String name; if (valuename != null) { - name = (String)valuename; + name = valuename; } else { name = null; @@ -127,15 +115,13 @@ public Result updatePetWithForm(Long petId) throws Exception { String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0]; String status; if (valuestatus != null) { - status = (String)valuestatus; + status = valuestatus; } else { status = null; } imp.updatePetWithForm(petId, name, status); - return ok(); - } @ApiAction @@ -143,16 +129,14 @@ public Result uploadFile(Long petId) throws Exception { String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0]; String additionalMetadata; if (valueadditionalMetadata != null) { - additionalMetadata = (String)valueadditionalMetadata; + additionalMetadata = valueadditionalMetadata; } else { additionalMetadata = null; } Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file"); - ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); + ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } } diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/PetApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/PetApiControllerImpInterface.java index 99790c4f4c9..144362644af 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/PetApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/PetApiControllerImpInterface.java @@ -10,6 +10,7 @@ import java.util.HashMap; +@SuppressWarnings("RedundantThrows") public interface PetApiControllerImpInterface { void addPet(Pet body) throws Exception; diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/StoreApiController.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/StoreApiController.java index be06c96459a..3b0cd2a23b3 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/StoreApiController.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/StoreApiController.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -35,9 +35,7 @@ private StoreApiController(StoreApiControllerImpInterface imp) { @ApiAction public Result deleteOrder(String orderId) throws Exception { imp.deleteOrder(orderId); - return ok(); - } @ApiAction @@ -45,8 +43,6 @@ public Result getInventory() throws Exception { Map obj = imp.getInventory(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -54,8 +50,6 @@ public Result getOrderById(Long orderId) throws Exception { Order obj = imp.getOrderById(orderId); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -68,7 +62,5 @@ public Result placeOrder() throws Exception { Order obj = imp.placeOrder(body); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } } diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/StoreApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/StoreApiControllerImpInterface.java index 0b38e579638..7a9c3fd82e8 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/StoreApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/StoreApiControllerImpInterface.java @@ -9,6 +9,7 @@ import java.util.HashMap; +@SuppressWarnings("RedundantThrows") public interface StoreApiControllerImpInterface { void deleteOrder(String orderId) throws Exception; diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiController.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiController.java index cd280b7b86c..0005ef24311 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiController.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiController.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -40,9 +40,7 @@ public Result createUser() throws Exception { body = mapper.readValue(nodebody.toString(), User.class); imp.createUser(body); - return ok(); - } @ApiAction @@ -53,9 +51,7 @@ public Result createUsersWithArrayInput() throws Exception { body = mapper.readValue(nodebody.toString(), new TypeReference>(){}); imp.createUsersWithArrayInput(body); - return ok(); - } @ApiAction @@ -66,17 +62,13 @@ public Result createUsersWithListInput() throws Exception { body = mapper.readValue(nodebody.toString(), new TypeReference>(){}); imp.createUsersWithListInput(body); - return ok(); - } @ApiAction public Result deleteUser(String username) throws Exception { imp.deleteUser(username); - return ok(); - } @ApiAction @@ -84,8 +76,6 @@ public Result getUserByName(String username) throws Exception { User obj = imp.getUserByName(username); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -93,26 +83,22 @@ public Result loginUser() throws Exception { String valueusername = request().getQueryString("username"); String username; - username = (String)valueusername; + username = valueusername; String valuepassword = request().getQueryString("password"); String password; - password = (String)valuepassword; + password = valuepassword; String obj = imp.loginUser(username, password); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction public Result logoutUser() throws Exception { imp.logoutUser(); - return ok(); - } @ApiAction @@ -123,8 +109,6 @@ public Result updateUser(String username) throws Exception { body = mapper.readValue(nodebody.toString(), User.class); imp.updateUser(username, body); - return ok(); - } } diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiControllerImpInterface.java index 9b8ea0f98a1..8c5a5ee0af6 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/controllers/UserApiControllerImpInterface.java @@ -9,6 +9,7 @@ import java.util.HashMap; +@SuppressWarnings("RedundantThrows") public interface UserApiControllerImpInterface { void createUser(User body) throws Exception; diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/logs/application.log b/samples/server/petstore/java-play-framework-no-bean-validation/logs/application.log deleted file mode 100644 index 2086ba3c321..00000000000 --- a/samples/server/petstore/java-play-framework-no-bean-validation/logs/application.log +++ /dev/null @@ -1 +0,0 @@ -2017-08-08 12:59:36,779 [INFO] from play.api.Play in ForkJoinPool-1-worker-1 - Application started (Dev) diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Category.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Category.java index d820c9d7365..fb9207f4b5d 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Category.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A category for a pet */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Category { @JsonProperty("id") private Long id = null; @@ -60,8 +61,8 @@ public boolean equals(java.lang.Object o) { return false; } Category category = (Category) o; - return Objects.equals(this.id, category.id) && - Objects.equals(this.name, category.name); + return Objects.equals(id, category.id) && + Objects.equals(name, category.name); } @Override @@ -69,6 +70,7 @@ public int hashCode() { return Objects.hash(id, name); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/ModelApiResponse.java index 4f9f27efb66..05911012313 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/ModelApiResponse.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Describes the result of uploading an image resource */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelApiResponse { @JsonProperty("code") private Integer code = null; @@ -80,9 +81,9 @@ public boolean equals(java.lang.Object o) { return false; } ModelApiResponse _apiResponse = (ModelApiResponse) o; - return Objects.equals(this.code, _apiResponse.code) && - Objects.equals(this.type, _apiResponse.type) && - Objects.equals(this.message, _apiResponse.message); + return Objects.equals(code, _apiResponse.code) && + Objects.equals(type, _apiResponse.type) && + Objects.equals(message, _apiResponse.message); } @Override @@ -90,6 +91,7 @@ public int hashCode() { return Objects.hash(code, type, message); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Order.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Order.java index acabaabd0ba..987ef07d460 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Order.java @@ -1,15 +1,16 @@ package apimodels; -import java.util.Objects; import java.time.OffsetDateTime; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * An order for a pets from the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Order { @JsonProperty("id") private Long id = null; @@ -33,7 +34,7 @@ public enum StatusEnum { DELIVERED("delivered"); - private String value; + private final String value; StatusEnum(String value) { this.value = value; @@ -175,12 +176,12 @@ public boolean equals(java.lang.Object o) { return false; } Order order = (Order) o; - return Objects.equals(this.id, order.id) && - Objects.equals(this.petId, order.petId) && - Objects.equals(this.quantity, order.quantity) && - Objects.equals(this.shipDate, order.shipDate) && - Objects.equals(this.status, order.status) && - Objects.equals(this.complete, order.complete); + return Objects.equals(id, order.id) && + Objects.equals(petId, order.petId) && + Objects.equals(quantity, order.quantity) && + Objects.equals(shipDate, order.shipDate) && + Objects.equals(status, order.status) && + Objects.equals(complete, order.complete); } @Override @@ -188,6 +189,7 @@ public int hashCode() { return Objects.hash(id, petId, quantity, shipDate, status, complete); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Pet.java index 69bae933aa5..430bbe805ce 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Pet.java @@ -1,6 +1,5 @@ package apimodels; -import java.util.Objects; import apimodels.Category; import apimodels.Tag; import java.util.ArrayList; @@ -8,11 +7,13 @@ import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A pet for sale in the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Pet { @JsonProperty("id") private Long id = null; @@ -24,7 +25,7 @@ public class Pet { private String name = null; @JsonProperty("photoUrls") - private List photoUrls = new ArrayList(); + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") private List tags = null; @@ -39,7 +40,7 @@ public enum StatusEnum { SOLD("sold"); - private String value; + private final String value; StatusEnum(String value) { this.value = value; @@ -124,7 +125,7 @@ public Pet photoUrls(List photoUrls) { } public Pet addPhotoUrlsItem(String photoUrlsItem) { - this.photoUrls.add(photoUrlsItem); + photoUrls.add(photoUrlsItem); return this; } @@ -147,10 +148,10 @@ public Pet tags(List tags) { } public Pet addTagsItem(Tag tagsItem) { - if (this.tags == null) { - this.tags = new ArrayList(); + if (tags == null) { + tags = new ArrayList<>(); } - this.tags.add(tagsItem); + tags.add(tagsItem); return this; } @@ -194,12 +195,12 @@ public boolean equals(java.lang.Object o) { return false; } Pet pet = (Pet) o; - return Objects.equals(this.id, pet.id) && - Objects.equals(this.category, pet.category) && - Objects.equals(this.name, pet.name) && - Objects.equals(this.photoUrls, pet.photoUrls) && - Objects.equals(this.tags, pet.tags) && - Objects.equals(this.status, pet.status); + return Objects.equals(id, pet.id) && + Objects.equals(category, pet.category) && + Objects.equals(name, pet.name) && + Objects.equals(photoUrls, pet.photoUrls) && + Objects.equals(tags, pet.tags) && + Objects.equals(status, pet.status); } @Override @@ -207,6 +208,7 @@ public int hashCode() { return Objects.hash(id, category, name, photoUrls, tags, status); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Tag.java index 02b787be589..709fef2cf11 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/Tag.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A tag for a pet */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Tag { @JsonProperty("id") private Long id = null; @@ -60,8 +61,8 @@ public boolean equals(java.lang.Object o) { return false; } Tag tag = (Tag) o; - return Objects.equals(this.id, tag.id) && - Objects.equals(this.name, tag.name); + return Objects.equals(id, tag.id) && + Objects.equals(name, tag.name); } @Override @@ -69,6 +70,7 @@ public int hashCode() { return Objects.hash(id, name); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/User.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/User.java index b9fd299724f..ba41fb76f80 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/apimodels/User.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A User who is purchasing from the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class User { @JsonProperty("id") private Long id = null; @@ -180,14 +181,14 @@ public boolean equals(java.lang.Object o) { return false; } User user = (User) o; - return Objects.equals(this.id, user.id) && - Objects.equals(this.username, user.username) && - Objects.equals(this.firstName, user.firstName) && - Objects.equals(this.lastName, user.lastName) && - Objects.equals(this.email, user.email) && - Objects.equals(this.password, user.password) && - Objects.equals(this.phone, user.phone) && - Objects.equals(this.userStatus, user.userStatus); + return Objects.equals(id, user.id) && + Objects.equals(username, user.username) && + Objects.equals(firstName, user.firstName) && + Objects.equals(lastName, user.lastName) && + Objects.equals(email, user.email) && + Objects.equals(password, user.password) && + Objects.equals(phone, user.phone) && + Objects.equals(userStatus, user.userStatus); } @Override @@ -195,6 +196,7 @@ public int hashCode() { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/PetApiController.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/PetApiController.java index 8c8a0cda1f9..ceec97042b1 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/PetApiController.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/PetApiController.java @@ -13,6 +13,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; +import java.io.File; import java.io.IOException; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -43,9 +44,7 @@ public Result addPet() throws IOException { body.validate(); imp.addPet(body); - return ok(); - } @ApiAction @@ -53,15 +52,13 @@ public Result deletePet(Long petId) { String valueapiKey = request().getHeader("api_key"); String apiKey; if (valueapiKey != null) { - apiKey = (String)valueapiKey; + apiKey = valueapiKey; } else { apiKey = null; } imp.deletePet(petId, apiKey); - return ok(); - } @ApiAction @@ -78,8 +75,6 @@ public Result findPetsByStatus() { } JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -96,8 +91,6 @@ public Result findPetsByTags() { } JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -106,8 +99,6 @@ public Result getPetById(Long petId) { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -119,9 +110,7 @@ public Result updatePet() throws IOException { body.validate(); imp.updatePet(body); - return ok(); - } @ApiAction @@ -129,7 +118,7 @@ public Result updatePetWithForm(Long petId) { String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0]; String name; if (valuename != null) { - name = (String)valuename; + name = valuename; } else { name = null; @@ -137,15 +126,13 @@ public Result updatePetWithForm(Long petId) { String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0]; String status; if (valuestatus != null) { - status = (String)valuestatus; + status = valuestatus; } else { status = null; } imp.updatePetWithForm(petId, name, status); - return ok(); - } @ApiAction @@ -153,17 +140,15 @@ public Result uploadFile(Long petId) { String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0]; String additionalMetadata; if (valueadditionalMetadata != null) { - additionalMetadata = (String)valueadditionalMetadata; + additionalMetadata = valueadditionalMetadata; } else { additionalMetadata = null; } Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file"); - ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); + ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } } diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/PetApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/PetApiControllerImpInterface.java index 5f091467ef9..6efc073d0f2 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/PetApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/PetApiControllerImpInterface.java @@ -11,6 +11,7 @@ import javax.validation.constraints.*; +@SuppressWarnings("RedundantThrows") public interface PetApiControllerImpInterface { void addPet(Pet body) ; diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/StoreApiController.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/StoreApiController.java index a1511878884..ab19ac3ae26 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/StoreApiController.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/StoreApiController.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; +import java.io.File; import java.io.IOException; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -36,9 +37,7 @@ private StoreApiController(StoreApiControllerImpInterface imp) { @ApiAction public Result deleteOrder(String orderId) { imp.deleteOrder(orderId); - return ok(); - } @ApiAction @@ -46,8 +45,6 @@ public Result getInventory() { Map obj = imp.getInventory(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -56,8 +53,6 @@ public Result getOrderById( @Min(1) @Max(5)Long orderId) { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -72,7 +67,5 @@ public Result placeOrder() throws IOException { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } } diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/StoreApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/StoreApiControllerImpInterface.java index 679250b46c8..70d313028c6 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/StoreApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/StoreApiControllerImpInterface.java @@ -10,6 +10,7 @@ import javax.validation.constraints.*; +@SuppressWarnings("RedundantThrows") public interface StoreApiControllerImpInterface { void deleteOrder(String orderId) ; diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiController.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiController.java index 7cd05f8d900..d09687a9a30 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiController.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiController.java @@ -12,6 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; +import java.io.File; import java.io.IOException; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -42,9 +43,7 @@ public Result createUser() throws IOException { body.validate(); imp.createUser(body); - return ok(); - } @ApiAction @@ -58,9 +57,7 @@ public Result createUsersWithArrayInput() throws IOException { } imp.createUsersWithArrayInput(body); - return ok(); - } @ApiAction @@ -74,17 +71,13 @@ public Result createUsersWithListInput() throws IOException { } imp.createUsersWithListInput(body); - return ok(); - } @ApiAction public Result deleteUser(String username) { imp.deleteUser(username); - return ok(); - } @ApiAction @@ -93,8 +86,6 @@ public Result getUserByName(String username) { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -102,26 +93,22 @@ public Result loginUser() { String valueusername = request().getQueryString("username"); String username; - username = (String)valueusername; + username = valueusername; String valuepassword = request().getQueryString("password"); String password; - password = (String)valuepassword; + password = valuepassword; String obj = imp.loginUser(username, password); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction public Result logoutUser() { imp.logoutUser(); - return ok(); - } @ApiAction @@ -133,8 +120,6 @@ public Result updateUser(String username) throws IOException { body.validate(); imp.updateUser(username, body); - return ok(); - } } diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiControllerImpInterface.java index a28ff6b1f66..c79d4b93820 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/controllers/UserApiControllerImpInterface.java @@ -10,6 +10,7 @@ import javax.validation.constraints.*; +@SuppressWarnings("RedundantThrows") public interface UserApiControllerImpInterface { void createUser(User body) ; diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/logs/application.log b/samples/server/petstore/java-play-framework-no-exception-handling/logs/application.log deleted file mode 100644 index 469f563f571..00000000000 --- a/samples/server/petstore/java-play-framework-no-exception-handling/logs/application.log +++ /dev/null @@ -1 +0,0 @@ -2017-08-08 13:00:03,356 [INFO] from play.api.Play in ForkJoinPool-1-worker-1 - Application started (Dev) diff --git a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Category.java b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Category.java index d820c9d7365..fb9207f4b5d 100644 --- a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Category.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A category for a pet */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Category { @JsonProperty("id") private Long id = null; @@ -60,8 +61,8 @@ public boolean equals(java.lang.Object o) { return false; } Category category = (Category) o; - return Objects.equals(this.id, category.id) && - Objects.equals(this.name, category.name); + return Objects.equals(id, category.id) && + Objects.equals(name, category.name); } @Override @@ -69,6 +70,7 @@ public int hashCode() { return Objects.hash(id, name); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/ModelApiResponse.java index 4f9f27efb66..05911012313 100644 --- a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/ModelApiResponse.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Describes the result of uploading an image resource */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelApiResponse { @JsonProperty("code") private Integer code = null; @@ -80,9 +81,9 @@ public boolean equals(java.lang.Object o) { return false; } ModelApiResponse _apiResponse = (ModelApiResponse) o; - return Objects.equals(this.code, _apiResponse.code) && - Objects.equals(this.type, _apiResponse.type) && - Objects.equals(this.message, _apiResponse.message); + return Objects.equals(code, _apiResponse.code) && + Objects.equals(type, _apiResponse.type) && + Objects.equals(message, _apiResponse.message); } @Override @@ -90,6 +91,7 @@ public int hashCode() { return Objects.hash(code, type, message); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Order.java b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Order.java index acabaabd0ba..987ef07d460 100644 --- a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Order.java @@ -1,15 +1,16 @@ package apimodels; -import java.util.Objects; import java.time.OffsetDateTime; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * An order for a pets from the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Order { @JsonProperty("id") private Long id = null; @@ -33,7 +34,7 @@ public enum StatusEnum { DELIVERED("delivered"); - private String value; + private final String value; StatusEnum(String value) { this.value = value; @@ -175,12 +176,12 @@ public boolean equals(java.lang.Object o) { return false; } Order order = (Order) o; - return Objects.equals(this.id, order.id) && - Objects.equals(this.petId, order.petId) && - Objects.equals(this.quantity, order.quantity) && - Objects.equals(this.shipDate, order.shipDate) && - Objects.equals(this.status, order.status) && - Objects.equals(this.complete, order.complete); + return Objects.equals(id, order.id) && + Objects.equals(petId, order.petId) && + Objects.equals(quantity, order.quantity) && + Objects.equals(shipDate, order.shipDate) && + Objects.equals(status, order.status) && + Objects.equals(complete, order.complete); } @Override @@ -188,6 +189,7 @@ public int hashCode() { return Objects.hash(id, petId, quantity, shipDate, status, complete); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Pet.java index 69bae933aa5..430bbe805ce 100644 --- a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Pet.java @@ -1,6 +1,5 @@ package apimodels; -import java.util.Objects; import apimodels.Category; import apimodels.Tag; import java.util.ArrayList; @@ -8,11 +7,13 @@ import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A pet for sale in the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Pet { @JsonProperty("id") private Long id = null; @@ -24,7 +25,7 @@ public class Pet { private String name = null; @JsonProperty("photoUrls") - private List photoUrls = new ArrayList(); + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") private List tags = null; @@ -39,7 +40,7 @@ public enum StatusEnum { SOLD("sold"); - private String value; + private final String value; StatusEnum(String value) { this.value = value; @@ -124,7 +125,7 @@ public Pet photoUrls(List photoUrls) { } public Pet addPhotoUrlsItem(String photoUrlsItem) { - this.photoUrls.add(photoUrlsItem); + photoUrls.add(photoUrlsItem); return this; } @@ -147,10 +148,10 @@ public Pet tags(List tags) { } public Pet addTagsItem(Tag tagsItem) { - if (this.tags == null) { - this.tags = new ArrayList(); + if (tags == null) { + tags = new ArrayList<>(); } - this.tags.add(tagsItem); + tags.add(tagsItem); return this; } @@ -194,12 +195,12 @@ public boolean equals(java.lang.Object o) { return false; } Pet pet = (Pet) o; - return Objects.equals(this.id, pet.id) && - Objects.equals(this.category, pet.category) && - Objects.equals(this.name, pet.name) && - Objects.equals(this.photoUrls, pet.photoUrls) && - Objects.equals(this.tags, pet.tags) && - Objects.equals(this.status, pet.status); + return Objects.equals(id, pet.id) && + Objects.equals(category, pet.category) && + Objects.equals(name, pet.name) && + Objects.equals(photoUrls, pet.photoUrls) && + Objects.equals(tags, pet.tags) && + Objects.equals(status, pet.status); } @Override @@ -207,6 +208,7 @@ public int hashCode() { return Objects.hash(id, category, name, photoUrls, tags, status); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Tag.java index 02b787be589..709fef2cf11 100644 --- a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/Tag.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A tag for a pet */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Tag { @JsonProperty("id") private Long id = null; @@ -60,8 +61,8 @@ public boolean equals(java.lang.Object o) { return false; } Tag tag = (Tag) o; - return Objects.equals(this.id, tag.id) && - Objects.equals(this.name, tag.name); + return Objects.equals(id, tag.id) && + Objects.equals(name, tag.name); } @Override @@ -69,6 +70,7 @@ public int hashCode() { return Objects.hash(id, name); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/User.java b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/User.java index b9fd299724f..ba41fb76f80 100644 --- a/samples/server/petstore/java-play-framework-no-interface/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework-no-interface/app/apimodels/User.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A User who is purchasing from the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class User { @JsonProperty("id") private Long id = null; @@ -180,14 +181,14 @@ public boolean equals(java.lang.Object o) { return false; } User user = (User) o; - return Objects.equals(this.id, user.id) && - Objects.equals(this.username, user.username) && - Objects.equals(this.firstName, user.firstName) && - Objects.equals(this.lastName, user.lastName) && - Objects.equals(this.email, user.email) && - Objects.equals(this.password, user.password) && - Objects.equals(this.phone, user.phone) && - Objects.equals(this.userStatus, user.userStatus); + return Objects.equals(id, user.id) && + Objects.equals(username, user.username) && + Objects.equals(firstName, user.firstName) && + Objects.equals(lastName, user.lastName) && + Objects.equals(email, user.email) && + Objects.equals(password, user.password) && + Objects.equals(phone, user.phone) && + Objects.equals(userStatus, user.userStatus); } @Override @@ -195,6 +196,7 @@ public int hashCode() { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-interface/app/controllers/PetApiController.java b/samples/server/petstore/java-play-framework-no-interface/app/controllers/PetApiController.java index b7fd7156423..0701f3ba336 100644 --- a/samples/server/petstore/java-play-framework-no-interface/app/controllers/PetApiController.java +++ b/samples/server/petstore/java-play-framework-no-interface/app/controllers/PetApiController.java @@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -43,9 +43,7 @@ public Result addPet() throws Exception { body.validate(); imp.addPet(body); - return ok(); - } @ApiAction @@ -53,15 +51,13 @@ public Result deletePet(Long petId) throws Exception { String valueapiKey = request().getHeader("api_key"); String apiKey; if (valueapiKey != null) { - apiKey = (String)valueapiKey; + apiKey = valueapiKey; } else { apiKey = null; } imp.deletePet(petId, apiKey); - return ok(); - } @ApiAction @@ -78,8 +74,6 @@ public Result findPetsByStatus() throws Exception { } JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -96,8 +90,6 @@ public Result findPetsByTags() throws Exception { } JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -106,8 +98,6 @@ public Result getPetById(Long petId) throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -119,9 +109,7 @@ public Result updatePet() throws Exception { body.validate(); imp.updatePet(body); - return ok(); - } @ApiAction @@ -129,7 +117,7 @@ public Result updatePetWithForm(Long petId) throws Exception { String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0]; String name; if (valuename != null) { - name = (String)valuename; + name = valuename; } else { name = null; @@ -137,15 +125,13 @@ public Result updatePetWithForm(Long petId) throws Exception { String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0]; String status; if (valuestatus != null) { - status = (String)valuestatus; + status = valuestatus; } else { status = null; } imp.updatePetWithForm(petId, name, status); - return ok(); - } @ApiAction @@ -153,17 +139,15 @@ public Result uploadFile(Long petId) throws Exception { String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0]; String additionalMetadata; if (valueadditionalMetadata != null) { - additionalMetadata = (String)valueadditionalMetadata; + additionalMetadata = valueadditionalMetadata; } else { additionalMetadata = null; } Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file"); - ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); + ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } } diff --git a/samples/server/petstore/java-play-framework-no-interface/app/controllers/PetApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-interface/app/controllers/PetApiControllerImpInterface.java new file mode 100644 index 00000000000..9ad4dcb3013 --- /dev/null +++ b/samples/server/petstore/java-play-framework-no-interface/app/controllers/PetApiControllerImpInterface.java @@ -0,0 +1,32 @@ +package controllers; + +import java.io.InputStream; +import apimodels.ModelApiResponse; +import apimodels.Pet; + +import play.mvc.Http; +import java.util.List; +import java.util.ArrayList; +import java.util.HashMap; + +import javax.validation.constraints.*; + +@SuppressWarnings("RedundantThrows") +interface PetApiControllerImpInterface { + void addPet(Pet body) throws Exception; + + void deletePet(Long petId, String apiKey) throws Exception; + + List findPetsByStatus( @NotNull List status) throws Exception; + + List findPetsByTags( @NotNull List tags) throws Exception; + + Pet getPetById(Long petId) throws Exception; + + void updatePet(Pet body) throws Exception; + + void updatePetWithForm(Long petId, String name, String status) throws Exception; + + ModelApiResponse uploadFile(Long petId, String additionalMetadata, Http.MultipartFormData.FilePart file) throws Exception; + +} diff --git a/samples/server/petstore/java-play-framework-no-interface/app/controllers/StoreApiController.java b/samples/server/petstore/java-play-framework-no-interface/app/controllers/StoreApiController.java index 93437d17d57..b6801a3ef1f 100644 --- a/samples/server/petstore/java-play-framework-no-interface/app/controllers/StoreApiController.java +++ b/samples/server/petstore/java-play-framework-no-interface/app/controllers/StoreApiController.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -36,9 +36,7 @@ private StoreApiController(StoreApiControllerImp imp) { @ApiAction public Result deleteOrder(String orderId) throws Exception { imp.deleteOrder(orderId); - return ok(); - } @ApiAction @@ -46,8 +44,6 @@ public Result getInventory() throws Exception { Map obj = imp.getInventory(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -56,8 +52,6 @@ public Result getOrderById( @Min(1) @Max(5)Long orderId) throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -72,7 +66,5 @@ public Result placeOrder() throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } } diff --git a/samples/server/petstore/java-play-framework-no-interface/app/controllers/StoreApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-interface/app/controllers/StoreApiControllerImpInterface.java new file mode 100644 index 00000000000..967298f7e67 --- /dev/null +++ b/samples/server/petstore/java-play-framework-no-interface/app/controllers/StoreApiControllerImpInterface.java @@ -0,0 +1,23 @@ +package controllers; + +import java.util.Map; +import apimodels.Order; + +import play.mvc.Http; +import java.util.List; +import java.util.ArrayList; +import java.util.HashMap; + +import javax.validation.constraints.*; + +@SuppressWarnings("RedundantThrows") +interface StoreApiControllerImpInterface { + void deleteOrder(String orderId) throws Exception; + + Map getInventory() throws Exception; + + Order getOrderById( @Min(1) @Max(5)Long orderId) throws Exception; + + Order placeOrder(Order body) throws Exception; + +} diff --git a/samples/server/petstore/java-play-framework-no-interface/app/controllers/UserApiController.java b/samples/server/petstore/java-play-framework-no-interface/app/controllers/UserApiController.java index 540e26d6e2c..a62e1fb9c02 100644 --- a/samples/server/petstore/java-play-framework-no-interface/app/controllers/UserApiController.java +++ b/samples/server/petstore/java-play-framework-no-interface/app/controllers/UserApiController.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -42,9 +42,7 @@ public Result createUser() throws Exception { body.validate(); imp.createUser(body); - return ok(); - } @ApiAction @@ -58,9 +56,7 @@ public Result createUsersWithArrayInput() throws Exception { } imp.createUsersWithArrayInput(body); - return ok(); - } @ApiAction @@ -74,17 +70,13 @@ public Result createUsersWithListInput() throws Exception { } imp.createUsersWithListInput(body); - return ok(); - } @ApiAction public Result deleteUser(String username) throws Exception { imp.deleteUser(username); - return ok(); - } @ApiAction @@ -93,8 +85,6 @@ public Result getUserByName(String username) throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -102,26 +92,22 @@ public Result loginUser() throws Exception { String valueusername = request().getQueryString("username"); String username; - username = (String)valueusername; + username = valueusername; String valuepassword = request().getQueryString("password"); String password; - password = (String)valuepassword; + password = valuepassword; String obj = imp.loginUser(username, password); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction public Result logoutUser() throws Exception { imp.logoutUser(); - return ok(); - } @ApiAction @@ -133,8 +119,6 @@ public Result updateUser(String username) throws Exception { body.validate(); imp.updateUser(username, body); - return ok(); - } } diff --git a/samples/server/petstore/java-play-framework-no-interface/app/controllers/UserApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-interface/app/controllers/UserApiControllerImpInterface.java new file mode 100644 index 00000000000..00b7778296f --- /dev/null +++ b/samples/server/petstore/java-play-framework-no-interface/app/controllers/UserApiControllerImpInterface.java @@ -0,0 +1,31 @@ +package controllers; + +import java.util.List; +import apimodels.User; + +import play.mvc.Http; +import java.util.List; +import java.util.ArrayList; +import java.util.HashMap; + +import javax.validation.constraints.*; + +@SuppressWarnings("RedundantThrows") +interface UserApiControllerImpInterface { + void createUser(User body) throws Exception; + + void createUsersWithArrayInput(List body) throws Exception; + + void createUsersWithListInput(List body) throws Exception; + + void deleteUser(String username) throws Exception; + + User getUserByName(String username) throws Exception; + + String loginUser( @NotNull String username, @NotNull String password) throws Exception; + + void logoutUser() throws Exception; + + void updateUser(String username, User body) throws Exception; + +} diff --git a/samples/server/petstore/java-play-framework-no-interface/logs/application.log b/samples/server/petstore/java-play-framework-no-interface/logs/application.log index d9c5849aa5e..029a73a780c 100644 --- a/samples/server/petstore/java-play-framework-no-interface/logs/application.log +++ b/samples/server/petstore/java-play-framework-no-interface/logs/application.log @@ -1 +1 @@ -2017-08-08 13:00:28,358 [INFO] from play.api.Play in ForkJoinPool-1-worker-1 - Application started (Dev) +2017-08-09 12:45:42,656 [INFO] from play.api.Play in ForkJoinPool-1-worker-1 - Application started (Dev) diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Category.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Category.java index d820c9d7365..fb9207f4b5d 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Category.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A category for a pet */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Category { @JsonProperty("id") private Long id = null; @@ -60,8 +61,8 @@ public boolean equals(java.lang.Object o) { return false; } Category category = (Category) o; - return Objects.equals(this.id, category.id) && - Objects.equals(this.name, category.name); + return Objects.equals(id, category.id) && + Objects.equals(name, category.name); } @Override @@ -69,6 +70,7 @@ public int hashCode() { return Objects.hash(id, name); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/ModelApiResponse.java index 4f9f27efb66..05911012313 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/ModelApiResponse.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Describes the result of uploading an image resource */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelApiResponse { @JsonProperty("code") private Integer code = null; @@ -80,9 +81,9 @@ public boolean equals(java.lang.Object o) { return false; } ModelApiResponse _apiResponse = (ModelApiResponse) o; - return Objects.equals(this.code, _apiResponse.code) && - Objects.equals(this.type, _apiResponse.type) && - Objects.equals(this.message, _apiResponse.message); + return Objects.equals(code, _apiResponse.code) && + Objects.equals(type, _apiResponse.type) && + Objects.equals(message, _apiResponse.message); } @Override @@ -90,6 +91,7 @@ public int hashCode() { return Objects.hash(code, type, message); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Order.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Order.java index acabaabd0ba..987ef07d460 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Order.java @@ -1,15 +1,16 @@ package apimodels; -import java.util.Objects; import java.time.OffsetDateTime; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * An order for a pets from the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Order { @JsonProperty("id") private Long id = null; @@ -33,7 +34,7 @@ public enum StatusEnum { DELIVERED("delivered"); - private String value; + private final String value; StatusEnum(String value) { this.value = value; @@ -175,12 +176,12 @@ public boolean equals(java.lang.Object o) { return false; } Order order = (Order) o; - return Objects.equals(this.id, order.id) && - Objects.equals(this.petId, order.petId) && - Objects.equals(this.quantity, order.quantity) && - Objects.equals(this.shipDate, order.shipDate) && - Objects.equals(this.status, order.status) && - Objects.equals(this.complete, order.complete); + return Objects.equals(id, order.id) && + Objects.equals(petId, order.petId) && + Objects.equals(quantity, order.quantity) && + Objects.equals(shipDate, order.shipDate) && + Objects.equals(status, order.status) && + Objects.equals(complete, order.complete); } @Override @@ -188,6 +189,7 @@ public int hashCode() { return Objects.hash(id, petId, quantity, shipDate, status, complete); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Pet.java index 69bae933aa5..430bbe805ce 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Pet.java @@ -1,6 +1,5 @@ package apimodels; -import java.util.Objects; import apimodels.Category; import apimodels.Tag; import java.util.ArrayList; @@ -8,11 +7,13 @@ import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A pet for sale in the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Pet { @JsonProperty("id") private Long id = null; @@ -24,7 +25,7 @@ public class Pet { private String name = null; @JsonProperty("photoUrls") - private List photoUrls = new ArrayList(); + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") private List tags = null; @@ -39,7 +40,7 @@ public enum StatusEnum { SOLD("sold"); - private String value; + private final String value; StatusEnum(String value) { this.value = value; @@ -124,7 +125,7 @@ public Pet photoUrls(List photoUrls) { } public Pet addPhotoUrlsItem(String photoUrlsItem) { - this.photoUrls.add(photoUrlsItem); + photoUrls.add(photoUrlsItem); return this; } @@ -147,10 +148,10 @@ public Pet tags(List tags) { } public Pet addTagsItem(Tag tagsItem) { - if (this.tags == null) { - this.tags = new ArrayList(); + if (tags == null) { + tags = new ArrayList<>(); } - this.tags.add(tagsItem); + tags.add(tagsItem); return this; } @@ -194,12 +195,12 @@ public boolean equals(java.lang.Object o) { return false; } Pet pet = (Pet) o; - return Objects.equals(this.id, pet.id) && - Objects.equals(this.category, pet.category) && - Objects.equals(this.name, pet.name) && - Objects.equals(this.photoUrls, pet.photoUrls) && - Objects.equals(this.tags, pet.tags) && - Objects.equals(this.status, pet.status); + return Objects.equals(id, pet.id) && + Objects.equals(category, pet.category) && + Objects.equals(name, pet.name) && + Objects.equals(photoUrls, pet.photoUrls) && + Objects.equals(tags, pet.tags) && + Objects.equals(status, pet.status); } @Override @@ -207,6 +208,7 @@ public int hashCode() { return Objects.hash(id, category, name, photoUrls, tags, status); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Tag.java index 02b787be589..709fef2cf11 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/Tag.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A tag for a pet */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Tag { @JsonProperty("id") private Long id = null; @@ -60,8 +61,8 @@ public boolean equals(java.lang.Object o) { return false; } Tag tag = (Tag) o; - return Objects.equals(this.id, tag.id) && - Objects.equals(this.name, tag.name); + return Objects.equals(id, tag.id) && + Objects.equals(name, tag.name); } @Override @@ -69,6 +70,7 @@ public int hashCode() { return Objects.hash(id, name); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/User.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/User.java index b9fd299724f..ba41fb76f80 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/apimodels/User.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A User who is purchasing from the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class User { @JsonProperty("id") private Long id = null; @@ -180,14 +181,14 @@ public boolean equals(java.lang.Object o) { return false; } User user = (User) o; - return Objects.equals(this.id, user.id) && - Objects.equals(this.username, user.username) && - Objects.equals(this.firstName, user.firstName) && - Objects.equals(this.lastName, user.lastName) && - Objects.equals(this.email, user.email) && - Objects.equals(this.password, user.password) && - Objects.equals(this.phone, user.phone) && - Objects.equals(this.userStatus, user.userStatus); + return Objects.equals(id, user.id) && + Objects.equals(username, user.username) && + Objects.equals(firstName, user.firstName) && + Objects.equals(lastName, user.lastName) && + Objects.equals(email, user.email) && + Objects.equals(password, user.password) && + Objects.equals(phone, user.phone) && + Objects.equals(userStatus, user.userStatus); } @Override @@ -195,6 +196,7 @@ public int hashCode() { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/PetApiController.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/PetApiController.java index 74731b82cdb..6ea11161da1 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/PetApiController.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/PetApiController.java @@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -43,9 +43,7 @@ public Result addPet() throws Exception { body.validate(); imp.addPet(body); - return ok(); - } @ApiAction @@ -53,15 +51,13 @@ public Result deletePet(Long petId) throws Exception { String valueapiKey = request().getHeader("api_key"); String apiKey; if (valueapiKey != null) { - apiKey = (String)valueapiKey; + apiKey = valueapiKey; } else { apiKey = null; } imp.deletePet(petId, apiKey); - return ok(); - } @ApiAction @@ -78,8 +74,6 @@ public Result findPetsByStatus() throws Exception { } JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -96,8 +90,6 @@ public Result findPetsByTags() throws Exception { } JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -106,8 +98,6 @@ public Result getPetById(Long petId) throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -119,9 +109,7 @@ public Result updatePet() throws Exception { body.validate(); imp.updatePet(body); - return ok(); - } @ApiAction @@ -129,7 +117,7 @@ public Result updatePetWithForm(Long petId) throws Exception { String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0]; String name; if (valuename != null) { - name = (String)valuename; + name = valuename; } else { name = null; @@ -137,15 +125,13 @@ public Result updatePetWithForm(Long petId) throws Exception { String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0]; String status; if (valuestatus != null) { - status = (String)valuestatus; + status = valuestatus; } else { status = null; } imp.updatePetWithForm(petId, name, status); - return ok(); - } @ApiAction @@ -153,17 +139,15 @@ public Result uploadFile(Long petId) throws Exception { String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0]; String additionalMetadata; if (valueadditionalMetadata != null) { - additionalMetadata = (String)valueadditionalMetadata; + additionalMetadata = valueadditionalMetadata; } else { additionalMetadata = null; } Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file"); - ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); + ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } } diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/PetApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/PetApiControllerImpInterface.java index df027c27920..307c6c18cfb 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/PetApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/PetApiControllerImpInterface.java @@ -11,6 +11,7 @@ import javax.validation.constraints.*; +@SuppressWarnings("RedundantThrows") public interface PetApiControllerImpInterface { void addPet(Pet body) throws Exception; diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/StoreApiController.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/StoreApiController.java index 0be3ecc4276..92fafa4b746 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/StoreApiController.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/StoreApiController.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -36,9 +36,7 @@ private StoreApiController(StoreApiControllerImpInterface imp) { @ApiAction public Result deleteOrder(String orderId) throws Exception { imp.deleteOrder(orderId); - return ok(); - } @ApiAction @@ -46,8 +44,6 @@ public Result getInventory() throws Exception { Map obj = imp.getInventory(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -56,8 +52,6 @@ public Result getOrderById( @Min(1) @Max(5)Long orderId) throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -72,7 +66,5 @@ public Result placeOrder() throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } } diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/StoreApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/StoreApiControllerImpInterface.java index 766a29c4f17..b42e4d6d3d0 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/StoreApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/StoreApiControllerImpInterface.java @@ -10,6 +10,7 @@ import javax.validation.constraints.*; +@SuppressWarnings("RedundantThrows") public interface StoreApiControllerImpInterface { void deleteOrder(String orderId) throws Exception; diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiController.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiController.java index eeab90cf178..c084e050fa2 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiController.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiController.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -42,9 +42,7 @@ public Result createUser() throws Exception { body.validate(); imp.createUser(body); - return ok(); - } @ApiAction @@ -58,9 +56,7 @@ public Result createUsersWithArrayInput() throws Exception { } imp.createUsersWithArrayInput(body); - return ok(); - } @ApiAction @@ -74,17 +70,13 @@ public Result createUsersWithListInput() throws Exception { } imp.createUsersWithListInput(body); - return ok(); - } @ApiAction public Result deleteUser(String username) throws Exception { imp.deleteUser(username); - return ok(); - } @ApiAction @@ -93,8 +85,6 @@ public Result getUserByName(String username) throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -102,26 +92,22 @@ public Result loginUser() throws Exception { String valueusername = request().getQueryString("username"); String username; - username = (String)valueusername; + username = valueusername; String valuepassword = request().getQueryString("password"); String password; - password = (String)valuepassword; + password = valuepassword; String obj = imp.loginUser(username, password); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction public Result logoutUser() throws Exception { imp.logoutUser(); - return ok(); - } @ApiAction @@ -133,8 +119,6 @@ public Result updateUser(String username) throws Exception { body.validate(); imp.updateUser(username, body); - return ok(); - } } diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiControllerImpInterface.java index 474905c2b2e..1290c84835f 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/controllers/UserApiControllerImpInterface.java @@ -10,6 +10,7 @@ import javax.validation.constraints.*; +@SuppressWarnings("RedundantThrows") public interface UserApiControllerImpInterface { void createUser(User body) throws Exception; diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/logs/application.log b/samples/server/petstore/java-play-framework-no-swagger-ui/logs/application.log deleted file mode 100644 index 19636d85ca6..00000000000 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/logs/application.log +++ /dev/null @@ -1 +0,0 @@ -2017-08-08 13:00:54,728 [INFO] from play.api.Play in ForkJoinPool-1-worker-1 - Application started (Dev) diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Category.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Category.java index d820c9d7365..fb9207f4b5d 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Category.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A category for a pet */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Category { @JsonProperty("id") private Long id = null; @@ -60,8 +61,8 @@ public boolean equals(java.lang.Object o) { return false; } Category category = (Category) o; - return Objects.equals(this.id, category.id) && - Objects.equals(this.name, category.name); + return Objects.equals(id, category.id) && + Objects.equals(name, category.name); } @Override @@ -69,6 +70,7 @@ public int hashCode() { return Objects.hash(id, name); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/ModelApiResponse.java index 4f9f27efb66..05911012313 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/ModelApiResponse.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Describes the result of uploading an image resource */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelApiResponse { @JsonProperty("code") private Integer code = null; @@ -80,9 +81,9 @@ public boolean equals(java.lang.Object o) { return false; } ModelApiResponse _apiResponse = (ModelApiResponse) o; - return Objects.equals(this.code, _apiResponse.code) && - Objects.equals(this.type, _apiResponse.type) && - Objects.equals(this.message, _apiResponse.message); + return Objects.equals(code, _apiResponse.code) && + Objects.equals(type, _apiResponse.type) && + Objects.equals(message, _apiResponse.message); } @Override @@ -90,6 +91,7 @@ public int hashCode() { return Objects.hash(code, type, message); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Order.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Order.java index acabaabd0ba..987ef07d460 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Order.java @@ -1,15 +1,16 @@ package apimodels; -import java.util.Objects; import java.time.OffsetDateTime; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * An order for a pets from the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Order { @JsonProperty("id") private Long id = null; @@ -33,7 +34,7 @@ public enum StatusEnum { DELIVERED("delivered"); - private String value; + private final String value; StatusEnum(String value) { this.value = value; @@ -175,12 +176,12 @@ public boolean equals(java.lang.Object o) { return false; } Order order = (Order) o; - return Objects.equals(this.id, order.id) && - Objects.equals(this.petId, order.petId) && - Objects.equals(this.quantity, order.quantity) && - Objects.equals(this.shipDate, order.shipDate) && - Objects.equals(this.status, order.status) && - Objects.equals(this.complete, order.complete); + return Objects.equals(id, order.id) && + Objects.equals(petId, order.petId) && + Objects.equals(quantity, order.quantity) && + Objects.equals(shipDate, order.shipDate) && + Objects.equals(status, order.status) && + Objects.equals(complete, order.complete); } @Override @@ -188,6 +189,7 @@ public int hashCode() { return Objects.hash(id, petId, quantity, shipDate, status, complete); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Pet.java index 69bae933aa5..430bbe805ce 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Pet.java @@ -1,6 +1,5 @@ package apimodels; -import java.util.Objects; import apimodels.Category; import apimodels.Tag; import java.util.ArrayList; @@ -8,11 +7,13 @@ import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A pet for sale in the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Pet { @JsonProperty("id") private Long id = null; @@ -24,7 +25,7 @@ public class Pet { private String name = null; @JsonProperty("photoUrls") - private List photoUrls = new ArrayList(); + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") private List tags = null; @@ -39,7 +40,7 @@ public enum StatusEnum { SOLD("sold"); - private String value; + private final String value; StatusEnum(String value) { this.value = value; @@ -124,7 +125,7 @@ public Pet photoUrls(List photoUrls) { } public Pet addPhotoUrlsItem(String photoUrlsItem) { - this.photoUrls.add(photoUrlsItem); + photoUrls.add(photoUrlsItem); return this; } @@ -147,10 +148,10 @@ public Pet tags(List tags) { } public Pet addTagsItem(Tag tagsItem) { - if (this.tags == null) { - this.tags = new ArrayList(); + if (tags == null) { + tags = new ArrayList<>(); } - this.tags.add(tagsItem); + tags.add(tagsItem); return this; } @@ -194,12 +195,12 @@ public boolean equals(java.lang.Object o) { return false; } Pet pet = (Pet) o; - return Objects.equals(this.id, pet.id) && - Objects.equals(this.category, pet.category) && - Objects.equals(this.name, pet.name) && - Objects.equals(this.photoUrls, pet.photoUrls) && - Objects.equals(this.tags, pet.tags) && - Objects.equals(this.status, pet.status); + return Objects.equals(id, pet.id) && + Objects.equals(category, pet.category) && + Objects.equals(name, pet.name) && + Objects.equals(photoUrls, pet.photoUrls) && + Objects.equals(tags, pet.tags) && + Objects.equals(status, pet.status); } @Override @@ -207,6 +208,7 @@ public int hashCode() { return Objects.hash(id, category, name, photoUrls, tags, status); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Tag.java index 02b787be589..709fef2cf11 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/Tag.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A tag for a pet */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Tag { @JsonProperty("id") private Long id = null; @@ -60,8 +61,8 @@ public boolean equals(java.lang.Object o) { return false; } Tag tag = (Tag) o; - return Objects.equals(this.id, tag.id) && - Objects.equals(this.name, tag.name); + return Objects.equals(id, tag.id) && + Objects.equals(name, tag.name); } @Override @@ -69,6 +70,7 @@ public int hashCode() { return Objects.hash(id, name); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/User.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/User.java index b9fd299724f..ba41fb76f80 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/apimodels/User.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A User who is purchasing from the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class User { @JsonProperty("id") private Long id = null; @@ -180,14 +181,14 @@ public boolean equals(java.lang.Object o) { return false; } User user = (User) o; - return Objects.equals(this.id, user.id) && - Objects.equals(this.username, user.username) && - Objects.equals(this.firstName, user.firstName) && - Objects.equals(this.lastName, user.lastName) && - Objects.equals(this.email, user.email) && - Objects.equals(this.password, user.password) && - Objects.equals(this.phone, user.phone) && - Objects.equals(this.userStatus, user.userStatus); + return Objects.equals(id, user.id) && + Objects.equals(username, user.username) && + Objects.equals(firstName, user.firstName) && + Objects.equals(lastName, user.lastName) && + Objects.equals(email, user.email) && + Objects.equals(password, user.password) && + Objects.equals(phone, user.phone) && + Objects.equals(userStatus, user.userStatus); } @Override @@ -195,6 +196,7 @@ public int hashCode() { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/PetApiController.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/PetApiController.java index f2e02a08811..c00d5993360 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/PetApiController.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/PetApiController.java @@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -42,9 +42,7 @@ public Result addPet() throws Exception { body.validate(); imp.addPet(body); - return ok(); - } @@ -52,15 +50,13 @@ public Result deletePet(Long petId) throws Exception { String valueapiKey = request().getHeader("api_key"); String apiKey; if (valueapiKey != null) { - apiKey = (String)valueapiKey; + apiKey = valueapiKey; } else { apiKey = null; } imp.deletePet(petId, apiKey); - return ok(); - } @@ -77,8 +73,6 @@ public Result findPetsByStatus() throws Exception { } JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @@ -95,8 +89,6 @@ public Result findPetsByTags() throws Exception { } JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @@ -105,8 +97,6 @@ public Result getPetById(Long petId) throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @@ -118,9 +108,7 @@ public Result updatePet() throws Exception { body.validate(); imp.updatePet(body); - return ok(); - } @@ -128,7 +116,7 @@ public Result updatePetWithForm(Long petId) throws Exception { String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0]; String name; if (valuename != null) { - name = (String)valuename; + name = valuename; } else { name = null; @@ -136,15 +124,13 @@ public Result updatePetWithForm(Long petId) throws Exception { String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0]; String status; if (valuestatus != null) { - status = (String)valuestatus; + status = valuestatus; } else { status = null; } imp.updatePetWithForm(petId, name, status); - return ok(); - } @@ -152,17 +138,15 @@ public Result uploadFile(Long petId) throws Exception { String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0]; String additionalMetadata; if (valueadditionalMetadata != null) { - additionalMetadata = (String)valueadditionalMetadata; + additionalMetadata = valueadditionalMetadata; } else { additionalMetadata = null; } Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file"); - ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); + ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } } diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/PetApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/PetApiControllerImpInterface.java index df027c27920..307c6c18cfb 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/PetApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/PetApiControllerImpInterface.java @@ -11,6 +11,7 @@ import javax.validation.constraints.*; +@SuppressWarnings("RedundantThrows") public interface PetApiControllerImpInterface { void addPet(Pet body) throws Exception; diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/StoreApiController.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/StoreApiController.java index 8557edeeaba..2f5b5b5b627 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/StoreApiController.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/StoreApiController.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -35,9 +35,7 @@ private StoreApiController(StoreApiControllerImpInterface imp) { public Result deleteOrder(String orderId) throws Exception { imp.deleteOrder(orderId); - return ok(); - } @@ -45,8 +43,6 @@ public Result getInventory() throws Exception { Map obj = imp.getInventory(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @@ -55,8 +51,6 @@ public Result getOrderById( @Min(1) @Max(5)Long orderId) throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @@ -71,7 +65,5 @@ public Result placeOrder() throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } } diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/StoreApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/StoreApiControllerImpInterface.java index 766a29c4f17..b42e4d6d3d0 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/StoreApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/StoreApiControllerImpInterface.java @@ -10,6 +10,7 @@ import javax.validation.constraints.*; +@SuppressWarnings("RedundantThrows") public interface StoreApiControllerImpInterface { void deleteOrder(String orderId) throws Exception; diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiController.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiController.java index 5f5878b7ccf..e95378850b6 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiController.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiController.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -41,9 +41,7 @@ public Result createUser() throws Exception { body.validate(); imp.createUser(body); - return ok(); - } @@ -57,9 +55,7 @@ public Result createUsersWithArrayInput() throws Exception { } imp.createUsersWithArrayInput(body); - return ok(); - } @@ -73,17 +69,13 @@ public Result createUsersWithListInput() throws Exception { } imp.createUsersWithListInput(body); - return ok(); - } public Result deleteUser(String username) throws Exception { imp.deleteUser(username); - return ok(); - } @@ -92,8 +84,6 @@ public Result getUserByName(String username) throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @@ -101,26 +91,22 @@ public Result loginUser() throws Exception { String valueusername = request().getQueryString("username"); String username; - username = (String)valueusername; + username = valueusername; String valuepassword = request().getQueryString("password"); String password; - password = (String)valuepassword; + password = valuepassword; String obj = imp.loginUser(username, password); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } public Result logoutUser() throws Exception { imp.logoutUser(); - return ok(); - } @@ -132,8 +118,6 @@ public Result updateUser(String username) throws Exception { body.validate(); imp.updateUser(username, body); - return ok(); - } } diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiControllerImpInterface.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiControllerImpInterface.java index 474905c2b2e..1290c84835f 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/controllers/UserApiControllerImpInterface.java @@ -10,6 +10,7 @@ import javax.validation.constraints.*; +@SuppressWarnings("RedundantThrows") public interface UserApiControllerImpInterface { void createUser(User body) throws Exception; diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/logs/application.log b/samples/server/petstore/java-play-framework-no-wrap-calls/logs/application.log deleted file mode 100644 index a99b01fe298..00000000000 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/logs/application.log +++ /dev/null @@ -1 +0,0 @@ -2017-08-08 13:01:23,306 [INFO] from play.api.Play in ForkJoinPool-1-worker-1 - Application started (Dev) diff --git a/samples/server/petstore/java-play-framework/app/apimodels/Category.java b/samples/server/petstore/java-play-framework/app/apimodels/Category.java index d820c9d7365..fb9207f4b5d 100644 --- a/samples/server/petstore/java-play-framework/app/apimodels/Category.java +++ b/samples/server/petstore/java-play-framework/app/apimodels/Category.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A category for a pet */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Category { @JsonProperty("id") private Long id = null; @@ -60,8 +61,8 @@ public boolean equals(java.lang.Object o) { return false; } Category category = (Category) o; - return Objects.equals(this.id, category.id) && - Objects.equals(this.name, category.name); + return Objects.equals(id, category.id) && + Objects.equals(name, category.name); } @Override @@ -69,6 +70,7 @@ public int hashCode() { return Objects.hash(id, name); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework/app/apimodels/ModelApiResponse.java b/samples/server/petstore/java-play-framework/app/apimodels/ModelApiResponse.java index 4f9f27efb66..05911012313 100644 --- a/samples/server/petstore/java-play-framework/app/apimodels/ModelApiResponse.java +++ b/samples/server/petstore/java-play-framework/app/apimodels/ModelApiResponse.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * Describes the result of uploading an image resource */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class ModelApiResponse { @JsonProperty("code") private Integer code = null; @@ -80,9 +81,9 @@ public boolean equals(java.lang.Object o) { return false; } ModelApiResponse _apiResponse = (ModelApiResponse) o; - return Objects.equals(this.code, _apiResponse.code) && - Objects.equals(this.type, _apiResponse.type) && - Objects.equals(this.message, _apiResponse.message); + return Objects.equals(code, _apiResponse.code) && + Objects.equals(type, _apiResponse.type) && + Objects.equals(message, _apiResponse.message); } @Override @@ -90,6 +91,7 @@ public int hashCode() { return Objects.hash(code, type, message); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework/app/apimodels/Order.java b/samples/server/petstore/java-play-framework/app/apimodels/Order.java index acabaabd0ba..987ef07d460 100644 --- a/samples/server/petstore/java-play-framework/app/apimodels/Order.java +++ b/samples/server/petstore/java-play-framework/app/apimodels/Order.java @@ -1,15 +1,16 @@ package apimodels; -import java.util.Objects; import java.time.OffsetDateTime; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * An order for a pets from the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Order { @JsonProperty("id") private Long id = null; @@ -33,7 +34,7 @@ public enum StatusEnum { DELIVERED("delivered"); - private String value; + private final String value; StatusEnum(String value) { this.value = value; @@ -175,12 +176,12 @@ public boolean equals(java.lang.Object o) { return false; } Order order = (Order) o; - return Objects.equals(this.id, order.id) && - Objects.equals(this.petId, order.petId) && - Objects.equals(this.quantity, order.quantity) && - Objects.equals(this.shipDate, order.shipDate) && - Objects.equals(this.status, order.status) && - Objects.equals(this.complete, order.complete); + return Objects.equals(id, order.id) && + Objects.equals(petId, order.petId) && + Objects.equals(quantity, order.quantity) && + Objects.equals(shipDate, order.shipDate) && + Objects.equals(status, order.status) && + Objects.equals(complete, order.complete); } @Override @@ -188,6 +189,7 @@ public int hashCode() { return Objects.hash(id, petId, quantity, shipDate, status, complete); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework/app/apimodels/Pet.java b/samples/server/petstore/java-play-framework/app/apimodels/Pet.java index 69bae933aa5..430bbe805ce 100644 --- a/samples/server/petstore/java-play-framework/app/apimodels/Pet.java +++ b/samples/server/petstore/java-play-framework/app/apimodels/Pet.java @@ -1,6 +1,5 @@ package apimodels; -import java.util.Objects; import apimodels.Category; import apimodels.Tag; import java.util.ArrayList; @@ -8,11 +7,13 @@ import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A pet for sale in the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Pet { @JsonProperty("id") private Long id = null; @@ -24,7 +25,7 @@ public class Pet { private String name = null; @JsonProperty("photoUrls") - private List photoUrls = new ArrayList(); + private List photoUrls = new ArrayList<>(); @JsonProperty("tags") private List tags = null; @@ -39,7 +40,7 @@ public enum StatusEnum { SOLD("sold"); - private String value; + private final String value; StatusEnum(String value) { this.value = value; @@ -124,7 +125,7 @@ public Pet photoUrls(List photoUrls) { } public Pet addPhotoUrlsItem(String photoUrlsItem) { - this.photoUrls.add(photoUrlsItem); + photoUrls.add(photoUrlsItem); return this; } @@ -147,10 +148,10 @@ public Pet tags(List tags) { } public Pet addTagsItem(Tag tagsItem) { - if (this.tags == null) { - this.tags = new ArrayList(); + if (tags == null) { + tags = new ArrayList<>(); } - this.tags.add(tagsItem); + tags.add(tagsItem); return this; } @@ -194,12 +195,12 @@ public boolean equals(java.lang.Object o) { return false; } Pet pet = (Pet) o; - return Objects.equals(this.id, pet.id) && - Objects.equals(this.category, pet.category) && - Objects.equals(this.name, pet.name) && - Objects.equals(this.photoUrls, pet.photoUrls) && - Objects.equals(this.tags, pet.tags) && - Objects.equals(this.status, pet.status); + return Objects.equals(id, pet.id) && + Objects.equals(category, pet.category) && + Objects.equals(name, pet.name) && + Objects.equals(photoUrls, pet.photoUrls) && + Objects.equals(tags, pet.tags) && + Objects.equals(status, pet.status); } @Override @@ -207,6 +208,7 @@ public int hashCode() { return Objects.hash(id, category, name, photoUrls, tags, status); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework/app/apimodels/Tag.java b/samples/server/petstore/java-play-framework/app/apimodels/Tag.java index 02b787be589..709fef2cf11 100644 --- a/samples/server/petstore/java-play-framework/app/apimodels/Tag.java +++ b/samples/server/petstore/java-play-framework/app/apimodels/Tag.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A tag for a pet */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class Tag { @JsonProperty("id") private Long id = null; @@ -60,8 +61,8 @@ public boolean equals(java.lang.Object o) { return false; } Tag tag = (Tag) o; - return Objects.equals(this.id, tag.id) && - Objects.equals(this.name, tag.name); + return Objects.equals(id, tag.id) && + Objects.equals(name, tag.name); } @Override @@ -69,6 +70,7 @@ public int hashCode() { return Objects.hash(id, name); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework/app/apimodels/User.java b/samples/server/petstore/java-play-framework/app/apimodels/User.java index b9fd299724f..ba41fb76f80 100644 --- a/samples/server/petstore/java-play-framework/app/apimodels/User.java +++ b/samples/server/petstore/java-play-framework/app/apimodels/User.java @@ -1,14 +1,15 @@ package apimodels; -import java.util.Objects; import com.fasterxml.jackson.annotation.*; import java.util.Set; import javax.validation.*; +import java.util.Objects; import javax.validation.constraints.*; /** * A User who is purchasing from the pet store */ +@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"}) public class User { @JsonProperty("id") private Long id = null; @@ -180,14 +181,14 @@ public boolean equals(java.lang.Object o) { return false; } User user = (User) o; - return Objects.equals(this.id, user.id) && - Objects.equals(this.username, user.username) && - Objects.equals(this.firstName, user.firstName) && - Objects.equals(this.lastName, user.lastName) && - Objects.equals(this.email, user.email) && - Objects.equals(this.password, user.password) && - Objects.equals(this.phone, user.phone) && - Objects.equals(this.userStatus, user.userStatus); + return Objects.equals(id, user.id) && + Objects.equals(username, user.username) && + Objects.equals(firstName, user.firstName) && + Objects.equals(lastName, user.lastName) && + Objects.equals(email, user.email) && + Objects.equals(password, user.password) && + Objects.equals(phone, user.phone) && + Objects.equals(userStatus, user.userStatus); } @Override @@ -195,6 +196,7 @@ public int hashCode() { return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); } + @SuppressWarnings("StringBufferReplaceableByString") @Override public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/samples/server/petstore/java-play-framework/app/controllers/PetApiController.java b/samples/server/petstore/java-play-framework/app/controllers/PetApiController.java index 74731b82cdb..6ea11161da1 100644 --- a/samples/server/petstore/java-play-framework/app/controllers/PetApiController.java +++ b/samples/server/petstore/java-play-framework/app/controllers/PetApiController.java @@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -43,9 +43,7 @@ public Result addPet() throws Exception { body.validate(); imp.addPet(body); - return ok(); - } @ApiAction @@ -53,15 +51,13 @@ public Result deletePet(Long petId) throws Exception { String valueapiKey = request().getHeader("api_key"); String apiKey; if (valueapiKey != null) { - apiKey = (String)valueapiKey; + apiKey = valueapiKey; } else { apiKey = null; } imp.deletePet(petId, apiKey); - return ok(); - } @ApiAction @@ -78,8 +74,6 @@ public Result findPetsByStatus() throws Exception { } JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -96,8 +90,6 @@ public Result findPetsByTags() throws Exception { } JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -106,8 +98,6 @@ public Result getPetById(Long petId) throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -119,9 +109,7 @@ public Result updatePet() throws Exception { body.validate(); imp.updatePet(body); - return ok(); - } @ApiAction @@ -129,7 +117,7 @@ public Result updatePetWithForm(Long petId) throws Exception { String valuename = (request().body().asMultipartFormData().asFormUrlEncoded().get("name"))[0]; String name; if (valuename != null) { - name = (String)valuename; + name = valuename; } else { name = null; @@ -137,15 +125,13 @@ public Result updatePetWithForm(Long petId) throws Exception { String valuestatus = (request().body().asMultipartFormData().asFormUrlEncoded().get("status"))[0]; String status; if (valuestatus != null) { - status = (String)valuestatus; + status = valuestatus; } else { status = null; } imp.updatePetWithForm(petId, name, status); - return ok(); - } @ApiAction @@ -153,17 +139,15 @@ public Result uploadFile(Long petId) throws Exception { String valueadditionalMetadata = (request().body().asMultipartFormData().asFormUrlEncoded().get("additionalMetadata"))[0]; String additionalMetadata; if (valueadditionalMetadata != null) { - additionalMetadata = (String)valueadditionalMetadata; + additionalMetadata = valueadditionalMetadata; } else { additionalMetadata = null; } Http.MultipartFormData.FilePart file = request().body().asMultipartFormData().getFile("file"); - ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); + ModelApiResponse obj = imp.uploadFile(petId, additionalMetadata, file); obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } } diff --git a/samples/server/petstore/java-play-framework/app/controllers/PetApiControllerImpInterface.java b/samples/server/petstore/java-play-framework/app/controllers/PetApiControllerImpInterface.java index df027c27920..307c6c18cfb 100644 --- a/samples/server/petstore/java-play-framework/app/controllers/PetApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework/app/controllers/PetApiControllerImpInterface.java @@ -11,6 +11,7 @@ import javax.validation.constraints.*; +@SuppressWarnings("RedundantThrows") public interface PetApiControllerImpInterface { void addPet(Pet body) throws Exception; diff --git a/samples/server/petstore/java-play-framework/app/controllers/StoreApiController.java b/samples/server/petstore/java-play-framework/app/controllers/StoreApiController.java index 0be3ecc4276..92fafa4b746 100644 --- a/samples/server/petstore/java-play-framework/app/controllers/StoreApiController.java +++ b/samples/server/petstore/java-play-framework/app/controllers/StoreApiController.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -36,9 +36,7 @@ private StoreApiController(StoreApiControllerImpInterface imp) { @ApiAction public Result deleteOrder(String orderId) throws Exception { imp.deleteOrder(orderId); - return ok(); - } @ApiAction @@ -46,8 +44,6 @@ public Result getInventory() throws Exception { Map obj = imp.getInventory(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -56,8 +52,6 @@ public Result getOrderById( @Min(1) @Max(5)Long orderId) throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -72,7 +66,5 @@ public Result placeOrder() throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } } diff --git a/samples/server/petstore/java-play-framework/app/controllers/StoreApiControllerImpInterface.java b/samples/server/petstore/java-play-framework/app/controllers/StoreApiControllerImpInterface.java index 766a29c4f17..b42e4d6d3d0 100644 --- a/samples/server/petstore/java-play-framework/app/controllers/StoreApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework/app/controllers/StoreApiControllerImpInterface.java @@ -10,6 +10,7 @@ import javax.validation.constraints.*; +@SuppressWarnings("RedundantThrows") public interface StoreApiControllerImpInterface { void deleteOrder(String orderId) throws Exception; diff --git a/samples/server/petstore/java-play-framework/app/controllers/UserApiController.java b/samples/server/petstore/java-play-framework/app/controllers/UserApiController.java index eeab90cf178..c084e050fa2 100644 --- a/samples/server/petstore/java-play-framework/app/controllers/UserApiController.java +++ b/samples/server/petstore/java-play-framework/app/controllers/UserApiController.java @@ -12,7 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.JsonNode; import com.google.inject.Inject; -import java.io.IOException; +import java.io.File; import swagger.SwaggerUtils; import com.fasterxml.jackson.core.type.TypeReference; @@ -42,9 +42,7 @@ public Result createUser() throws Exception { body.validate(); imp.createUser(body); - return ok(); - } @ApiAction @@ -58,9 +56,7 @@ public Result createUsersWithArrayInput() throws Exception { } imp.createUsersWithArrayInput(body); - return ok(); - } @ApiAction @@ -74,17 +70,13 @@ public Result createUsersWithListInput() throws Exception { } imp.createUsersWithListInput(body); - return ok(); - } @ApiAction public Result deleteUser(String username) throws Exception { imp.deleteUser(username); - return ok(); - } @ApiAction @@ -93,8 +85,6 @@ public Result getUserByName(String username) throws Exception { obj.validate(); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction @@ -102,26 +92,22 @@ public Result loginUser() throws Exception { String valueusername = request().getQueryString("username"); String username; - username = (String)valueusername; + username = valueusername; String valuepassword = request().getQueryString("password"); String password; - password = (String)valuepassword; + password = valuepassword; String obj = imp.loginUser(username, password); JsonNode result = mapper.valueToTree(obj); return ok(result); - - } @ApiAction public Result logoutUser() throws Exception { imp.logoutUser(); - return ok(); - } @ApiAction @@ -133,8 +119,6 @@ public Result updateUser(String username) throws Exception { body.validate(); imp.updateUser(username, body); - return ok(); - } } diff --git a/samples/server/petstore/java-play-framework/app/controllers/UserApiControllerImpInterface.java b/samples/server/petstore/java-play-framework/app/controllers/UserApiControllerImpInterface.java index 474905c2b2e..1290c84835f 100644 --- a/samples/server/petstore/java-play-framework/app/controllers/UserApiControllerImpInterface.java +++ b/samples/server/petstore/java-play-framework/app/controllers/UserApiControllerImpInterface.java @@ -10,6 +10,7 @@ import javax.validation.constraints.*; +@SuppressWarnings("RedundantThrows") public interface UserApiControllerImpInterface { void createUser(User body) throws Exception; diff --git a/samples/server/petstore/java-play-framework/logs/application.log b/samples/server/petstore/java-play-framework/logs/application.log deleted file mode 100644 index 91d83963048..00000000000 --- a/samples/server/petstore/java-play-framework/logs/application.log +++ /dev/null @@ -1 +0,0 @@ -2017-08-08 12:55:27,544 [INFO] from play.api.Play in ForkJoinPool-1-worker-1 - Application started (Dev)