diff --git a/src/main/java/org/janelia/saalfeldlab/n5/FileSystemKeyValueAccess.java b/src/main/java/org/janelia/saalfeldlab/n5/FileSystemKeyValueAccess.java index cb7444f5..cfb45592 100644 --- a/src/main/java/org/janelia/saalfeldlab/n5/FileSystemKeyValueAccess.java +++ b/src/main/java/org/janelia/saalfeldlab/n5/FileSystemKeyValueAccess.java @@ -291,7 +291,7 @@ public URI uri(final String normalPath) throws URISyntaxException { try { final URI normalUri = URI.create(normalPath); if (normalUri.isAbsolute()) return normalUri.normalize(); - } catch (IllegalArgumentException e) { + } catch (final IllegalArgumentException e) { return new File(normalPath).toURI().normalize(); } return new File(normalPath).toURI().normalize(); @@ -445,7 +445,7 @@ protected static Path createDirectories(Path dir, final FileAttribute... attr // don't have permission to get absolute path se = x; } - // find a decendent that exists + // find a descendant that exists Path parent = dir.getParent(); while (parent != null) { try { @@ -485,7 +485,7 @@ protected static Path createDirectories(Path dir, final FileAttribute... attr * * Used by createDirectories to attempt to create a directory. A no-op if the * directory already exists. - * + * * @param dir directory path * @param attrs file attributes * @throws IOException the exception diff --git a/src/main/java/org/janelia/saalfeldlab/n5/GsonUtils.java b/src/main/java/org/janelia/saalfeldlab/n5/GsonUtils.java index d72307c0..f8a5677e 100644 --- a/src/main/java/org/janelia/saalfeldlab/n5/GsonUtils.java +++ b/src/main/java/org/janelia/saalfeldlab/n5/GsonUtils.java @@ -108,6 +108,7 @@ static T readAttribute( * @return the deserialized attribute object, or {@code null} if * {@code attribute} cannot deserialize to {@code T} */ + @SuppressWarnings("unchecked") static T parseAttributeElement(final JsonElement attribute, final Gson gson, final Type type) throws JsonSyntaxException, NumberFormatException, ClassCastException { if (attribute == null) @@ -266,6 +267,7 @@ static T getJsonAsArray(final Gson gson, final JsonArray array, final Class< return getJsonAsArray(gson, array, TypeToken.get(cls).getType()); } + @SuppressWarnings("unchecked") static T getJsonAsArray(final Gson gson, final JsonArray array, final Type type) { final Class clazz = (type instanceof Class) ? ((Class)type) : null; diff --git a/src/main/java/org/janelia/saalfeldlab/n5/LinkedAttributePathToken.java b/src/main/java/org/janelia/saalfeldlab/n5/LinkedAttributePathToken.java index ca7a9504..6702b4c2 100644 --- a/src/main/java/org/janelia/saalfeldlab/n5/LinkedAttributePathToken.java +++ b/src/main/java/org/janelia/saalfeldlab/n5/LinkedAttributePathToken.java @@ -130,6 +130,7 @@ public boolean jsonCompatible(final JsonElement json) { * to attempt to set to {@link #parentJson} * @return the value set to {@link #parentJson}. */ + @SuppressWarnings("unchecked") protected JsonElement setAndCreateParentElement(final JsonElement json) { if (json == null || !jsonCompatible(json)) { diff --git a/src/main/java/org/janelia/saalfeldlab/n5/cache/N5JsonCache.java b/src/main/java/org/janelia/saalfeldlab/n5/cache/N5JsonCache.java index a9c85ce2..e00d10a5 100644 --- a/src/main/java/org/janelia/saalfeldlab/n5/cache/N5JsonCache.java +++ b/src/main/java/org/janelia/saalfeldlab/n5/cache/N5JsonCache.java @@ -60,6 +60,7 @@ public boolean isGroup() { } } + @SuppressWarnings("deprecation") protected static class EmptyJson extends JsonElement { @Override diff --git a/src/test/java/org/janelia/saalfeldlab/n5/AbstractN5Test.java b/src/test/java/org/janelia/saalfeldlab/n5/AbstractN5Test.java index 8fdd5281..6e2e9e8f 100644 --- a/src/test/java/org/janelia/saalfeldlab/n5/AbstractN5Test.java +++ b/src/test/java/org/janelia/saalfeldlab/n5/AbstractN5Test.java @@ -25,18 +25,13 @@ */ package org.janelia.saalfeldlab.n5; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonNull; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.google.gson.reflect.TypeToken; -import org.janelia.saalfeldlab.n5.N5Exception.N5ClassCastException; -import org.janelia.saalfeldlab.n5.N5Reader.Version; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; import java.io.IOException; import java.net.URISyntaxException; @@ -53,13 +48,19 @@ import java.util.concurrent.Executors; import java.util.function.Predicate; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; +import org.janelia.saalfeldlab.n5.N5Exception.N5ClassCastException; +import org.janelia.saalfeldlab.n5.N5Reader.Version; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonNull; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.google.gson.reflect.TypeToken; /** * Abstract base class for testing N5 functionality. @@ -117,10 +118,10 @@ protected final N5Writer createTempN5Writer(String location, GsonBuilder gson) { @After public void removeTempWriters() { synchronized (tempWriters) { - for (N5Writer writer : tempWriters) { + for (final N5Writer writer : tempWriters) { try { writer.remove(); - } catch (Exception e) { + } catch (final Exception e) { } } tempWriters.clear(); @@ -1168,6 +1169,7 @@ public static class TestData { public T attributeValue; public Class attributeClass; + @SuppressWarnings("unchecked") public TestData(final String groupPath, final String key, final T attributeValue) { this.groupPath = groupPath;