Remove unnecessary warning-suppression annotations

These annotations used to suppress real Eclipse warnings.  However,
we've now turned those warnings off for the entire project.
This commit is contained in:
Ben Liblit 2017-07-24 13:23:44 -05:00 committed by Manu Sridharan
parent 455a4a2bd6
commit c1572ec3a5
38 changed files with 8 additions and 47 deletions

View File

@ -20,7 +20,6 @@ public class Array1 {
ary[i]= i; ary[i]= i;
} }
@SuppressWarnings("unused")
int sum = 0; int sum = 0;
for(int j= 0; j < ary.length; j++) { for(int j= 0; j < ary.length; j++) {

View File

@ -9,7 +9,6 @@
* IBM Corporation - initial API and implementation * IBM Corporation - initial API and implementation
*****************************************************************************/ *****************************************************************************/
public class ArrayLiteral1 { public class ArrayLiteral1 {
@SuppressWarnings("unused")
public static void main(String[] args) { public static void main(String[] args) {
ArrayLiteral1 al1= new ArrayLiteral1(); ArrayLiteral1 al1= new ArrayLiteral1();
int[] a= new int[] { 0, 1, 2, 3, 5 }; int[] a= new int[] { 0, 1, 2, 3, 5 };

View File

@ -9,7 +9,6 @@
* IBM Corporation - initial API and implementation * IBM Corporation - initial API and implementation
*****************************************************************************/ *****************************************************************************/
public class ArrayLiteral2 { public class ArrayLiteral2 {
@SuppressWarnings("unused")
public static void main(String[] args) { public static void main(String[] args) {
ArrayLiteral2 al2= new ArrayLiteral2(); ArrayLiteral2 al2= new ArrayLiteral2();
int[] x= {}; int[] x= {};

View File

@ -9,7 +9,7 @@
* IBM Corporation - initial API and implementation * IBM Corporation - initial API and implementation
*****************************************************************************/ *****************************************************************************/
public class CastFromNull { public class CastFromNull {
@SuppressWarnings({ "cast", "unused" }) @SuppressWarnings({ "cast" })
public static void main(String args[]) { public static void main(String args[]) {
new CastFromNull(); new CastFromNull();
Object x = (Object) null; Object x = (Object) null;

View File

@ -14,7 +14,6 @@ public class Casts {
(new Casts()).test(args); (new Casts()).test(args);
} }
@SuppressWarnings("unused")
private void test(String[] args) { private void test(String[] args) {
long l1 = Long.parseLong(args[0]); long l1 = Long.parseLong(args[0]);
int i1 = Integer.parseInt(args[1]); int i1 = Integer.parseInt(args[1]);

View File

@ -11,7 +11,6 @@
public class DefaultConstructors { public class DefaultConstructors {
public static void main(String args[]) { public static void main(String args[]) {
@SuppressWarnings("unused")
E e = new E(); E e = new E();
// System.out.println(e.x); // System.out.println(e.x);
// System.out.println(e.y); // System.out.println(e.y);

View File

@ -11,7 +11,6 @@
public class Exception1 { public class Exception1 {
public static void main(String[] args) { public static void main(String[] args) {
@SuppressWarnings("unused")
Exception1 e1= new Exception1(); Exception1 e1= new Exception1();
try { try {
FooEx1 f = new FooEx1(); FooEx1 f = new FooEx1();

View File

@ -17,7 +17,6 @@ public final class Exception2 {
@SuppressWarnings("resource") @SuppressWarnings("resource")
public static void main(String[] args) { public static void main(String[] args) {
@SuppressWarnings("unused")
Exception2 e2= new Exception2(); Exception2 e2= new Exception2();
FileInputStream fis = null; FileInputStream fis = null;
FileOutputStream fos = null; FileOutputStream fos = null;

View File

@ -10,7 +10,6 @@
*****************************************************************************/ *****************************************************************************/
public class Finally1 { public class Finally1 {
public static void main(String[] args) throws BadLanguageExceptionF1 { public static void main(String[] args) throws BadLanguageExceptionF1 {
@SuppressWarnings("unused")
Finally1 f1= new Finally1(); Finally1 f1= new Finally1();
try { try {
FooF1 f = new FooF1(); FooF1 f = new FooF1();

View File

@ -10,7 +10,6 @@
*****************************************************************************/ *****************************************************************************/
public class Inheritance1 { public class Inheritance1 {
public static void main(String[] args) { public static void main(String[] args) {
@SuppressWarnings("unused")
Inheritance1 ih1= new Inheritance1(); Inheritance1 ih1= new Inheritance1();
Base b1 = new Base(); Base b1 = new Base();
Base b2 = new Derived(); Base b2 = new Derived();
@ -23,7 +22,6 @@ public class Inheritance1 {
} }
class Base { class Base {
public void foo() { public void foo() {
@SuppressWarnings("unused")
int i= 0; int i= 0;
} }
public String bar(int x) { public String bar(int x) {

View File

@ -10,7 +10,6 @@
*****************************************************************************/ *****************************************************************************/
public class InheritedField { public class InheritedField {
public static void main(String[] args) { public static void main(String[] args) {
@SuppressWarnings("unused")
InheritedField if1= new InheritedField(); InheritedField if1= new InheritedField();
B b = new B(); B b = new B();

View File

@ -22,7 +22,6 @@ public class InnerClass {
} }
public void method() { public void method() {
@SuppressWarnings("unused")
WhatsIt w= new WhatsIt(); WhatsIt w= new WhatsIt();
} }

View File

@ -52,7 +52,6 @@ public class InnerClassA {
AB ab = new AB(); AB ab = new AB();
AB.ABSubA absuba = ab.new ABSubA(); AB.ABSubA absuba = ab.new ABSubA();
absuba.aba_x = 7; absuba.aba_x = 7;
@SuppressWarnings("unused")
AB.ABA.ABAA abaa2 = ab.new ABA().new ABAA(); // just used to add ABA instance key in ABAA.getABA_X() AB.ABA.ABAA abaa2 = ab.new ABA().new ABAA(); // just used to add ABA instance key in ABAA.getABA_X()
AB.ABA aba = ab.new ABA(); AB.ABA aba = ab.new ABA();

View File

@ -48,7 +48,6 @@ public class InnerClassLexicalReads {
* 4 invokevirtual < Source, Ljava/io/PrintStream, println(I)V > v7,v8 @4 exception:v10[18:2] -> [18:38] * 4 invokevirtual < Source, Ljava/io/PrintStream, println(I)V > v7,v8 @4 exception:v10[18:2] -> [18:38]
*/ */
public static void main(String args[]) { public static void main(String args[]) {
@SuppressWarnings("unused")
InnerClassLexicalReads ignored = new InnerClassLexicalReads(); // call this just to make <init> reachable (test checks for unreachable methods) InnerClassLexicalReads ignored = new InnerClassLexicalReads(); // call this just to make <init> reachable (test checks for unreachable methods)
int foo = 5; int foo = 5;
int haha = foo * foo; int haha = foo * foo;

View File

@ -10,10 +10,8 @@
*****************************************************************************/ *****************************************************************************/
public class InterfaceTest1 { public class InterfaceTest1 {
public static void main(String[] args) { public static void main(String[] args) {
@SuppressWarnings("unused")
InterfaceTest1 it= new InterfaceTest1(); InterfaceTest1 it= new InterfaceTest1();
IFoo foo = new FooIT1('a'); IFoo foo = new FooIT1('a');
@SuppressWarnings("unused")
char ch2 = foo.getValue(); char ch2 = foo.getValue();
} }
} }

View File

@ -11,7 +11,6 @@
public class NullArrayInit { public class NullArrayInit {
String[] x = {null}; String[] x = {null};
@SuppressWarnings("unused")
public static void main(String[] args) { public static void main(String[] args) {
new NullArrayInit(); new NullArrayInit();
Object a[] = new Object[] {null,null}; Object a[] = new Object[] {null,null};

View File

@ -9,7 +9,6 @@
* IBM Corporation - initial API and implementation * IBM Corporation - initial API and implementation
*****************************************************************************/ *****************************************************************************/
public class QualifiedStatic { public class QualifiedStatic {
@SuppressWarnings("unused")
public static void main(String[] args) { public static void main(String[] args) {
QualifiedStatic qs= new QualifiedStatic(); QualifiedStatic qs= new QualifiedStatic();
FooQ fq= new FooQ(); FooQ fq= new FooQ();

View File

@ -10,7 +10,6 @@
*****************************************************************************/ *****************************************************************************/
public class Scoping1 { public class Scoping1 {
public static void main(String[] args) { public static void main(String[] args) {
@SuppressWarnings("unused")
Scoping1 s1= new Scoping1(); Scoping1 s1= new Scoping1();
{ {
int x= 5; int x= 5;

View File

@ -10,7 +10,6 @@
*****************************************************************************/ *****************************************************************************/
public class Scoping2 { public class Scoping2 {
public static void main(String[] args) { public static void main(String[] args) {
@SuppressWarnings("unused")
Scoping2 s2 = new Scoping2(); Scoping2 s2 = new Scoping2();
{ {
final int x = 5; final int x = 5;

View File

@ -19,7 +19,6 @@ public class Simple1 {
this(0); this(0);
} }
public static void doStuff(int N) { public static void doStuff(int N) {
@SuppressWarnings("unused")
int prod = 1; int prod = 1;
for(int j=0; j < N; j++) for(int j=0; j < N; j++)
prod *= j; prod *= j;

View File

@ -9,7 +9,6 @@
* IBM Corporation - initial API and implementation * IBM Corporation - initial API and implementation
*****************************************************************************/ *****************************************************************************/
public class StaticNesting { public class StaticNesting {
@SuppressWarnings("unused")
public static void main(String[] args) { public static void main(String[] args) {
StaticNesting sn= new StaticNesting(); StaticNesting sn= new StaticNesting();
WhatsIt w= new WhatsIt(); WhatsIt w= new WhatsIt();

View File

@ -18,7 +18,6 @@ public class TwoClasses {
this(0); this(0);
} }
public static void doStuff(int N) { public static void doStuff(int N) {
@SuppressWarnings("unused")
int prod= 1; int prod= 1;
TwoClasses tc= new TwoClasses(); TwoClasses tc= new TwoClasses();
tc.instanceMethod1(); tc.instanceMethod1();
@ -36,7 +35,6 @@ public class TwoClasses {
instanceMethod2(); instanceMethod2();
} }
public void instanceMethod2() { public void instanceMethod2() {
@SuppressWarnings("unused")
Bar b= Bar.create('a'); Bar b= Bar.create('a');
} }
} }

View File

@ -10,7 +10,6 @@
*****************************************************************************/ *****************************************************************************/
public class WhileTest1 { public class WhileTest1 {
public static void main(String[] args) { public static void main(String[] args) {
@SuppressWarnings("unused")
WhileTest1 wt1= new WhileTest1(); WhileTest1 wt1= new WhileTest1();
int x= 235834; int x= 235834;
boolean stop= false; boolean stop= false;

View File

@ -87,7 +87,6 @@ public class InnerClassAA {
AB ab = new AB(); AB ab = new AB();
AB.ABSubA absuba = ab.new ABSubA(); AB.ABSubA absuba = ab.new ABSubA();
absuba.aba_x = 7; absuba.aba_x = 7;
@SuppressWarnings("unused")
AB.ABA.ABAA abaa2 = ab.new ABA().new ABAA(); // just used to add ABA instance key in ABAA.getABA_X() AB.ABA.ABAA abaa2 = ab.new ABA().new ABAA(); // just used to add ABA instance key in ABAA.getABA_X()
AB.ABA aba = ab.new ABA(); AB.ABA aba = ab.new ABA();

View File

@ -42,7 +42,7 @@ public class ArraysAndSuch {
public static void main(String args[]) { public static void main(String args[]) {
ArraysAndSuch.main(); ArraysAndSuch.main();
} }
@SuppressWarnings({ "null", "unused" }) @SuppressWarnings("null")
public static void main() { public static void main() {
Object o1 = null; Object o1 = null;
Object[] os1 = new Object[] { null, o1, null }; Object[] os1 = new Object[] { null, o1, null };

View File

@ -102,7 +102,6 @@ public class ConstructorsAndInitializers extends Super {
class T{ class T{
} }
@SuppressWarnings("unused")
T t = new T(); T t = new T();
} }
} }

View File

@ -40,7 +40,6 @@ package foo.bar.hello.world;
public class CopyOfLoopsAndLabels { public class CopyOfLoopsAndLabels {
static int X=5; static int X=5;
public static void main(String args[]) { public static void main(String args[]) {
@SuppressWarnings("unused")
int k=X; int k=X;
for (; ; k++) for (; ; k++)
break; break;

View File

@ -90,7 +90,6 @@ public class InnerClasses extends Temp {
se2.setSEVar(); se2.setSEVar();
System.out.println(sub2.hello()); //1001 System.out.println(sub2.hello()); //1001
@SuppressWarnings("unused")
int foo = 12; int foo = 12;
foo++; foo++;
--foo; --foo;

View File

@ -51,7 +51,6 @@ public class MethodMadness {
public static void staticTest() { public static void staticTest() {
System.out.println("staticTest"); System.out.println("staticTest");
} }
@SuppressWarnings("static-access")
protected int protectedInteger() { protected int protectedInteger() {
this.s = 5; this.s = 5;
new MethodMadness("thrownaway").staticTest(); // MethodMadness object evaluated but thrown away new MethodMadness("thrownaway").staticTest(); // MethodMadness object evaluated but thrown away

View File

@ -40,7 +40,6 @@ package foo.bar.hello.world;
public class MiniaturList2 { public class MiniaturList2 {
public static void main(String[] args) { public static void main(String[] args) {
@SuppressWarnings("unused")
int a; int a;
for ( ;; ) { for ( ;; ) {
break; break;

View File

@ -116,13 +116,11 @@ public class CustomGenericsAndFields {
///////////////////////////// /////////////////////////////
@SuppressWarnings("unused")
String thrownaway = cg2.bar("a","b"); String thrownaway = cg2.bar("a","b");
cg2.setFoo("real one"); cg2.setFoo("real one");
MyGeneric<String,ConcreteGeneric2<String>> mygeneric = new MyGeneric<String,ConcreteGeneric2<String>>("useless",cg2); MyGeneric<String,ConcreteGeneric2<String>> mygeneric = new MyGeneric<String,ConcreteGeneric2<String>>("useless",cg2);
String x = mygeneric.doFoo(); String x = mygeneric.doFoo();
System.out.println(x); System.out.println(x);
@SuppressWarnings("unused")
String y = cg2.x; String y = cg2.x;
System.out.println(mygeneric.getB().y); System.out.println(mygeneric.getB().y);
System.out.println(mygeneric.b.y); // TODO: fields are going to be a pain... watch out for Lvalues in context? System.out.println(mygeneric.b.y); // TODO: fields are going to be a pain... watch out for Lvalues in context?

View File

@ -47,7 +47,6 @@ public class ExplicitBoxingTest {
int a = 6; int a = 6;
a = a + a; a = a + a;
System.out.println(a); System.out.println(a);
@SuppressWarnings("unused")
Integer useless1 = new Integer(5+6); Integer useless1 = new Integer(5+6);
Integer aa = new Integer(a+a); Integer aa = new Integer(a+a);
int aaa = aa.intValue(); int aaa = aa.intValue();
@ -56,7 +55,6 @@ public class ExplicitBoxingTest {
int b = 6; int b = 6;
b = b + b; b = b + b;
System.out.println(b); System.out.println(b);
@SuppressWarnings("unused")
Integer useless2 = 5+6; Integer useless2 = 5+6;
Integer bb = b+b; Integer bb = b+b;
int bbb = bb; int bbb = bb;

View File

@ -52,7 +52,6 @@ public class GenericArrays {
List<Integer> li = new ArrayList<Integer>(); List<Integer> li = new ArrayList<Integer>();
li.add(new Integer(3)); li.add(new Integer(3));
oa[1] = li; // correct oa[1] = li; // correct
@SuppressWarnings("unused")
String s = (String) lsa[1].get(0); // run time error, but cast is explicit String s = (String) lsa[1].get(0); // run time error, but cast is explicit
} }

View File

@ -13,7 +13,6 @@ package javaonepointfive;
public class TypeInferencePrimAndStringOp { public class TypeInferencePrimAndStringOp {
public static void main(String[] args) { public static void main(String[] args) {
int a = 2; int a = 2;
@SuppressWarnings("unused")
String result = "a" + a; String result = "a" + a;
} }
} }

View File

@ -11,7 +11,6 @@
package p; package p;
public class NonPrimaryTopLevel { public class NonPrimaryTopLevel {
@SuppressWarnings("unused")
public static void main(String[] args) { public static void main(String[] args) {
NonPrimaryTopLevel nptl= new NonPrimaryTopLevel(); NonPrimaryTopLevel nptl= new NonPrimaryTopLevel();
Foo f = new Foo(); Foo f = new Foo();

View File

@ -67,11 +67,11 @@ public abstract class JavaIRTests extends IRTests {
@Test public void testSimple1() throws IllegalArgumentException, CancelException, IOException { @Test public void testSimple1() throws IllegalArgumentException, CancelException, IOException {
List<? extends IRAssertion> assertions = Arrays.asList( List<? extends IRAssertion> assertions = Arrays.asList(
new SourceMapAssertion("Source#Simple1#doStuff#(I)V", "prod", 25), new SourceMapAssertion("Source#Simple1#doStuff#(I)V", "prod", 24),
new SourceMapAssertion("Source#Simple1#doStuff#(I)V", "j", 24), new SourceMapAssertion("Source#Simple1#doStuff#(I)V", "j", 23),
new SourceMapAssertion("Source#Simple1#main#([Ljava/lang/String;)V", "s", 33), new SourceMapAssertion("Source#Simple1#main#([Ljava/lang/String;)V", "s", 32),
new SourceMapAssertion("Source#Simple1#main#([Ljava/lang/String;)V", "i", 29), new SourceMapAssertion("Source#Simple1#main#([Ljava/lang/String;)V", "i", 28),
new SourceMapAssertion("Source#Simple1#main#([Ljava/lang/String;)V", "sum", 30), new SourceMapAssertion("Source#Simple1#main#([Ljava/lang/String;)V", "sum", 29),
EdgeAssertions.make("Source#Simple1#main#([Ljava/lang/String;)V", "Source#Simple1#doStuff#(I)V"), EdgeAssertions.make("Source#Simple1#main#([Ljava/lang/String;)V", "Source#Simple1#doStuff#(I)V"),
EdgeAssertions.make("Source#Simple1#instanceMethod1#()V", "Source#Simple1#instanceMethod2#()V")); EdgeAssertions.make("Source#Simple1#instanceMethod1#()V", "Source#Simple1#instanceMethod2#()V"));

View File

@ -118,7 +118,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.align_type_members_on_columns=false

View File

@ -69,7 +69,6 @@ public class NList implements Collection {
* @see java.util.Collection#iterator() * @see java.util.Collection#iterator()
*/ */
@Override @Override
@SuppressWarnings("rawtypes")
public Iterator iterator() { public Iterator iterator() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;