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

(-)compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java (-3 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 8-15 Link Here
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Genady Beriozkin - added support for reporting assignment with no effect
10
 *     Genady Beriozkin - added support for reporting assignment with no effect
11
 *     Stephan Herrmann <stephan@cs.tu-berlin.de> - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE
11
 *     Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for 
12
 *     												and bug 292478 - Report potentially null across variable assignment
12
 * 							bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE
13
 * 							bug 292478 - Report potentially null across variable assignment
14
 *     						bug 335093 - [compiler][null] minimal hook for future null annotation support
13
 *******************************************************************************/
15
 *******************************************************************************/
14
package org.eclipse.jdt.internal.compiler.ast;
16
package org.eclipse.jdt.internal.compiler.ast;
15
17
Lines 52-57 Link Here
52
	flowInfo = ((Reference) this.lhs)
54
	flowInfo = ((Reference) this.lhs)
53
		.analyseAssignment(currentScope, flowContext, flowInfo, this, false)
55
		.analyseAssignment(currentScope, flowContext, flowInfo, this, false)
54
		.unconditionalInits();
56
		.unconditionalInits();
57
	nullStatus = checkAgainstNullAnnotation(currentScope, local, nullStatus);
55
	if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) {
58
	if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) {
56
		flowInfo.markNullStatus(local, nullStatus);
59
		flowInfo.markNullStatus(local, nullStatus);
57
		if (flowContext.initsOnFinally != null)
60
		if (flowContext.initsOnFinally != null)
(-)compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java (-3 / +6 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 7-14 Link Here
7
 *
7
 *
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> - Contribution for bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE
10
 *     Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for 
11
 *     												and bug 292478 - Report potentially null across variable assignment
11
 *     						bug 319201 - [null] no warning when unboxing SingleNameReference causes NPE
12
 *     						bug 292478 - Report potentially null across variable assignment
13
 *     						bug 335093 - [compiler][null] minimal hook for future null annotation support
12
 *******************************************************************************/
14
 *******************************************************************************/
13
package org.eclipse.jdt.internal.compiler.ast;
15
package org.eclipse.jdt.internal.compiler.ast;
14
16
Lines 80-85 Link Here
80
		this.bits &= ~FirstAssignmentToLocal;  // int i = (i = 0);
82
		this.bits &= ~FirstAssignmentToLocal;  // int i = (i = 0);
81
	}
83
	}
82
	flowInfo.markAsDefinitelyAssigned(this.binding);
84
	flowInfo.markAsDefinitelyAssigned(this.binding);
85
	nullStatus = checkAgainstNullAnnotation(currentScope, this.binding, nullStatus);		
83
	if ((this.binding.type.tagBits & TagBits.IsBaseType) == 0) {
86
	if ((this.binding.type.tagBits & TagBits.IsBaseType) == 0) {
84
		flowInfo.markNullStatus(this.binding, nullStatus);
87
		flowInfo.markNullStatus(this.binding, nullStatus);
85
		// no need to inform enclosing try block since its locals won't get
88
		// no need to inform enclosing try block since its locals won't get
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java (+6 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 *     Stephan Herrmann - Contribution for bug 335093 - [compiler][null] minimal hook for future null annotation support
10
 *******************************************************************************/
11
 *******************************************************************************/
11
package org.eclipse.jdt.internal.compiler.ast;
12
package org.eclipse.jdt.internal.compiler.ast;
12
13
Lines 54-59 Link Here
54
	public static final int COMPLAINED_FAKE_REACHABLE = 1;
55
	public static final int COMPLAINED_FAKE_REACHABLE = 1;
55
	public static final int COMPLAINED_UNREACHABLE = 2;
56
	public static final int COMPLAINED_UNREACHABLE = 2;
56
	
57
	
58
/** Empty hook for checking null status against declaration using null annotations, once this will be supported. */
59
protected int checkAgainstNullAnnotation(BlockScope currentScope, LocalVariableBinding local, int nullStatus) {
60
	return nullStatus;
61
}
62
57
/**
63
/**
58
 * INTERNAL USE ONLY.
64
 * INTERNAL USE ONLY.
59
 * This is used to redirect inter-statements jumps.
65
 * This is used to redirect inter-statements jumps.
(-)src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java (-1 / +1 lines)
Lines 2614-2620 Link Here
2614
//    JavacTestOptions.SKIP /* skip javac tests */);
2614
//    JavacTestOptions.SKIP /* skip javac tests */);
2615
//    JavacTestOptions.DEFAULT /* default javac test options */);
2615
//    JavacTestOptions.DEFAULT /* default javac test options */);
2616
//    javacTestOptions /* javac test options */);
2616
//    javacTestOptions /* javac test options */);
2617
void runNegativeTest(
2617
protected void runNegativeTest(
2618
	// test directory preparation
2618
	// test directory preparation
2619
	boolean shouldFlushOutputDirectory,
2619
	boolean shouldFlushOutputDirectory,
2620
	String[] testFiles,
2620
	String[] testFiles,

Return to bug 335093