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 174162 Details for
Bug 310264
Wrong warning: The assignment to variable has no effect
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch under consideration
patch.txt (text/plain), 2.85 KB, created by
Srikanth Sankaran
on 2010-07-13 11:15:35 EDT
(
hide
)
Description:
Patch under consideration
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2010-07-13 11:15:35 EDT
Size:
2.85 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java,v >retrieving revision 1.88 >diff -u -r1.88 Assignment.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java 7 Mar 2009 00:58:57 -0000 1.88 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java 13 Jul 2010 15:14:31 -0000 >@@ -160,7 +160,7 @@ > } > // check for assignment with no effect > Binding left = getDirectBinding(this.lhs); >- if (left != null && left == getDirectBinding(this.expression)) { >+ if (left != null && !left.isVolatile() && left == getDirectBinding(this.expression)) { > scope.problemReporter().assignmentHasNoEffect(this, left.shortReadableName()); > } > >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java,v >retrieving revision 1.22 >diff -u -r1.22 ProgrammingProblemsTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java 18 Jun 2010 15:51:58 -0000 1.22 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java 13 Jul 2010 15:14:35 -0000 >@@ -1638,4 +1638,49 @@ > "a cannot be resolved to a variable\n" + > "----------\n"); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=310264 >+public void test0044() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "class X {\n" + >+ " volatile int x;\n" + >+ " int nvx;\n" + >+ " void foo(int i) {\n" + >+ " x = x;\n" + >+ " nvx = nvx;\n" + >+ " }\n" + >+ "}" >+ }, >+ "----------\n" + >+ "1. WARNING in X.java (at line 6)\n" + >+ " nvx = nvx;\n" + >+ " ^^^^^^^^^\n" + >+ "The assignment to variable nvx has no effect\n" + >+ "----------\n"); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=310264 >+public void test0045() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "class X {\n" + >+ " volatile int x = this.x;\n" + >+ " int nvx = this.nvx;\n" + >+ " void foo(int i) {\n" + >+ " }\n" + >+ "}" >+ }, >+ "----------\n" + >+ "1. WARNING in X.java (at line 2)\n" + >+ " volatile int x = this.x;\n" + >+ " ^^^^^^^^^^\n" + >+ "The assignment to variable x has no effect\n" + >+ "----------\n" + >+ "2. WARNING in X.java (at line 3)\n" + >+ " int nvx = this.nvx;\n" + >+ " ^^^^^^^^^^^^^^\n" + >+ "The assignment to variable nvx has no effect\n" + >+ "----------\n"); >+} > } >\ No newline at end of file
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 310264
:
174162
|
174166