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

Collapse All | Expand All

(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java (-1 / +1 lines)
Lines 691-697 private void internalAnalyseCode(FlowContext flowContext, FlowInfo flowInfo) { Link Here
691
		UnconditionalFlowInfo outerInfo = flowInfo.unconditionalFieldLessCopy();
691
		UnconditionalFlowInfo outerInfo = flowInfo.unconditionalFieldLessCopy();
692
		UnconditionalFlowInfo staticFieldUnconditionalInfo = staticFieldInfo.unconditionalInits();
692
		UnconditionalFlowInfo staticFieldUnconditionalInfo = staticFieldInfo.unconditionalInits();
693
		flowInfo.addNullInfoFrom(staticFieldUnconditionalInfo.discardNonFieldInitializations());
693
		flowInfo.addNullInfoFrom(staticFieldUnconditionalInfo.discardNonFieldInitializations());
694
		flowInfo.addConstantFieldsMask(staticFieldInfo);	// prevent resetting null info for constant fields inside methods
694
		flowInfo.addConstantFieldsMask(staticFieldUnconditionalInfo);	// prevent resetting null info for constant fields inside methods
695
		flowInfo.resetNullInfoForFields();	// only preserve null info for constant fields
695
		flowInfo.resetNullInfoForFields();	// only preserve null info for constant fields
696
696
697
		FlowInfo constructorInfo = nonStaticFieldInfo.unconditionalInits().discardNonFieldInitializations().addInitializationsFrom(flowInfo);
697
		FlowInfo constructorInfo = nonStaticFieldInfo.unconditionalInits().discardNonFieldInitializations().addInitializationsFrom(flowInfo);
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java (-1 / +1 lines)
Lines 165-171 public void updateConstantFieldsMask(FieldBinding field) { Link Here
165
	this.initsWhenFalse.updateConstantFieldsMask(field);
165
	this.initsWhenFalse.updateConstantFieldsMask(field);
166
}
166
}
167
167
168
public void addConstantFieldsMask(FlowInfo other) {
168
public void addConstantFieldsMask(UnconditionalFlowInfo other) {
169
	this.initsWhenTrue.addConstantFieldsMask(other);
169
	this.initsWhenTrue.addConstantFieldsMask(other);
170
	this.initsWhenFalse.addConstantFieldsMask(other);
170
	this.initsWhenFalse.addConstantFieldsMask(other);
171
}
171
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java (-5 / +1 lines)
Lines 54-63 public abstract class FlowInfo { Link Here
54
		DEAD_END.tagBits = UNREACHABLE;
54
		DEAD_END.tagBits = UNREACHABLE;
55
	}
55
	}
56
	
56
	
57
	public long constantFieldsMask; // record positions of constant fields so that they don't get reset in resetNullInfoForFields()
58
	
59
	public long extraConstantFieldMask[];	// extra mask for larger number of fields
60
61
/**
57
/**
62
 * Add other inits to this flow info, then return this. The operation semantics
58
 * Add other inits to this flow info, then return this. The operation semantics
63
 * are to match as closely as possible the application to this flow info of all
59
 * are to match as closely as possible the application to this flow info of all
Lines 291-297 abstract public void markAsComparedEqualToNull(VariableBinding binding); Link Here
291
	/**
287
	/**
292
	 * add the constant fields info from the other flow info
288
	 * add the constant fields info from the other flow info
293
	 */
289
	 */
294
	abstract public void addConstantFieldsMask(FlowInfo other);
290
	abstract public void addConstantFieldsMask(UnconditionalFlowInfo other);
295
	
291
	
296
	/**
292
	/**
297
	 * Record a field or local may have got assigned to unknown (set the bit on existing info).
293
	 * Record a field or local may have got assigned to unknown (set the bit on existing info).
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java (-1 / +3 lines)
Lines 93-98 public class UnconditionalFlowInfo extends FlowInfo { Link Here
93
	// Constants
93
	// Constants
94
	public static final int BitCacheSize = 64; // 64 bits in a long.
94
	public static final int BitCacheSize = 64; // 64 bits in a long.
95
	public int[] nullStatusChangedInAssert; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=303448
95
	public int[] nullStatusChangedInAssert; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=303448
96
	public long constantFieldsMask;
97
	public long extraConstantFieldMask[];
96
	private static final int AccConstant = ClassFileConstants.AccStatic|ClassFileConstants.AccFinal;
98
	private static final int AccConstant = ClassFileConstants.AccStatic|ClassFileConstants.AccFinal;
97
	
99
	
98
	public static final int indexOfConstantFieldBitStream = 6; // the index just after nullBit4 i.e. extraLength
100
	public static final int indexOfConstantFieldBitStream = 6; // the index just after nullBit4 i.e. extraLength
Lines 1605-1611 public void updateConstantFieldsMask(FieldBinding field) { Link Here
1605
 * All the infos originate in TypeDeclaration.analyseCode(). So making sure that this method is called for every info that is sent into
1607
 * All the infos originate in TypeDeclaration.analyseCode(). So making sure that this method is called for every info that is sent into
1606
 * methods/constructors should be sufficient
1608
 * methods/constructors should be sufficient
1607
 */
1609
 */
1608
public void addConstantFieldsMask(FlowInfo other) {
1610
public void addConstantFieldsMask(UnconditionalFlowInfo other) {
1609
	this.constantFieldsMask |= other.constantFieldsMask;
1611
	this.constantFieldsMask |= other.constantFieldsMask;
1610
    if (other.extraConstantFieldMask != null) {
1612
    if (other.extraConstantFieldMask != null) {
1611
    	int oldLength = 0;
1613
    	int oldLength = 0;

Return to bug 247564