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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/core/compiler/IProblem.java (-3 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 719-729 Link Here
719
	int DuplicateModifierForVariable = MethodRelated + 395;
719
	int DuplicateModifierForVariable = MethodRelated + 395;
720
	int IllegalModifierForVariable = MethodRelated + 396;
720
	int IllegalModifierForVariable = MethodRelated + 396;
721
	/** @since 3.1 */
721
	/** @since 3.1 */
722
	int LocalVariableCannotBeNull = Internal + 397;
722
	int LocalVariableCannotBeNull = Internal + 397; // since 3.3: semantics are LocalVariableRedundantCheckOnNonNull
723
	/** @since 3.1 */
723
	/** @since 3.1 */
724
	int LocalVariableCanOnlyBeNull = Internal + 398;
724
	int LocalVariableCanOnlyBeNull = Internal + 398; // since 3.3: split with LocalVariableRedundantCheckOnNull depending on context
725
													 //            this id shares the null dereference errors with LocalVariableMayBeNull
725
	/** @since 3.2 */
726
	/** @since 3.2 */
726
	int LocalVariableMayBeNull = Internal + 399;
727
	int LocalVariableMayBeNull = Internal + 399;
728
	/** @since 3.3 */
729
	int LocalVariableRedundantCheckOnNull = Internal + 392;
727
730
728
	// method verifier problems
731
	// method verifier problems
729
	int AbstractMethodMustBeImplemented = MethodRelated + 400;
732
	int AbstractMethodMustBeImplemented = MethodRelated + 400;
(-)batch/org/eclipse/jdt/internal/compiler/batch/messages.properties (-1 / +2 lines)
Lines 248-254 Link Here
248
\      maskedCatchBlock   + hidden catch block\n\
248
\      maskedCatchBlock   + hidden catch block\n\
249
\      nls                  string literal lacking non-nls tag //$NON-NLS-<n>$\n\
249
\      nls                  string literal lacking non-nls tag //$NON-NLS-<n>$\n\
250
\      noEffectAssign     + assignment without effect\n\
250
\      noEffectAssign     + assignment without effect\n\
251
\      null                 missing or redundant null check\n\
251
\      null                 potential missing or redundant null check\n\
252
\      nullDereference      missing null check\n\
252
\      over-ann             missing @Override annotation\n\
253
\      over-ann             missing @Override annotation\n\
253
\      paramAssign          assignment to a parameter\n\
254
\      paramAssign          assignment to a parameter\n\
254
\      pkgDefaultMethod   + attempt to override package-default method\n\
255
\      pkgDefaultMethod   + attempt to override package-default method\n\
(-)batch/org/eclipse/jdt/internal/compiler/batch/Main.java (-1 / +12 lines)
Lines 1601-1609 Link Here
1601
			CompilerOptions.OPTION_ReportVarargsArgumentNeedCast,
1601
			CompilerOptions.OPTION_ReportVarargsArgumentNeedCast,
1602
			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
1602
			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
1603
	} else if (token.equals("null")) { //$NON-NLS-1$
1603
	} else if (token.equals("null")) { //$NON-NLS-1$
1604
		if (isEnabling) {
1605
			this.options.put(CompilerOptions.OPTION_ReportNullReference,
1606
					CompilerOptions.WARNING);
1607
			this.options.put(CompilerOptions.OPTION_ReportPotentialNullReference,
1608
					CompilerOptions.WARNING);
1609
			this.options.put(CompilerOptions.OPTION_ReportRedundantNullCheck,
1610
					CompilerOptions.WARNING);
1611
		}
1612
	} else if (token.equals("nullDereference")) { //$NON-NLS-1$
1604
		this.options.put(
1613
		this.options.put(
1605
			CompilerOptions.OPTION_ReportNullReference,
1614
			CompilerOptions.OPTION_ReportNullReference,
1606
			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);						
1615
			isEnabling ? CompilerOptions.WARNING : CompilerOptions.IGNORE);
1616
		// no need to position OPTION_ReportPotentialNullReference or
1617
		// OPTION_ReportRedundantNullCheck, which are ignored by default
1607
	} else if (token.equals("boxing")) { //$NON-NLS-1$
1618
	} else if (token.equals("boxing")) { //$NON-NLS-1$
1608
		this.options.put(
1619
		this.options.put(
1609
			CompilerOptions.OPTION_ReportAutoboxing,
1620
			CompilerOptions.OPTION_ReportAutoboxing,
(-)compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties (+1 lines)
Lines 320-325 Link Here
320
###[obsolete] 394 = The imported type {0} is defined in an inherited type and an enclosing scope
320
###[obsolete] 394 = The imported type {0} is defined in an inherited type and an enclosing scope
321
321
322
391 = The static import {0} must be a field or member type
322
391 = The static import {0} must be a field or member type
323
392 = The variable {0} can only be null; it was either set to null or checked for null when last used
323
324
324
395 = Duplicate modifier for the variable {0}
325
395 = Duplicate modifier for the variable {0}
325
396 = Illegal modifier for the variable {0}; only final is permitted
326
396 = Illegal modifier for the variable {0}; only final is permitted
(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-4 / +21 lines)
Lines 184-193 Link Here
184
		case IProblem.ConstructorVarargsArgumentNeedCast :
184
		case IProblem.ConstructorVarargsArgumentNeedCast :
185
			return CompilerOptions.VarargsArgumentNeedCast;
185
			return CompilerOptions.VarargsArgumentNeedCast;
186
186
187
		case IProblem.LocalVariableCannotBeNull :
187
		case IProblem.LocalVariableCanOnlyBeNull:
188
		case IProblem.LocalVariableCanOnlyBeNull :
189
		case IProblem.LocalVariableMayBeNull :
190
			return CompilerOptions.NullReference;
188
			return CompilerOptions.NullReference;
189
190
		case IProblem.LocalVariableMayBeNull:
191
			return CompilerOptions.PotentialNullReference;
192
			
193
		case IProblem.LocalVariableCannotBeNull:
194
		case IProblem.LocalVariableRedundantCheckOnNull:
195
			return CompilerOptions.RedundantNullCheck;
191
			
196
			
192
		case IProblem.BoxingConversion :
197
		case IProblem.BoxingConversion :
193
		case IProblem.UnboxingConversion :
198
		case IProblem.UnboxingConversion :
Lines 4385-4391 Link Here
4385
	if (severity == ProblemSeverities.Ignore) return;
4390
	if (severity == ProblemSeverities.Ignore) return;
4386
	String[] arguments = new String[] {new String(local.name)  };
4391
	String[] arguments = new String[] {new String(local.name)  };
4387
	this.handle(
4392
	this.handle(
4388
		IProblem.LocalVariableCanOnlyBeNull,
4393
			IProblem.LocalVariableCanOnlyBeNull,
4389
		arguments,
4394
		arguments,
4390
		arguments,
4395
		arguments,
4391
		severity,
4396
		severity,
Lines 4438-4443 Link Here
4438
		nodeSourceStart(local, location),
4443
		nodeSourceStart(local, location),
4439
		nodeSourceEnd(local, location));
4444
		nodeSourceEnd(local, location));
4440
}
4445
}
4446
public void localVariableRedundantCheckOnNull(LocalVariableBinding local, ASTNode location) {
4447
	int severity = computeSeverity(IProblem.LocalVariableRedundantCheckOnNull);
4448
	if (severity == ProblemSeverities.Ignore) return;
4449
	String[] arguments = new String[] {new String(local.name)  };
4450
	this.handle(
4451
		IProblem.LocalVariableRedundantCheckOnNull,
4452
		arguments,
4453
		arguments,
4454
		severity,
4455
		nodeSourceStart(local, location),
4456
		nodeSourceEnd(local, location));
4457
}
4441
public void methodMustOverride(AbstractMethodDeclaration method) {
4458
public void methodMustOverride(AbstractMethodDeclaration method) {
4442
	MethodBinding binding = method.binding;
4459
	MethodBinding binding = method.binding;
4443
	this.handle(
4460
	this.handle(
(-)compiler/org/eclipse/jdt/internal/compiler/flow/FinallyFlowContext.java (-3 / +3 lines)
Lines 99-105 Link Here
99
					}
99
					}
100
				case CAN_ONLY_NULL:
100
				case CAN_ONLY_NULL:
101
					if (flowInfo.isDefinitelyNull(local)) {
101
					if (flowInfo.isDefinitelyNull(local)) {
102
						scope.problemReporter().localVariableCanOnlyBeNull(local, expression);
102
						scope.problemReporter().localVariableRedundantCheckOnNull(local, expression);
103
					}
103
					}
104
					break;
104
					break;
105
				case MAY_NULL :
105
				case MAY_NULL :
Lines 170-176 Link Here
170
						return;
170
						return;
171
					}
171
					}
172
					if (flowInfo.canOnlyBeNull(local)) {
172
					if (flowInfo.canOnlyBeNull(local)) {
173
						scope.problemReporter().localVariableCanOnlyBeNull(local, reference);
173
						scope.problemReporter().localVariableRedundantCheckOnNull(local, reference);
174
						return;
174
						return;
175
					}
175
					}
176
					break;
176
					break;
Lines 196-202 Link Here
196
					}
196
					}
197
				case CAN_ONLY_NULL:
197
				case CAN_ONLY_NULL:
198
					if (flowInfo.isDefinitelyNull(local)) {
198
					if (flowInfo.isDefinitelyNull(local)) {
199
						scope.problemReporter().localVariableCanOnlyBeNull(local, reference);
199
						scope.problemReporter().localVariableRedundantCheckOnNull(local, reference);
200
						return;
200
						return;
201
					}
201
					}
202
					break;
202
					break;
(-)compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java (-5 / +5 lines)
Lines 136-149 Link Here
136
					}
136
					}
137
					if (flowInfo.isDefinitelyNull(local)) {
137
					if (flowInfo.isDefinitelyNull(local)) {
138
						this.nullReferences[i] = null;
138
						this.nullReferences[i] = null;
139
						scope.problemReporter().localVariableCanOnlyBeNull(local, expression);
139
						scope.problemReporter().localVariableRedundantCheckOnNull(local, expression);
140
						continue;
140
						continue;
141
					}
141
					}
142
					break;
142
					break;
143
				case CAN_ONLY_NULL :
143
				case CAN_ONLY_NULL :
144
					if (flowInfo.isDefinitelyNull(local)) {
144
					if (flowInfo.isDefinitelyNull(local)) {
145
						this.nullReferences[i] = null;
145
						this.nullReferences[i] = null;
146
						scope.problemReporter().localVariableCanOnlyBeNull(local, expression);
146
						scope.problemReporter().localVariableRedundantCheckOnNull(local, expression);
147
						continue;
147
						continue;
148
					}
148
					}
149
					break;
149
					break;
Lines 177-183 Link Here
177
				case CAN_ONLY_NULL :
177
				case CAN_ONLY_NULL :
178
					if (flowInfo.isDefinitelyNull(local)) {
178
					if (flowInfo.isDefinitelyNull(local)) {
179
						this.nullReferences[i] = null;
179
						this.nullReferences[i] = null;
180
						scope.problemReporter().localVariableCanOnlyBeNull(local, expression);
180
						scope.problemReporter().localVariableRedundantCheckOnNull(local, expression);
181
						continue;
181
						continue;
182
					}
182
					}
183
					break;
183
					break;
Lines 329-335 Link Here
329
				return;
329
				return;
330
			}
330
			}
331
			if (flowInfo.isDefinitelyNull(local)) {
331
			if (flowInfo.isDefinitelyNull(local)) {
332
				scope.problemReporter().localVariableCanOnlyBeNull(local, reference);
332
				scope.problemReporter().localVariableRedundantCheckOnNull(local, reference);
333
				return;
333
				return;
334
			}
334
			}
335
			if (flowInfo.cannotBeDefinitelyNullOrNonNull(local)) {
335
			if (flowInfo.cannotBeDefinitelyNullOrNonNull(local)) {
Lines 347-353 Link Here
347
				return;
347
				return;
348
			}
348
			}
349
			if (flowInfo.isDefinitelyNull(local)) {
349
			if (flowInfo.isDefinitelyNull(local)) {
350
				scope.problemReporter().localVariableCanOnlyBeNull(local, reference);
350
				scope.problemReporter().localVariableRedundantCheckOnNull(local, reference);
351
				return;
351
				return;
352
			}
352
			}
353
			recordNullReference(local, reference, checkType);
353
			recordNullReference(local, reference, checkType);
(-)compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java (-1 / +1 lines)
Lines 508-514 Link Here
508
			}
508
			}
509
		case CAN_ONLY_NULL:
509
		case CAN_ONLY_NULL:
510
			if (flowInfo.isDefinitelyNull(local)) {
510
			if (flowInfo.isDefinitelyNull(local)) {
511
				scope.problemReporter().localVariableCanOnlyBeNull(local, reference);
511
				scope.problemReporter().localVariableRedundantCheckOnNull(local, reference);
512
				return;
512
				return;
513
			}
513
			}
514
			else if (flowInfo.cannotBeDefinitelyNullOrNonNull(local)) {
514
			else if (flowInfo.cannotBeDefinitelyNullOrNonNull(local)) {
(-)compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java (-3 / +14 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
2
 * Copyright (c) 2000, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
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_ReportPotentialNullReference = "org.eclipse.jdt.core.compiler.problem.potentialNullReference"; //$NON-NLS-1$
98
	public static final String OPTION_ReportRedundantNullCheck = "org.eclipse.jdt.core.compiler.problem.redundantNullCheck"; //$NON-NLS-1$
97
	public static final String OPTION_ReportAutoboxing = "org.eclipse.jdt.core.compiler.problem.autoboxing"; //$NON-NLS-1$
99
	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$
100
	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$
101
	public static final String OPTION_ReportMissingOverrideAnnotation = "org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation"; //$NON-NLS-1$
Lines 194-199 Link Here
194
	public static final long ParameterAssignment = ASTNode.Bit48L;
196
	public static final long ParameterAssignment = ASTNode.Bit48L;
195
	public static final long FallthroughCase = ASTNode.Bit49L;
197
	public static final long FallthroughCase = ASTNode.Bit49L;
196
	public static final long OverridingMethodWithoutSuperInvocation = ASTNode.Bit50L;
198
	public static final long OverridingMethodWithoutSuperInvocation = ASTNode.Bit50L;
199
	public static final long PotentialNullReference = ASTNode.Bit51L;
200
	public static final long RedundantNullCheck = ASTNode.Bit52L;
201
197
	
202
	
198
	// Default severity level for handlers
203
	// Default severity level for handlers
199
	public long errorThreshold = 0;
204
	public long errorThreshold = 0;
Lines 413-419 Link Here
413
		optionsMap.put(OPTION_MaxProblemPerUnit, String.valueOf(this.maxProblemsPerUnit));
418
		optionsMap.put(OPTION_MaxProblemPerUnit, String.valueOf(this.maxProblemsPerUnit));
414
		optionsMap.put(OPTION_InlineJsr, this.inlineJsrBytecode ? ENABLED : DISABLED); 
419
		optionsMap.put(OPTION_InlineJsr, this.inlineJsrBytecode ? ENABLED : DISABLED); 
415
		optionsMap.put(OPTION_ReportNullReference, getSeverityString(NullReference));
420
		optionsMap.put(OPTION_ReportNullReference, getSeverityString(NullReference));
416
		optionsMap.put(OPTION_SuppressWarnings, this.suppressWarnings ? ENABLED : DISABLED); 
421
		optionsMap.put(OPTION_ReportPotentialNullReference, getSeverityString(PotentialNullReference));
422
		optionsMap.put(OPTION_ReportRedundantNullCheck, getSeverityString(RedundantNullCheck));
423
			optionsMap.put(OPTION_SuppressWarnings, this.suppressWarnings ? ENABLED : DISABLED); 
417
		optionsMap.put(OPTION_ReportUnhandledWarningToken, getSeverityString(UnhandledWarningToken));
424
		optionsMap.put(OPTION_ReportUnhandledWarningToken, getSeverityString(UnhandledWarningToken));
418
		optionsMap.put(OPTION_ReportParameterAssignment, getSeverityString(ParameterAssignment));
425
		optionsMap.put(OPTION_ReportParameterAssignment, getSeverityString(ParameterAssignment));
419
		optionsMap.put(OPTION_ReportFallthroughCase, getSeverityString(FallthroughCase));
426
		optionsMap.put(OPTION_ReportFallthroughCase, getSeverityString(FallthroughCase));
Lines 652-657 Link Here
652
		if ((optionValue = optionsMap.get(OPTION_ReportDiscouragedReference)) != null) updateSeverity(DiscouragedReference, optionValue);
659
		if ((optionValue = optionsMap.get(OPTION_ReportDiscouragedReference)) != null) updateSeverity(DiscouragedReference, optionValue);
653
		if ((optionValue = optionsMap.get(OPTION_ReportVarargsArgumentNeedCast)) != null) updateSeverity(VarargsArgumentNeedCast, optionValue);
660
		if ((optionValue = optionsMap.get(OPTION_ReportVarargsArgumentNeedCast)) != null) updateSeverity(VarargsArgumentNeedCast, optionValue);
654
		if ((optionValue = optionsMap.get(OPTION_ReportNullReference)) != null) updateSeverity(NullReference, optionValue);
661
		if ((optionValue = optionsMap.get(OPTION_ReportNullReference)) != null) updateSeverity(NullReference, optionValue);
662
		if ((optionValue = optionsMap.get(OPTION_ReportPotentialNullReference)) != null) updateSeverity(PotentialNullReference, optionValue);
663
		if ((optionValue = optionsMap.get(OPTION_ReportRedundantNullCheck)) != null) updateSeverity(RedundantNullCheck, optionValue);
655
		if ((optionValue = optionsMap.get(OPTION_ReportAutoboxing)) != null) updateSeverity(AutoBoxing, optionValue);
664
		if ((optionValue = optionsMap.get(OPTION_ReportAutoboxing)) != null) updateSeverity(AutoBoxing, optionValue);
656
		if ((optionValue = optionsMap.get(OPTION_ReportAnnotationSuperInterface)) != null) updateSeverity(AnnotationSuperInterface, optionValue);
665
		if ((optionValue = optionsMap.get(OPTION_ReportAnnotationSuperInterface)) != null) updateSeverity(AnnotationSuperInterface, optionValue);
657
		if ((optionValue = optionsMap.get(OPTION_ReportMissingOverrideAnnotation)) != null) updateSeverity(MissingOverrideAnnotation, optionValue);
666
		if ((optionValue = optionsMap.get(OPTION_ReportMissingOverrideAnnotation)) != null) updateSeverity(MissingOverrideAnnotation, optionValue);
Lines 959-964 Link Here
959
			OPTION_ReportNonExternalizedStringLiteral,
968
			OPTION_ReportNonExternalizedStringLiteral,
960
			OPTION_ReportNonStaticAccessToStatic,
969
			OPTION_ReportNonStaticAccessToStatic,
961
			OPTION_ReportNullReference,
970
			OPTION_ReportNullReference,
971
			OPTION_ReportPotentialNullReference,
972
			OPTION_ReportRedundantNullCheck,
962
			OPTION_ReportOverridingPackageDefaultMethod,
973
			OPTION_ReportOverridingPackageDefaultMethod,
963
			OPTION_ReportParameterAssignment,
974
			OPTION_ReportParameterAssignment,
964
			OPTION_ReportPossibleAccidentalBooleanAssignment,
975
			OPTION_ReportPossibleAccidentalBooleanAssignment,
Lines 1106-1112 Link Here
1106
				if ("nls".equals(warningToken)) //$NON-NLS-1$
1117
				if ("nls".equals(warningToken)) //$NON-NLS-1$
1107
					return NonExternalizedString;
1118
					return NonExternalizedString;
1108
				if ("null".equals(warningToken)) //$NON-NLS-1$
1119
				if ("null".equals(warningToken)) //$NON-NLS-1$
1109
					return NullReference;
1120
					return NullReference | PotentialNullReference | RedundantNullCheck;
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$
(-)src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest.java (+2 lines)
Lines 24-29 Link Here
24
protected Map getCompilerOptions() {
24
protected Map getCompilerOptions() {
25
	Map options = super.getCompilerOptions();
25
	Map options = super.getCompilerOptions();
26
	options.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.ERROR);
26
	options.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.ERROR);
27
	options.put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.ERROR);
28
	options.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.ERROR);
27
	options.put(CompilerOptions.OPTION_ReportNoEffectAssignment, CompilerOptions.ERROR);
29
	options.put(CompilerOptions.OPTION_ReportNoEffectAssignment, CompilerOptions.ERROR);
28
	return options;
30
	return options;
29
}
31
}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java (-2 / +86 lines)
Lines 37-43 Link Here
37
	static {
37
	static {
38
//	TESTS_NAMES = new String[] { "test000" };
38
//	TESTS_NAMES = new String[] { "test000" };
39
//	TESTS_NUMBERS = new int[] { 59 };
39
//	TESTS_NUMBERS = new int[] { 59 };
40
//	TESTS_RANGE = new int[] { 107, -1 };
40
//	TESTS_RANGE = new int[] { 122, -1 };
41
}
41
}
42
public BatchCompilerTest(String name) {
42
public BatchCompilerTest(String name) {
43
	super(name);
43
	super(name);
Lines 1116-1122 Link Here
1116
        "      maskedCatchBlock   + hidden catch block\n" + 
1116
        "      maskedCatchBlock   + hidden catch block\n" + 
1117
        "      nls                  string literal lacking non-nls tag //$NON-NLS-<n>$\n" + 
1117
        "      nls                  string literal lacking non-nls tag //$NON-NLS-<n>$\n" + 
1118
        "      noEffectAssign     + assignment without effect\n" + 
1118
        "      noEffectAssign     + assignment without effect\n" + 
1119
        "      null                 missing or redundant null check\n" + 
1119
        "      null                 potential missing or redundant null check\n" + 
1120
        "      nullDereference      missing null check\n" + 
1120
        "      over-ann             missing @Override annotation\n" + 
1121
        "      over-ann             missing @Override annotation\n" + 
1121
        "      paramAssign          assignment to a parameter\n" + 
1122
        "      paramAssign          assignment to a parameter\n" + 
1122
        "      pkgDefaultMethod   + attempt to override package-default method\n" + 
1123
        "      pkgDefaultMethod   + attempt to override package-default method\n" + 
Lines 1262-1268 Link Here
1262
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod\" value=\"warning\"/>\n" + 
1263
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod\" value=\"warning\"/>\n" + 
1263
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.parameterAssignment\" value=\"ignore\"/>\n" + 
1264
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.parameterAssignment\" value=\"ignore\"/>\n" + 
1264
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment\" value=\"ignore\"/>\n" + 
1265
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment\" value=\"ignore\"/>\n" + 
1266
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.potentialNullReference\" value=\"ignore\"/>\n" +
1265
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.rawTypeReference\" value=\"warning\"/>\n" + 
1267
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.rawTypeReference\" value=\"warning\"/>\n" + 
1268
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantNullCheck\" value=\"ignore\"/>\n" +
1266
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.specialParameterHidingField\" value=\"disabled\"/>\n" + 
1269
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.specialParameterHidingField\" value=\"disabled\"/>\n" + 
1267
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.staticAccessReceiver\" value=\"warning\"/>\n" + 
1270
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.staticAccessReceiver\" value=\"warning\"/>\n" + 
1268
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.suppressWarnings\" value=\"enabled\"/>\n" + 
1271
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.suppressWarnings\" value=\"enabled\"/>\n" + 
Lines 5164-5169 Link Here
5164
		null,
5167
		null,
5165
		null);
5168
		null);
5166
}
5169
}
5170
// null ref option
5171
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704
5172
// adding distinct options to control null checks in more detail
5173
public void test139_null_ref_option(){
5174
	this.runConformTest(
5175
		new String[] {
5176
			"X.java",
5177
			"public class X {\n" + 
5178
			"  void foo() {\n" + 
5179
			"    Object o = null;\n" + 
5180
			"    o.toString();\n" + 
5181
			"  }\n" + 
5182
			"}"},
5183
        "\"" + OUTPUT_DIR +  File.separator + "X.java\""
5184
        + " -1.5 -g -preserveAllLocals"
5185
        + " -bootclasspath " + getLibraryClasses()
5186
        + " -cp " + getJCEJar()
5187
        + " -warn:+nullDereference"
5188
        + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
5189
        "", 
5190
        "----------\n" + 
5191
        "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" + 
5192
        "	o.toString();\n" + 
5193
        "	^\n" + 
5194
        "The variable o can only be null; it was either set to null or checked for null when last used\n" + 
5195
        "----------\n" + 
5196
        "1 problem (1 warning)",
5197
        true);
5198
}
5199
// null ref option
5200
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704
5201
// adding distinct options to control null checks in more detail
5202
public void test140_null_ref_option(){
5203
	this.runConformTest(
5204
		new String[] {
5205
			"X.java",
5206
			"public class X {\n" + 
5207
			"  void foo() {\n" + 
5208
			"    Object o = null;\n" + 
5209
			"    if (o == null) {}\n" + 
5210
			"  }\n" + 
5211
			"}"},
5212
     "\"" + OUTPUT_DIR +  File.separator + "X.java\""
5213
     + " -1.5 -g -preserveAllLocals"
5214
     + " -bootclasspath " + getLibraryClasses()
5215
     + " -cp " + getJCEJar()
5216
     + " -warn:+null"
5217
     + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
5218
     "", 
5219
     "----------\n" + 
5220
     "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" + 
5221
     "	if (o == null) {}\n" + 
5222
     "	    ^\n" + 
5223
     "The variable o can only be null; it was either set to null or checked for null when last used\n" + 
5224
     "----------\n" + 
5225
     "1 problem (1 warning)",
5226
     true);
5227
}
5228
// null ref option
5229
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704
5230
// adding distinct options to control null checks in more detail
5231
public void test141_null_ref_option(){
5232
	this.runConformTest(
5233
		new String[] {
5234
			"X.java",
5235
			"public class X {\n" + 
5236
			"  void foo() {\n" + 
5237
			"    Object o = null;\n" + 
5238
			"    if (o == null) {}\n" + 
5239
			"  }\n" + 
5240
			"}"},
5241
  "\"" + OUTPUT_DIR +  File.separator + "X.java\""
5242
  + " -1.5 -g -preserveAllLocals"
5243
  + " -bootclasspath " + getLibraryClasses()
5244
  + " -cp " + getJCEJar()
5245
  + " -warn:+nullDereference"
5246
  + " -proceedOnError -referenceInfo -d \"" + OUTPUT_DIR + "\"",
5247
  "", 
5248
  "",
5249
  true);
5250
}
5167
public static Class testClass() {
5251
public static Class testClass() {
5168
	return BatchCompilerTest.class;
5252
	return BatchCompilerTest.class;
5169
}
5253
}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java (-8 / +328 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2006 IBM Corporation and others.
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 33-39 Link Here
33
//    	TESTS_RANGE = new int[] { 2050, -1 }; 
33
//    	TESTS_RANGE = new int[] { 2050, -1 }; 
34
//  	TESTS_RANGE = new int[] { 1, 2049 }; 
34
//  	TESTS_RANGE = new int[] { 1, 2049 }; 
35
//  	TESTS_RANGE = new int[] { 449, 451 }; 
35
//  	TESTS_RANGE = new int[] { 449, 451 }; 
36
//    	TESTS_RANGE = new int[] { 900, 999 }; 
36
//    	TESTS_RANGE = new int[] { 1050, 1099 }; 
37
  	}
37
  	}
38
38
39
public static Test suite() {
39
public static Test suite() {
Lines 44-56 Link Here
44
    return NullReferenceTest.class;
44
    return NullReferenceTest.class;
45
}
45
}
46
46
47
// Augment problem detection settings
47
// Conditionally augment problem detection settings
48
static boolean setNullRelatedOptions = true;
48
protected Map getCompilerOptions() {
49
protected Map getCompilerOptions() {
49
    Map defaultOptions = super.getCompilerOptions();
50
    Map defaultOptions = super.getCompilerOptions();
50
//    defaultOptions.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.WARNING);
51
    if (setNullRelatedOptions) {
51
    defaultOptions.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.ERROR);
52
	    defaultOptions.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.ERROR);
52
	defaultOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
53
	    defaultOptions.put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.ERROR);
53
//    defaultOptions.put(CompilerOptions.OPTION_ReportNoEffectAssignment, CompilerOptions.WARNING);
54
	    defaultOptions.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.ERROR);
55
		defaultOptions.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
56
    }
54
    return defaultOptions;
57
    return defaultOptions;
55
}
58
}
56
  
59
  
Lines 7856-7862 Link Here
7856
		"The variable o can only be null; it was either set to null or checked for null when last used\n" + 
7859
		"The variable o can only be null; it was either set to null or checked for null when last used\n" + 
7857
		"----------\n");
7860
		"----------\n");
7858
}
7861
}
7859
7862
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704
7863
// adding distinct options to control null checks in more detail
7864
// default for null options is Ignore
7865
public void test1050_options_all_default() {
7866
	try {
7867
		setNullRelatedOptions = false;
7868
		this.runConformTest(
7869
			new String[] {
7870
				"X.java",
7871
				  "public class X {\n" + 
7872
				  "  void foo(Object p) {\n" + 
7873
				  "    Object o = null;\n" +
7874
				  "    if (o != null) {\n" +
7875
				  "       o = null;\n" +
7876
				  "    }\n" +
7877
				  "    if (p == null) {}\n" + // taint p 
7878
				  "    o.toString();\n" +
7879
				  "    p.toString();\n" + 
7880
				  "  }\n" + 
7881
				  "}\n"});
7882
	}
7883
	finally {
7884
		setNullRelatedOptions = true;
7885
	}
7886
}
7887
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704
7888
// adding distinct options to control null checks in more detail
7889
// all null options set to Ignore
7890
public void test1051_options_all_ignore() {
7891
	Map customOptions = getCompilerOptions();
7892
	customOptions.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.IGNORE);
7893
	customOptions.put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.IGNORE);
7894
    customOptions.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.IGNORE);
7895
	this.runConformTest(
7896
			new String[] {
7897
				"X.java",
7898
				  "public class X {\n" + 
7899
				  "  void foo(Object p) {\n" + 
7900
				  "    Object o = null;\n" +
7901
				  "    if (o != null) {\n" +
7902
				  "       o = null;\n" +
7903
				  "    }\n" +
7904
				  "    if (p == null) {}\n" + // taint p 
7905
				  "    o.toString();\n" +
7906
				  "    p.toString();\n" + 
7907
				  "  }\n" + 
7908
				  "}\n"},
7909
			null /* no expected output string */, 
7910
			null /* no extra class libraries */, 
7911
			true /* flush output directory */, 
7912
			null /* no vm arguments */,
7913
			customOptions,
7914
			null /* no custom requestor*/,
7915
		  	false /* do not skip javac for this peculiar test */);	
7916
}
7917
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704
7918
// adding distinct options to control null checks in more detail
7919
// all options set to error
7920
public void test1052_options_all_error() {
7921
	this.runNegativeTest(
7922
		new String[] {
7923
			"X.java",
7924
			  "public class X {\n" + 
7925
			  "  void foo(Object p) {\n" + 
7926
			  "    Object o = null;\n" +
7927
			  "    if (o != null) {\n" +
7928
			  "       o = null;\n" +
7929
			  "    }\n" +
7930
			  "    if (p == null) {}\n" + // taint p 
7931
			  "    o.toString();\n" +
7932
			  "    p.toString();\n" + 
7933
			  "  }\n" + 
7934
			  "}\n"},
7935
		"----------\n" + 
7936
		"1. ERROR in X.java (at line 4)\r\n" + 
7937
		"	if (o != null) {\r\n" + 
7938
		"	    ^\n" + 
7939
		"The variable o can only be null; it was either set to null or checked for null when last used\n" + 
7940
		"----------\n" + 
7941
		"2. ERROR in X.java (at line 8)\r\n" + 
7942
		"	o.toString();\r\n" + 
7943
		"	^\n" + 
7944
		"The variable o can only be null; it was either set to null or checked for null when last used\n" + 
7945
		"----------\n" + 
7946
		"3. ERROR in X.java (at line 9)\r\n" + 
7947
		"	p.toString();\r\n" + 
7948
		"	^\n" + 
7949
		"The variable p may be null\n" + 
7950
		"----------\n");
7951
}
7952
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704
7953
// adding distinct options to control null checks in more detail
7954
// selectively changing error levels
7955
public void test1053_options_mix() {
7956
	Map customOptions = getCompilerOptions();
7957
	customOptions.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.ERROR);
7958
	customOptions.put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.IGNORE);
7959
	customOptions.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.IGNORE);
7960
	this.runNegativeTest(
7961
		new String[] {
7962
			"X.java",
7963
			  "public class X {\n" + 
7964
			  "  void foo(Object p) {\n" + 
7965
			  "    Object o = null;\n" +
7966
			  "    if (o != null) {\n" +
7967
			  "       o = null;\n" +
7968
			  "    }\n" +
7969
			  "    if (p == null) {}\n" + // taint p 
7970
			  "    o.toString();\n" +
7971
			  "    p.toString();\n" + 
7972
			  "  }\n" + 
7973
			  "}\n"},
7974
		"----------\n" + 
7975
		"1. ERROR in X.java (at line 8)\r\n" + 
7976
		"	o.toString();\r\n" + 
7977
		"	^\n" + 
7978
		"The variable o can only be null; it was either set to null or checked for null when last used\n" + 
7979
		"----------\n",
7980
		null /* no extra class libraries */, 
7981
		true /* flush output directory */, 
7982
		customOptions,
7983
		false /* do not generate output */,
7984
		false /* do not show category */, 
7985
		false /* do not show warning token */, 
7986
		false  /* do not skip javac for this peculiar test */,
7987
		false  /* do not perform statements recovery */);
7988
}
7989
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704
7990
// adding distinct options to control null checks in more detail
7991
// selectively changing error levels
7992
public void test1054_options_mix() {
7993
	Map customOptions = getCompilerOptions();
7994
	customOptions.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.WARNING);
7995
	customOptions.put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.IGNORE);
7996
	customOptions.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.ERROR);
7997
	this.runNegativeTest(
7998
		new String[] {
7999
			"X.java",
8000
			  "public class X {\n" + 
8001
			  "  void foo(Object p) {\n" + 
8002
			  "    Object o = null;\n" +
8003
			  "    if (o != null) {\n" +
8004
			  "       o = null;\n" +
8005
			  "    }\n" +
8006
			  "    if (p == null) {}\n" + // taint p 
8007
			  "    o.toString();\n" +
8008
			  "    p.toString();\n" + 
8009
			  "  }\n" + 
8010
			  "}\n"},
8011
		"----------\n" + 
8012
		"1. ERROR in X.java (at line 4)\r\n" + 
8013
		"	if (o != null) {\r\n" + 
8014
		"	    ^\n" + 
8015
		"The variable o can only be null; it was either set to null or checked for null when last used\n" + 
8016
		"----------\n" + 
8017
		"2. WARNING in X.java (at line 8)\r\n" + 
8018
		"	o.toString();\r\n" + 
8019
		"	^\n" + 
8020
		"The variable o can only be null; it was either set to null or checked for null when last used\n" + 
8021
		"----------\n",
8022
		null /* no extra class libraries */, 
8023
		true /* flush output directory */, 
8024
		customOptions,
8025
		false /* do not generate output */,
8026
		false /* do not show category */, 
8027
		false /* do not show warning token */, 
8028
		false  /* do not skip javac for this peculiar test */,
8029
		false  /* do not perform statements recovery */);
8030
}
8031
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704
8032
// adding distinct options to control null checks in more detail
8033
// selectively changing error levels
8034
public void test1055_options_mix() {
8035
	Map customOptions = getCompilerOptions();
8036
	customOptions.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.IGNORE);
8037
	customOptions.put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.ERROR);
8038
	customOptions.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.ERROR);
8039
	this.runNegativeTest(
8040
		new String[] {
8041
			"X.java",
8042
			  "public class X {\n" + 
8043
			  "  void foo(Object p) {\n" + 
8044
			  "    Object o = null;\n" +
8045
			  "    if (o != null) {\n" +
8046
			  "       o = null;\n" +
8047
			  "    }\n" +
8048
			  "    if (p == null) {}\n" + // taint p 
8049
			  "    o.toString();\n" +
8050
			  "    p.toString();\n" + 
8051
			  "  }\n" + 
8052
			  "}\n"},
8053
		"----------\n" + 
8054
		"1. ERROR in X.java (at line 4)\r\n" + 
8055
		"	if (o != null) {\r\n" + 
8056
		"	    ^\n" + 
8057
		"The variable o can only be null; it was either set to null or checked for null when last used\n" + 
8058
		"----------\n" + 
8059
		"2. ERROR in X.java (at line 9)\r\n" + 
8060
		"	p.toString();\r\n" + 
8061
		"	^\n" + 
8062
		"The variable p may be null\n" + 
8063
		"----------\n",
8064
		null /* no extra class libraries */, 
8065
		true /* flush output directory */, 
8066
		customOptions,
8067
		false /* do not generate output */,
8068
		false /* do not show category */, 
8069
		false /* do not show warning token */, 
8070
		false  /* do not skip javac for this peculiar test */,
8071
		false  /* do not perform statements recovery */);
8072
}
8073
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704
8074
// adding distinct options to control null checks in more detail
8075
// selectively changing error levels
8076
public void test1056_options_mix_with_SuppressWarnings() {
8077
	if (complianceLevel.compareTo(COMPLIANCE_1_5) >= 0) {
8078
	Map customOptions = getCompilerOptions();
8079
	customOptions.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.ERROR);
8080
	customOptions.put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.WARNING);
8081
	customOptions.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.WARNING);
8082
	this.runNegativeTest(
8083
		new String[] {
8084
			"X.java",
8085
			  "public class X {\n" + 
8086
			  "@SuppressWarnings(\"null\")\n" + 
8087
			  "  void foo(Object p) {\n" + 
8088
			  "    Object o = null;\n" +
8089
			  "    if (o != null) {\n" +
8090
			  "       o = null;\n" +
8091
			  "    }\n" +
8092
			  "    if (p == null) {}\n" + // taint p 
8093
			  "    o.toString();\n" +
8094
			  "    p.toString();\n" + 
8095
			  "  }\n" + 
8096
			  "}\n"},
8097
		"----------\n" + 
8098
		"1. ERROR in X.java (at line 9)\r\n" + 
8099
		"	o.toString();\r\n" + 
8100
		"	^\n" + 
8101
		"The variable o can only be null; it was either set to null or checked for null when last used\n" + 
8102
		"----------\n",
8103
		null /* no extra class libraries */, 
8104
		true /* flush output directory */, 
8105
		customOptions,
8106
		false /* do not generate output */,
8107
		false /* do not show category */, 
8108
		false /* do not show warning token */, 
8109
		false  /* do not skip javac for this peculiar test */,
8110
		false  /* do not perform statements recovery */);
8111
	}
8112
}
8113
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704
8114
// adding distinct options to control null checks in more detail
8115
public void test1057_options_instanceof_is_check() {
8116
	this.runNegativeTest(
8117
		new String[] {
8118
			"X.java",
8119
			  "public class X {\n" + 
8120
			  "  void foo(Object p) {\n" + 
8121
			  "    Object o = null;\n" +
8122
			  "    if (p == null) {}\n" + // taint p 
8123
			  "    if (o instanceof String) {};\n" +
8124
			  "    if (p instanceof String) {};\n" + 
8125
			  "  }\n" + 
8126
			  "}\n"},
8127
		"----------\n" + 
8128
		"1. ERROR in X.java (at line 5)\n" + 
8129
		"	if (o instanceof String) {};\n" + 
8130
		"	    ^\n" + 
8131
		"The variable o can only be null; it was either set to null or checked for null when last used\n" + 
8132
		"----------\n");
8133
}
8134
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704
8135
// adding distinct options to control null checks in more detail
8136
public void test1058_options_instanceof_is_check() {
8137
	Map customOptions = getCompilerOptions();
8138
	customOptions.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.IGNORE);
8139
	this.runConformTest(
8140
		new String[] {
8141
			"X.java",
8142
			  "public class X {\n" + 
8143
			  "  void foo(Object p) {\n" + 
8144
			  "    Object o = null;\n" +
8145
			  "    if (p == null) {}\n" + // taint p 
8146
			  "    if (o instanceof String) {};\n" +
8147
			  "    if (p instanceof String) {};\n" + 
8148
			  "  }\n" + 
8149
			  "}\n"},
8150
		null /* no expected output string */, 
8151
		null /* no extra class libraries */, 
8152
		true /* flush output directory */, 
8153
		null /* no vm arguments */,
8154
		customOptions,
8155
		null /* no custom requestor*/,
8156
	  	false /* do not skip javac for this peculiar test */);	
8157
}
8158
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=170704
8159
// adding distinct options to control null checks in more detail
8160
public void test1059_options_cannot_be_null_check() {
8161
	Map customOptions = getCompilerOptions();
8162
	customOptions.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.IGNORE);
8163
	this.runConformTest(
8164
		new String[] {
8165
			"X.java",
8166
			  "public class X {\n" + 
8167
			  "  void foo(Object p) {\n" + 
8168
			  "    Object o = new Object();\n" +
8169
			  "    if (o == null) {}\n" + 
8170
			  "  }\n" + 
8171
			  "}\n"},
8172
		null /* no expected output string */, 
8173
		null /* no extra class libraries */, 
8174
		true /* flush output directory */, 
8175
		null /* no vm arguments */,
8176
		customOptions,
8177
		null /* no custom requestor*/,
8178
	  	false /* do not skip javac for this peculiar test */);	
8179
}
7860
// encoding validation
8180
// encoding validation
7861
public void test1500() {
8181
public void test1500() {
7862
	this.runConformTest(
8182
	this.runConformTest(

Return to bug 170704