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 181445 Details for
Bug 328361
[1.4][compiler] variable initialized within an assert expression are no longer reported as potential non initialized
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
updated patch v2
patch328361.txt (text/plain), 5.46 KB, created by
Ayushman Jain
on 2010-10-21 15:58:15 EDT
(
hide
)
Description:
updated patch v2
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2010-10-21 15:58:15 EDT
Size:
5.46 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java,v >retrieving revision 1.65 >diff -u -r1.65 AssertStatement.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java 29 Sep 2010 16:43:28 -0000 1.65 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java 21 Oct 2010 19:55:51 -0000 >@@ -86,7 +86,7 @@ > CompilerOptions compilerOptions = currentScope.compilerOptions(); > if (!compilerOptions.includeNullInfoFromAsserts) { > // keep just the initializations info, don't include assert's null info >- return flowInfo.addInitializationsFrom(assertInfo.nullInfoLessUnconditionalCopy()); >+ return flowInfo.mergedWith(assertInfo.nullInfoLessUnconditionalCopy()); > } > return flowInfo.mergedWith(assertInfo.nullInfoLessUnconditionalCopy()). > addInitializationsFrom(assertWhenTrueInfo.discardInitializationInfo()); >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/AssertionTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssertionTest.java,v >retrieving revision 1.23 >diff -u -r1.23 AssertionTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/AssertionTest.java 17 Aug 2009 17:46:06 -0000 1.23 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/AssertionTest.java 21 Oct 2010 19:55:52 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -507,5 +507,114 @@ > "The local variable error6 may not have been initialized\n" + > "----------\n"); > } >- >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=328361 >+ public void test018() { >+ this.runNegativeTest(new String[] { >+ "X.java", >+ "public class X {\n" + >+ " static final int i;\n" + >+ " static {\n" + >+ " assert (i = 0) == 0;\n" + >+ " System.out.println(i);\n" + >+ " }\n" + >+ "}" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 2)\n" + >+ " static final int i;\n" + >+ " ^\n" + >+ "The blank final field i may not have been initialized\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 5)\n" + >+ " System.out.println(i);\n" + >+ " ^\n" + >+ "The blank final field i may not have been initialized\n" + >+ "----------\n"); >+ } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=328361 >+ public void test019() { >+ this.runConformTest(new String[] { >+ "X.java", >+ "public class X {\n" + >+ " static final int i;\n" + >+ " static {\n" + >+ " i = 0;\n" + >+ " assert i == 0;\n" + >+ " System.out.println(i);\n" + >+ " }\n" + >+ "}" >+ }, >+ ""); >+ } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=328361 >+ public void test020() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " void method1() {\n" + >+ " int i;" + >+ " assert (i = 0) == 0;\n" + >+ " System.out.println(i);\n" + >+ " }\n" + >+ "}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 4)\n" + >+ " System.out.println(i);\n" + >+ " ^\n" + >+ "The local variable i may not have been initialized\n" + >+ "----------\n"); >+ } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=328361 >+ public void test021() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public int bar() {\n" + >+ " return 1;\n" + >+ " }\n" + >+ " void method1() {\n" + >+ " int i;" + >+ " assert (i = this.bar()) == 0;\n" + >+ " System.out.println(i);\n" + >+ " }\n" + >+ "}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 7)\n" + >+ " System.out.println(i);\n" + >+ " ^\n" + >+ "The local variable i may not have been initialized\n" + >+ "----------\n"); >+ } >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=328361 >+ public void test022() throws Exception { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public int bar() {\n" + >+ " return 1;\n" + >+ " }\n" + >+ " void method1() {\n" + >+ " int i;\n" + >+ " assert i++ == 0;\n" + >+ " System.out.println(i);\n" + >+ " }\n" + >+ "}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 7)\n" + >+ " assert i++ == 0;\n" + >+ " ^\n" + >+ "The local variable i may not have been initialized\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 8)\n" + >+ " System.out.println(i);\n" + >+ " ^\n" + >+ "The local variable i may not have been initialized\n" + >+ "----------\n"); >+ } > }
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 328361
:
181440
|
181442
| 181445