Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2005, 2010 IBM Corporation and others. |
2 |
* Copyright (c) 2005, 2011 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 714-719
Link Here
|
714 |
// javac options |
714 |
// javac options |
715 |
JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */); |
715 |
JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */); |
716 |
} |
716 |
} |
|
|
717 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=343621 |
718 |
public void test021() { |
719 |
Map options = getCompilerOptions(); |
720 |
options.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.ERROR); |
721 |
runNegativeTest( |
722 |
new String[] { /* test files */ |
723 |
"X.java", |
724 |
"public class X {\n" + |
725 |
" public Object[] foo() {\n" + |
726 |
" Object[] i, j= new Object[0];\n" + |
727 |
" i= j = null;\n" + |
728 |
" i= (new Object[] { null, null });\n" + |
729 |
" return j;\n" + |
730 |
" }\n" + |
731 |
"}", // ================= |
732 |
}, |
733 |
"----------\n" + |
734 |
"1. ERROR in X.java (at line 3)\n" + |
735 |
" Object[] i, j= new Object[0];\n" + |
736 |
" ^\n" + |
737 |
"The value of the local variable i is not used\n" + |
738 |
"----------\n", |
739 |
null /* no class libraries */, |
740 |
true, |
741 |
options /* custom options */); |
742 |
} |
717 |
public static Class testClass() { |
743 |
public static Class testClass() { |
718 |
return LocalVariableTest.class; |
744 |
return LocalVariableTest.class; |
719 |
} |
745 |
} |