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 209486 Details for
Bug 247564
[compiler][null] Detecting null field reference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
fixlet for local class in initializer
Bug_247564_delta3.patch (text/plain), 3.25 KB, created by
Stephan Herrmann
on 2012-01-13 17:45:05 EST
(
hide
)
Description:
fixlet for local class in initializer
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2012-01-13 17:45:05 EST
Size:
3.25 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java >index 0c3916c..403e69c 100644 >--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java >@@ -49,7 +49,7 @@ public NullReferenceTest(String name) { > // Only the highest compliance level is run; add the VM argument > // -Dcompliance=1.4 (for example) to lower it if needed > static { >-// TESTS_NAMES = new String[] { "testBug247564i" }; >+// TESTS_NAMES = new String[] { "testBug247564j" }; > // TESTS_NUMBERS = new int[] { 561 }; > // TESTS_RANGE = new int[] { 1, 2049 }; > } >@@ -16373,4 +16373,42 @@ public void testBug247564i_5() { > JavacTestOptions.Excuse.EclipseWarningConfiguredAsError > ); > } >+// null analysis -- simple case for field for inner class >+// regression? >+public void testBug247564j() { >+ this.runNegativeTest( >+ new String[] { >+ "Z.java", >+ "public class Z {\n" + >+ " final int field1 = 0;\n" + >+ " {\n" + >+ " class ZInner {\n" + >+ " final int fieldz1;\n" + >+ " final int fieldz2 = 0;\n" + >+ " }\n" + >+ " }\n" + >+ "}\n"}, >+ "----------\n" + >+ "1. WARNING in Z.java (at line 4)\n" + >+ " class ZInner {\n" + >+ " ^^^^^^\n" + >+ "The type ZInner is never used locally\n" + >+ "----------\n" + >+ "2. ERROR in Z.java (at line 4)\n" + >+ " class ZInner {\n" + >+ " ^^^^^^\n" + >+ "The blank final field fieldz1 may not have been initialized\n" + >+ "----------\n" + >+ "3. WARNING in Z.java (at line 5)\n" + >+ " final int fieldz1;\n" + >+ " ^^^^^^^\n" + >+ "The value of the field ZInner.fieldz1 is not used\n" + >+ "----------\n" + >+ "4. WARNING in Z.java (at line 6)\n" + >+ " final int fieldz2 = 0;\n" + >+ " ^^^^^^^\n" + >+ "The value of the field ZInner.fieldz2 is not used\n" + >+ "----------\n" >+ ); >+} > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java >index 8ceb3bc..5bc52b7 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java >@@ -1085,6 +1085,7 @@ public void resolve() { > superFieldsCount += findFieldCountFromSuperInterfaces(superInterfacesBinding); > this.binding.cumulativeFieldCount += superFieldsCount; > >+ this.maxFieldCount = sourceType.cumulativeFieldCount; > if (this.fields != null) { > for (int i = 0, count = this.fields.length; i < count; i++) { > FieldDeclaration field = this.fields[i]; >@@ -1120,8 +1121,7 @@ public void resolve() { > } > field.resolve(field.isStatic() ? this.staticInitializerScope : this.initializerScope); > } >- } >- this.maxFieldCount = sourceType.cumulativeFieldCount; >+ } > if (this.memberTypes != null) { > for (int i = 0, count = this.memberTypes.length; i < count; i++) { > this.memberTypes[i].resolve(this.scope);
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 247564
:
185536
|
185729
|
186938
|
187094
|
188023
|
206514
|
206570
|
206572
|
207019
|
209475
| 209486 |
209552
|
209734
|
209741
|
209759
|
209774
|
209775