diff options
author | Shigeru Chiba <chibash@users.noreply.github.com> | 2017-11-12 15:45:25 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-12 15:45:25 +0900 |
commit | e1f0bba5de4dc03a9debfab333683f07cfbcb594 (patch) | |
tree | 9ef368fd89a76a6470c1c8d5fe9d96104e56f21e /src/test | |
parent | e41e0790c0cb073e9e2e30071afecfcdc4621d42 (diff) | |
parent | e5656fc869ccc7f7b60a095e692c2475f7f130bf (diff) | |
download | javassist-e1f0bba5de4dc03a9debfab333683f07cfbcb594.tar.gz javassist-e1f0bba5de4dc03a9debfab333683f07cfbcb594.zip |
Merge pull request #160 from nickl-/squash-warnings
Source walk/Spring clean/Parameterize/Enhance/Squash warnings et.al.
Diffstat (limited to 'src/test')
67 files changed, 149 insertions, 29 deletions
diff --git a/src/test/Jassist150.java b/src/test/Jassist150.java index d3945069..2d57da06 100644 --- a/src/test/Jassist150.java +++ b/src/test/Jassist150.java @@ -6,6 +6,7 @@ import javassist.NotFoundException; import javassist.expr.ExprEditor; import javassist.expr.MethodCall; +@SuppressWarnings("unused") public class Jassist150 { public static final String BASE_PATH = "./"; public static final String JAVASSIST_JAR = BASE_PATH + "javassist.jar"; diff --git a/src/test/Test.java b/src/test/Test.java index b01a6211..9907406d 100644 --- a/src/test/Test.java +++ b/src/test/Test.java @@ -2,6 +2,7 @@ import java.util.ArrayList; import java.util.List; import javassist.*; +@SuppressWarnings("unused") class InvalidStackMapFrame { public void bytecodeVerifyError1() { diff --git a/src/test/VisibleTop.java b/src/test/VisibleTop.java index 6430bd70..0bb6161f 100644 --- a/src/test/VisibleTop.java +++ b/src/test/VisibleTop.java @@ -1,3 +1,4 @@ +@SuppressWarnings("unused") public class VisibleTop { public int pub; protected int pro; diff --git a/src/test/VisibleTop2.java b/src/test/VisibleTop2.java index 93fed9da..a09a1396 100644 --- a/src/test/VisibleTop2.java +++ b/src/test/VisibleTop2.java @@ -1,3 +1,4 @@ +@SuppressWarnings("unused") public class VisibleTop2 { public int pub; protected int pro; diff --git a/src/test/javassist/Bench.java b/src/test/javassist/Bench.java index 723fa198..b7b8b27e 100644 --- a/src/test/javassist/Bench.java +++ b/src/test/javassist/Bench.java @@ -153,11 +153,6 @@ public class Bench extends JvstTestRoot { System.out.println("println: " + (t5 * 10) + " usec"); } - public static void main(String[] args) { - // junit.textui.TestRunner.run(suite()); - junit.swingui.TestRunner.main(new String[] { "javassist.Bench" }); - } - public static Test suite() { TestSuite suite = new TestSuite("Benchmark Tests"); suite.addTestSuite(Bench.class); diff --git a/src/test/javassist/ClassPoolBench.java b/src/test/javassist/ClassPoolBench.java index d3cb6b2d..bf71051c 100644 --- a/src/test/javassist/ClassPoolBench.java +++ b/src/test/javassist/ClassPoolBench.java @@ -24,6 +24,7 @@ public class ClassPoolBench { cc.detach();
}
+ @SuppressWarnings("rawtypes")
public static void accessAll(String filename) throws Exception {
ZipFile zip = new ZipFile(filename);
Enumeration files = zip.entries();
diff --git a/src/test/javassist/JvstTest.java b/src/test/javassist/JvstTest.java index d660a335..c6825fd0 100644 --- a/src/test/javassist/JvstTest.java +++ b/src/test/javassist/JvstTest.java @@ -7,6 +7,7 @@ import javassist.bytecode.*; import javassist.expr.*; import javassist.runtime.*; +@SuppressWarnings({"rawtypes","unused", "resource"}) public class JvstTest extends JvstTestRoot { public static boolean java9; diff --git a/src/test/javassist/JvstTest2.java b/src/test/javassist/JvstTest2.java index ec314e12..117560c0 100644 --- a/src/test/javassist/JvstTest2.java +++ b/src/test/javassist/JvstTest2.java @@ -2,10 +2,16 @@ package javassist; import java.io.*; import java.net.URL; + +import org.junit.FixMethodOrder; +import org.junit.runners.MethodSorters; + import java.lang.reflect.Method; import javassist.expr.*; +@SuppressWarnings({"rawtypes","unused"}) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class JvstTest2 extends JvstTestRoot { public JvstTest2(String name) { super(name); diff --git a/src/test/javassist/JvstTest3.java b/src/test/javassist/JvstTest3.java index 056df5c2..47131a93 100644 --- a/src/test/javassist/JvstTest3.java +++ b/src/test/javassist/JvstTest3.java @@ -5,6 +5,7 @@ import javassist.bytecode.annotation.*; import javassist.expr.*; import test3.*; +@SuppressWarnings({"rawtypes","unchecked","unused"}) public class JvstTest3 extends JvstTestRoot { public JvstTest3(String name) { super(name); diff --git a/src/test/javassist/JvstTest4.java b/src/test/javassist/JvstTest4.java index 467caf2b..187abb3d 100644 --- a/src/test/javassist/JvstTest4.java +++ b/src/test/javassist/JvstTest4.java @@ -6,10 +6,15 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.HashSet; +import org.junit.FixMethodOrder; +import org.junit.runners.MethodSorters; + import javassist.bytecode.*; import javassist.bytecode.annotation.Annotation; import javassist.expr.*; +@SuppressWarnings({"rawtypes","unchecked","unused"}) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class JvstTest4 extends JvstTestRoot { public JvstTest4(String name) { super(name); @@ -599,6 +604,7 @@ public class JvstTest4 extends JvstTestRoot { }); } + @SuppressWarnings("deprecation") public void testMakePackage() throws Exception { if (ClassFile.MAJOR_VERSION >= ClassFile.JAVA_9) { ClassPool pool = ClassPool.getDefault(); @@ -610,6 +616,7 @@ public class JvstTest4 extends JvstTestRoot { } } + @SuppressWarnings("deprecation") public void testPackage() throws Throwable { // JASSIST-147 String packageName = "test4.pack"; ClassPool pool = ClassPool.getDefault(); @@ -628,7 +635,7 @@ public class JvstTest4 extends JvstTestRoot { assertEquals(packageName, obj.getClass().getPackage().getName()); } - public static final String BASE_PATH = "../"; + public static final String BASE_PATH = "../../"; public static final String JAVASSIST_JAR = BASE_PATH + "javassist.jar"; public static final String CLASSES_FOLDER = BASE_PATH + "build/classes"; public static final String TEST_CLASSES_FOLDER = BASE_PATH + "build/test-classes"; diff --git a/src/test/javassist/JvstTest5.java b/src/test/javassist/JvstTest5.java index 76d0c1a2..578abfb2 100644 --- a/src/test/javassist/JvstTest5.java +++ b/src/test/javassist/JvstTest5.java @@ -12,6 +12,7 @@ import javassist.bytecode.InnerClassesAttribute; import javassist.expr.ExprEditor; import javassist.expr.MethodCall; +@SuppressWarnings({"rawtypes","unchecked","unused"}) public class JvstTest5 extends JvstTestRoot { public JvstTest5(String name) { super(name); diff --git a/src/test/javassist/JvstTestRoot.java b/src/test/javassist/JvstTestRoot.java index 118e8511..69f4a6ae 100644 --- a/src/test/javassist/JvstTestRoot.java +++ b/src/test/javassist/JvstTestRoot.java @@ -5,10 +5,10 @@ import java.lang.reflect.Method; public class JvstTestRoot extends TestCase { // the directory where all compiled class files are found. - public static final String PATH = "../target/test-classes/"; + public static final String PATH = "../../target/test-classes/"; // the directory where javassist.jar is found. - public static final String JAR_PATH = "../"; + public static final String JAR_PATH = "../../"; ClassPool sloader, dloader; Loader cloader; diff --git a/src/test/javassist/LoaderTestByRandall.java b/src/test/javassist/LoaderTestByRandall.java index 1b8825f6..04e05cd8 100644 --- a/src/test/javassist/LoaderTestByRandall.java +++ b/src/test/javassist/LoaderTestByRandall.java @@ -11,6 +11,7 @@ import junit.framework.TestCase; /**
* @author brandall
*/
+@SuppressWarnings({"rawtypes","unused"})
public class LoaderTestByRandall extends TestCase {
ClassPool cp;
diff --git a/src/test/javassist/SetterTest.java b/src/test/javassist/SetterTest.java index a989d39a..44eec140 100644 --- a/src/test/javassist/SetterTest.java +++ b/src/test/javassist/SetterTest.java @@ -3,6 +3,7 @@ import java.lang.reflect.Method; import junit.framework.TestCase;
+@SuppressWarnings({"rawtypes","unchecked"})
public class SetterTest extends TestCase {
ClassPool pool;
diff --git a/src/test/javassist/bytecode/BytecodeTest.java b/src/test/javassist/bytecode/BytecodeTest.java index a859f248..5ddf5d5b 100644 --- a/src/test/javassist/bytecode/BytecodeTest.java +++ b/src/test/javassist/bytecode/BytecodeTest.java @@ -7,6 +7,7 @@ import javassist.*; import javassist.bytecode.annotation.*; import javassist.bytecode.SignatureAttribute.*; +@SuppressWarnings("unused") public class BytecodeTest extends TestCase { public static final String PATH = JvstTest.PATH; private ClassPool loader, dloader; @@ -826,12 +827,6 @@ public class BytecodeTest extends TestCase { assertEquals("(I)V", cPool2.getUtf8Info(cPool2.getMethodTypeInfo(mtIndex))); } - public static void main(String[] args) { - // junit.textui.TestRunner.run(suite()); - junit.awtui.TestRunner.main(new String[] { - "javassist.bytecode.BytecodeTest" }); - } - public static Test suite() { TestSuite suite = new TestSuite("Bytecode Tests"); suite.addTestSuite(BytecodeTest.class); diff --git a/src/test/javassist/bytecode/CodeAnalyzerTest.java b/src/test/javassist/bytecode/CodeAnalyzerTest.java index 4f115687..b6b33189 100644 --- a/src/test/javassist/bytecode/CodeAnalyzerTest.java +++ b/src/test/javassist/bytecode/CodeAnalyzerTest.java @@ -5,6 +5,7 @@ import java.util.Enumeration; import java.util.List;
import java.io.*;
+@SuppressWarnings({"rawtypes","resource"})
public class CodeAnalyzerTest {
public static void main(String[] args) throws Exception {
ZipFile zfile = new ZipFile(args[0]);
diff --git a/src/test/javassist/bytecode/InsertGap0.java b/src/test/javassist/bytecode/InsertGap0.java index 6a034141..824b9305 100644 --- a/src/test/javassist/bytecode/InsertGap0.java +++ b/src/test/javassist/bytecode/InsertGap0.java @@ -2,6 +2,7 @@ package javassist.bytecode; import javassist.*; +@SuppressWarnings("unused") final class Gap0Example { public static int counter = 1; @@ -70,6 +71,7 @@ final class Gap0Example { } } +@SuppressWarnings("unused") final class Gap0Example2 { public static int counter = 1; @@ -155,6 +157,7 @@ final class Gap0Example2 { } } +@SuppressWarnings({"rawtypes","unchecked","unused"}) public final class InsertGap0 extends JvstTestRoot { public InsertGap0(String name) { super(name); diff --git a/src/test/javassist/bytecode/StackMapTest.java b/src/test/javassist/bytecode/StackMapTest.java index 77d827be..153f75ac 100644 --- a/src/test/javassist/bytecode/StackMapTest.java +++ b/src/test/javassist/bytecode/StackMapTest.java @@ -21,6 +21,7 @@ import javassist.bytecode.stackmap.MapMaker; import javassist.bytecode.stackmap.TypeData; import junit.framework.TestCase; +@SuppressWarnings({"rawtypes","unused"}) public class StackMapTest extends TestCase { public static final String PATH = JvstTest.PATH; private ClassPool loader, dloader; diff --git a/src/test/javassist/compiler/CompTest.java b/src/test/javassist/compiler/CompTest.java index 6a1d5424..4154935f 100644 --- a/src/test/javassist/compiler/CompTest.java +++ b/src/test/javassist/compiler/CompTest.java @@ -113,12 +113,6 @@ public class CompTest extends TestCase { assertEquals("(int,char[],String)", s); } - public static void main(String[] args) { - // junit.textui.TestRunner.run(suite()); - junit.awtui.TestRunner.main(new String[] { - "javassist.compiler.CompTest" }); - } - public static Test suite() { TestSuite suite = new TestSuite("Compiler Tests"); suite.addTestSuite(CompTest.class); @@ -131,6 +125,7 @@ class Print{ public static int k; } +@SuppressWarnings({"rawtypes","unchecked"}) class HelloAspect{ List list; diff --git a/src/test/javassist/proxyfactory/MyCls.java b/src/test/javassist/proxyfactory/MyCls.java index 43fcb8dd..c4c5f35e 100644 --- a/src/test/javassist/proxyfactory/MyCls.java +++ b/src/test/javassist/proxyfactory/MyCls.java @@ -7,6 +7,8 @@ import java.io.Serializable; */ public class MyCls implements Serializable { + /** default serialVersionUID */ + private static final long serialVersionUID = 1L; private int i,j; public int getI() { diff --git a/src/test/javassist/proxyfactory/ProxyFactoryTest.java b/src/test/javassist/proxyfactory/ProxyFactoryTest.java index 2b41af7a..3189b568 100644 --- a/src/test/javassist/proxyfactory/ProxyFactoryTest.java +++ b/src/test/javassist/proxyfactory/ProxyFactoryTest.java @@ -11,6 +11,7 @@ import java.lang.reflect.Method; /** * <a href="mailto:struberg@yahoo.de">Mark Struberg</a> */ +@SuppressWarnings({"rawtypes","unchecked","unused"}) public class ProxyFactoryTest extends TestCase { public void testMethodHandlers() throws Exception { ProxyFactory fact = new ProxyFactory(); @@ -59,6 +60,8 @@ public class ProxyFactoryTest extends TestCase { public static class MyMethodHandler implements MethodHandler, Serializable { + /** default serialVersionUID */ + private static final long serialVersionUID = 1L; private int x; public int getX() { diff --git a/src/test/javassist/proxyfactory/Tester.java b/src/test/javassist/proxyfactory/Tester.java index 601076da..874fba1e 100644 --- a/src/test/javassist/proxyfactory/Tester.java +++ b/src/test/javassist/proxyfactory/Tester.java @@ -8,12 +8,18 @@ import java.io.ByteArrayOutputStream; import java.lang.reflect.Method; class Hand implements java.io.Serializable { + /** default serialVersionUID */ + private static final long serialVersionUID = 1L; public int setHandler(int i) { return i; } int getHandler() { return 3; } } +@SuppressWarnings({"rawtypes","unchecked","resource"}) public class Tester extends TestCase { static class MHandler implements MethodHandler, java.io.Serializable { + /** default serialVersionUID */ + private static final long serialVersionUID = 1L; + public Object invoke(Object self, Method m, Method proceed, Object[] args) throws Throwable { System.out.println("Name: " + m.getName()); diff --git a/src/test/javassist/tools/reflect/Person.java b/src/test/javassist/tools/reflect/Person.java index 739d5948..c9e061c6 100644 --- a/src/test/javassist/tools/reflect/Person.java +++ b/src/test/javassist/tools/reflect/Person.java @@ -3,7 +3,7 @@ package javassist.tools.reflect; import java.lang.reflect.Method;
import java.util.Arrays;
-import junit.framework.Assert;
+import org.junit.Assert;
/**
* Work with ClassMetaobjectTest.java
diff --git a/src/test/javassist/tools/reflect/SubClass.java b/src/test/javassist/tools/reflect/SubClass.java index dd818316..cf42f77d 100644 --- a/src/test/javassist/tools/reflect/SubClass.java +++ b/src/test/javassist/tools/reflect/SubClass.java @@ -1,6 +1,6 @@ package javassist.tools.reflect;
-import junit.framework.*;
+import org.junit.Assert;
public class SubClass extends SuperClass {
public String f() { return "f2"; } // override
diff --git a/src/test/test/javassist/bytecode/analysis/AnalyzerTest.java b/src/test/test/javassist/bytecode/analysis/AnalyzerTest.java index 0c5a77e6..b76ff0e7 100644 --- a/src/test/test/javassist/bytecode/analysis/AnalyzerTest.java +++ b/src/test/test/javassist/bytecode/analysis/AnalyzerTest.java @@ -319,13 +319,17 @@ public class AnalyzerTest extends TestCase { public static class A {}; - public static class B1 extends A implements Serializable {}; - public static class B2 extends A implements Serializable {}; - public static class A2 implements Serializable, Cloneable {}; - public static class A3 implements Serializable, Cloneable {}; - + public static class B1 extends A implements Serializable { + private static final long serialVersionUID = 1L;}; + public static class B2 extends A implements Serializable { + private static final long serialVersionUID = 1L;}; + public static class A2 implements Serializable, Cloneable { + private static final long serialVersionUID = 1L;}; + public static class A3 implements Serializable, Cloneable { + private static final long serialVersionUID = 1L;}; public static class B3 extends A {}; - public static class C31 extends B3 implements Serializable {}; + public static class C31 extends B3 implements Serializable { + private static final long serialVersionUID = 1L;}; public void dummy(Serializable s) {} @@ -359,6 +363,7 @@ public class AnalyzerTest extends TestCase { } + @SuppressWarnings("rawtypes") public void reusedLocalMerge() { ArrayList list = new ArrayList(); try { diff --git a/src/test/test/javassist/convert/ArrayAccessReplaceTest.java b/src/test/test/javassist/convert/ArrayAccessReplaceTest.java index 58ea8357..d81f220d 100644 --- a/src/test/test/javassist/convert/ArrayAccessReplaceTest.java +++ b/src/test/test/javassist/convert/ArrayAccessReplaceTest.java @@ -147,6 +147,7 @@ public class ArrayAccessReplaceTest extends TestCase { } } + @SuppressWarnings({"rawtypes","unchecked"}) public static class Echo { public static Map byteMap = new HashMap(); public static Map charMap = new HashMap(); diff --git a/src/test/test/javassist/proxy/JBPAPP9257Test.java b/src/test/test/javassist/proxy/JBPAPP9257Test.java index 3549f2df..773e18b0 100644 --- a/src/test/test/javassist/proxy/JBPAPP9257Test.java +++ b/src/test/test/javassist/proxy/JBPAPP9257Test.java @@ -8,6 +8,7 @@ import javassist.util.proxy.ProxyObject; import javassist.util.proxy.Proxy; import junit.framework.TestCase; +@SuppressWarnings({"rawtypes","unchecked"}) public class JBPAPP9257Test extends TestCase { public void testGetHandler() throws Exception { ProxyFactory f = new ProxyFactory(); diff --git a/src/test/test/javassist/proxy/ProxyCacheGCTest.java b/src/test/test/javassist/proxy/ProxyCacheGCTest.java index e4331bbd..97b7281d 100644 --- a/src/test/test/javassist/proxy/ProxyCacheGCTest.java +++ b/src/test/test/javassist/proxy/ProxyCacheGCTest.java @@ -11,6 +11,7 @@ import junit.framework.TestCase; * test which checks that proxy classes are not retained after their classloader is released. * this is a before and after test which validates JASSIST-104 */ +@SuppressWarnings({"rawtypes","unchecked"}) public class ProxyCacheGCTest extends TestCase { /** diff --git a/src/test/test/javassist/proxy/ProxyFactoryCompatibilityTest.java b/src/test/test/javassist/proxy/ProxyFactoryCompatibilityTest.java index 634e6c14..861abb72 100644 --- a/src/test/test/javassist/proxy/ProxyFactoryCompatibilityTest.java +++ b/src/test/test/javassist/proxy/ProxyFactoryCompatibilityTest.java @@ -16,6 +16,7 @@ import java.lang.reflect.Method; * automatically disabled if this legacy api is used. it also exercises the new style * api, ensuring that caching works correctly with this model. */ +@SuppressWarnings({"rawtypes","unchecked","unused"}) public class ProxyFactoryCompatibilityTest extends TestCase { private ClassPool basePool; diff --git a/src/test/test/javassist/proxy/ProxySerializationTest.java b/src/test/test/javassist/proxy/ProxySerializationTest.java index 28125de0..39d94f7e 100644 --- a/src/test/test/javassist/proxy/ProxySerializationTest.java +++ b/src/test/test/javassist/proxy/ProxySerializationTest.java @@ -13,6 +13,7 @@ import java.lang.reflect.Method; * {@link javassist.util.proxy.ProxyObjectOutputStream} and @link javassist.util.proxy.ProxyObjectInputStream} * reuses classes located in the proxy cache. This tests the fixes provided for JASSIST-42 and JASSIST-97. */ +@SuppressWarnings({"rawtypes","unchecked","unused","resource"}) public class ProxySerializationTest extends TestCase { public void testSerialization() @@ -80,6 +81,9 @@ public class ProxySerializationTest extends TestCase public static class TestFilter implements MethodFilter, Serializable { + /** default serialVersionUID */ + private static final long serialVersionUID = 1L; + public boolean isHandled(Method m) { if (m.getName().equals("getName")) { return true; @@ -105,6 +109,9 @@ public class ProxySerializationTest extends TestCase public static class TestHandler implements MethodHandler, Serializable { + /** default serialVersionUID */ + private static final long serialVersionUID = 1L; + public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable { return proceed.invoke(self, args); @@ -127,6 +134,8 @@ public class ProxySerializationTest extends TestCase public static class TestClass implements Serializable { + /** default serialVersionUID */ + private static final long serialVersionUID = 1L; public String name; public TestClass() diff --git a/src/test/test/javassist/proxy/ProxySimpleTest.java b/src/test/test/javassist/proxy/ProxySimpleTest.java index bbae9d8d..212c15fa 100644 --- a/src/test/test/javassist/proxy/ProxySimpleTest.java +++ b/src/test/test/javassist/proxy/ProxySimpleTest.java @@ -14,6 +14,7 @@ import javassist.util.proxy.MethodHandler; import javassist.util.proxy.Proxy; import javassist.util.proxy.ProxyFactory; +@SuppressWarnings({"rawtypes","unchecked"}) public class ProxySimpleTest extends TestCase { String testResult; @@ -84,6 +85,9 @@ public class ProxySimpleTest extends TestCase { } public static class ReadWriteData implements Serializable { + /** default serialVersionUID */ + private static final long serialVersionUID = 1L; + public int foo() { return 4; } } @@ -102,10 +106,16 @@ public class ProxySimpleTest extends TestCase { } public static class WriteReplace implements Serializable { + /** default serialVersionUID */ + private static final long serialVersionUID = 1L; + public Object writeReplace() { return this; } } public static class WriteReplace2 implements Serializable { + /** default serialVersionUID */ + private static final long serialVersionUID = 1L; + public Object writeReplace(int i) { return Integer.valueOf(i); } } diff --git a/src/test/test/javassist/tools/DummyClass.java b/src/test/test/javassist/tools/DummyClass.java index 020aa55d..ab9400f6 100644 --- a/src/test/test/javassist/tools/DummyClass.java +++ b/src/test/test/javassist/tools/DummyClass.java @@ -2,6 +2,7 @@ package test.javassist.tools; public class DummyClass { + @SuppressWarnings("unused") private String dummyString = "dummyStringValue"; public void dummyMethod(){} diff --git a/src/test/test1/FieldMod.java b/src/test/test1/FieldMod.java index 0023d2e3..2d68b335 100644 --- a/src/test/test1/FieldMod.java +++ b/src/test/test1/FieldMod.java @@ -1,6 +1,7 @@ package test1;
public class FieldMod {
+ @SuppressWarnings("unused") private String text;
public int i;
}
diff --git a/src/test/test1/GetThrowables.java b/src/test/test1/GetThrowables.java index 19e9a8a5..11ff3e05 100644 --- a/src/test/test1/GetThrowables.java +++ b/src/test/test1/GetThrowables.java @@ -1,9 +1,15 @@ package test1; class GetThrow1 extends Exception { + + /** default serialVersionUID */ + private static final long serialVersionUID = 1L; } class GetThrow2 extends Exception { + + /** default serialVersionUID */ + private static final long serialVersionUID = 1L; } public class GetThrowables { diff --git a/src/test/test1/Howard.java b/src/test/test1/Howard.java index 53bbae8c..6d203808 100644 --- a/src/test/test1/Howard.java +++ b/src/test/test1/Howard.java @@ -21,6 +21,7 @@ class Howard2 { }
public class Howard extends Howard2 {
+ @SuppressWarnings("unused") private Object _remote;
public int run() {
diff --git a/src/test/test1/MySerializableClass.java b/src/test/test1/MySerializableClass.java index 486d1b1b..975dd653 100644 --- a/src/test/test1/MySerializableClass.java +++ b/src/test/test1/MySerializableClass.java @@ -7,6 +7,8 @@ import java.io.*; * @author Bob Lee */ public class MySerializableClass implements Serializable, Cloneable { + /** default serialVersionUID */ + private static final long serialVersionUID = 1L; String fieldA; String fieldB; diff --git a/src/test/test1/Proceed.java b/src/test/test1/Proceed.java index a37306ef..a55128f6 100644 --- a/src/test/test1/Proceed.java +++ b/src/test/test1/Proceed.java @@ -1,5 +1,6 @@ package test1; +@SuppressWarnings("unused") public class Proceed { public int p(int i, int j) { return i + j; } diff --git a/src/test/test1/RenameClass.java b/src/test/test1/RenameClass.java index 99a92c62..93cfc23e 100644 --- a/src/test/test1/RenameClass.java +++ b/src/test/test1/RenameClass.java @@ -6,6 +6,7 @@ class RenameClass2 { String name; } +@SuppressWarnings({"rawtypes","unchecked", "unused"}) public class RenameClass { private Hashtable table; public RenameClass() { diff --git a/src/test/test2/AddMethod.java b/src/test/test2/AddMethod.java index a7179e6e..c04ff606 100644 --- a/src/test/test2/AddMethod.java +++ b/src/test/test2/AddMethod.java @@ -1,6 +1,7 @@ package test2;
public class AddMethod {
+ @SuppressWarnings("unused") private int f;
public int f() { return 0; }
diff --git a/src/test/test2/Anon.java b/src/test/test2/Anon.java index 56223436..a9c0773f 100644 --- a/src/test/test2/Anon.java +++ b/src/test/test2/Anon.java @@ -1,5 +1,6 @@ package test2;
+@SuppressWarnings("unused") public class Anon {
public Object make() {
return new Object() { int k; };
diff --git a/src/test/test2/Brennan.java b/src/test/test2/Brennan.java index e93e00a9..4cc0a505 100644 --- a/src/test/test2/Brennan.java +++ b/src/test/test2/Brennan.java @@ -1,5 +1,6 @@ package test2; +@SuppressWarnings("unused") public class Brennan { private Object format = null; } diff --git a/src/test/test2/Inner.java b/src/test/test2/Inner.java index dbfb6d6e..15e08663 100644 --- a/src/test/test2/Inner.java +++ b/src/test/test2/Inner.java @@ -1,5 +1,6 @@ package test2; +@SuppressWarnings("unused") public class Inner { public void sample() throws Exception { java.util.Properties props = new java.util.Properties(); diff --git a/src/test/test2/InsertLocal.java b/src/test/test2/InsertLocal.java index d400e622..43794cc8 100644 --- a/src/test/test2/InsertLocal.java +++ b/src/test/test2/InsertLocal.java @@ -22,6 +22,7 @@ public class InsertLocal { return k + s.length(); } + @SuppressWarnings("unused") public int run3() { int i = 0; int j = field; diff --git a/src/test/test2/Nested.java b/src/test/test2/Nested.java index 70ce60ee..6bb4547a 100644 --- a/src/test/test2/Nested.java +++ b/src/test/test2/Nested.java @@ -1,5 +1,6 @@ package test2;
+@SuppressWarnings("unused") public class Nested {
private int i = 3;
private int geti() { return i; }
diff --git a/src/test/test2/Nested2.java b/src/test/test2/Nested2.java index f23439bd..728c1b7a 100644 --- a/src/test/test2/Nested2.java +++ b/src/test/test2/Nested2.java @@ -1,5 +1,6 @@ package test2;
+@SuppressWarnings("unused") public class Nested2 {
private int i = 3;
private double d = 3.0;
diff --git a/src/test/test2/Nested3.java b/src/test/test2/Nested3.java index 570f7a5e..9e9f1ab3 100644 --- a/src/test/test2/Nested3.java +++ b/src/test/test2/Nested3.java @@ -1,5 +1,6 @@ package test2;
+@SuppressWarnings("unused") public class Nested3 {
private int i = 0;
private int geti() { return i; }
diff --git a/src/test/test2/Nested4.java b/src/test/test2/Nested4.java index 5b33aea5..04bcd767 100644 --- a/src/test/test2/Nested4.java +++ b/src/test/test2/Nested4.java @@ -1,5 +1,6 @@ package test2;
+@SuppressWarnings("unused") public class Nested4 {
private static int value = 6;
}
diff --git a/src/test/test2/NewArray.java b/src/test/test2/NewArray.java index d61fa750..f7c0439b 100644 --- a/src/test/test2/NewArray.java +++ b/src/test/test2/NewArray.java @@ -1,5 +1,6 @@ package test2;
+@SuppressWarnings("unused") public class NewArray {
public int run() {
return foo(1);
diff --git a/src/test/test2/NewExprInTry.java b/src/test/test2/NewExprInTry.java index e6e1fe90..70dc9b28 100644 --- a/src/test/test2/NewExprInTry.java +++ b/src/test/test2/NewExprInTry.java @@ -2,12 +2,17 @@ package test2; import java.util.HashMap;
+@SuppressWarnings("rawtypes") class HashMapWrapper extends HashMap {
+ /** default serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
HashMapWrapper(int size, int args) {
super(size);
}
}
+@SuppressWarnings({"rawtypes","unused"}) public class NewExprInTry {
public int run() {
return foo(6);
diff --git a/src/test/test2/NewExprTry.java b/src/test/test2/NewExprTry.java index fb779d96..f728dbe7 100644 --- a/src/test/test2/NewExprTry.java +++ b/src/test/test2/NewExprTry.java @@ -15,6 +15,7 @@ public class NewExprTry { }
public static void main(String[] args) {
+ @SuppressWarnings("unused") NewExprTry obj = new NewExprTry(3);
}
}
diff --git a/src/test/test2/NewOp.java b/src/test/test2/NewOp.java index bf798a92..a9334252 100644 --- a/src/test/test2/NewOp.java +++ b/src/test/test2/NewOp.java @@ -5,6 +5,7 @@ class NewOp2 { }
public class NewOp {
+ @SuppressWarnings("rawtypes") java.util.Vector listenerList;
static int i = 0;
static String s;
diff --git a/src/test/test2/Prune.java b/src/test/test2/Prune.java index 1daf9cbb..f98f7764 100644 --- a/src/test/test2/Prune.java +++ b/src/test/test2/Prune.java @@ -1,6 +1,8 @@ package test2;
public class Prune extends java.awt.Point implements Cloneable, Runnable {
+ /** default serialVersionUID */
+ private static final long serialVersionUID = 1L;
public int value;
public Prune(int i) {
diff --git a/src/test/test3/Enhancer.java b/src/test/test3/Enhancer.java index 8aa13d25..e3a93e8a 100644 --- a/src/test/test3/Enhancer.java +++ b/src/test/test3/Enhancer.java @@ -11,6 +11,7 @@ class EnhanceTest { public void foo(String s) { System.out.println(s); } } +@SuppressWarnings({"rawtypes","unchecked","unused"}) public class Enhancer { private ClassPool pool; private CtClass superClass; diff --git a/src/test/test3/Erasure.java b/src/test/test3/Erasure.java index 412f439a..7514981a 100644 --- a/src/test/test3/Erasure.java +++ b/src/test/test3/Erasure.java @@ -9,6 +9,7 @@ public class Erasure<T> { public Erasure(T t) { value = t; } public Erasure() { value = null; } public int run() { + @SuppressWarnings("unchecked") ErasureGet<String> obj = (ErasureGet<String>)new Erasure<String>("1234"); return obj.get().length(); } diff --git a/src/test/test3/FieldAccessType.java b/src/test/test3/FieldAccessType.java index c61550d6..bb102ba8 100644 --- a/src/test/test3/FieldAccessType.java +++ b/src/test/test3/FieldAccessType.java @@ -4,6 +4,7 @@ public class FieldAccessType { private int[] k; public void access() { k = new int[1]; + @SuppressWarnings("unused") int i = 3; i += k[0]; } diff --git a/src/test/test3/GetMethods.java b/src/test/test3/GetMethods.java index 69cc49fa..64e66bd0 100644 --- a/src/test/test3/GetMethods.java +++ b/src/test/test3/GetMethods.java @@ -1,5 +1,6 @@ package test3; +@SuppressWarnings("unused") class SuperGetMethods { public int f0; protected double d0; @@ -12,6 +13,7 @@ class SuperGetMethods { private void mpri0() {} } +@SuppressWarnings("unused") public class GetMethods extends SuperGetMethods { public GetMethods(int i) {} protected GetMethods(String i, int j) {} diff --git a/src/test/test3/MethodRedirect.java b/src/test/test3/MethodRedirect.java index 889a3c68..c7cacde8 100644 --- a/src/test/test3/MethodRedirect.java +++ b/src/test/test3/MethodRedirect.java @@ -5,6 +5,7 @@ interface MethodRedirectIntf { } public class MethodRedirect implements MethodRedirectIntf { + @SuppressWarnings("unused") private int foo() { return 0; } public static int poi() { return 1; } public int bar() { return 2; } diff --git a/src/test/test3/NestedClass.java b/src/test/test3/NestedClass.java index 75b4efe2..e1459b26 100644 --- a/src/test/test3/NestedClass.java +++ b/src/test/test3/NestedClass.java @@ -17,6 +17,7 @@ public class NestedClass { public Object bar() { class Local { + @SuppressWarnings("unused") int j; } return new Local(); diff --git a/src/test/test3/NewExprTryCatch.java b/src/test/test3/NewExprTryCatch.java index 193985eb..f93b528d 100644 --- a/src/test/test3/NewExprTryCatch.java +++ b/src/test/test3/NewExprTryCatch.java @@ -18,6 +18,7 @@ public class NewExprTryCatch { // the error is somehow related to the string concatenation and local variables, // when the code below is replaced with something else, the error does not occur. String s1 = "a"; + @SuppressWarnings("unused") String s2 = s1 + "b"; } diff --git a/src/test/test3/ReplaceNew.java b/src/test/test3/ReplaceNew.java index 018408eb..8f8a7869 100644 --- a/src/test/test3/ReplaceNew.java +++ b/src/test/test3/ReplaceNew.java @@ -6,6 +6,7 @@ public class ReplaceNew { int i = 0; public int run() { i = 3; + @SuppressWarnings("unused") ReplaceNew s = new ReplaceNew(); new ReplaceNew(); return i; diff --git a/src/test/test3/Visible.java b/src/test/test3/Visible.java index 162f46e1..d3397f1e 100644 --- a/src/test/test3/Visible.java +++ b/src/test/test3/Visible.java @@ -1,5 +1,6 @@ package test3; +@SuppressWarnings("unused") class Visible2 { public int pub; protected int pro; @@ -7,6 +8,7 @@ class Visible2 { int pack; } +@SuppressWarnings("unused") public class Visible { public int pub; protected int pro; diff --git a/src/test/test4/GetAllRefInnerTest.java b/src/test/test4/GetAllRefInnerTest.java index 352b3252..a4921caf 100644 --- a/src/test/test4/GetAllRefInnerTest.java +++ b/src/test/test4/GetAllRefInnerTest.java @@ -20,6 +20,9 @@ public class GetAllRefInnerTest<T> { } public Object foo() { return new java.util.HashSet<String>() { + /** default serialVersionUID */ + private static final long serialVersionUID = 1L; + public String toString() { return this.getClass().toString(); } }; } diff --git a/src/test/test4/JIRA181.java b/src/test/test4/JIRA181.java index c3d2f45a..7c0b0930 100644 --- a/src/test/test4/JIRA181.java +++ b/src/test/test4/JIRA181.java @@ -3,6 +3,9 @@ package test4; import java.util.ArrayList; public class JIRA181<T extends Number> extends ArrayList<T> { + /** default serialVersionUID */ + private static final long serialVersionUID = 1L; + public @interface Condition { Class<? extends ICondition> condition(); } diff --git a/src/test/testproxy/ProxyFactoryPerformanceTest.java b/src/test/testproxy/ProxyFactoryPerformanceTest.java index 55bc7849..df8bd8fc 100644 --- a/src/test/testproxy/ProxyFactoryPerformanceTest.java +++ b/src/test/testproxy/ProxyFactoryPerformanceTest.java @@ -17,6 +17,7 @@ import junit.framework.TestCase; import junit.framework.TestSuite;
import junit.textui.TestRunner;
+@SuppressWarnings({"rawtypes","unchecked", "unused"})
public class ProxyFactoryPerformanceTest extends TestCase {
public static final int COUNT = 100;
@@ -84,6 +85,7 @@ public class ProxyFactoryPerformanceTest extends TestCase { }
}
+@SuppressWarnings({"rawtypes","unused"})
class ProxyMaker extends Thread implements MethodHandler {
private static final MethodFilter FINALIZE_FILTER = new MethodFilter() {
public boolean isHandled(Method m) {
@@ -163,6 +165,9 @@ class EnhancerUser extends Thread implements InvocationHandler { */
class SampleBean implements Serializable {
+ /** default serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
long oid;
int version;
diff --git a/src/test/testproxy/ProxyTester.java b/src/test/testproxy/ProxyTester.java index f325997d..64712ef3 100644 --- a/src/test/testproxy/ProxyTester.java +++ b/src/test/testproxy/ProxyTester.java @@ -3,16 +3,19 @@ package testproxy; import java.lang.reflect.Method; import java.lang.reflect.Constructor; import java.lang.reflect.Modifier; + +import org.junit.Assert; + import java.lang.reflect.InvocationTargetException; import javassist.util.proxy.ProxyFactory; import javassist.util.proxy.MethodFilter; import javassist.util.proxy.MethodHandler; import javassist.util.proxy.ProxyObject; import javassist.util.proxy.Proxy; -import junit.framework.Assert; import junit.framework.TestCase; import java.io.*; +@SuppressWarnings({"unchecked", "rawtypes","unused"}) public class ProxyTester extends TestCase { public ProxyTester(String s) { super(s); @@ -398,6 +401,9 @@ public class ProxyTester extends TestCase { } public static class ReadWriteData implements Serializable { + /** default serialVersionUID */ + private static final long serialVersionUID = 1L; + public int foo() { return 4; } } @@ -416,10 +422,16 @@ public class ProxyTester extends TestCase { } public static class WriteReplace implements Serializable { + /** default serialVersionUID */ + private static final long serialVersionUID = 1L; + public Object writeReplace() { return this; } } public static class WriteReplace2 implements Serializable { + /** default serialVersionUID */ + private static final long serialVersionUID = 1L; + public Object writeReplace(int i) { return Integer.valueOf(i); } } diff --git a/src/test/testproxy/Target2.java b/src/test/testproxy/Target2.java index 91b57be5..192bac77 100644 --- a/src/test/testproxy/Target2.java +++ b/src/test/testproxy/Target2.java @@ -2,6 +2,7 @@ package testproxy; import java.io.IOException;
+@SuppressWarnings("unused") public class Target2 {
private int value;
public Target2(int i) { value = 1; }
diff --git a/src/test/testproxy/sub/TargetSuper.java b/src/test/testproxy/sub/TargetSuper.java index 0e40cded..9eb8d1da 100644 --- a/src/test/testproxy/sub/TargetSuper.java +++ b/src/test/testproxy/sub/TargetSuper.java @@ -1,5 +1,6 @@ package testproxy.sub; +@SuppressWarnings("unused") public class TargetSuper { private int poi() { return 1; } int poi2() { return 2; } |