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 188976 Details for
Bug 336648
wrong compiler problem "The value of the local variable xxx is not used"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
patch.txt (text/plain), 7.22 KB, created by
Srikanth Sankaran
on 2011-02-15 03:18:37 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2011-02-15 03:18:37 EST
Size:
7.22 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java,v >retrieving revision 1.123 >diff -u -r1.123 BlockScope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java 17 Dec 2010 09:38:59 -0000 1.123 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java 15 Feb 2011 08:15:36 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -199,7 +199,10 @@ > && ((local.declaration.bits & ASTNode.IsLocalDeclarationReachable) != 0)) { // declaration is reachable > > if (!(local.declaration instanceof Argument)) // do not report unused catch arguments >- problemReporter().unusedLocalVariable(local.declaration); >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=336648 >+ if (!this.referenceCompilationUnit().compilationResult.hasErrors()) { >+ problemReporter().unusedLocalVariable(local.declaration); >+ } > } > > // could be optimized out, but does need to preserve unread variables ? >#P org.eclipse.jdt.core.tests >Index: Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java >=================================================================== >RCS file: /home/cvs/numbat/org.eclipse.jdt.core.tests/Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java,v >retrieving revision 1.343 >diff -u -r1.343 NegativeTest.java >--- Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java 23 Oct 2010 00:18:44 -0000 1.343 >+++ Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java 15 Feb 2011 08:16:11 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005, 2010 IBM Corporation and others. >+ * Copyright (c) 2005, 2011 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 >@@ -11539,62 +11539,56 @@ > " ^^^^^^^^^^^^^^^^^^^^^\n" + > "Dead code\n" + > "----------\n" + >- "3. WARNING in X.java (at line 28)\n" + >- " Object obj = \"dummy\"; \n" + >- " ^^^\n" + >- "The value of the local variable obj is not used\n" + >- "----------\n" + >- "4. WARNING in X.java (at line 36)\n" + >+ "3. WARNING in X.java (at line 36)\n" + > " if (false) { \n" + > " doit(obj); //this is DEFINITELY unreachable code, but is not recognized as such \n" + > " } \n" + > " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + > "Dead code\n" + > "----------\n" + >- "5. ERROR in X.java (at line 44)\n" + >+ "4. ERROR in X.java (at line 44)\n" + > " while (false) { \n" + > " doit(obj); //this is DEFINITELY unreachable code, and is recognized as such, with error \n" + > " } \n" + > " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + > "Unreachable code\n" + > "----------\n" + >- "6. ERROR in X.java (at line 48)\n" + >+ "5. ERROR in X.java (at line 48)\n" + > " while (FALSE) { \n" + > " doit(obj); //this is conditionnally unreachable code, but is recognized as definitely unreacheable code, with error \n" + > " } \n" + > " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + > "Unreachable code\n" + > "----------\n" + >- "7. ERROR in X.java (at line 52)\n" + >+ "6. ERROR in X.java (at line 52)\n" + > " for (; false;) { \n" + > " doit(obj); //this is DEFINITELY unreachable code, but is recognized as definitely unreacheable code, with error \n" + > " } \n" + > " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + > "Unreachable code\n" + > "----------\n" + >- "8. ERROR in X.java (at line 56)\n" + >+ "7. ERROR in X.java (at line 56)\n" + > " for (; FALSE;) { \n" + > " doit(obj); //this is conditionnally unreachable code, but is recognized as definitely unreacheable code, with error \n" + > " } \n" + > " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + > "Unreachable code\n" + > "----------\n" + >- "9. WARNING in X.java (at line 60)\n" + >+ "8. WARNING in X.java (at line 60)\n" + > " int i = (false ? doit(\"0\") : doit(\"1\")); \n" + > " ^^^^^^^^^\n" + > "Dead code\n" + > "----------\n" + >- "10. WARNING in X.java (at line 77)\n" + >+ "9. WARNING in X.java (at line 77)\n" + > " doit(obj); //this is conditionnally unreachable code \n" + > " ^^^^^^^^^\n" + > "Dead code\n" + > "----------\n" + >- "11. WARNING in X.java (at line 91)\n" + >+ "10. WARNING in X.java (at line 91)\n" + > " doit(obj); //this is DEFINITELY unreachable code \n" + > " ^^^^^^^^^\n" + > "Dead code\n" + >- "----------\n" >-, >+ "----------\n", > null, > true, > customOptions); >#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.30 >diff -u -r1.30 ProgrammingProblemsTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java 15 Feb 2011 05:53:25 -0000 1.30 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java 15 Feb 2011 08:16:19 -0000 >@@ -2280,9 +2280,7 @@ > null); > } > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=336648 >-public void _test0058() { >- if (this.complianceLevel < ClassFileConstants.JDK1_5) >- return; >+public void test0058() { > Map customOptions = getCompilerOptions(); > customOptions.put(CompilerOptions.OPTION_ReportUnusedLocal, CompilerOptions.WARNING); > this.runNegativeTest( >@@ -2302,12 +2300,7 @@ > "}\n" > }, > "----------\n" + >- "1. WARNING in X.java (at line 3)\n" + >- " final String message= m;\n" + >- " ^^^^^^^\n" + >- "The value of the local variable message is not used\n" + >- "----------\n" + >- "2. ERROR in X.java (at line 7)\n" + >+ "1. ERROR in X.java (at line 7)\n" + > " bug(); // undefined method\n" + > " ^^^\n" + > "The method bug() is undefined for the type new Runnable(){}\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 336648
: 188976