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 179145 Details for
Bug 325567
A blocking "java.lang.IllegalArgumentException: info cannot be null" exception
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression tests
patch_325567.txt (text/plain), 9.20 KB, created by
Olivier Thomann
on 2010-09-17 15:38:41 EDT
(
hide
)
Description:
Proposed fix + regression tests
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2010-09-17 15:38:41 EDT
Size:
9.20 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java,v >retrieving revision 1.144 >diff -u -r1.144 QualifiedNameReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java 15 Sep 2010 16:10:50 -0000 1.144 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java 17 Sep 2010 19:32:47 -0000 >@@ -779,6 +779,10 @@ > if ((this.bits & ASTNode.RestrictiveFlagMASK) == Binding.LOCAL) { > LocalVariableBinding localVariableBinding = (LocalVariableBinding) this.binding; > if (localVariableBinding != null) { >+ if ((localVariableBinding.tagBits & TagBits.NotInitialized) != 0) { >+ // local was tagged as uninitialized >+ return; >+ } > switch(localVariableBinding.useFlag) { > case LocalVariableBinding.FAKE_USED : > case LocalVariableBinding.USED : >Index: compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java,v >retrieving revision 1.119 >diff -u -r1.119 SingleNameReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java 9 Sep 2010 17:36:21 -0000 1.119 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java 17 Sep 2010 19:32:48 -0000 >@@ -727,6 +727,10 @@ > if ((this.bits & ASTNode.RestrictiveFlagMASK) == Binding.LOCAL) { > LocalVariableBinding localVariableBinding = (LocalVariableBinding) this.binding; > if (localVariableBinding != null) { >+ if ((localVariableBinding.tagBits & TagBits.NotInitialized) != 0) { >+ // local was tagged as uninitialized >+ return; >+ } > switch(localVariableBinding.useFlag) { > case LocalVariableBinding.FAKE_USED : > case LocalVariableBinding.USED : >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java,v >retrieving revision 1.41 >diff -u -r1.41 TagBits.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java 3 Feb 2010 06:34:21 -0000 1.41 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java 17 Sep 2010 19:32:48 -0000 >@@ -33,6 +33,9 @@ > // for method > long HasUncheckedTypeArgumentForBoundCheck = ASTNode.Bit9; > >+ // local variable >+ long NotInitialized = ASTNode.Bit9; >+ > // set when method has argument(s) that couldn't be resolved > long HasUnresolvedArguments = ASTNode.Bit10; > >Index: compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java,v >retrieving revision 1.419 >diff -u -r1.419 ProblemReporter.java >--- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 15 Sep 2010 15:17:25 -0000 1.419 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 17 Sep 2010 19:32:48 -0000 >@@ -6777,6 +6777,7 @@ > nodeSourceEnd(field, location)); > } > public void uninitializedLocalVariable(LocalVariableBinding binding, ASTNode location) { >+ binding.tagBits |= TagBits.NotInitialized; > String[] arguments = new String[] {new String(binding.readableName())}; > this.handle( > IProblem.UninitializedLocalVariable, >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/InitializationTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InitializationTests.java,v >retrieving revision 1.1 >diff -u -r1.1 InitializationTests.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/InitializationTests.java 21 Jul 2010 07:08:51 -0000 1.1 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/InitializationTests.java 17 Sep 2010 19:32:49 -0000 >@@ -338,7 +338,61 @@ > "----------\n", > null, false, options); > } >- >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=325567 >+public void test325567() { >+ Map options = getCompilerOptions(); >+ options.put(CompilerOptions.OPTION_ReportDeadCode, CompilerOptions.IGNORE); >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "import java.io.IOException;\n" + >+ "\n" + >+ "public class X {\n" + >+ " public static void main(String[] args) {\n" + >+ " bar(3);\n" + >+ " }\n" + >+ " public static void bar(int i) {\n" + >+ " final String before;\n" + >+ " try {\n" + >+ " before = foo();\n" + >+ " } catch (IOException e) {\n" + >+ " // ignore\n" + >+ " }\n" + >+ " B b = new B(new I() {\n" + >+ " public String bar() {\n" + >+ " return new String(before);\n" + >+ " }\n" + >+ " });\n" + >+ " try {\n" + >+ " b.i.bar();\n" + >+ " } catch(Exception e) {\n" + >+ " // ignore\n" + >+ " }\n" + >+ " }\n" + >+ "\n" + >+ " private static String foo() throws IOException {\n" + >+ " return null;\n" + >+ " }\n" + >+ " \n" + >+ " static class B {\n" + >+ " I i;\n" + >+ " B(I i) {\n" + >+ " this.i = i;\n" + >+ " }\n" + >+ " }\n" + >+ " static interface I {\n" + >+ " String bar();\n" + >+ " }\n" + >+ "}" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 16)\n" + >+ " return new String(before);\n" + >+ " ^^^^^^\n" + >+ "The local variable before may not have been initialized\n" + >+ "----------\n", >+ null, false, options); >+} > public static Class testClass() { > return InitializationTests.class; > } >Index: src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java,v >retrieving revision 1.32 >diff -u -r1.32 ProblemTypeAndMethodTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java 15 Sep 2010 15:17:26 -0000 1.32 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java 17 Sep 2010 19:32:50 -0000 >@@ -31,7 +31,7 @@ > // All specified tests which does not belong to the class are skipped... > static { > // TESTS_NAMES = new String[] { "test127" }; >-// TESTS_NUMBERS = new int[] { 109 }; >+// TESTS_NUMBERS = new int[] { 113 }; > // TESTS_RANGE = new int[] { 108, -1 }; > } > >@@ -5816,4 +5816,75 @@ > "int pe0, int pe1, int pe2, int pe3, int pe4, int pe5, int pe6, int pe7, int pe8, int pe9, int pea, int peb, int pec, int ped, int pee, int pef, \n" + > "int pf0, int pf1, int pf2, int pf3, int pf4, int pf5, int pf6, int pf7, int pf8, int pf9, int pfa, int pfb, int pfc"); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=325567 >+public void test113() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "import java.io.IOException;\n" + >+ "public class X {\n" + >+ " public static void bar(int i) {\n" + >+ " final String before;\n" + >+ " try {\n" + >+ " before = foo();\n" + >+ " } catch (IOException e) {\n" + >+ " // ignore\n" + >+ " }\n" + >+ " B b = new B(new I() {\n" + >+ " public String bar() {\n" + >+ " return new String(before);\n" + >+ " }\n" + >+ " });\n" + >+ " try {\n" + >+ " b.toString();\n" + >+ " } catch(Exception e) {\n" + >+ " // ignore\n" + >+ " }\n" + >+ " }\n" + >+ " private static String foo() throws IOException {\n" + >+ " return null;\n" + >+ " }\n" + >+ " static class B {\n" + >+ " B(I i) {\n" + >+ " //ignore\n" + >+ " }\n" + >+ " }\n" + >+ " static interface I {\n" + >+ " String bar();\n" + >+ " }\n" + >+ "}" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 12)\n" + >+ " return new String(before);\n" + >+ " ^^^^^^\n" + >+ "The local variable before may not have been initialized\n" + >+ "----------\n", >+ null /* no extra class libraries */, >+ true /* flush output directory */, >+ null /* no custom options */, >+ true /* do not generate output */, >+ false /* do not show category */, >+ false /* do not show warning token */, >+ false /* do not skip javac for this peculiar test */, >+ false /* do not perform statements recovery */ >+ ); >+ this.runConformTest( >+ new String[] { >+ "Y.java", //----------------------------------------------------------------------- >+ "public class Y {\n" + >+ " public static void main(String[] args) {\n" + >+ " try {\n" + >+ " X.bar(3);\n" + >+ " } catch(VerifyError e) {\n" + >+ " System.out.println(\"FAILED\");\n" + >+ " }\n" + >+ " }\n" + >+ "}", >+ }, >+ "", >+ null, >+ false, >+ null); >+} > }
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 325567
:
179100
|
179141
| 179145