Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 111358 Details for
Bug 236385
[compiler] Warn for potential programming problem if an object is created but not used
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed tests
bug_236385_tests.txt (text/plain), 4.77 KB, created by
Stephan Herrmann
on 2008-08-31 11:44:12 EDT
(
hide
)
Description:
proposed tests
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2008-08-31 11:44:12 EDT
Size:
4.77 KB
patch
obsolete
>Index: src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java,v >retrieving revision 1.28 >diff -u -w -r1.28 FlowAnalysisTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java 2 Apr 2008 11:27:57 -0000 1.28 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java 31 Aug 2008 15:39:48 -0000 >@@ -1418,6 +1418,150 @@ > null /* clientRequestor */, > true /* skipJavac */); > } >+ >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=236385 >+public void test050() { >+ runTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " boolean bar() { return false; } \n" + >+ " public void foo() {" + >+ " if (bar())\n" + >+ " new IllegalArgumentException(\"You must not bar!\");\n" + >+ " }\n" + >+ "}", >+ }, >+ false /* expectingCompilerErrors */, >+ "----------\n" + >+ "1. WARNING in X.java (at line 4)\n" + >+ " new IllegalArgumentException(\"You must not bar!\");\n" + >+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + >+ "Allocating an instance of a throwable type, which is never used. Perhaps you meant to throw it?\n" + >+ "----------\n", >+ "" /* expectedOutputString */, >+ "" /* expectedErrorString */, >+ false /* forceExecution */, >+ null /* classLib */, >+ true /* shouldFlushOutputDirectory */, >+ null /* vmArguments */, >+ null /* customOptions */, >+ null /* clientRequestor */, >+ false /* skipJavac */); >+} >+ >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=236385 >+// warning suppressed >+public void test051() { >+ if (this.complianceLevel < ClassFileConstants.JDK1_5) return; >+ runTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " boolean bar() { return false; }\n" + >+ " @SuppressWarnings(\"unused\")\n" + >+ " public void foo() {" + >+ " if (bar())\n" + >+ " new IllegalArgumentException(\"You must not bar!\");\n" + >+ " }\n" + >+ "}", >+ }, >+ false /* expectingCompilerErrors */, >+ "" /* expectedCompilerLog */, >+ "" /* expectedOutputString */, >+ "" /* expectedErrorString */, >+ false /* forceExecution */, >+ null /* classLib */, >+ true /* shouldFlushOutputDirectory */, >+ null /* vmArguments */, >+ null /* customOptions */, >+ null /* clientRequestor */, >+ false /* skipJavac */); >+} >+ >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=236385 >+// warning ignored >+public void test052() { >+ Map compilerOptions = getCompilerOptions(); >+ compilerOptions.put(CompilerOptions.OPTION_ReportUnusedThrowableAllocation, CompilerOptions.IGNORE); >+ runTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " boolean bar() { return false; }\n" + >+ " public void foo() {" + >+ " if (bar())\n" + >+ " new IllegalArgumentException(\"You must not bar!\");\n" + >+ " }\n" + >+ "}", >+ }, >+ false /* expectingCompilerErrors */, >+ "" /* expectedCompilerLog */, >+ "" /* expectedOutputString */, >+ "" /* expectedErrorString */, >+ false /* forceExecution */, >+ null /* classLib */, >+ true /* shouldFlushOutputDirectory */, >+ null /* vmArguments */, >+ compilerOptions /* customOptions */, >+ null /* clientRequestor */, >+ false /* skipJavac */); >+} >+ >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=236385 >+// instance is assigned >+public void test053() { >+ runTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " boolean bar() { return false; }\n" + >+ " Throwable t;\n" + >+ " public void foo() {" + >+ " t = new IllegalArgumentException(\"You must not bar!\");\n" + >+ " }\n" + >+ "}", >+ }, >+ false /* expectingCompilerErrors */, >+ "" /* expectedCompilerLog */, >+ "" /* expectedOutputString */, >+ "" /* expectedErrorString */, >+ false /* forceExecution */, >+ null /* classLib */, >+ true /* shouldFlushOutputDirectory */, >+ null /* vmArguments */, >+ null /* customOptions */, >+ null /* clientRequestor */, >+ false /* skipJavac */); >+} >+ >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=236385 >+// method invoked >+public void test054() { >+ runTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " boolean bar() { return false; }\n" + >+ " public void foo() {" + >+ " if (bar())\n" + >+ " new IllegalArgumentException(\"You must not bar!\").printStackTrace();\n" + >+ " }\n" + >+ "}", >+ }, >+ false /* expectingCompilerErrors */, >+ "" /* expectedCompilerLog */, >+ "" /* expectedOutputString */, >+ "" /* expectedErrorString */, >+ false /* forceExecution */, >+ null /* classLib */, >+ true /* shouldFlushOutputDirectory */, >+ null /* vmArguments */, >+ null /* customOptions */, >+ null /* clientRequestor */, >+ false /* skipJavac */); >+} >+ > public static Class testClass() { > return FlowAnalysisTest.class; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 236385
:
110739
|
111358
|
153869
|
155923
|
155983
|
155987
|
155989
|
156030