Skip to content
This repository was archived by the owner on Feb 10, 2023. It is now read-only.

Commit 908a6d0

Browse files
committed
Fix and suppress warnings
We can use diamond syntax now that we are using Java 7.
1 parent 9f8d684 commit 908a6d0

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/main/java/uk/co/o2/json/schema/ArraySchema.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ArraySchema implements JsonSchema {
2121

2222
@Override
2323
public List<ErrorMessage> validate(JsonNode jsonDocument) {
24-
List<ErrorMessage> results = new ArrayList<ErrorMessage>();
24+
List<ErrorMessage> results = new ArrayList<>();
2525
if (!jsonDocument.isArray()) {
2626
return singleError("", "Invalid type: must be an array");
2727
}
@@ -41,7 +41,7 @@ public List<ErrorMessage> validate(JsonNode jsonDocument) {
4141
}
4242

4343
private List<ErrorMessage> generateNestedErrorMessages(int index, List<ErrorMessage> errorMessages) {
44-
List<ErrorMessage> nestedResults = new ArrayList<ErrorMessage>();
44+
List<ErrorMessage> nestedResults = new ArrayList<>();
4545
String pathPrefix = "[" + index + "]";
4646
for(ErrorMessage error: errorMessages) {
4747
nestedResults.add(new ErrorMessage(pathPrefix, error));

src/main/java/uk/co/o2/json/schema/ObjectSchema.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public List<ErrorMessage> validate(JsonNode jsonDocumentToValidate) {
2222
}
2323
};
2424

25-
private List<Property> properties = new ArrayList<Property>();
25+
private List<Property> properties = new ArrayList<>();
2626

2727
List<Property> getProperties() {
2828
return properties;
@@ -40,11 +40,11 @@ JsonSchema getAdditionalProperties() {
4040

4141
@Override
4242
public List<ErrorMessage> validate(JsonNode jsonDocumentToValidate) {
43-
List<ErrorMessage> results = new ArrayList<ErrorMessage>();
43+
List<ErrorMessage> results = new ArrayList<>();
4444
if (!jsonDocumentToValidate.isObject()) {
4545
return singleError("", "Invalid type: must be an object");
4646
}
47-
Set<String> visitedPropertyNames = new HashSet<String>();
47+
Set<String> visitedPropertyNames = new HashSet<>();
4848

4949
for (Property property : properties) {
5050
if (!jsonDocumentToValidate.has(property.getName())) {

src/main/java/uk/co/o2/json/schema/SchemaCompiler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
class SchemaCompiler {
1717
private final SchemaPassThroughCache cache;
1818
private final JsonFactory jsonFactory;
19-
private final Queue<ProcessingEntry> schemasToCompile = new LinkedList<ProcessingEntry>();
19+
private final Queue<ProcessingEntry> schemasToCompile = new LinkedList<>();
2020

2121
public SchemaCompiler(SchemaPassThroughCache cache, JsonFactory jsonFactory) {
2222
this.cache = cache;
@@ -25,7 +25,7 @@ public SchemaCompiler(SchemaPassThroughCache cache, JsonFactory jsonFactory) {
2525

2626
public JsonSchema parse(URL schemaLocation) {
2727

28-
List<ProcessedSchemaEntry> compiledSchemasToRegister = new ArrayList<ProcessedSchemaEntry>();
28+
List<ProcessedSchemaEntry> compiledSchemasToRegister = new ArrayList<>();
2929

3030
scheduleSchemaForProcessing(schemaLocation);
3131

@@ -157,7 +157,7 @@ private SimpleTypeSchema parseSimpleTypeSchema(JsonNode rawSchema) {
157157

158158
JsonNode enumeration = rawSchema.get("enumeration");
159159
if (enumeration != null) {
160-
List<JsonNode> enumerationValues = new ArrayList<JsonNode>();
160+
List<JsonNode> enumerationValues = new ArrayList<>();
161161
for (JsonNode node : enumeration) {
162162
enumerationValues.add(node);
163163
}

src/main/java/uk/co/o2/json/schema/SchemaPassThroughCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
public class SchemaPassThroughCache {
1010

11-
final ConcurrentMap<String, JsonSchema> registeredSchemas = new ConcurrentHashMap<String, JsonSchema>();
11+
final ConcurrentMap<String, JsonSchema> registeredSchemas = new ConcurrentHashMap<>();
1212
private SchemaCompilerFactory schemaCompilerFactory;
1313

1414
public SchemaPassThroughCache(JsonFactory factory) {

src/test/java/uk/co/o2/json/schema/SchemaCompilerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
public class SchemaCompilerTest {
2222
private static JsonFactory jsonFactory = new JsonFactory(new ObjectMapper());
2323

24-
private final List<File> filesToDelete = new ArrayList<File>();
24+
private final List<File> filesToDelete = new ArrayList<>();
2525

2626
private SchemaPassThroughCache registry = new SchemaPassThroughCache(jsonFactory);
2727
private SchemaCompiler schemaFactory = new SchemaCompiler(registry, jsonFactory);

0 commit comments

Comments
 (0)