Add Javadoc and remove all Checkstyle issues from API and natives.

This commit is contained in:
Andrew Steinborn
2018-11-15 19:04:39 -05:00
parent a4cdc4884a
commit 868976e09c
15 changed files with 149 additions and 18 deletions

View File

@@ -76,10 +76,10 @@ public final class NativeCodeLoader<T> implements Supplier<T> {
}
static final BooleanSupplier MACOS = () ->
System.getProperty("os.name", "").equalsIgnoreCase("Mac OS X") &&
System.getProperty("os.arch").equals("x86_64");
System.getProperty("os.name", "").equalsIgnoreCase("Mac OS X")
&& System.getProperty("os.arch").equals("x86_64");
static final BooleanSupplier LINUX = () ->
System.getProperties().getProperty("os.name", "").equalsIgnoreCase("Linux") &&
System.getProperty("os.arch").equals("amd64");
System.getProperties().getProperty("os.name", "").equalsIgnoreCase("Linux")
&& System.getProperty("os.arch").equals("amd64");
static final BooleanSupplier ALWAYS = () -> true;
}

View File

@@ -43,7 +43,7 @@ public class Natives {
};
}
public static final NativeCodeLoader<VelocityCompressorFactory> compressor = new NativeCodeLoader<>(
public static final NativeCodeLoader<VelocityCompressorFactory> compress = new NativeCodeLoader<>(
ImmutableList.of(
new NativeCodeLoader.Variant<>(NativeCodeLoader.MACOS,
copyAndLoadNative("/macosx/velocity-compress.dylib"), "native (macOS)",

View File

@@ -20,13 +20,13 @@ class VelocityCompressorTest {
@BeforeAll
static void checkNatives() {
Natives.compressor.getLoadedVariant();
Natives.compress.getLoadedVariant();
}
@Test
@EnabledOnOs({MAC, LINUX})
void nativeIntegrityCheck() throws DataFormatException {
VelocityCompressor compressor = Natives.compressor.get().create(Deflater.DEFAULT_COMPRESSION);
VelocityCompressor compressor = Natives.compress.get().create(Deflater.DEFAULT_COMPRESSION);
if (compressor instanceof JavaVelocityCompressor) {
compressor.dispose();
fail("Loaded regular compressor");

View File

@@ -28,7 +28,7 @@ class VelocityCipherTest {
void nativeIntegrityCheck() throws GeneralSecurityException {
VelocityCipherFactory factory = Natives.cipher.get();
if (factory == JavaVelocityCipher.FACTORY) {
fail("Loaded regular compressor");
fail("Loaded regular cipher");
}
check(factory);
}