Skip to content
Permalink
Browse files
Cleanup checkstyle violations and Eclipse IDE warnings
  • Loading branch information
davecromberge committed May 11, 2022
1 parent 1d2a960 commit 847a322e7f5ff3204bef2c63ceb9b1b12dabff50
Showing 58 changed files with 15 additions and 88 deletions.
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
@SuppressWarnings("javadoc")
module org.apache.datasketches.memory {
requires java.base;
requires java.logging;
@@ -43,4 +43,4 @@ public interface Map extends AutoCloseable {
*/
boolean isLoaded();

}
}
@@ -47,4 +47,4 @@ public MemoryCleaner(final Object referent, final Runnable deallocator) {
public void clean() {
cleaner.clean();
}
}
}
@@ -38,7 +38,6 @@
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

@SuppressWarnings({"javadoc", "unused"})
public class AllocateDirectMapMemoryTest {
private static final String LS = System.getProperty("line.separator");
MapHandle hand = null;
@@ -32,7 +32,6 @@
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class AllocateDirectMemoryTest {

@Test
@@ -50,7 +50,6 @@
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class AllocateDirectWritableMapMemoryTest {
private static final String LS = System.getProperty("line.separator");

@@ -154,7 +153,6 @@ public void checkNonNativeFile() throws Exception {
}
}

@SuppressWarnings("resource")
@Test(expectedExceptions = RuntimeException.class)
public void testMapException() throws IOException {
File dummy = createFile("dummy.txt", ""); //zero length
@@ -30,7 +30,6 @@
/**
* @author Lee Rhodes
*/
@SuppressWarnings("javadoc")
public class BaseBufferTest {

@Test
@@ -37,7 +37,6 @@
import org.apache.datasketches.memory.internal.Util;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class BaseStateTest {

@Test
@@ -35,7 +35,6 @@
import org.apache.datasketches.memory.WritableMemory;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class Buffer2Test {

@Test
@@ -22,7 +22,6 @@
import org.apache.datasketches.memory.WritableMemory;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class BufferBoundaryCheckTest {

private final WritableMemory writableMemory = WritableMemory.allocate(8);
@@ -33,7 +33,6 @@
/**
* @author Lee Rhodes
*/
@SuppressWarnings("javadoc")
public class BufferInvariantsTest {

@Test
@@ -27,7 +27,6 @@
import org.apache.datasketches.memory.WritableMemory;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class BufferReadWriteSafetyTest {

// Test various operations with read-only Buffer
@@ -33,7 +33,6 @@
import org.testng.annotations.Test;
import org.testng.collections.Lists;

@SuppressWarnings("javadoc")
public class BufferTest {

@Test
@@ -283,7 +282,6 @@ public void checkWRegions() {
@Test(expectedExceptions = AssertionError.class)
public void checkParentUseAfterFree() throws Exception {
int bytes = 64 * 8;
@SuppressWarnings("resource") //intentionally not using try-with-resources here
WritableHandle wh = WritableMemory.allocateDirect(bytes);
WritableMemory wmem = wh.getWritable();
WritableBuffer wbuf = wmem.asWritableBuffer();
@@ -293,7 +291,6 @@ public void checkParentUseAfterFree() throws Exception {
wbuf.getLong();
}

@SuppressWarnings("resource")
@Test(expectedExceptions = AssertionError.class)
public void checkRegionUseAfterFree() throws Exception {
int bytes = 64;
@@ -26,7 +26,6 @@
import org.apache.datasketches.memory.WritableMemory;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class CommonBufferTest {

@Test
@@ -31,7 +31,6 @@
import org.apache.datasketches.memory.WritableMemory;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class CommonMemoryTest {

@Test
@@ -29,7 +29,6 @@
/**
* @author Lee Rhodes
*/
@SuppressWarnings("javadoc")
public class CopyMemoryOverlapTest {

@Test
@@ -30,7 +30,6 @@
import org.testng.Assert;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class CopyMemoryTest {

@Test
@@ -48,7 +48,6 @@
* @author Lee Rhodes
*
*/
@SuppressWarnings("javadoc")
public class DruidIssue11544Test {

@Test
@@ -33,14 +33,12 @@
* Examples of how to use the MemoryRequestServer with a memory hungry client.
* @author Lee Rhodes
*/
@SuppressWarnings("javadoc")
public class ExampleMemoryRequestServerTest {

/**
* This version is without a TWR block.all of the memory allocations are done through the MemoryRequestServer
* and each is closed by the MemoryClient when it is done with each.
*/
@SuppressWarnings("resource")
@Test
public void checkExampleMemoryRequestServer1() throws Exception {
int bytes = 8;
@@ -74,7 +72,6 @@ public void checkExampleMemoryRequestServer2() throws Exception {
}
}

@SuppressWarnings("resource")
@Test(expectedExceptions = IllegalArgumentException.class)
public void checkZeroCapacity() throws Exception {
ExampleMemoryRequestServer svr = new ExampleMemoryRequestServer();
@@ -131,7 +128,6 @@ void process() {
public static class ExampleMemoryRequestServer implements MemoryRequestServer {
IdentityHashMap<WritableMemory, WritableHandle> map = new IdentityHashMap<>();

@SuppressWarnings("resource")
@Override
public WritableMemory request(WritableMemory currentWMem, long capacityBytes) {
ByteOrder order = currentWMem.getTypeByteOrder();
@@ -141,7 +137,6 @@ public WritableMemory request(WritableMemory currentWMem, long capacityBytes) {
return wmem;
}

@SuppressWarnings("resource")
@Override
//here we actually release it, in reality it might be a lot more complex.
public void requestClose(WritableMemory memToRelease, WritableMemory newMemory) {
@@ -25,7 +25,6 @@
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class IgnoredArrayOverflowTest {

private WritableHandle h;
@@ -42,7 +42,6 @@
/**
* @author Lee Rhodes
*/
@SuppressWarnings("javadoc")
public class LeafImplTest {
private static final ByteOrder NBO = ByteOrder.nativeOrder();
private static final ByteOrder NNBO = NON_NATIVE_BYTE_ORDER;
@@ -23,7 +23,6 @@
import org.apache.datasketches.memory.WritableMemory;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class MemoryBoundaryCheckTest {

private final WritableBuffer writableBuffer = WritableMemory.allocate(8).asWritableBuffer();
@@ -27,7 +27,6 @@
import org.apache.datasketches.memory.internal.MemoryCleaner;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class MemoryCleanerTest {

@Test
@@ -38,7 +37,6 @@ public void cleanerDeallocates() {
assertTrue(SimpleDeallocator.getHasRun());
}

@SuppressWarnings("unused")
@Test
public void noDeallocation() {
SimpleDeallocator deallocator = new SimpleDeallocator();
@@ -22,7 +22,6 @@
import org.apache.datasketches.memory.MemoryCloseException;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class MemoryCloseExceptionTest {

@Test
@@ -30,7 +30,6 @@
import org.apache.datasketches.memory.WritableMemory;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class MemoryReadWriteSafetyTest {

// Test various operations with read-only Memory
@@ -46,7 +46,6 @@
import org.testng.annotations.Test;
import org.testng.collections.Lists;

@SuppressWarnings("javadoc")
public class MemoryTest {
private static final String LS = System.getProperty("line.separator");

@@ -324,7 +323,6 @@ public void checkWRegionsReverseBO() {
@Test(expectedExceptions = AssertionError.class)
public void checkParentUseAfterFree() throws Exception {
int bytes = 64 * 8;
@SuppressWarnings("resource") //intentionally not using try-with-resouces here
WritableHandle wh = WritableMemory.allocateDirect(bytes);
WritableMemory wmem = wh.getWritable();
wh.close();
@@ -336,7 +334,6 @@ public void checkParentUseAfterFree() throws Exception {
@Test(expectedExceptions = AssertionError.class)
public void checkRegionUseAfterFree() throws Exception {
int bytes = 64;
@SuppressWarnings("resource") //intentionally not using try-with-resouces here
WritableHandle wh = WritableMemory.allocateDirect(bytes);
Memory wmem = wh.get();
Memory region = wmem.region(0L, bytes);
@@ -346,7 +343,6 @@ public void checkRegionUseAfterFree() throws Exception {
region.getByte(0);
}

@SuppressWarnings({ "resource"})
@Test
public void checkMonitorDirectStats() throws Exception {
int bytes = 1024;
@@ -369,7 +365,6 @@ public void checkMonitorDirectStats() throws Exception {
assertEquals(BaseState.getCurrentDirectMemoryAllocated(), 0L + curAllocated);
}

@SuppressWarnings({ "resource"})
@Test
public void checkMonitorDirectMapStats() throws Exception {
File file = getResourceFile("GettysburgAddress.txt");
@@ -33,7 +33,6 @@
import org.testng.Assert;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class MemoryWriteToTest {

@Test
@@ -36,7 +36,6 @@
*
* @author Lee Rhodes
*/
@SuppressWarnings("javadoc")
public class MurmurHash3v2Test {

@Test
@@ -38,12 +38,10 @@
import org.testng.Assert;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class NativeWritableBufferImplTest {

//Simple Native direct

@SuppressWarnings("resource")
@Test
public void checkNativeCapacityAndClose() throws Exception {
int memCapacity = 64;
@@ -37,12 +37,10 @@
import org.apache.datasketches.memory.WritableMemory;
import org.testng.annotations.Test;

@SuppressWarnings("javadoc")
public class NativeWritableMemoryImplTest {

//Simple Native direct

@SuppressWarnings("resource")
@Test
public void checkNativeCapacityAndClose() throws Exception {
int memCapacity = 64;
@@ -26,7 +26,6 @@
/**
* @author Lee Rhodes
*/
@SuppressWarnings("javadoc")
public class NioBitsTest {

@Test
@@ -31,7 +31,6 @@
/**
* @author Lee Rhodes
*/
@SuppressWarnings("javadoc")
public class NonNativeWritableBufferImplTest {

//Check primitives
@@ -30,7 +30,6 @@
/**
* @author Lee Rhodes
*/
@SuppressWarnings("javadoc")
public class NonNativeWritableMemoryImplTest {
private byte[] bArr = new byte[8];
private final WritableMemory wmem = WritableMemory.writableWrap(bArr, ByteOrder.BIG_ENDIAN);
@@ -28,7 +28,6 @@

import org.apache.datasketches.memory.MemoryRequestServer;

@SuppressWarnings("javadoc")
public final class ReflectUtil {

private ReflectUtil() {}
@@ -203,7 +202,7 @@ public static Object getFieldValue(final Class<?> ownerClass, final Field field)
/**
* Gets a declared method of the given the loaded owning class, method name and parameter types.
* The accessible flag will be set true.
* @param ownerClass the given
* @param ownerClass the given owner class
* @param methodName the given method name
* @param parameterTypes the list of parameter types
* @return the desired method.