View | Details | Raw Unified | Return to bug 338303
Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-1 / +5 lines)
Lines 8-14 Link Here
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Benjamin Muskalla - Contribution for bug 239066
10
 *     Benjamin Muskalla - Contribution for bug 239066
11
 *     Stephan Herrmann  - Contribution for bug 236385
11
 *     Stephan Herrmann  - Contributions for 
12
 *     						bug 236385 - 
13
 *     						bug 338303 - Warning about Redundant assignment conflicts with definite assignment
12
 *******************************************************************************/
14
 *******************************************************************************/
13
package org.eclipse.jdt.internal.compiler.problem;
15
package org.eclipse.jdt.internal.compiler.problem;
14
16
Lines 4981-4986 Link Here
4981
}
4983
}
4982
4984
4983
public void localVariableRedundantNullAssignment(LocalVariableBinding local, ASTNode location) {
4985
public void localVariableRedundantNullAssignment(LocalVariableBinding local, ASTNode location) {
4986
	if ((location.bits & ASTNode.FirstAssignmentToLocal) != 0) // https://bugs.eclipse.org/338303 - Warning about Redundant assignment conflicts with definite assignment
4987
		return;
4984
	int severity = computeSeverity(IProblem.RedundantLocalVariableNullAssignment);
4988
	int severity = computeSeverity(IProblem.RedundantLocalVariableNullAssignment);
4985
	if (severity == ProblemSeverities.Ignore) return;
4989
	if (severity == ProblemSeverities.Ignore) return;
4986
	String[] arguments = new String[] {new String(local.name)  };
4990
	String[] arguments = new String[] {new String(local.name)  };
(-)src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java (-1 / +30 lines)
Lines 8-14 Link Here
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for
10
 *     Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for
11
 *     			bugs 325755, 133125, 292478, 319201, 320170 and 332637
11
 *     			bugs 325755, 133125, 292478, 319201, 320170, 332637 and 338303
12
 *******************************************************************************/
12
 *******************************************************************************/
13
package org.eclipse.jdt.core.tests.compiler.regression;
13
package org.eclipse.jdt.core.tests.compiler.regression;
14
14
Lines 14025-14028 Link Here
14025
		},
14025
		},
14026
		"");
14026
		"");
14027
}
14027
}
14028
// https://bugs.eclipse.org/338303 - Warning about Redundant assignment conflicts with definite assignment
14029
public void testBug338303() {
14030
	this.runConformTest(
14031
		new String[] {
14032
			"Bug338303.java",
14033
			"import java.io.File;\n" + 
14034
			"import java.io.IOException;\n" + 
14035
			"\n" + 
14036
			"public class Bug338303 {\n" + 
14037
			"   Object test(Object in, final File f) {\n" + 
14038
			"        Object local;\n" + 
14039
			"        try {\n" + 
14040
			"            local = in;\n" + 
14041
			"            if (local == null)\n" + 
14042
			"                local = loadEntry(f, false);\n" + 
14043
			"        } catch (final IOException e) {\n" + 
14044
			"            e.printStackTrace();\n" + 
14045
			"            local = null;\n" + 
14046
			"        }\n" + 
14047
			"        return local;\n" + 
14048
			"    }\n" + 
14049
			"\n" + 
14050
			"    private Object loadEntry(File f, boolean b)  throws IOException {\n" + 
14051
			"        throw new IOException();\n" + 
14052
			"    }\n" + 
14053
			"}\n"
14054
		},
14055
		"");
14056
}
14028
}
14057
}

Return to bug 338303