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 209774 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]
final cleanups and refactorings
cleanups-for-fix-for-bug-247564-compilernull-Detecti.patch (text/plain), 63.50 KB, created by
Ayushman Jain
on 2012-01-19 15:19:51 EST
(
hide
)
Description:
final cleanups and refactorings
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2012-01-19 15:19:51 EST
Size:
63.50 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 b546d16..46ec01e 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 >@@ -15533,6 +15533,7 @@ > "public class X {\n" + > " Object o;\n" + > " void foo() {\n" + >+ " o = null;\n" + > " }\n" + > " void foo1() {\n" + > " o.toString();\n" + >@@ -15580,7 +15581,7 @@ > " if (field == null) { \n" + > " field = new Object();\n" + > " }\n" + >- " field.toString(); //Pot. NPE\n" + >+ " field.toString(); // Wrong outcome was: Pot. NPE\n" + > " i--;\n" + > " }\n" + > " }\n" + >@@ -16005,7 +16006,7 @@ > " }\n" + > " void foo1() {\n" + > " if (o == null) {\n" + >- " o.toString(); // danger" + >+ " o.toString(); // danger\n" + > " return;\n" + > " }\n" + > " o.toString(); // safe\n" + >@@ -16019,11 +16020,11 @@ > "}\n"}, > "----------\n" + > "1. ERROR in X.java (at line 13)\n" + >- " o.toString(); // danger return;\n" + >+ " o.toString(); // danger\n" + > " ^\n" + > "Null pointer access: The field o can only be null at this location\n" + > "----------\n" + >- "2. ERROR in X.java (at line 21)\n" + >+ "2. ERROR in X.java (at line 22)\n" + > " o.toString(); // uncertain\n" + > " ^\n" + > "Potential null pointer access: The field o may be null at this location\n" + >@@ -16075,7 +16076,7 @@ > " }\n" + > " void foo1() {\n" + > " if (o == null) {\n" + >- " o.toString(); // danger" + >+ " o.toString(); // danger\n" + > " return;\n" + > " }\n" + > " o.toString(); // safe\n" + >@@ -16089,11 +16090,11 @@ > "}\n"}, > "----------\n" + > "1. ERROR in X.java (at line 39)\n" + >- " o.toString(); // danger return;\n" + >+ " o.toString(); // danger\n" + > " ^\n" + > "Null pointer access: The field o can only be null at this location\n" + > "----------\n" + >- "2. ERROR in X.java (at line 47)\n" + >+ "2. ERROR in X.java (at line 48)\n" + > " o.toString(); // uncertain\n" + > " ^\n" + > "Potential null pointer access: The field o may be null at this location\n" + >@@ -16128,6 +16129,7 @@ > " if (o == null) {\n" + // don't know o's nullness, so silent > " o.toString();\n" + // report NPE > " }\n" + >+ " local.toString();\n" + // try to diffuse status for o / o2 > " o.toString();\n" + // already reported NPE above. So silent. Same behaviour as 'local' > " if (o2 == null) {\n" + // report always false null check > " o2.toString();\n" + // dead code >@@ -16151,12 +16153,12 @@ > " ^\n" + > "Null pointer access: The field o can only be null at this location\n" + > "----------\n" + >- "4. ERROR in X.java (at line 22)\n" + >+ "4. ERROR in X.java (at line 23)\n" + > " if (o2 == null) {\n" + > " ^^\n" + > "Null comparison always yields false: The field o2 cannot be null at this location\n" + > "----------\n" + >- "5. WARNING in X.java (at line 22)\n" + >+ "5. WARNING in X.java (at line 23)\n" + > " if (o2 == null) {\n" + > " o2.toString();\n" + > " }\n" + >@@ -16166,9 +16168,9 @@ > ); > } > >-//null analysis -- case for static final field initialized inside static block with different values >-//check if the resetting works properly i.e. null status for constant fields should not be >-//reset on method calls. This test is for constructors >+// null analysis -- case for static final field initialized inside static block with different values >+// check if the resetting works properly i.e. null status for constant fields should not be >+// reset on method calls. This test is for constructors > public void testBug247564b_6() { > this.runNegativeTest( > new String[] { >@@ -16193,6 +16195,7 @@ > " if (o == null) {\n" + // don't know o's nullness, so silent > " o.toString();\n" + // report NPE > " }\n" + >+ " local.toString();\n" + // try to diffuse status for o / o2 > " o.toString();\n" + // already reported NPE above. So silent. Same behaviour as 'local' > " if (o2 == null) {\n" + // report always false null check > " o2.toString();\n" + // dead code >@@ -16216,12 +16219,12 @@ > " ^\n" + > "Null pointer access: The field o can only be null at this location\n" + > "----------\n" + >- "4. ERROR in X.java (at line 22)\n" + >+ "4. ERROR in X.java (at line 23)\n" + > " if (o2 == null) {\n" + > " ^^\n" + > "Null comparison always yields false: The field o2 cannot be null at this location\n" + > "----------\n" + >- "5. WARNING in X.java (at line 22)\n" + >+ "5. WARNING in X.java (at line 23)\n" + > " if (o2 == null) {\n" + > " o2.toString();\n" + > " }\n" + >@@ -16231,9 +16234,9 @@ > ); > } > >-//null analysis -- case for static final field initialized inside static block with different values >-//check if the resetting works properly i.e. null status for constant fields should not be >-//reset on method calls. This test is for constructors >+// null analysis -- case for static final field initialized inside static block with different values >+// check if the resetting works properly i.e. null status for constant fields should not be >+// reset on method calls. This test is for constructors > public void testBug247564b_6_2() { > this.runNegativeTest( > new String[] { >@@ -16284,6 +16287,7 @@ > " if (o == null) {\n" + // don't know o's nullness, so silent > " o.toString();\n" + // report NPE > " }\n" + >+ " local.toString();\n" + // try to diffuse status for o / o2 > " o.toString();\n" + // already reported NPE above. So silent. Same behaviour as 'local' > " if (o2 == null) {\n" + // report always false null check > " o2.toString();\n" + // dead code >@@ -16307,12 +16311,12 @@ > " ^\n" + > "Null pointer access: The field o can only be null at this location\n" + > "----------\n" + >- "4. ERROR in X.java (at line 48)\n" + >+ "4. ERROR in X.java (at line 49)\n" + > " if (o2 == null) {\n" + > " ^^\n" + > "Null comparison always yields false: The field o2 cannot be null at this location\n" + > "----------\n" + >- "5. WARNING in X.java (at line 48)\n" + >+ "5. WARNING in X.java (at line 49)\n" + > " if (o2 == null) {\n" + > " o2.toString();\n" + > " }\n" + >@@ -16349,6 +16353,7 @@ > " if (o1 == null) {\n" + // can't be null, was dereferenced in static initializer > " o1.toString();\n" + // dead > " }\n" + >+ " local.toString();\n" + // try to diffuse status for o1 / o2 > " o1.toString();\n" + // safe > " if (o2 == null) {\n" + // report always false null check > " o2.toString();\n" + // dead code >@@ -16384,12 +16389,12 @@ > " ^^^^^^^^^^^^^^^^^^^^^^\n" + > "Dead code\n" + > "----------\n" + >- "6. ERROR in X.java (at line 22)\n" + >+ "6. ERROR in X.java (at line 23)\n" + > " if (o2 == null) {\n" + > " ^^\n" + > "Null comparison always yields false: The field o2 cannot be null at this location\n" + > "----------\n" + >- "7. WARNING in X.java (at line 22)\n" + >+ "7. WARNING in X.java (at line 23)\n" + > " if (o2 == null) {\n" + > " o2.toString();\n" + > " }\n" + >@@ -16447,6 +16452,7 @@ > " if (o1 == null) {\n" + // report redundant null check > " o1.toString();\n" + // report NPE > " }\n" + >+ " local.toString();\n" + // try to diffuse status for o1 / o2 > " o1.toString();\n" + // already reported NPE above. So silent. Same behaviour as 'local' > " if (o2 == null) {\n" + // report always false null check > " o2.toString();\n" + // dead code >@@ -16477,12 +16483,12 @@ > " ^^\n" + > "Null pointer access: The field o1 can only be null at this location\n" + > "----------\n" + >- "5. ERROR in X.java (at line 40)\n" + >+ "5. ERROR in X.java (at line 41)\n" + > " if (o2 == null) {\n" + > " ^^\n" + > "Null comparison always yields false: The field o2 cannot be null at this location\n" + > "----------\n" + >- "6. WARNING in X.java (at line 40)\n" + >+ "6. WARNING in X.java (at line 41)\n" + > " if (o2 == null) {\n" + > " o2.toString();\n" + > " }\n" + >@@ -16517,6 +16523,7 @@ > " if (o1 == null) {\n" + // report redundant null check > " o1.toString();\n" + // report NPE > " }\n" + >+ " local.toString();\n" + // try to diffuse status for o1 / o2 > " o1.toString();\n" + // already reported NPE above. So silent. Same behaviour as 'local' > " if (o2 == null) {\n" + // report always false null check > " o2.toString();\n" + // dead code >@@ -16547,12 +16554,12 @@ > " ^^\n" + > "Null pointer access: The field o1 can only be null at this location\n" + > "----------\n" + >- "5. ERROR in X.java (at line 18)\n" + >+ "5. ERROR in X.java (at line 19)\n" + > " if (o2 == null) {\n" + > " ^^\n" + > "Null comparison always yields false: The field o2 cannot be null at this location\n" + > "----------\n" + >- "6. WARNING in X.java (at line 18)\n" + >+ "6. WARNING in X.java (at line 19)\n" + > " if (o2 == null) {\n" + > " o2.toString();\n" + > " }\n" + >@@ -17025,26 +17032,6 @@ > ); > } > >-// null analysis -- test redundant instanceof warning for static final fields >-public void testBug247564e_1() { >- this.runNegativeTest( >- new String[] { >- "X.java", >- "public class X {\n" + >- " static final Object o = null;\n" + >- " void foo() {\n" + >- " if (o instanceof X) return;\n" + >- " }\n" + >- "}"}, >- "----------\n" + >- "1. ERROR in X.java (at line 4)\n" + >- " if (o instanceof X) return;\n" + >- " ^\n" + >- "instanceof always yields false: The field o can only be null at this location\n" + >- "----------\n", >- JavacTestOptions.Excuse.EclipseWarningConfiguredAsError); >-} >- > // null analysis -- test potential null ptr access warning because of static field access through object returned by method call > public void testBug247564f() { > Map compilerOptions = getCompilerOptions(); >@@ -17148,7 +17135,7 @@ > " if (this.field99 == null && this.field99.hashCode() == 0){}\n" + > " this.field98 = null;\n" + > " }\n" + >- " if (this.field98.hashCode() == 0) {}\n" + // should not complain >+ " if (this.field98.hashCode() == 0) {}\n" + > " this.field97 = null;\n" + > " if (this.field97.hashCode() == 0) {}\n" + > " if (this.field100.hashCode() == 0) {}\n" + >@@ -17212,7 +17199,7 @@ > } > > // null analysis -- simple case for field for inner class >-// to make sure that id's of local variables in inner classes dotn conflict with those of fields. >+// to make sure that id's of local variables in inner classes don't conflict with those of fields. > public void testBug247564h_1() { > this.runNegativeTest( > new String[] { >@@ -17240,7 +17227,7 @@ > } > > // null analysis -- simple case for field for inner class >-// to make sure that id's of local variables in inner classes dotn conflict with those of fields. >+// to make sure that id's of local variables in inner classes don't conflict with those of fields. > public void testBug247564h_2() { > this.runNegativeTest( > new String[] { >@@ -17254,14 +17241,14 @@ > " class X2 {\n" + > " Object field4;\n" + > " Object field5;\n" + >- " void goo(Object var) {\n" + >- " if (var == null && field4.toString() == \"\"){}\n" + >- " if (var == null && field5.toString() == \"\"){}\n" + >- " if (field3 == null && field3.toString() == \"\"){}\n" + >- " if (field3 == null && field1.toString() == \"\"){}\n" + >+ " void goo(Object var) {\n" + >+ " if (var == null && field4.toString() == \"\"){}\n" + >+ " if (var == null && field5.toString() == \"\"){}\n" + >+ " if (field3 == null && field3.toString() == \"\"){}\n" + >+ " if (field3 == null && field1.toString() == \"\"){}\n" + >+ " }\n" + > " }\n" + >- " }\n" + >- " Object field22;\n" + >+ " Object field22;\n" + > " }\n" + > "}\n"}, > "----------\n" + >@@ -17298,7 +17285,7 @@ > " if (X.field0 == null && X.field0.toString() == \"\"){}\n" + // warn > " if (this.field0 == null && X.field0.toString() == \"\"){}\n" + // warn > " if (X.field0 == null && this.field0.toString() == \"\"){}\n" + // warn >- " if (X.field0 == null && getX().field0.toString() == \"\"){}\n" + // no warn >+ " if (X.field0 == null && getX().field0.toString() == \"\"){}\n" + // no warn (diffused by getX() call) > " }\n" + > "}\n" + > "class Y{\n" + >@@ -17412,9 +17399,9 @@ > " static Y getY(){ return new Y();}\n" + > " static X getX() { return new X();}\n" + > " static class XInner{\n" + >- " static Object xinnerfield;\n" + >- " XInner getXInner() { return new XInner();\n}" + >- " void goo(Object var) {\n" + >+ " static Object xinnerfield;\n" + >+ " XInner getXInner() { return new XInner();\n}" + >+ " void goo(Object var) {\n" + > " if (new Y().getY().yField1 == null && field0.toString() == \"\"){}\n" + // no warn > " if (getY().yField1 == null && field0.toString() == \"\"){}\n" + // no warn > " if (new Y().getX().field0 == null && field0.toString() == \"\"){}\n" + // warn >@@ -17436,7 +17423,7 @@ > " if (Y.xiny.field1 == null && Y.yField1.toString() == \"\"){}\n" + // no warn > " if (X.field0 == null && X.field0.toString() == \"\"){}\n" + // warn > " if (X.field0 == null && getX().field0.toString() == \"\"){}\n" + // no warn >- " }\n" + >+ " }\n" + > " }\n" + > "}\n" + > "class Y{\n" + >@@ -17890,7 +17877,7 @@ > this.runNegativeTest( > new String[] { > "X.java", >- "class MyException extends Exception{}" + >+ "class MyException extends Exception{}\n" + > "public class X {\n" + > " private Object f;\n" + > " void gooCalls() throws MyException{}\n" + >@@ -17907,11 +17894,11 @@ > "}\n"}, > "----------\n" + > "1. WARNING in X.java (at line 1)\n" + >- " class MyException extends Exception{}public class X {\n" + >+ " class MyException extends Exception{}\n" + > " ^^^^^^^^^^^\n" + > "The serializable class MyException does not declare a static final serialVersionUID field of type long\n" + > "----------\n" + >- "2. ERROR in X.java (at line 11)\n" + >+ "2. ERROR in X.java (at line 12)\n" + > " f.toString();\n" + > " ^\n" + > "Potential null pointer access: The field f may be null at this location\n" + >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java >index 7f47925..6b55b1b 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java >@@ -39,43 +39,43 @@ > // TODO: handle all kinds of expressions (cf. also https://bugs.eclipse.org/364326) > } > >- VariableBinding local = this.left.variableBinding(scope); >- if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) { >- checkVariableComparison(scope, flowContext, flowInfo, initsWhenTrue, initsWhenFalse, local, rightStatus, this.left); >+ VariableBinding var = this.left.variableBinding(scope); >+ if (var != null && (var.type.tagBits & TagBits.IsBaseType) == 0) { >+ checkVariableComparison(scope, flowContext, flowInfo, initsWhenTrue, initsWhenFalse, var, rightStatus, this.left); > } >- local = this.right.variableBinding(scope); >- if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) { >- checkVariableComparison(scope, flowContext, flowInfo, initsWhenTrue, initsWhenFalse, local, leftStatus, this.right); >+ var = this.right.variableBinding(scope); >+ if (var != null && (var.type.tagBits & TagBits.IsBaseType) == 0) { >+ checkVariableComparison(scope, flowContext, flowInfo, initsWhenTrue, initsWhenFalse, var, leftStatus, this.right); > } > } >- private void checkVariableComparison(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo, FlowInfo initsWhenTrue, FlowInfo initsWhenFalse, VariableBinding local, int nullStatus, Expression reference) { >+ private void checkVariableComparison(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo, FlowInfo initsWhenTrue, FlowInfo initsWhenFalse, VariableBinding var, int nullStatus, Expression reference) { > switch (nullStatus) { > case FlowInfo.NULL : > if (((this.bits & OperatorMASK) >> OperatorSHIFT) == EQUAL_EQUAL) { >- flowContext.recordUsingNullReference(scope, local, reference, >+ flowContext.recordUsingNullReference(scope, var, reference, > FlowContext.CAN_ONLY_NULL_NON_NULL | FlowContext.IN_COMPARISON_NULL, flowInfo); >- initsWhenTrue.markAsComparedEqualToNull(local); // from thereon it is set >- initsWhenFalse.markAsComparedEqualToNonNull(local); // from thereon it is set >+ initsWhenTrue.markAsComparedEqualToNull(var); // from thereon it is set >+ initsWhenFalse.markAsComparedEqualToNonNull(var); // from thereon it is set > } else { >- flowContext.recordUsingNullReference(scope, local, reference, >+ flowContext.recordUsingNullReference(scope, var, reference, > FlowContext.CAN_ONLY_NULL_NON_NULL | FlowContext.IN_COMPARISON_NON_NULL, flowInfo); >- initsWhenTrue.markAsComparedEqualToNonNull(local); // from thereon it is set >- initsWhenFalse.markAsComparedEqualToNull(local); // from thereon it is set >+ initsWhenTrue.markAsComparedEqualToNonNull(var); // from thereon it is set >+ initsWhenFalse.markAsComparedEqualToNull(var); // from thereon it is set > } > if ((flowContext.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) != 0) { >- flowInfo.markedAsNullOrNonNullInAssertExpression(local); >+ flowInfo.markedAsNullOrNonNullInAssertExpression(var); > } > break; > case FlowInfo.NON_NULL : > if (((this.bits & OperatorMASK) >> OperatorSHIFT) == EQUAL_EQUAL) { >- flowContext.recordUsingNullReference(scope, local, reference, >+ flowContext.recordUsingNullReference(scope, var, reference, > FlowContext.CAN_ONLY_NULL | FlowContext.IN_COMPARISON_NON_NULL, flowInfo); >- initsWhenTrue.markAsComparedEqualToNonNull(local); // from thereon it is set >+ initsWhenTrue.markAsComparedEqualToNonNull(var); // from thereon it is set > if ((flowContext.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) != 0) { >- initsWhenTrue.markedAsNullOrNonNullInAssertExpression(local); >+ initsWhenTrue.markedAsNullOrNonNullInAssertExpression(var); > } > } else { >- flowContext.recordUsingNullReference(scope, local, reference, >+ flowContext.recordUsingNullReference(scope, var, reference, > FlowContext.CAN_ONLY_NULL | FlowContext.IN_COMPARISON_NULL, flowInfo); > } > break; >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java >index 87d886d..665e6fc 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java >@@ -526,22 +526,22 @@ > * @param flowInfo the upstream flow info; caveat: may get modified > */ > public void checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo) { >- VariableBinding local = variableBinding(scope); >- if (local != null && >- (local.type.tagBits & TagBits.IsBaseType) == 0) { >+ VariableBinding var = variableBinding(scope); >+ if (var != null && >+ (var.type.tagBits & TagBits.IsBaseType) == 0) { > if ((this.bits & ASTNode.IsNonNull) == 0) { >- flowContext.recordUsingNullReference(scope, local, this, >+ flowContext.recordUsingNullReference(scope, var, this, > FlowContext.MAY_NULL, flowInfo); > } >- flowInfo.markAsComparedEqualToNonNull(local ); >+ flowInfo.markAsComparedEqualToNonNull(var ); > // from thereon it is set > if ((flowContext.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) != 0) { >- flowInfo.markedAsNullOrNonNullInAssertExpression(local); >+ flowInfo.markedAsNullOrNonNullInAssertExpression(var); > } > if (flowContext.initsOnFinally != null) { >- flowContext.initsOnFinally.markAsComparedEqualToNonNull(local); >+ flowContext.initsOnFinally.markAsComparedEqualToNonNull(var); > if ((flowContext.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) != 0) { >- flowContext.initsOnFinally.markedAsNullOrNonNullInAssertExpression(local); >+ flowContext.initsOnFinally.markedAsNullOrNonNullInAssertExpression(var); > } > } > } >@@ -873,9 +873,9 @@ > this.constant != null && this.constant != Constant.NotAConstant) > return FlowInfo.NON_NULL; // constant expression cannot be null > >- VariableBinding local = variableBinding(null); >- if (local != null) >- return flowInfo.nullStatus(local); >+ VariableBinding var = variableBinding(null); >+ if (var != null) >+ return flowInfo.nullStatus(var); > return FlowInfo.NON_NULL; > } > >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java >index 5128a63..4689bf8 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java >@@ -80,19 +80,19 @@ > && this.initsWhenFalse.isDefinitelyAssigned(var); > } > >-public boolean isDefinitelyNonNull(VariableBinding local) { >- return this.initsWhenTrue.isDefinitelyNonNull(local) >- && this.initsWhenFalse.isDefinitelyNonNull(local); >+public boolean isDefinitelyNonNull(VariableBinding var) { >+ return this.initsWhenTrue.isDefinitelyNonNull(var) >+ && this.initsWhenFalse.isDefinitelyNonNull(var); > } > >-public boolean isDefinitelyNull(VariableBinding local) { >- return this.initsWhenTrue.isDefinitelyNull(local) >- && this.initsWhenFalse.isDefinitelyNull(local); >+public boolean isDefinitelyNull(VariableBinding var) { >+ return this.initsWhenTrue.isDefinitelyNull(var) >+ && this.initsWhenFalse.isDefinitelyNull(var); > } > >-public boolean isDefinitelyUnknown(VariableBinding local) { >- return this.initsWhenTrue.isDefinitelyUnknown(local) >- && this.initsWhenFalse.isDefinitelyUnknown(local); >+public boolean isDefinitelyUnknown(VariableBinding var) { >+ return this.initsWhenTrue.isDefinitelyUnknown(var) >+ && this.initsWhenFalse.isDefinitelyUnknown(var); > } > > public boolean isPotentiallyAssigned(VariableBinding var) { >@@ -100,39 +100,39 @@ > || this.initsWhenFalse.isPotentiallyAssigned(var); > } > >-public boolean isPotentiallyNonNull(VariableBinding local) { >- return this.initsWhenTrue.isPotentiallyNonNull(local) >- || this.initsWhenFalse.isPotentiallyNonNull(local); >+public boolean isPotentiallyNonNull(VariableBinding var) { >+ return this.initsWhenTrue.isPotentiallyNonNull(var) >+ || this.initsWhenFalse.isPotentiallyNonNull(var); > } > >-public boolean isPotentiallyNull(VariableBinding local) { >- return this.initsWhenTrue.isPotentiallyNull(local) >- || this.initsWhenFalse.isPotentiallyNull(local); >+public boolean isPotentiallyNull(VariableBinding var) { >+ return this.initsWhenTrue.isPotentiallyNull(var) >+ || this.initsWhenFalse.isPotentiallyNull(var); > } > >-public boolean isPotentiallyUnknown(VariableBinding local) { >- return this.initsWhenTrue.isPotentiallyUnknown(local) >- || this.initsWhenFalse.isPotentiallyUnknown(local); >+public boolean isPotentiallyUnknown(VariableBinding var) { >+ return this.initsWhenTrue.isPotentiallyUnknown(var) >+ || this.initsWhenFalse.isPotentiallyUnknown(var); > } > >-public boolean isProtectedNonNull(VariableBinding local) { >- return this.initsWhenTrue.isProtectedNonNull(local) >- && this.initsWhenFalse.isProtectedNonNull(local); >+public boolean isProtectedNonNull(VariableBinding var) { >+ return this.initsWhenTrue.isProtectedNonNull(var) >+ && this.initsWhenFalse.isProtectedNonNull(var); > } > >-public boolean isProtectedNull(VariableBinding local) { >- return this.initsWhenTrue.isProtectedNull(local) >- && this.initsWhenFalse.isProtectedNull(local); >+public boolean isProtectedNull(VariableBinding var) { >+ return this.initsWhenTrue.isProtectedNull(var) >+ && this.initsWhenFalse.isProtectedNull(var); > } > >-public void markAsComparedEqualToNonNull(VariableBinding local) { >- this.initsWhenTrue.markAsComparedEqualToNonNull(local); >- this.initsWhenFalse.markAsComparedEqualToNonNull(local); >+public void markAsComparedEqualToNonNull(VariableBinding var) { >+ this.initsWhenTrue.markAsComparedEqualToNonNull(var); >+ this.initsWhenFalse.markAsComparedEqualToNonNull(var); > } > >-public void markAsComparedEqualToNull(VariableBinding local) { >- this.initsWhenTrue.markAsComparedEqualToNull(local); >- this.initsWhenFalse.markAsComparedEqualToNull(local); >+public void markAsComparedEqualToNull(VariableBinding var) { >+ this.initsWhenTrue.markAsComparedEqualToNull(var); >+ this.initsWhenFalse.markAsComparedEqualToNull(var); > } > > public void markAsDefinitelyAssigned(VariableBinding var) { >@@ -140,19 +140,19 @@ > this.initsWhenFalse.markAsDefinitelyAssigned(var); > } > >-public void markAsDefinitelyNonNull(VariableBinding local) { >- this.initsWhenTrue.markAsDefinitelyNonNull(local); >- this.initsWhenFalse.markAsDefinitelyNonNull(local); >+public void markAsDefinitelyNonNull(VariableBinding var) { >+ this.initsWhenTrue.markAsDefinitelyNonNull(var); >+ this.initsWhenFalse.markAsDefinitelyNonNull(var); > } > >-public void markAsDefinitelyNull(VariableBinding local) { >- this.initsWhenTrue.markAsDefinitelyNull(local); >- this.initsWhenFalse.markAsDefinitelyNull(local); >+public void markAsDefinitelyNull(VariableBinding var) { >+ this.initsWhenTrue.markAsDefinitelyNull(var); >+ this.initsWhenFalse.markAsDefinitelyNull(var); > } > >-public void resetNullInfo(VariableBinding local) { >- this.initsWhenTrue.resetNullInfo(local); >- this.initsWhenFalse.resetNullInfo(local); >+public void resetNullInfo(VariableBinding var) { >+ this.initsWhenTrue.resetNullInfo(var); >+ this.initsWhenFalse.resetNullInfo(var); > } > > public void resetNullInfoForFields() { >@@ -170,24 +170,24 @@ > this.initsWhenFalse.addConstantFieldsMask(other); > } > >-public void markPotentiallyNullBit(VariableBinding local) { >- this.initsWhenTrue.markPotentiallyNullBit(local); >- this.initsWhenFalse.markPotentiallyNullBit(local); >+public void markPotentiallyNullBit(VariableBinding var) { >+ this.initsWhenTrue.markPotentiallyNullBit(var); >+ this.initsWhenFalse.markPotentiallyNullBit(var); > } > >-public void markPotentiallyNonNullBit(VariableBinding local) { >- this.initsWhenTrue.markPotentiallyNonNullBit(local); >- this.initsWhenFalse.markPotentiallyNonNullBit(local); >+public void markPotentiallyNonNullBit(VariableBinding var) { >+ this.initsWhenTrue.markPotentiallyNonNullBit(var); >+ this.initsWhenFalse.markPotentiallyNonNullBit(var); > } > >-public void markAsDefinitelyUnknown(VariableBinding local) { >- this.initsWhenTrue.markAsDefinitelyUnknown(local); >- this.initsWhenFalse.markAsDefinitelyUnknown(local); >+public void markAsDefinitelyUnknown(VariableBinding var) { >+ this.initsWhenTrue.markAsDefinitelyUnknown(var); >+ this.initsWhenFalse.markAsDefinitelyUnknown(var); > } > >-public void markPotentiallyUnknownBit(VariableBinding local) { >- this.initsWhenTrue.markPotentiallyUnknownBit(local); >- this.initsWhenFalse.markPotentiallyUnknownBit(local); >+public void markPotentiallyUnknownBit(VariableBinding var) { >+ this.initsWhenTrue.markPotentiallyUnknownBit(var); >+ this.initsWhenFalse.markPotentiallyUnknownBit(var); > } > > public FlowInfo setReachMode(int reachMode) { >@@ -243,18 +243,18 @@ > mergedWith(this.initsWhenFalse.unconditionalInits()); > } > >-public void markedAsNullOrNonNullInAssertExpression(VariableBinding local) { >- this.initsWhenTrue.markedAsNullOrNonNullInAssertExpression(local); >- this.initsWhenFalse.markedAsNullOrNonNullInAssertExpression(local); >+public void markedAsNullOrNonNullInAssertExpression(VariableBinding var) { >+ this.initsWhenTrue.markedAsNullOrNonNullInAssertExpression(var); >+ this.initsWhenFalse.markedAsNullOrNonNullInAssertExpression(var); > } > >-public boolean isMarkedAsNullOrNonNullInAssertExpression(VariableBinding local) { >- return (this.initsWhenTrue.isMarkedAsNullOrNonNullInAssertExpression(local) >- || this.initsWhenFalse.isMarkedAsNullOrNonNullInAssertExpression(local)); >+public boolean isMarkedAsNullOrNonNullInAssertExpression(VariableBinding var) { >+ return (this.initsWhenTrue.isMarkedAsNullOrNonNullInAssertExpression(var) >+ || this.initsWhenFalse.isMarkedAsNullOrNonNullInAssertExpression(var)); > } > >-public void resetAssignmentInfo(LocalVariableBinding local) { >- this.initsWhenTrue.resetAssignmentInfo(local); >- this.initsWhenFalse.resetAssignmentInfo(local); >+public void resetAssignmentInfo(LocalVariableBinding var) { >+ this.initsWhenTrue.resetAssignmentInfo(var); >+ this.initsWhenFalse.resetAssignmentInfo(var); > } > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FinallyFlowContext.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FinallyFlowContext.java >index 3c62413..ea64a1a 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FinallyFlowContext.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FinallyFlowContext.java >@@ -100,18 +100,18 @@ > for (int i = 0; i < this.nullCount; i++) { > Expression expression = this.nullReferences[i]; > // final local variable >- VariableBinding local = this.nullVariables[i]; >+ VariableBinding var = this.nullVariables[i]; > switch (this.nullCheckTypes[i]) { > case CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NULL: > case CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NON_NULL: >- if (flowInfo.isDefinitelyNonNull(local)) { >+ if (flowInfo.isDefinitelyNonNull(var)) { > if (this.nullCheckTypes[i] == (CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NON_NULL)) { > if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) { >- scope.problemReporter().variableRedundantCheckOnNonNull(local, expression); >+ scope.problemReporter().variableRedundantCheckOnNonNull(var, expression); > } > } else { > if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) { >- scope.problemReporter().variableNonNullComparedToNull(local, expression); >+ scope.problemReporter().variableNonNullComparedToNull(var, expression); > } > } > continue; >@@ -121,46 +121,46 @@ > case CAN_ONLY_NULL | IN_COMPARISON_NON_NULL: > case CAN_ONLY_NULL | IN_ASSIGNMENT: > case CAN_ONLY_NULL | IN_INSTANCEOF: >- if (flowInfo.isDefinitelyNull(local)) { >+ if (flowInfo.isDefinitelyNull(var)) { > switch(this.nullCheckTypes[i] & CONTEXT_MASK) { > case FlowContext.IN_COMPARISON_NULL: > if (((this.nullCheckTypes[i] & CHECK_MASK) == CAN_ONLY_NULL) && (expression.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning >- scope.problemReporter().variableNullReference(local, expression); >+ scope.problemReporter().variableNullReference(var, expression); > continue; > } > if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) { >- scope.problemReporter().variableRedundantCheckOnNull(local, expression); >+ scope.problemReporter().variableRedundantCheckOnNull(var, expression); > } > continue; > case FlowContext.IN_COMPARISON_NON_NULL: > if (((this.nullCheckTypes[i] & CHECK_MASK) == CAN_ONLY_NULL) && (expression.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning >- scope.problemReporter().variableNullReference(local, expression); >+ scope.problemReporter().variableNullReference(var, expression); > continue; > } > if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) { >- scope.problemReporter().variableNullComparedToNonNull(local, expression); >+ scope.problemReporter().variableNullComparedToNonNull(var, expression); > } > continue; > case FlowContext.IN_ASSIGNMENT: >- scope.problemReporter().variableRedundantNullAssignment(local, expression); >+ scope.problemReporter().variableRedundantNullAssignment(var, expression); > continue; > case FlowContext.IN_INSTANCEOF: >- scope.problemReporter().variableNullInstanceof(local, expression); >+ scope.problemReporter().variableNullInstanceof(var, expression); > continue; > } >- } else if (flowInfo.isPotentiallyNull(local)) { >+ } else if (flowInfo.isPotentiallyNull(var)) { > switch(this.nullCheckTypes[i] & CONTEXT_MASK) { > case FlowContext.IN_COMPARISON_NULL: > this.nullReferences[i] = null; > if (((this.nullCheckTypes[i] & CHECK_MASK) == CAN_ONLY_NULL) && (expression.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning >- scope.problemReporter().variablePotentialNullReference(local, expression); >+ scope.problemReporter().variablePotentialNullReference(var, expression); > continue; > } > break; > case FlowContext.IN_COMPARISON_NON_NULL: > this.nullReferences[i] = null; > if (((this.nullCheckTypes[i] & CHECK_MASK) == CAN_ONLY_NULL) && (expression.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning >- scope.problemReporter().variablePotentialNullReference(local, expression); >+ scope.problemReporter().variablePotentialNullReference(var, expression); > continue; > } > break; >@@ -168,16 +168,16 @@ > } > break; > case MAY_NULL: >- if (flowInfo.isDefinitelyNull(local)) { >- scope.problemReporter().variableNullReference(local, expression); >+ if (flowInfo.isDefinitelyNull(var)) { >+ scope.problemReporter().variableNullReference(var, expression); > continue; > } >- if (flowInfo.isPotentiallyNull(local)) { >- scope.problemReporter().variablePotentialNullReference(local, expression); >+ if (flowInfo.isPotentiallyNull(var)) { >+ scope.problemReporter().variablePotentialNullReference(var, expression); > } > break; > case ASSIGN_TO_NONNULL: >- int nullStatus = flowInfo.nullStatus(local); >+ int nullStatus = flowInfo.nullStatus(var); > if (nullStatus != FlowInfo.NON_NULL) { > char[][] annotationName = scope.environment().getNonNullAnnotationName(); > scope.problemReporter().nullityMismatch(expression, this.expectedTypes[i], nullStatus, annotationName); >@@ -228,9 +228,9 @@ > return true; > } > >- public void recordUsingNullReference(Scope scope, VariableBinding local, >+ public void recordUsingNullReference(Scope scope, VariableBinding var, > Expression reference, int checkType, FlowInfo flowInfo) { >- if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0 && !flowInfo.isDefinitelyUnknown(local)) { >+ if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0 && !flowInfo.isDefinitelyUnknown(var)) { > if ((this.tagBits & FlowContext.DEFER_NULL_DIAGNOSTIC) != 0) { // within an enclosing loop, be conservative > switch (checkType) { > case CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NULL: >@@ -239,68 +239,68 @@ > case CAN_ONLY_NULL | IN_COMPARISON_NON_NULL: > case CAN_ONLY_NULL | IN_ASSIGNMENT: > case CAN_ONLY_NULL | IN_INSTANCEOF: >- if (flowInfo.cannotBeNull(local)) { >+ if (flowInfo.cannotBeNull(var)) { > if (checkType == (CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NON_NULL)) { > if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) { >- scope.problemReporter().variableRedundantCheckOnNonNull(local, reference); >+ scope.problemReporter().variableRedundantCheckOnNonNull(var, reference); > } >- if (!flowInfo.isMarkedAsNullOrNonNullInAssertExpression(local)) { >+ if (!flowInfo.isMarkedAsNullOrNonNullInAssertExpression(var)) { > flowInfo.initsWhenFalse().setReachMode(FlowInfo.UNREACHABLE_BY_NULLANALYSIS); > } > } else if (checkType == (CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NULL)) { > if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) { >- scope.problemReporter().variableNonNullComparedToNull(local, reference); >+ scope.problemReporter().variableNonNullComparedToNull(var, reference); > } >- if (!flowInfo.isMarkedAsNullOrNonNullInAssertExpression(local)) { >+ if (!flowInfo.isMarkedAsNullOrNonNullInAssertExpression(var)) { > flowInfo.initsWhenTrue().setReachMode(FlowInfo.UNREACHABLE_BY_NULLANALYSIS); > } > } > return; > } >- if (flowInfo.canOnlyBeNull(local)) { >+ if (flowInfo.canOnlyBeNull(var)) { > switch(checkType & CONTEXT_MASK) { > case FlowContext.IN_COMPARISON_NULL: > if (((checkType & CHECK_MASK) == CAN_ONLY_NULL) && (reference.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning >- scope.problemReporter().variableNullReference(local, reference); >+ scope.problemReporter().variableNullReference(var, reference); > return; > } > if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) { >- scope.problemReporter().variableRedundantCheckOnNull(local, reference); >+ scope.problemReporter().variableRedundantCheckOnNull(var, reference); > } >- if (!flowInfo.isMarkedAsNullOrNonNullInAssertExpression(local)) { >+ if (!flowInfo.isMarkedAsNullOrNonNullInAssertExpression(var)) { > flowInfo.initsWhenFalse().setReachMode(FlowInfo.UNREACHABLE_BY_NULLANALYSIS); > } > return; > case FlowContext.IN_COMPARISON_NON_NULL: > if (((checkType & CHECK_MASK) == CAN_ONLY_NULL) && (reference.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning >- scope.problemReporter().variableNullReference(local, reference); >+ scope.problemReporter().variableNullReference(var, reference); > return; > } > if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) { >- scope.problemReporter().variableNullComparedToNonNull(local, reference); >+ scope.problemReporter().variableNullComparedToNonNull(var, reference); > } >- if (!flowInfo.isMarkedAsNullOrNonNullInAssertExpression(local)) { >+ if (!flowInfo.isMarkedAsNullOrNonNullInAssertExpression(var)) { > flowInfo.initsWhenTrue().setReachMode(FlowInfo.UNREACHABLE_BY_NULLANALYSIS); > } > return; > case FlowContext.IN_ASSIGNMENT: >- scope.problemReporter().variableRedundantNullAssignment(local, reference); >+ scope.problemReporter().variableRedundantNullAssignment(var, reference); > return; > case FlowContext.IN_INSTANCEOF: >- scope.problemReporter().variableNullInstanceof(local, reference); >+ scope.problemReporter().variableNullInstanceof(var, reference); > return; > } >- } else if (flowInfo.isPotentiallyNull(local)) { >+ } else if (flowInfo.isPotentiallyNull(var)) { > switch(checkType & CONTEXT_MASK) { > case FlowContext.IN_COMPARISON_NULL: > if (((checkType & CHECK_MASK) == CAN_ONLY_NULL) && (reference.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning >- scope.problemReporter().variablePotentialNullReference(local, reference); >+ scope.problemReporter().variablePotentialNullReference(var, reference); > return; > } > break; > case FlowContext.IN_COMPARISON_NON_NULL: > if (((checkType & CHECK_MASK) == CAN_ONLY_NULL) && (reference.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning >- scope.problemReporter().variablePotentialNullReference(local, reference); >+ scope.problemReporter().variablePotentialNullReference(var, reference); > return; > } > break; >@@ -308,11 +308,11 @@ > } > break; > case MAY_NULL : >- if (flowInfo.cannotBeNull(local)) { >+ if (flowInfo.cannotBeNull(var)) { > return; > } >- if (flowInfo.canOnlyBeNull(local)) { >- scope.problemReporter().variableNullReference(local, reference); >+ if (flowInfo.canOnlyBeNull(var)) { >+ scope.problemReporter().variableNullReference(var, reference); > return; > } > break; >@@ -324,19 +324,19 @@ > switch (checkType) { > case CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NULL: > case CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NON_NULL: >- if (flowInfo.isDefinitelyNonNull(local)) { >+ if (flowInfo.isDefinitelyNonNull(var)) { > if (checkType == (CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NON_NULL)) { > if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) { >- scope.problemReporter().variableRedundantCheckOnNonNull(local, reference); >+ scope.problemReporter().variableRedundantCheckOnNonNull(var, reference); > } >- if (!flowInfo.isMarkedAsNullOrNonNullInAssertExpression(local)) { >+ if (!flowInfo.isMarkedAsNullOrNonNullInAssertExpression(var)) { > flowInfo.initsWhenFalse().setReachMode(FlowInfo.UNREACHABLE_BY_NULLANALYSIS); > } > } else { > if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) { >- scope.problemReporter().variableNonNullComparedToNull(local, reference); >+ scope.problemReporter().variableNonNullComparedToNull(var, reference); > } >- if (!flowInfo.isMarkedAsNullOrNonNullInAssertExpression(local)) { >+ if (!flowInfo.isMarkedAsNullOrNonNullInAssertExpression(var)) { > flowInfo.initsWhenTrue().setReachMode(FlowInfo.UNREACHABLE_BY_NULLANALYSIS); > } > } >@@ -347,50 +347,50 @@ > case CAN_ONLY_NULL | IN_COMPARISON_NON_NULL: > case CAN_ONLY_NULL | IN_ASSIGNMENT: > case CAN_ONLY_NULL | IN_INSTANCEOF: >- if (flowInfo.isDefinitelyNull(local)) { >+ if (flowInfo.isDefinitelyNull(var)) { > switch(checkType & CONTEXT_MASK) { > case FlowContext.IN_COMPARISON_NULL: > if (((checkType & CHECK_MASK) == CAN_ONLY_NULL) && (reference.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning >- scope.problemReporter().variableNullReference(local, reference); >+ scope.problemReporter().variableNullReference(var, reference); > return; > } > if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) { >- scope.problemReporter().variableRedundantCheckOnNull(local, reference); >+ scope.problemReporter().variableRedundantCheckOnNull(var, reference); > } >- if (!flowInfo.isMarkedAsNullOrNonNullInAssertExpression(local)) { >+ if (!flowInfo.isMarkedAsNullOrNonNullInAssertExpression(var)) { > flowInfo.initsWhenFalse().setReachMode(FlowInfo.UNREACHABLE_BY_NULLANALYSIS); > } > return; > case FlowContext.IN_COMPARISON_NON_NULL: > if (((checkType & CHECK_MASK) == CAN_ONLY_NULL) && (reference.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning >- scope.problemReporter().variableNullReference(local, reference); >+ scope.problemReporter().variableNullReference(var, reference); > return; > } > if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) { >- scope.problemReporter().variableNullComparedToNonNull(local, reference); >+ scope.problemReporter().variableNullComparedToNonNull(var, reference); > } >- if (!flowInfo.isMarkedAsNullOrNonNullInAssertExpression(local)) { >+ if (!flowInfo.isMarkedAsNullOrNonNullInAssertExpression(var)) { > flowInfo.initsWhenTrue().setReachMode(FlowInfo.UNREACHABLE_BY_NULLANALYSIS); > } > return; > case FlowContext.IN_ASSIGNMENT: >- scope.problemReporter().variableRedundantNullAssignment(local, reference); >+ scope.problemReporter().variableRedundantNullAssignment(var, reference); > return; > case FlowContext.IN_INSTANCEOF: >- scope.problemReporter().variableNullInstanceof(local, reference); >+ scope.problemReporter().variableNullInstanceof(var, reference); > return; > } >- } else if (flowInfo.isPotentiallyNull(local)) { >+ } else if (flowInfo.isPotentiallyNull(var)) { > switch(checkType & CONTEXT_MASK) { > case FlowContext.IN_COMPARISON_NULL: > if (((checkType & CHECK_MASK) == CAN_ONLY_NULL) && (reference.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning >- scope.problemReporter().variablePotentialNullReference(local, reference); >+ scope.problemReporter().variablePotentialNullReference(var, reference); > return; > } > break; > case FlowContext.IN_COMPARISON_NON_NULL: > if (((checkType & CHECK_MASK) == CAN_ONLY_NULL) && (reference.implicitConversion & TypeIds.UNBOXING) != 0) { // check for auto-unboxing first and report appropriate warning >- scope.problemReporter().variablePotentialNullReference(local, reference); >+ scope.problemReporter().variablePotentialNullReference(var, reference); > return; > } > break; >@@ -398,15 +398,15 @@ > } > break; > case MAY_NULL : >- if (flowInfo.isDefinitelyNull(local)) { >- scope.problemReporter().variableNullReference(local, reference); >+ if (flowInfo.isDefinitelyNull(var)) { >+ scope.problemReporter().variableNullReference(var, reference); > return; > } >- if (flowInfo.isPotentiallyNull(local)) { >- scope.problemReporter().variablePotentialNullReference(local, reference); >+ if (flowInfo.isPotentiallyNull(var)) { >+ scope.problemReporter().variablePotentialNullReference(var, reference); > return; > } >- if (flowInfo.isDefinitelyNonNull(local)) { >+ if (flowInfo.isDefinitelyNonNull(var)) { > return; // shortcut: cannot be null > } > break; >@@ -419,7 +419,7 @@ > if(((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) || checkType == MAY_NULL > || (checkType & CONTEXT_MASK) == FlowContext.IN_ASSIGNMENT > || (checkType & CONTEXT_MASK) == FlowContext.IN_INSTANCEOF) { >- recordNullReference(local, reference, checkType); >+ recordNullReference(var, reference, checkType); > } > // prepare to re-check with try/catch flow info > } >@@ -435,7 +435,7 @@ > } > } > >-protected void recordNullReference(VariableBinding local, >+protected void recordNullReference(VariableBinding var, > Expression expression, int status) { > if (this.nullCount == 0) { > this.nullVariables = new VariableBinding[5]; >@@ -454,7 +454,7 @@ > this.nullCheckTypes = new int[newLength], 0, > this.nullCount); > } >- this.nullVariables[this.nullCount] = local; >+ this.nullVariables[this.nullCount] = var; > this.nullReferences[this.nullCount] = expression; > this.nullCheckTypes[this.nullCount++] = status; > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java >index 422f0ad..61e990f 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java >@@ -277,7 +277,7 @@ > /** > * variant of {@link #resetNullInfo(VariableBinding)} for resetting null info for all fields > * Note that each fields status after the reset will become def. unknown i.e. 1001 >- * Also this method does not reset constant fields, which are identified by {@link #constantFieldsMask} >+ * Also this method does not reset constant fields > */ > abstract public void resetNullInfoForFields(); > >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java >index d3bb7e2..ac028b0 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java >@@ -525,12 +525,12 @@ > return this; > } > >-final public boolean cannotBeDefinitelyNullOrNonNull(VariableBinding local) { >+final public boolean cannotBeDefinitelyNullOrNonNull(VariableBinding var) { > if ((this.tagBits & NULL_FLAG_MASK) == 0 || >- (local.type.tagBits & TagBits.IsBaseType) != 0) { >+ (var.type.tagBits & TagBits.IsBaseType) != 0) { > return false; > } >- int position = local.getAnalysisId(this.maxFieldCount); >+ int position = var.getAnalysisId(this.maxFieldCount); > if (position < BitCacheSize) { > // use bits > return ( >@@ -556,12 +556,12 @@ > & (1L << (position % BitCacheSize))) != 0; > } > >-final public boolean cannotBeNull(VariableBinding local) { >+final public boolean cannotBeNull(VariableBinding var) { > if ((this.tagBits & NULL_FLAG_MASK) == 0 || >- (local.type.tagBits & TagBits.IsBaseType) != 0) { >+ (var.type.tagBits & TagBits.IsBaseType) != 0) { > return false; > } >- int position = local.getAnalysisId(this.maxFieldCount); >+ int position = var.getAnalysisId(this.maxFieldCount); > if (position < BitCacheSize) { > // use bits > return (this.nullBit1 & this.nullBit3 >@@ -583,12 +583,12 @@ > & (1L << (position % BitCacheSize))) != 0; > } > >-final public boolean canOnlyBeNull(VariableBinding local) { >+final public boolean canOnlyBeNull(VariableBinding var) { > if ((this.tagBits & NULL_FLAG_MASK) == 0 || >- (local.type.tagBits & TagBits.IsBaseType) != 0) { >+ (var.type.tagBits & TagBits.IsBaseType) != 0) { > return false; > } >- int position = local.getAnalysisId(this.maxFieldCount); >+ int position = var.getAnalysisId(this.maxFieldCount); > if (position < BitCacheSize) { > // use bits > return (this.nullBit1 & this.nullBit2 >@@ -749,12 +749,12 @@ > return isDefinitelyAssigned(field.getAnalysisId(this.maxFieldCount)); > } > >-final public boolean isDefinitelyAssigned(LocalVariableBinding local) { >+final public boolean isDefinitelyAssigned(LocalVariableBinding var) { > // do not want to complain in unreachable code if local declared in reachable code >- if ((this.tagBits & UNREACHABLE_OR_DEAD) != 0 && (local.declaration.bits & ASTNode.IsLocalDeclarationReachable) != 0) { >+ if ((this.tagBits & UNREACHABLE_OR_DEAD) != 0 && (var.declaration.bits & ASTNode.IsLocalDeclarationReachable) != 0) { > return true; > } >- return isDefinitelyAssigned(local.id + this.maxFieldCount); >+ return isDefinitelyAssigned(var.id + this.maxFieldCount); > } > > final public boolean isDefinitelyAssigned(VariableBinding var) { >@@ -765,8 +765,8 @@ > } > } > >-final public boolean isDefinitelyNonNull(VariableBinding local) { >- boolean isField = local instanceof FieldBinding; >+final public boolean isDefinitelyNonNull(VariableBinding var) { >+ boolean isField = var instanceof FieldBinding; > if (isField && (this.tagBits & NULL_FLAG_MASK) == 0) { > // no local yet in scope. Came here because of a field being queried for non null > // will only happen for final fields, since they are assigned in a constructor or static block >@@ -778,11 +778,11 @@ > (this.tagBits & NULL_FLAG_MASK) == 0) { > return false; > } >- if ((local.type.tagBits & TagBits.IsBaseType) != 0 || >- local.constant() != Constant.NotAConstant) { // String instances >+ if ((var.type.tagBits & TagBits.IsBaseType) != 0 || >+ var.constant() != Constant.NotAConstant) { // String instances > return true; > } >- int position = local.getAnalysisId(this.maxFieldCount); >+ int position = var.getAnalysisId(this.maxFieldCount); > if (position < BitCacheSize) { // use bits > return ((this.nullBit1 & this.nullBit3 & (~this.nullBit2 | this.nullBit4)) > & (1L << position)) != 0; >@@ -801,8 +801,8 @@ > & (1L << (position % BitCacheSize))) != 0; > } > >-final public boolean isDefinitelyNull(VariableBinding local) { >- boolean isField = local instanceof FieldBinding; >+final public boolean isDefinitelyNull(VariableBinding var) { >+ boolean isField = var instanceof FieldBinding; > if (isField && (this.tagBits & NULL_FLAG_MASK) == 0) { > // no local yet in scope. Came here because of a field being queried for non null > // will only happen for final fields, since they are assigned in a constructor or static block >@@ -812,10 +812,10 @@ > // do not want to complain in unreachable code > if ((this.tagBits & UNREACHABLE) != 0 || > (this.tagBits & NULL_FLAG_MASK) == 0 || >- (local.type.tagBits & TagBits.IsBaseType) != 0) { >+ (var.type.tagBits & TagBits.IsBaseType) != 0) { > return false; > } >- int position = local.getAnalysisId(this.maxFieldCount); >+ int position = var.getAnalysisId(this.maxFieldCount); > if (position < BitCacheSize) { // use bits > return ((this.nullBit1 & this.nullBit2 > & (~this.nullBit3 | ~this.nullBit4)) >@@ -835,13 +835,13 @@ > & (1L << (position % BitCacheSize))) != 0; > } > >-final public boolean isDefinitelyUnknown(VariableBinding local) { >+final public boolean isDefinitelyUnknown(VariableBinding var) { > // do not want to complain in unreachable code > if ((this.tagBits & UNREACHABLE) != 0 || > (this.tagBits & NULL_FLAG_MASK) == 0) { > return false; > } >- int position = local.getAnalysisId(this.maxFieldCount); >+ int position = var.getAnalysisId(this.maxFieldCount); > if (position < BitCacheSize) { // use bits > return ((this.nullBit1 & this.nullBit4 > & ~this.nullBit2 & ~this.nullBit3) & (1L << position)) != 0; >@@ -903,12 +903,12 @@ > } > > // TODO (Ayush) Check why this method does not return true for protected non null (1111) >-final public boolean isPotentiallyNonNull(VariableBinding local) { >+final public boolean isPotentiallyNonNull(VariableBinding var) { > if ((this.tagBits & NULL_FLAG_MASK) == 0 || >- (local.type.tagBits & TagBits.IsBaseType) != 0) { >+ (var.type.tagBits & TagBits.IsBaseType) != 0) { > return false; > } >- int position = local.getAnalysisId(this.maxFieldCount); >+ int position = var.getAnalysisId(this.maxFieldCount); > if (position < BitCacheSize) { // use bits > // use bits > return ((this.nullBit3 & (~this.nullBit1 | ~this.nullBit2)) >@@ -929,12 +929,12 @@ > } > > // TODO (Ayush) Check why this method does not return true for protected null >-final public boolean isPotentiallyNull(VariableBinding local) { >+final public boolean isPotentiallyNull(VariableBinding var) { > if ((this.tagBits & NULL_FLAG_MASK) == 0 || >- (local.type.tagBits & TagBits.IsBaseType) != 0) { >+ (var.type.tagBits & TagBits.IsBaseType) != 0) { > return false; > } >- int position = local.getAnalysisId(this.maxFieldCount); >+ int position = var.getAnalysisId(this.maxFieldCount); > if (position < BitCacheSize) { > // use bits > return ((this.nullBit2 & (~this.nullBit1 | ~this.nullBit3)) >@@ -954,13 +954,13 @@ > & (1L << (position % BitCacheSize))) != 0; > } > >-final public boolean isPotentiallyUnknown(VariableBinding local) { >+final public boolean isPotentiallyUnknown(VariableBinding var) { > // do not want to complain in unreachable code > if ((this.tagBits & UNREACHABLE) != 0 || > (this.tagBits & NULL_FLAG_MASK) == 0) { > return false; > } >- int position = local.getAnalysisId(this.maxFieldCount); >+ int position = var.getAnalysisId(this.maxFieldCount); > if (position < BitCacheSize) { // use bits > return (this.nullBit4 > & (~this.nullBit1 | ~this.nullBit2 & ~this.nullBit3) >@@ -981,12 +981,12 @@ > & (1L << (position % BitCacheSize))) != 0; > } > >-final public boolean isProtectedNonNull(VariableBinding local) { >+final public boolean isProtectedNonNull(VariableBinding var) { > if ((this.tagBits & NULL_FLAG_MASK) == 0 || >- (local.type.tagBits & TagBits.IsBaseType) != 0) { >+ (var.type.tagBits & TagBits.IsBaseType) != 0) { > return false; > } >- int position = local.getAnalysisId(this.maxFieldCount); >+ int position = var.getAnalysisId(this.maxFieldCount); > if (position < BitCacheSize) { // use bits > return (this.nullBit1 & this.nullBit3 & this.nullBit4 & (1L << position)) != 0; > } >@@ -1005,12 +1005,12 @@ > & (1L << (position % BitCacheSize))) != 0; > } > >-final public boolean isProtectedNull(VariableBinding local) { >+final public boolean isProtectedNull(VariableBinding var) { > if ((this.tagBits & NULL_FLAG_MASK) == 0 || >- (local.type.tagBits & TagBits.IsBaseType) != 0) { >+ (var.type.tagBits & TagBits.IsBaseType) != 0) { > return false; > } >- int position = local.getAnalysisId(this.maxFieldCount); >+ int position = var.getAnalysisId(this.maxFieldCount); > if (position < BitCacheSize) { > // use bits > return (this.nullBit1 & this.nullBit2 >@@ -1044,22 +1044,22 @@ > throw new AssertionFailedException("assertion failed: " + message); //$NON-NLS-1$ > return expression; > } >-public void markAsComparedEqualToNonNull(VariableBinding local) { >+public void markAsComparedEqualToNonNull(VariableBinding var) { > // protected from non-object locals in calling methods > if (this != DEAD_END) { > this.tagBits |= NULL_FLAG_MASK; > int position; >- if (local instanceof FieldBinding) { >- if ((local.modifiers & AccConstant) == AccConstant) { >- position = local.getAnalysisId(this.maxFieldCount); >+ if (var instanceof FieldBinding) { >+ if ((var.modifiers & AccConstant) == AccConstant) { >+ position = var.getAnalysisId(this.maxFieldCount); > } else { > // non-final fields may be modified in separate threads and we cannot be sure about their > // definite nullness. Hence, marking as definitely unknown to avoid deferring null check for these fields >- this.markAsDefinitelyUnknown(local); >+ this.markAsDefinitelyUnknown(var); > return; > } > } else { >- position = local.id + this.maxFieldCount; >+ position = var.id + this.maxFieldCount; > } > long mask; > long a1, a2, a3, a4, na2; >@@ -1153,24 +1153,24 @@ > } > } > >-public void markAsComparedEqualToNull(VariableBinding local) { >+public void markAsComparedEqualToNull(VariableBinding var) { > // protected from non-object locals in calling methods > if (this != DEAD_END) { > this.tagBits |= NULL_FLAG_MASK; > int position; > long mask; > // position is zero-based >- if (local instanceof FieldBinding) { >- if ((local.modifiers & AccConstant) == AccConstant) { >- position = local.getAnalysisId(this.maxFieldCount); >+ if (var instanceof FieldBinding) { >+ if ((var.modifiers & AccConstant) == AccConstant) { >+ position = var.getAnalysisId(this.maxFieldCount); > } else { > // non-final fields may be modified in separate threads and we cannot be sure about their > // definite nullness. Hence, marking as potential null. >- this.markNullStatus(local, FlowInfo.POTENTIALLY_NULL); >+ this.markNullStatus(var, FlowInfo.POTENTIALLY_NULL); > return; > } > } else { >- position = local.id + this.maxFieldCount; >+ position = var.id + this.maxFieldCount; > } > if (position < BitCacheSize) { > // use bits >@@ -1298,24 +1298,24 @@ > markAsDefinitelyAssigned(var.getAnalysisId(this.maxFieldCount)); > } > >-public void markAsDefinitelyNonNull(VariableBinding local) { >+public void markAsDefinitelyNonNull(VariableBinding var) { > // protected from non-object locals in calling methods > if (this != DEAD_END) { > this.tagBits |= NULL_FLAG_MASK; > long mask; > int position; > // position is zero-based >- if (local instanceof FieldBinding) { >- if ((local.modifiers & AccConstant) == AccConstant) { >- position = local.getAnalysisId(this.maxFieldCount); >+ if (var instanceof FieldBinding) { >+ if ((var.modifiers & AccConstant) == AccConstant) { >+ position = var.getAnalysisId(this.maxFieldCount); > } else { > // non-final fields may be modified in separate threads and we cannot be sure about their > // definite nullness. Hence, marking as definitely unknown to avoid deferring null check for these fields. >- this.markAsDefinitelyUnknown(local); >+ this.markAsDefinitelyUnknown(var); > return; > } > } else { >- position = local.id + this.maxFieldCount; >+ position = var.id + this.maxFieldCount; > } > if (position < BitCacheSize) { // use bits > // set assigned non null >@@ -1364,24 +1364,24 @@ > } > } > >-public void markAsDefinitelyNull(VariableBinding local) { >+public void markAsDefinitelyNull(VariableBinding var) { > // protected from non-object locals in calling methods > if (this != DEAD_END) { > this.tagBits |= NULL_FLAG_MASK; > long mask; > int position; > // position is zero-based >- if (local instanceof FieldBinding) { >- if ((local.modifiers & AccConstant) == AccConstant) { >- position = local.getAnalysisId(this.maxFieldCount); >+ if (var instanceof FieldBinding) { >+ if ((var.modifiers & AccConstant) == AccConstant) { >+ position = var.getAnalysisId(this.maxFieldCount); > } else { > // non-final fields may be modified in separate threads and we cannot be sure about their > // definite nullness. Hence, marking as potential null. >- this.markNullStatus(local, FlowInfo.POTENTIALLY_NULL); >+ this.markNullStatus(var, FlowInfo.POTENTIALLY_NULL); > return; > } > } else { >- position = local.id + this.maxFieldCount; >+ position = var.id + this.maxFieldCount; > } > if (position < BitCacheSize) { // use bits > // mark assigned null >@@ -1432,16 +1432,16 @@ > > /** > * Mark a local as having been assigned to an unknown value. >- * @param local the local to mark >+ * @param var the local to mark > */ > // PREMATURE may try to get closer to markAsDefinitelyAssigned, but not > // obvious >-public void markAsDefinitelyUnknown(VariableBinding local) { >+public void markAsDefinitelyUnknown(VariableBinding var) { > // protected from non-object locals in calling methods > if (this != DEAD_END) { > this.tagBits |= NULL_FLAG_MASK; > long mask; >- int position = local.getAnalysisId(this.maxFieldCount); >+ int position = var.getAnalysisId(this.maxFieldCount); > if (position < BitCacheSize) { > // use bits > // mark assigned null >@@ -1490,11 +1490,11 @@ > } > } > >-public void resetNullInfo(VariableBinding local) { >+public void resetNullInfo(VariableBinding var) { > if (this != DEAD_END) { > this.tagBits |= NULL_FLAG_MASK; > long mask; >- int position = local.getAnalysisId(this.maxFieldCount); >+ int position = var.getAnalysisId(this.maxFieldCount); > if (position < BitCacheSize) { > // use bits > this.nullBit1 &= (mask = ~(1L << position)); >@@ -1630,14 +1630,14 @@ > > /** > * Mark a local as potentially having been assigned to an unknown value. >- * @param local the local to mark >+ * @param var the local to mark > */ >-public void markPotentiallyUnknownBit(VariableBinding local) { >+public void markPotentiallyUnknownBit(VariableBinding var) { > // protected from non-object locals in calling methods > if (this != DEAD_END) { > this.tagBits |= NULL_FLAG_MASK; > long mask; >- int position = local.getAnalysisId(this.maxFieldCount); >+ int position = var.getAnalysisId(this.maxFieldCount); > if (position < BitCacheSize) { > // use bits > mask = 1L << position; >@@ -1680,11 +1680,11 @@ > } > } > >-public void markPotentiallyNullBit(VariableBinding local) { >+public void markPotentiallyNullBit(VariableBinding var) { > if (this != DEAD_END) { > this.tagBits |= NULL_FLAG_MASK; > long mask; >- int position = local.getAnalysisId(this.maxFieldCount); >+ int position = var.getAnalysisId(this.maxFieldCount); > if (position < BitCacheSize) { > // use bits > mask = 1L << position; >@@ -1727,11 +1727,11 @@ > } > } > >-public void markPotentiallyNonNullBit(VariableBinding local) { >+public void markPotentiallyNonNullBit(VariableBinding var) { > if (this != DEAD_END) { > this.tagBits |= NULL_FLAG_MASK; > long mask; >- int position = local.getAnalysisId(this.maxFieldCount); >+ int position = var.getAnalysisId(this.maxFieldCount); > if (position < BitCacheSize) { > // use bits > mask = 1L << position;
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