View | Details | Raw Unified | Return to bug 170704 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties (+3 lines)
Lines 326-331 Link Here
326
397 = The variable {0} cannot be null; it was either set to a non-null value or assumed to be non-null when last used
326
397 = The variable {0} cannot be null; it was either set to a non-null value or assumed to be non-null when last used
327
398 = The variable {0} can only be null; it was either set to null or checked for null when last used
327
398 = The variable {0} can only be null; it was either set to null or checked for null when last used
328
399 = The variable {0} may be null
328
399 = The variable {0} may be null
329
330
417 = The variable {0} can only be null; it was either set to null or checked for null when last used
331
418 = The variable {0} may be null
329
	
332
	
330
400 = The type {3} must implement the inherited abstract method {2}.{0}({1})
333
400 = The type {3} must implement the inherited abstract method {2}.{0}({1})
331
401 = Cannot override the final method from {0}
334
401 = Cannot override the final method from {0}
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-4 / +19 lines)
Lines 189-194 Link Here
189
		case IProblem.LocalVariableMayBeNull :
189
		case IProblem.LocalVariableMayBeNull :
190
			return CompilerOptions.NullReference;
190
			return CompilerOptions.NullReference;
191
			
191
			
192
		case IProblem.LocalVariableCanOnlyBeNullWhenDereferenced :
193
		case IProblem.LocalVariableMayBeNullWhenDereferenced :
194
			return CompilerOptions.NullDereference;
195
			
192
		case IProblem.BoxingConversion :
196
		case IProblem.BoxingConversion :
193
		case IProblem.UnboxingConversion :
197
		case IProblem.UnboxingConversion :
194
			return CompilerOptions.AutoBoxing;
198
			return CompilerOptions.AutoBoxing;
Lines 370-375 Link Here
370
				case (int)(CompilerOptions.MissingSerialVersion >>> 32):
374
				case (int)(CompilerOptions.MissingSerialVersion >>> 32):
371
				case (int)(CompilerOptions.VarargsArgumentNeedCast >>> 32):
375
				case (int)(CompilerOptions.VarargsArgumentNeedCast >>> 32):
372
				case (int)(CompilerOptions.NullReference >>> 32):
376
				case (int)(CompilerOptions.NullReference >>> 32):
377
				case (int)(CompilerOptions.NullDereference >>> 32):
373
				case (int)(CompilerOptions.IncompleteEnumSwitch >>> 32):
378
				case (int)(CompilerOptions.IncompleteEnumSwitch >>> 32):
374
				case (int)(CompilerOptions.FallthroughCase >>> 32):
379
				case (int)(CompilerOptions.FallthroughCase >>> 32):
375
				case (int)(CompilerOptions.OverridingMethodWithoutSuperInvocation >>> 32):
380
				case (int)(CompilerOptions.OverridingMethodWithoutSuperInvocation >>> 32):
Lines 4346-4356 Link Here
4346
		nodeSourceEnd(local, location));
4351
		nodeSourceEnd(local, location));
4347
}
4352
}
4348
public void localVariableCanOnlyBeNull(LocalVariableBinding local, ASTNode location) {
4353
public void localVariableCanOnlyBeNull(LocalVariableBinding local, ASTNode location) {
4349
	int severity = computeSeverity(IProblem.LocalVariableCanOnlyBeNull);
4354
	localVariableCanOnlyBeNull(local, location, false);
4355
}
4356
public void localVariableCanOnlyBeNull(LocalVariableBinding local, ASTNode location, boolean isDereference) {
4357
	int problem = (isDereference ? IProblem.LocalVariableCanOnlyBeNullWhenDereferenced 
4358
			                     : IProblem.LocalVariableCanOnlyBeNull);
4359
	int severity = computeSeverity(problem);
4350
	if (severity == ProblemSeverities.Ignore) return;
4360
	if (severity == ProblemSeverities.Ignore) return;
4351
	String[] arguments = new String[] {new String(local.name)  };
4361
	String[] arguments = new String[] {new String(local.name)  };
4352
	this.handle(
4362
	this.handle(
4353
		IProblem.LocalVariableCanOnlyBeNull,
4363
		problem,
4354
		arguments,
4364
		arguments,
4355
		arguments,
4365
		arguments,
4356
		severity,
4366
		severity,
Lines 4392-4402 Link Here
4392
	}
4402
	}
4393
}
4403
}
4394
public void localVariableMayBeNull(LocalVariableBinding local, ASTNode location) {
4404
public void localVariableMayBeNull(LocalVariableBinding local, ASTNode location) {
4395
	int severity = computeSeverity(IProblem.LocalVariableMayBeNull);
4405
	localVariableMayBeNull(local, location, false);
4406
}
4407
public void localVariableMayBeNull(LocalVariableBinding local, ASTNode location, boolean isDereference) {
4408
	int problem = (isDereference ? IProblem.LocalVariableMayBeNullWhenDereferenced 
4409
                                 : IProblem.LocalVariableMayBeNull);
4410
	int severity = computeSeverity(problem);
4396
	if (severity == ProblemSeverities.Ignore) return;
4411
	if (severity == ProblemSeverities.Ignore) return;
4397
	String[] arguments = new String[] {new String(local.name)};
4412
	String[] arguments = new String[] {new String(local.name)};
4398
	this.handle(
4413
	this.handle(
4399
		IProblem.LocalVariableMayBeNull,
4414
		problem,
4400
		arguments,
4415
		arguments,
4401
		arguments,
4416
		arguments,
4402
		severity,
4417
		severity,
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java (-2 / +6 lines)
Lines 479-491 Link Here
479
 * @param flowInfo the upstream flow info; caveat: may get modified
479
 * @param flowInfo the upstream flow info; caveat: may get modified
480
 */
480
 */
481
public void checkNPE(BlockScope scope, FlowContext flowContext, 
481
public void checkNPE(BlockScope scope, FlowContext flowContext, 
482
		FlowInfo flowInfo) {
482
			FlowInfo flowInfo) {
483
	checkNPE(scope, flowContext, flowInfo, false);
484
}
485
public void checkNPE(BlockScope scope, FlowContext flowContext, 
486
		FlowInfo flowInfo, boolean isDereference) {
483
	LocalVariableBinding local = this.localVariableBinding();
487
	LocalVariableBinding local = this.localVariableBinding();
484
	if (local != null && 
488
	if (local != null && 
485
			(local.type.tagBits & TagBits.IsBaseType) == 0) {
489
			(local.type.tagBits & TagBits.IsBaseType) == 0) {
486
		if ((this.bits & IsNonNull) == 0) {
490
		if ((this.bits & IsNonNull) == 0) {
487
			flowContext.recordUsingNullReference(scope, local, this, 
491
			flowContext.recordUsingNullReference(scope, local, this, 
488
					FlowContext.MAY_NULL, flowInfo);
492
					FlowContext.MAY_NULL, flowInfo, isDereference);
489
		}
493
		}
490
		flowInfo.markAsComparedEqualToNonNull(local); 
494
		flowInfo.markAsComparedEqualToNonNull(local); 
491
			// from thereon it is set
495
			// from thereon it is set
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java (-1 / +1 lines)
Lines 49-55 Link Here
49
		BlockScope currentScope,
49
		BlockScope currentScope,
50
		FlowContext flowContext,
50
		FlowContext flowContext,
51
		FlowInfo flowInfo) {
51
		FlowInfo flowInfo) {
52
	receiver.checkNPE(currentScope, flowContext, flowInfo);
52
	receiver.checkNPE(currentScope, flowContext, flowInfo, true);
53
	flowInfo = receiver.analyseCode(currentScope, flowContext, flowInfo);
53
	flowInfo = receiver.analyseCode(currentScope, flowContext, flowInfo);
54
	return position.analyseCode(currentScope, flowContext, flowInfo);
54
	return position.analyseCode(currentScope, flowContext, flowInfo);
55
}
55
}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java (-1 / +1 lines)
Lines 45-51 Link Here
45
	boolean nonStatic = !binding.isStatic();
45
	boolean nonStatic = !binding.isStatic();
46
	flowInfo = receiver.analyseCode(currentScope, flowContext, flowInfo, nonStatic).unconditionalInits();
46
	flowInfo = receiver.analyseCode(currentScope, flowContext, flowInfo, nonStatic).unconditionalInits();
47
	if (nonStatic) {
47
	if (nonStatic) {
48
		receiver.checkNPE(currentScope, flowContext, flowInfo);
48
		receiver.checkNPE(currentScope, flowContext, flowInfo, true);
49
	}
49
	}
50
50
51
	if (arguments != null) {
51
	if (arguments != null) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java (-1 / +1 lines)
Lines 99-105 Link Here
99
	boolean nonStatic = !binding.isStatic();
99
	boolean nonStatic = !binding.isStatic();
100
	receiver.analyseCode(currentScope, flowContext, flowInfo, nonStatic);
100
	receiver.analyseCode(currentScope, flowContext, flowInfo, nonStatic);
101
	if (nonStatic) {
101
	if (nonStatic) {
102
		receiver.checkNPE(currentScope, flowContext, flowInfo);
102
		receiver.checkNPE(currentScope, flowContext, flowInfo, true);
103
	}
103
	}
104
	
104
	
105
	if (valueRequired || currentScope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4) {
105
	if (valueRequired || currentScope.compilerOptions().complianceLevel >= ClassFileConstants.JDK1_4) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java (-1 / +1 lines)
Lines 81-87 Link Here
81
		continueLabel = new BranchLabel();
81
		continueLabel = new BranchLabel();
82
82
83
		// process the element variable and collection
83
		// process the element variable and collection
84
		this.collection.checkNPE(currentScope, flowContext, flowInfo);
84
		this.collection.checkNPE(currentScope, flowContext, flowInfo, true);
85
		flowInfo = this.elementVariable.analyseCode(scope, flowContext, flowInfo);
85
		flowInfo = this.elementVariable.analyseCode(scope, flowContext, flowInfo);
86
		FlowInfo condInfo = this.collection.analyseCode(scope, flowContext, flowInfo.copy());
86
		FlowInfo condInfo = this.collection.analyseCode(scope, flowContext, flowInfo.copy());
87
87
(-)batch/org/eclipse/jdt/internal/compiler/batch/Main.java (+7 lines)
Lines 1604-1609 Link Here
1604
		this.options.put(
1604
		this.options.put(
1605
			CompilerOptions.OPTION_ReportNullReference,
1605
			CompilerOptions.OPTION_ReportNullReference,
1606
			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
1606
			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
1607
		this.options.put(
1608
				CompilerOptions.OPTION_ReportNullDereference,
1609
				isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
1610
	} else if (token.equals("nullDereference")) { //$NON-NLS-1$
1611
		this.options.put(
1612
				CompilerOptions.OPTION_ReportNullDereference,
1613
				isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
1607
	} else if (token.equals("boxing")) { //$NON-NLS-1$
1614
	} else if (token.equals("boxing")) { //$NON-NLS-1$
1608
		this.options.put(
1615
		this.options.put(
1609
			CompilerOptions.OPTION_ReportAutoboxing,
1616
			CompilerOptions.OPTION_ReportAutoboxing,
(-)model/org/eclipse/jdt/core/JavaCore.java (+6 lines)
Lines 679-684 Link Here
679
	 * @see #getDefaultOptions()
679
	 * @see #getDefaultOptions()
680
	 * @since 3.3
680
	 * @since 3.3
681
	 */
681
	 */
682
	public static final String COMPILER_PB_NULL_DEREFERENCE = PLUGIN_ID + ".compiler.problem.nullDereference"; //$NON-NLS-1$
683
	/**
684
	 * Possible  configurable option ID.
685
	 * @see #getDefaultOptions()
686
	 * @since 3.3
687
	 */
682
	public static final String COMPILER_PB_OVERRIDING_METHOD_WITHOUT_SUPER_INVOCATION = PLUGIN_ID + ".compiler.problem.overridingMethodWithoutSuperInvocation"; //$NON-NLS-1$
688
	public static final String COMPILER_PB_OVERRIDING_METHOD_WITHOUT_SUPER_INVOCATION = PLUGIN_ID + ".compiler.problem.overridingMethodWithoutSuperInvocation"; //$NON-NLS-1$
683
	/**
689
	/**
684
	 * Possible  configurable option ID.
690
	 * Possible  configurable option ID.
(-)compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java (+11 lines)
Lines 94-99 Link Here
94
	public static final String OPTION_TaskCaseSensitive = "org.eclipse.jdt.core.compiler.taskCaseSensitive"; //$NON-NLS-1$
94
	public static final String OPTION_TaskCaseSensitive = "org.eclipse.jdt.core.compiler.taskCaseSensitive"; //$NON-NLS-1$
95
	public static final String OPTION_InlineJsr = "org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode"; //$NON-NLS-1$
95
	public static final String OPTION_InlineJsr = "org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode"; //$NON-NLS-1$
96
	public static final String OPTION_ReportNullReference = "org.eclipse.jdt.core.compiler.problem.nullReference"; //$NON-NLS-1$
96
	public static final String OPTION_ReportNullReference = "org.eclipse.jdt.core.compiler.problem.nullReference"; //$NON-NLS-1$
97
	public static final String OPTION_ReportNullDereference = "org.eclipse.jdt.core.compiler.problem.nullDereference"; //$NON-NLS-1$
97
	public static final String OPTION_ReportAutoboxing = "org.eclipse.jdt.core.compiler.problem.autoboxing"; //$NON-NLS-1$
98
	public static final String OPTION_ReportAutoboxing = "org.eclipse.jdt.core.compiler.problem.autoboxing"; //$NON-NLS-1$
98
	public static final String OPTION_ReportAnnotationSuperInterface = "org.eclipse.jdt.core.compiler.problem.annotationSuperInterface"; //$NON-NLS-1$
99
	public static final String OPTION_ReportAnnotationSuperInterface = "org.eclipse.jdt.core.compiler.problem.annotationSuperInterface"; //$NON-NLS-1$
99
	public static final String OPTION_ReportMissingOverrideAnnotation = "org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation"; //$NON-NLS-1$
100
	public static final String OPTION_ReportMissingOverrideAnnotation = "org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation"; //$NON-NLS-1$
Lines 181-186 Link Here
181
	public static final long ForbiddenReference = ASTNode.Bit35L;
182
	public static final long ForbiddenReference = ASTNode.Bit35L;
182
	public static final long VarargsArgumentNeedCast = ASTNode.Bit36L;
183
	public static final long VarargsArgumentNeedCast = ASTNode.Bit36L;
183
	public static final long NullReference = ASTNode.Bit37L;
184
	public static final long NullReference = ASTNode.Bit37L;
185
//* DSRG: can we use bit 51?
186
	public static final long NullDereference = ASTNode.Bit51L;
184
	public static final long AutoBoxing = ASTNode.Bit38L;
187
	public static final long AutoBoxing = ASTNode.Bit38L;
185
	public static final long AnnotationSuperInterface = ASTNode.Bit39L;
188
	public static final long AnnotationSuperInterface = ASTNode.Bit39L;
186
	public static final long TypeHiding = ASTNode.Bit40L;
189
	public static final long TypeHiding = ASTNode.Bit40L;
Lines 413-418 Link Here
413
		optionsMap.put(OPTION_MaxProblemPerUnit, String.valueOf(this.maxProblemsPerUnit));
416
		optionsMap.put(OPTION_MaxProblemPerUnit, String.valueOf(this.maxProblemsPerUnit));
414
		optionsMap.put(OPTION_InlineJsr, this.inlineJsrBytecode ? ENABLED : DISABLED); 
417
		optionsMap.put(OPTION_InlineJsr, this.inlineJsrBytecode ? ENABLED : DISABLED); 
415
		optionsMap.put(OPTION_ReportNullReference, getSeverityString(NullReference));
418
		optionsMap.put(OPTION_ReportNullReference, getSeverityString(NullReference));
419
		optionsMap.put(OPTION_ReportNullDereference, getSeverityString(NullDereference));
416
		optionsMap.put(OPTION_SuppressWarnings, this.suppressWarnings ? ENABLED : DISABLED); 
420
		optionsMap.put(OPTION_SuppressWarnings, this.suppressWarnings ? ENABLED : DISABLED); 
417
		optionsMap.put(OPTION_ReportUnhandledWarningToken, getSeverityString(UnhandledWarningToken));
421
		optionsMap.put(OPTION_ReportUnhandledWarningToken, getSeverityString(UnhandledWarningToken));
418
		optionsMap.put(OPTION_ReportParameterAssignment, getSeverityString(ParameterAssignment));
422
		optionsMap.put(OPTION_ReportParameterAssignment, getSeverityString(ParameterAssignment));
Lines 652-657 Link Here
652
		if ((optionValue = optionsMap.get(OPTION_ReportDiscouragedReference)) != null) updateSeverity(DiscouragedReference, optionValue);
656
		if ((optionValue = optionsMap.get(OPTION_ReportDiscouragedReference)) != null) updateSeverity(DiscouragedReference, optionValue);
653
		if ((optionValue = optionsMap.get(OPTION_ReportVarargsArgumentNeedCast)) != null) updateSeverity(VarargsArgumentNeedCast, optionValue);
657
		if ((optionValue = optionsMap.get(OPTION_ReportVarargsArgumentNeedCast)) != null) updateSeverity(VarargsArgumentNeedCast, optionValue);
654
		if ((optionValue = optionsMap.get(OPTION_ReportNullReference)) != null) updateSeverity(NullReference, optionValue);
658
		if ((optionValue = optionsMap.get(OPTION_ReportNullReference)) != null) updateSeverity(NullReference, optionValue);
659
		if ((optionValue = optionsMap.get(OPTION_ReportNullDereference)) != null) updateSeverity(NullDereference, optionValue);
655
		if ((optionValue = optionsMap.get(OPTION_ReportAutoboxing)) != null) updateSeverity(AutoBoxing, optionValue);
660
		if ((optionValue = optionsMap.get(OPTION_ReportAutoboxing)) != null) updateSeverity(AutoBoxing, optionValue);
656
		if ((optionValue = optionsMap.get(OPTION_ReportAnnotationSuperInterface)) != null) updateSeverity(AnnotationSuperInterface, optionValue);
661
		if ((optionValue = optionsMap.get(OPTION_ReportAnnotationSuperInterface)) != null) updateSeverity(AnnotationSuperInterface, optionValue);
657
		if ((optionValue = optionsMap.get(OPTION_ReportMissingOverrideAnnotation)) != null) updateSeverity(MissingOverrideAnnotation, optionValue);
662
		if ((optionValue = optionsMap.get(OPTION_ReportMissingOverrideAnnotation)) != null) updateSeverity(MissingOverrideAnnotation, optionValue);
Lines 959-964 Link Here
959
			OPTION_ReportNonExternalizedStringLiteral,
964
			OPTION_ReportNonExternalizedStringLiteral,
960
			OPTION_ReportNonStaticAccessToStatic,
965
			OPTION_ReportNonStaticAccessToStatic,
961
			OPTION_ReportNullReference,
966
			OPTION_ReportNullReference,
967
			OPTION_ReportNullDereference,
962
			OPTION_ReportOverridingPackageDefaultMethod,
968
			OPTION_ReportOverridingPackageDefaultMethod,
963
			OPTION_ReportParameterAssignment,
969
			OPTION_ReportParameterAssignment,
964
			OPTION_ReportPossibleAccidentalBooleanAssignment,
970
			OPTION_ReportPossibleAccidentalBooleanAssignment,
Lines 1037-1042 Link Here
1037
					return "restriction"; //$NON-NLS-1$
1043
					return "restriction"; //$NON-NLS-1$
1038
				case (int) (NullReference >>> 32) :
1044
				case (int) (NullReference >>> 32) :
1039
					return "null"; //$NON-NLS-1$
1045
					return "null"; //$NON-NLS-1$
1046
				case (int) (NullDereference >>> 32) :
1047
					return "nullDereference"; //$NON-NLS-1$
1040
				case (int) (FallthroughCase >>> 32) :
1048
				case (int) (FallthroughCase >>> 32) :
1041
					return "fallthrough"; //$NON-NLS-1$
1049
					return "fallthrough"; //$NON-NLS-1$
1042
				case (int) (OverridingMethodWithoutSuperInvocation >>> 32) :
1050
				case (int) (OverridingMethodWithoutSuperInvocation >>> 32) :
Lines 1058-1063 Link Here
1058
		"incomplete-switch", //$NON-NLS-1$
1066
		"incomplete-switch", //$NON-NLS-1$
1059
		"nls", //$NON-NLS-1$
1067
		"nls", //$NON-NLS-1$
1060
		"null", //$NON-NLS-1$
1068
		"null", //$NON-NLS-1$
1069
		"nullDereference", //$NON-NLS-1$
1061
		"restriction", //$NON-NLS-1$
1070
		"restriction", //$NON-NLS-1$
1062
		"serial", //$NON-NLS-1$
1071
		"serial", //$NON-NLS-1$
1063
		"static-access", //$NON-NLS-1$
1072
		"static-access", //$NON-NLS-1$
Lines 1107-1112 Link Here
1107
					return NonExternalizedString;
1116
					return NonExternalizedString;
1108
				if ("null".equals(warningToken)) //$NON-NLS-1$
1117
				if ("null".equals(warningToken)) //$NON-NLS-1$
1109
					return NullReference;
1118
					return NullReference;
1119
				if ("nullDereference".equals(warningToken)) //$NON-NLS-1$
1120
					return NullDereference;
1110
				break;
1121
				break;
1111
			case 'r' :
1122
			case 'r' :
1112
				if ("restriction".equals(warningToken)) //$NON-NLS-1$
1123
				if ("restriction".equals(warningToken)) //$NON-NLS-1$
(-)compiler/org/eclipse/jdt/core/compiler/IProblem.java (+6 lines)
Lines 724-729 Link Here
724
	int LocalVariableCanOnlyBeNull = Internal + 398;
724
	int LocalVariableCanOnlyBeNull = Internal + 398;
725
	/** @since 3.2 */
725
	/** @since 3.2 */
726
	int LocalVariableMayBeNull = Internal + 399;
726
	int LocalVariableMayBeNull = Internal + 399;
727
	
728
	//* the following 2 probably need to have the numbers adjusted...
729
	/** @since 3.3 */
730
	int LocalVariableCanOnlyBeNullWhenDereferenced = Internal + 417;
731
	/** @since 3.3 */
732
	int LocalVariableMayBeNullWhenDereferenced = Internal + 418;
727
733
728
	// method verifier problems
734
	// method verifier problems
729
	int AbstractMethodMustBeImplemented = MethodRelated + 400;
735
	int AbstractMethodMustBeImplemented = MethodRelated + 400;
(-)compiler/org/eclipse/jdt/internal/compiler/flow/FinallyFlowContext.java (-2 / +2 lines)
Lines 157-163 Link Here
157
	}
157
	}
158
158
159
	public void recordUsingNullReference(Scope scope, LocalVariableBinding local, 
159
	public void recordUsingNullReference(Scope scope, LocalVariableBinding local, 
160
			Expression reference, int checkType, FlowInfo flowInfo) {
160
			Expression reference, int checkType, FlowInfo flowInfo, boolean isDereference) {
161
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0)	{
161
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0)	{
162
		if (deferNullDiagnostic) { // within an enclosing loop, be conservative
162
		if (deferNullDiagnostic) { // within an enclosing loop, be conservative
163
			switch (checkType) {
163
			switch (checkType) {
Lines 179-185 Link Here
179
						return;
179
						return;
180
					}
180
					}
181
					if (flowInfo.canOnlyBeNull(local)) {
181
					if (flowInfo.canOnlyBeNull(local)) {
182
						scope.problemReporter().localVariableCanOnlyBeNull(local, reference);
182
						scope.problemReporter().localVariableCanOnlyBeNull(local, reference, isDereference);
183
						return;
183
						return;
184
					}
184
					}
185
					break;
185
					break;
(-)compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java (-3 / +3 lines)
Lines 317-323 Link Here
317
}
317
}
318
	
318
	
319
public void recordUsingNullReference(Scope scope, LocalVariableBinding local,
319
public void recordUsingNullReference(Scope scope, LocalVariableBinding local,
320
		Expression reference, int checkType, FlowInfo flowInfo) {
320
		Expression reference, int checkType, FlowInfo flowInfo, boolean isDereference) {
321
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0 || 
321
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0 || 
322
			flowInfo.isDefinitelyUnknown(local)) {
322
			flowInfo.isDefinitelyUnknown(local)) {
323
		return;
323
		return;
Lines 357-367 Link Here
357
				return;
357
				return;
358
			}
358
			}
359
			if (flowInfo.isDefinitelyNull(local)) {
359
			if (flowInfo.isDefinitelyNull(local)) {
360
				scope.problemReporter().localVariableCanOnlyBeNull(local, reference);
360
				scope.problemReporter().localVariableCanOnlyBeNull(local, reference, isDereference);
361
				return;
361
				return;
362
			}
362
			}
363
			if (flowInfo.isPotentiallyNull(local)) {
363
			if (flowInfo.isPotentiallyNull(local)) {
364
				scope.problemReporter().localVariableMayBeNull(local, reference);
364
				scope.problemReporter().localVariableMayBeNull(local, reference, isDereference);
365
				return;
365
				return;
366
			}
366
			}
367
			recordNullReference(local, reference, checkType);
367
			recordNullReference(local, reference, checkType);
(-)compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java (-2 / +6 lines)
Lines 493-498 Link Here
493
 */
493
 */
494
public void recordUsingNullReference(Scope scope, LocalVariableBinding local, 
494
public void recordUsingNullReference(Scope scope, LocalVariableBinding local, 
495
		Expression reference, int checkType, FlowInfo flowInfo) {
495
		Expression reference, int checkType, FlowInfo flowInfo) {
496
	recordUsingNullReference(scope, local, reference, checkType, flowInfo, false);
497
}
498
public void recordUsingNullReference(Scope scope, LocalVariableBinding local, 
499
		Expression reference, int checkType, FlowInfo flowInfo, boolean isDereference) {
496
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0 || 
500
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0 || 
497
			flowInfo.isDefinitelyUnknown(local)) {
501
			flowInfo.isDefinitelyUnknown(local)) {
498
		return;
502
		return;
Lines 517-527 Link Here
517
			break;
521
			break;
518
		case MAY_NULL :
522
		case MAY_NULL :
519
			if (flowInfo.isDefinitelyNull(local)) {
523
			if (flowInfo.isDefinitelyNull(local)) {
520
				scope.problemReporter().localVariableCanOnlyBeNull(local, reference);
524
				scope.problemReporter().localVariableCanOnlyBeNull(local, reference, isDereference);
521
				return;
525
				return;
522
			}
526
			}
523
			if (flowInfo.isPotentiallyNull(local)) {
527
			if (flowInfo.isPotentiallyNull(local)) {
524
				scope.problemReporter().localVariableMayBeNull(local, reference);
528
				scope.problemReporter().localVariableMayBeNull(local, reference, isDereference);
525
				return;
529
				return;
526
			}
530
			}
527
			break;
531
			break;

Return to bug 170704