Skip to content

Commit

Permalink
Fix IDE warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
opwvhk committed Feb 9, 2024
1 parent b0474c4 commit 4f3dcd3
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 69 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven
name: Maven Build

on:
push:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Build Status](https://github.com/opwvhk/avro-conversions/workflows/Java%20CI%20with%20Maven/badge.svg)
[![license](doc/license-APACHE-2.0-brightgreen.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.sf.opk/avro-conversions/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.sf.opk/avro-conversions)
[![License](https://img.shields.io/github/license/opwvhk/avro-conversions?color=brightgreen)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![Maven Central Version](https://img.shields.io/maven-central/v/net.sf.opk/avro-conversions?color=brightgreen)](https://maven-badges.herokuapp.com/maven-central/net.sf.opk/avro-conversions)

Avro Conversions
================
Expand Down
20 changes: 2 additions & 18 deletions doc/license-APACHE-2.0-brightgreen.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 11 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@
</properties>
<dependencies>
<!-- Basics -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down Expand Up @@ -94,16 +88,6 @@
<artifactId>avro-compiler</artifactId>
<version>${avro.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
Expand All @@ -129,7 +113,17 @@
<version>2.3.1</version>
</dependency>

<!-- JSON Schema related -->
<!-- JSON & JSON Schema related -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<!-- From JITPack https://jitpack.io/ -->
<groupId>net.jimblackler.jsonschemafriend</groupId>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/opwvhk/avro/io/AsAvroParserBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ protected AsAvroParserBase(GenericData model, ZoneId defaultTimezone) {
}

/**
* Collect all fields in a record schema, mapped by their names (i.e. name and aliases).
* Collect all fields in a record schema, mapped by their names (i.e., name and aliases).
*
* @param recordSchema a record schema
* @return all fields, mapped by all their names
Expand Down Expand Up @@ -445,7 +445,7 @@ public ValueResolver createResolver(WriteSchema writeSchema, Schema readSchema)
/**
* Factory interface to create resolvers based on a read and write schema.
*/
protected interface ResolverFactory<WriteSchema> {
public interface ResolverFactory<WriteSchema> {
/**
* Create a resolver.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/opwvhk/avro/io/RecordResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class RecordResolver
extends ValueResolver {
private static final Object NOT_SET = new Object();

private final GenericData model;
private final GenericData model;
private final Schema recordSchema;
private final Map<String, ValueResolver> resolversByName;
private final Map<String, Schema.Field> fieldsByName;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/opwvhk/avro/io/ScalarValueResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import java.util.function.Function;

import static java.util.Objects.requireNonNull;

/**
* A resolver for scalar values. Supports content, but ignores any properties.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/opwvhk/avro/json/SchemaAnalyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private Schema asAvroSchema(SchemaProperties schemaProperties, IdentityHashMap<S
// Assume a scalar value
ValueResolver resolver = new AsAvroParserBase<>(GenericData.get()) {
@Override
public ValueResolver createResolver(Schema readSchema) {
protected ValueResolver createResolver(Schema readSchema) {
return super.createResolver(readSchema);
}
}.createResolver(fieldSchema);
Expand Down
32 changes: 15 additions & 17 deletions src/main/java/opwvhk/avro/util/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Collection;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Locale;
Expand Down Expand Up @@ -234,20 +232,20 @@ public static <T> T nonRecursive(String algorithm, Object caller, Object differe
/**
* Check if a map is not empty. Throws otherwise.
*
* @param map the map to check
* @param map the map to check
* @param message the exception message to use when the map is null or empty
* @return the map
*/
public static <T extends Map<?,?>> T requireNonEmpty(T map, String message) {
public static <T extends Map<?, ?>> T requireNonEmpty(T map, String message) {
return require(map, m -> m != null && !m.isEmpty(), message);
}

/**
* Check if a requirement holds. Throws otherwise.
*
* @param object the object to check
* @param object the object to check
* @param assertion the assertion on the object that must hold
* @param message the exception message to use when the assertion fails
* @param message the exception message to use when the assertion fails
* @return the object
*/
public static <T> T require(T object, Predicate<T> assertion, String message) {
Expand All @@ -261,23 +259,23 @@ private Utils() {
// Utility class: no need to instantiate.
}

/**
/**
* <p>Simple pair class with equality check (!) on its contents, useful to prevent infinite recursion.</p>
*
* <p>Suggested use is as keys of a {@link Map} or {@link Set}, where one would use an {@link java.util.IdentityHashMap IdentityHashMap} if there were
* only one value. One such usage is in the method {@link #nonRecursive(String, Object, Object, Object, Supplier)}, where the pairs of {@code caller} and
* {@code differentiator} are used to check if the method should allow recursion, or return a default value instead.</p>
*
* <p>Suggested use is as keys of a {@link Map} or {@link Set}, where one would use an {@link java.util.IdentityHashMap IdentityHashMap} if there were
* only one value. One such usage is in the method {@link #nonRecursive(String, Object, Object, Object, Supplier)}, where the pairs of {@code caller} and
* {@code differentiator} are used to check if the method should allow recursion, or return a default value instead.</p>
*/
public static class Seen {
private final Object left;
private final Object right;

/**
* Create a 'seen' pair.
*
* @param left one of the values to check against
* @param right the other value to check against
*/
/**
* Create a 'seen' pair.
*
* @param left one of the values to check against
* @param right the other value to check against
*/
public Seen(Object left, Object right) {
this.left = left;
this.right = right;
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/opwvhk/avro/xml/SimpleContentAdapter.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package opwvhk.avro.xml;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
Expand All @@ -17,10 +15,6 @@
* <p>Requires the parser to support namespaces (and return namespace attributes).</p>
*/
class SimpleContentAdapter extends DefaultHandler {
/**
* Logger for this class.
*/
private static final Logger LOGGER = LoggerFactory.getLogger(SimpleContentAdapter.class);
private static final int DEFAULT_BUFFER_CAPACITY = 1024;
private final SimpleContentHandler simpleContentHandler;
private final boolean enforceXsd;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/opwvhk/avro/xml/XsdAnalyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import org.apache.ws.commons.schema.utils.NamespacePrefixList;
import org.apache.ws.commons.schema.walker.FixedXmlSchemaWalker;
import org.apache.ws.commons.schema.walker.XmlSchemaVisitor;
import org.apache.ws.commons.schema.walker.XmlSchemaWalker;
import org.xml.sax.helpers.DefaultHandler;

import static java.nio.charset.StandardCharsets.UTF_8;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.apache.avro.Schema;

/**
* A type with unparsed content. This means the type has a text field named "value", where the XML parser can place the content of an XML element.
* A type with unparsed content. This means the type has a text field named "value", where the XML parser can place the content of an XML element.
*
* @param actualType the actual type (with a text field named "value")
*/
Expand Down

0 comments on commit 4f3dcd3

Please sign in to comment.