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 53626 Details for
Bug 162918
[compiler] Illegal usage of a local inside a switch statement is not rejected
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Fix plus test cases - option 2
org.eclipse.jdt.core_02.txt (text/plain), 4.03 KB, created by
Maxime Daniel
on 2006-11-10 10:13:00 EST
(
hide
)
Description:
Fix plus test cases - option 2
Filename:
MIME Type:
Creator:
Maxime Daniel
Created:
2006-11-10 10:13:00 EST
Size:
4.03 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java,v >retrieving revision 1.58 >diff -u -r1.58 UnconditionalFlowInfo.java >--- compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java 26 Sep 2006 12:04:03 -0000 1.58 >+++ compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java 10 Nov 2006 15:10:28 -0000 >@@ -696,10 +696,6 @@ > if ((this.tagBits & UNREACHABLE) != 0) { > return true; > } >- // final constants are inlined, and thus considered as always initialized >- if (local.constant() != Constant.NotAConstant) { >- return true; >- } > return isDefinitelyAssigned(local.id + this.maxFieldCount); > } > >#P org.eclipse.jdt.core.tests.compiler >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.16 >diff -u -r1.16 FlowAnalysisTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java 9 Nov 2006 11:07:10 -0000 1.16 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java 10 Nov 2006 15:10:30 -0000 >@@ -1032,7 +1032,7 @@ > ""); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=162918 >-public void _test034() { >+public void test034() { > this.runNegativeTest( > new String[] { > "X.java", >@@ -1045,10 +1045,18 @@ > " System.out.println(i); // should complain: i not initialized\n" + > " }\n" + > " }\n" + >- "}", >+ "}" > }, > "----------\n" + >- "2 ERRORS" + >+ "1. ERROR in X.java (at line 6)\n" + >+ " case i: // should complain: i not initialized\n" + >+ " ^\n" + >+ "The local variable i may not have been initialized\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 7)\n" + >+ " System.out.println(i); // should complain: i not initialized\n" + >+ " ^\n" + >+ "The local variable i may not have been initialized\n" + > "----------\n"); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=162918 >@@ -1076,30 +1084,42 @@ > "----------\n"); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=162918 >-// variant >-public void _test036() { >- this.runNegativeTest( >- new String[] { >- "X.java", >- "public class X {\n" + >- " void foo3() {\n" + >- " switch (1) {\n" + >- " case 0:\n" + >- " class Local {\n" + >- " }\n" + >- " ;\n" + >- " case 1:\n" + >- " new Local(); // should complain: Local undefined\n" + >- " }\n" + >- " }\n" + >- "}", >- }, >- "----------\n" + >- "1. ERROR in X.java (at line 9)\n" + >- " new Local(); // should complain: Local undefined\n" + >- " ^^^^^\n" + >- "Local cannot be resolved to a type\n" + >- "----------\n"); >+// variant - not a flow analysis issue per se, contrast with 34 and 35 above >+public void test036() { >+ String src = >+ "public class X {\n" + >+ " void foo3() {\n" + >+ " switch (1) {\n" + >+ " case 0:\n" + >+ " class Local {\n" + >+ " }\n" + >+ " ;\n" + >+ " case 1:\n" + >+ " new Local();\n" + // complain for compliance >= 1.4 >+ " }\n" + >+ " }\n" + >+ "}"; >+ if (complianceLevel.compareTo(COMPLIANCE_1_3) <= 0) { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ src >+ }, >+ "" >+ ); >+ } else { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ src >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 9)\n" + >+ " new Local();\n" + >+ " ^^^^^\n" + >+ "Local cannot be resolved to a type\n" + >+ "----------\n"); >+ } > } > 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 162918
:
53625
| 53626