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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java (-2 / +2 lines)
Lines 184-190 Link Here
184
 * exact need.
184
 * exact need.
185
 */
185
 */
186
public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
186
public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
187
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) return;
187
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) return;
188
	ReferenceBinding allocatedTypeErasure = (ReferenceBinding) this.binding.declaringClass.erasure();
188
	ReferenceBinding allocatedTypeErasure = (ReferenceBinding) this.binding.declaringClass.erasure();
189
189
190
	// perform some emulation work in case there is some and we are inside a local type only
190
	// perform some emulation work in case there is some and we are inside a local type only
Lines 203-209 Link Here
203
}
203
}
204
204
205
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
205
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
206
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) return;
206
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) return;
207
	// if constructor from parameterized type got found, use the original constructor at codegen time
207
	// if constructor from parameterized type got found, use the original constructor at codegen time
208
	MethodBinding codegenBinding = this.binding.original();
208
	MethodBinding codegenBinding = this.binding.original();
209
209
(-)compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java (-1 / +1 lines)
Lines 174-180 Link Here
174
}
174
}
175
175
176
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
176
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
177
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) {
177
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) {
178
		// need assertion flag: $assertionsDisabled on outer most source clas
178
		// need assertion flag: $assertionsDisabled on outer most source clas
179
		// (in case of static member of interface, will use the outermost static member - bug 22334)
179
		// (in case of static member of interface, will use the outermost static member - bug 22334)
180
		SourceTypeBinding outerMostClass = currentScope.enclosingSourceType();
180
		SourceTypeBinding outerMostClass = currentScope.enclosingSourceType();
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java (-1 / +1 lines)
Lines 61-67 Link Here
61
					FlowInfo.DEAD_END);
61
					FlowInfo.DEAD_END);
62
62
63
			// check for missing returning path
63
			// check for missing returning path
64
			if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) {
64
			if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) {
65
				this.bits |= ASTNode.NeedFreeReturn;
65
				this.bits |= ASTNode.NeedFreeReturn;
66
			}
66
			}
67
67
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java (-1 / +1 lines)
Lines 156-162 Link Here
156
			}
156
			}
157
		}
157
		}
158
		// check for missing returning path
158
		// check for missing returning path
159
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) {
159
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) {
160
			this.bits |= ASTNode.NeedFreeReturn;
160
			this.bits |= ASTNode.NeedFreeReturn;
161
		}
161
		}
162
162
(-)compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java (-2 / +2 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 72-78 Link Here
72
		// code generation can be optimized when no need to continue in the loop
72
		// code generation can be optimized when no need to continue in the loop
73
		if ((actionInfo.tagBits &
73
		if ((actionInfo.tagBits &
74
				loopingContext.initsOnContinue.tagBits &
74
				loopingContext.initsOnContinue.tagBits &
75
				FlowInfo.UNREACHABLE) != 0) {
75
				FlowInfo.UNREACHABLE_OR_DEAD) != 0) {
76
			this.continueLabel = null;
76
			this.continueLabel = null;
77
		}
77
		}
78
		if ((this.condition.implicitConversion & TypeIds.UNBOXING) != 0) {
78
		if ((this.condition.implicitConversion & TypeIds.UNBOXING) != 0) {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java (-3 / +3 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 196-202 Link Here
196
	void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
196
	void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
197
		ReferenceBinding superTypeErasure = (ReferenceBinding) this.binding.declaringClass.erasure();
197
		ReferenceBinding superTypeErasure = (ReferenceBinding) this.binding.declaringClass.erasure();
198
198
199
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0)	{
199
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0)	{
200
		// perform some emulation work in case there is some and we are inside a local type only
200
		// perform some emulation work in case there is some and we are inside a local type only
201
		if (superTypeErasure.isNestedType()
201
		if (superTypeErasure.isNestedType()
202
			&& currentScope.enclosingSourceType().isLocalType()) {
202
			&& currentScope.enclosingSourceType().isLocalType()) {
Lines 212-218 Link Here
212
	}
212
	}
213
213
214
	public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
214
	public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
215
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0)	{
215
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0)	{
216
			// if constructor from parameterized type got found, use the original constructor at codegen time
216
			// if constructor from parameterized type got found, use the original constructor at codegen time
217
			MethodBinding codegenBinding = this.binding.original();
217
			MethodBinding codegenBinding = this.binding.original();
218
218
(-)compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java (-2 / +2 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 439-445 Link Here
439
 * No need to emulate access to protected fields since not implicitly accessed
439
 * No need to emulate access to protected fields since not implicitly accessed
440
 */
440
 */
441
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo, boolean isReadAccess) {
441
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo, boolean isReadAccess) {
442
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0)	return;
442
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0)	return;
443
	
443
	
444
	// if field from parameterized type got found, use the original field at codegen time
444
	// if field from parameterized type got found, use the original field at codegen time
445
	FieldBinding codegenBinding = this.binding.original();
445
	FieldBinding codegenBinding = this.binding.original();
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java (-1 / +1 lines)
Lines 145-151 Link Here
145
			// code generation can be optimized when no need to continue in the loop
145
			// code generation can be optimized when no need to continue in the loop
146
			if ((actionInfo.tagBits &
146
			if ((actionInfo.tagBits &
147
					loopingContext.initsOnContinue.tagBits &
147
					loopingContext.initsOnContinue.tagBits &
148
					FlowInfo.UNREACHABLE) != 0) {
148
					FlowInfo.UNREACHABLE_OR_DEAD) != 0) {
149
				this.continueLabel = null;
149
				this.continueLabel = null;
150
			}
150
			}
151
			else {
151
			else {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java (-2 / +2 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 108-114 Link Here
108
			addInitializationsFrom(condInfo.initsWhenFalse());
108
			addInitializationsFrom(condInfo.initsWhenFalse());
109
			// TODO (maxime) no need to test when false: can optimize (same for action being unreachable above)
109
			// TODO (maxime) no need to test when false: can optimize (same for action being unreachable above)
110
			if ((actionInfo.tagBits & loopingContext.initsOnContinue.tagBits &
110
			if ((actionInfo.tagBits & loopingContext.initsOnContinue.tagBits &
111
					FlowInfo.UNREACHABLE) != 0) {
111
					FlowInfo.UNREACHABLE_OR_DEAD) != 0) {
112
				this.continueLabel = null;
112
				this.continueLabel = null;
113
			} else {
113
			} else {
114
				actionInfo = actionInfo.mergedWith(loopingContext.initsOnContinue);
114
				actionInfo = actionInfo.mergedWith(loopingContext.initsOnContinue);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java (-9 / +3 lines)
Lines 99-105 Link Here
99
		thenFlowInfo = this.thenStatement.analyseCode(currentScope, flowContext, thenFlowInfo);
99
		thenFlowInfo = this.thenStatement.analyseCode(currentScope, flowContext, thenFlowInfo);
100
	}
100
	}
101
	// code gen: optimizing the jump around the ELSE part
101
	// code gen: optimizing the jump around the ELSE part
102
	if ((thenFlowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) {
102
	if ((thenFlowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) {
103
		this.bits |= ASTNode.ThenExit;
103
		this.bits |= ASTNode.ThenExit;
104
	}
104
	}
105
105
Lines 164-173 Link Here
164
	if (hasThenPart) {
164
	if (hasThenPart) {
165
		BranchLabel falseLabel = null;
165
		BranchLabel falseLabel = null;
166
		// generate boolean condition only if needed
166
		// generate boolean condition only if needed
167
		if (((this.bits & ASTNode.IsElseStatementUnreachable) != 0) ||
167
		if (cst != Constant.NotAConstant && cst.booleanValue() == true) {
168
				(cst != Constant.NotAConstant && cst.booleanValue() == true)) {
169
			// No need to generate if condition statement when we know that only the then action
170
			// will be executed
171
			this.condition.generateCode(currentScope, codeStream, false);
168
			this.condition.generateCode(currentScope, codeStream, false);
172
		} else {
169
		} else {
173
			this.condition.generateOptimizedBoolean(
170
			this.condition.generateOptimizedBoolean(
Lines 206-215 Link Here
206
		}
203
		}
207
	} else if (hasElsePart) {
204
	} else if (hasElsePart) {
208
		// generate boolean condition only if needed
205
		// generate boolean condition only if needed
209
		if (((this.bits & ASTNode.IsThenStatementUnreachable) != 0) ||
206
		if (cst != Constant.NotAConstant && cst.booleanValue() == false) {
210
				(cst != Constant.NotAConstant && cst.booleanValue() == false)) {
211
			// No need to generate if condition statement when we know that only the else action
212
			// will be executed
213
			this.condition.generateCode(currentScope, codeStream, false);
207
			this.condition.generateCode(currentScope, codeStream, false);
214
		} else {
208
		} else {
215
			this.condition.generateOptimizedBoolean(
209
			this.condition.generateOptimizedBoolean(
(-)compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java (-2 / +2 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 214-220 Link Here
214
}
214
}
215
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo){
215
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo){
216
216
217
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0)	return;
217
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0)	return;
218
218
219
	// if method from parameterized type got found, use the original method at codegen time
219
	// if method from parameterized type got found, use the original method at codegen time
220
	MethodBinding codegenBinding = this.binding.original();
220
	MethodBinding codegenBinding = this.binding.original();
(-)compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java (-2 / +2 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 111-117 Link Here
111
			// check for missing returning path
111
			// check for missing returning path
112
			TypeBinding returnTypeBinding = this.binding.returnType;
112
			TypeBinding returnTypeBinding = this.binding.returnType;
113
			if ((returnTypeBinding == TypeBinding.VOID) || isAbstract()) {
113
			if ((returnTypeBinding == TypeBinding.VOID) || isAbstract()) {
114
				if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) {
114
				if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) {
115
					this.bits |= ASTNode.NeedFreeReturn;
115
					this.bits |= ASTNode.NeedFreeReturn;
116
				}
116
				}
117
			} else {
117
			} else {
(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java (-2 / +2 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 192-198 Link Here
192
	 * exact need.
192
	 * exact need.
193
	 */
193
	 */
194
	public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
194
	public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
195
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0)	{
195
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0)	{
196
		ReferenceBinding allocatedTypeErasure = (ReferenceBinding) this.binding.declaringClass.erasure();
196
		ReferenceBinding allocatedTypeErasure = (ReferenceBinding) this.binding.declaringClass.erasure();
197
197
198
		// perform some extra emulation work in case there is some and we are inside a local type only
198
		// perform some extra emulation work in case there is some and we are inside a local type only
(-)compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java (-2 / +2 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 807-813 Link Here
807
 * index is <0 to denote write access emulation
807
 * index is <0 to denote write access emulation
808
 */
808
 */
809
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FieldBinding fieldBinding, int index, FlowInfo flowInfo) {
809
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FieldBinding fieldBinding, int index, FlowInfo flowInfo) {
810
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) return;
810
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) return;
811
	// index == 0 denotes the first fieldBinding, index > 0 denotes one of the 'otherBindings', index < 0 denotes a write access (to last binding)
811
	// index == 0 denotes the first fieldBinding, index > 0 denotes one of the 'otherBindings', index < 0 denotes a write access (to last binding)
812
	if (fieldBinding.constant() != Constant.NotAConstant)
812
	if (fieldBinding.constant() != Constant.NotAConstant)
813
		return;
813
		return;
(-)compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java (-2 / +2 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 829-835 Link Here
829
}
829
}
830
830
831
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo, boolean isReadAccess) {
831
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo, boolean isReadAccess) {
832
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0)	return;
832
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0)	return;
833
833
834
	//If inlinable field, forget the access emulation, the code gen will directly target it
834
	//If inlinable field, forget the access emulation, the code gen will directly target it
835
	if (this.constant != Constant.NotAConstant)
835
	if (this.constant != Constant.NotAConstant)
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java (-1 / +2 lines)
Lines 72-78 Link Here
72
// complaintLevel = 0 if was reachable up until now, 1 if fake reachable (deadcode), 2 if fatal unreachable (error)
72
// complaintLevel = 0 if was reachable up until now, 1 if fake reachable (deadcode), 2 if fatal unreachable (error)
73
public int complainIfUnreachable(FlowInfo flowInfo, BlockScope scope, int previousComplaintLevel) {
73
public int complainIfUnreachable(FlowInfo flowInfo, BlockScope scope, int previousComplaintLevel) {
74
	if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0) {
74
	if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0) {
75
		this.bits &= ~ASTNode.IsReachable;
75
		if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE_OR_DEAD) != 0)
76
			this.bits &= ~ASTNode.IsReachable;
76
		if (flowInfo == FlowInfo.DEAD_END) {
77
		if (flowInfo == FlowInfo.DEAD_END) {
77
			if (previousComplaintLevel < COMPLAINED_UNREACHABLE) {
78
			if (previousComplaintLevel < COMPLAINED_UNREACHABLE) {
78
				scope.problemReporter().unreachableCode(this);
79
				scope.problemReporter().unreachableCode(this);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/SynchronizedStatement.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 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 64-70 Link Here
64
		currentScope.methodScope().recordInitializationStates(flowInfo);
64
		currentScope.methodScope().recordInitializationStates(flowInfo);
65
65
66
	// optimizing code gen
66
	// optimizing code gen
67
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) {
67
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) {
68
		this.bits |= ASTNode.BlockExit;
68
		this.bits |= ASTNode.BlockExit;
69
	}
69
	}
70
70
(-)compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java (-2 / +2 lines)
Lines 101-107 Link Here
101
			tryInfo = flowInfo;
101
			tryInfo = flowInfo;
102
		} else {
102
		} else {
103
			tryInfo = this.tryBlock.analyseCode(currentScope, handlingContext, flowInfo.copy());
103
			tryInfo = this.tryBlock.analyseCode(currentScope, handlingContext, flowInfo.copy());
104
			if ((tryInfo.tagBits & FlowInfo.UNREACHABLE) != 0)
104
			if ((tryInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0)
105
				this.bits |= ASTNode.IsTryBlockExiting;
105
				this.bits |= ASTNode.IsTryBlockExiting;
106
		}
106
		}
107
107
Lines 210-216 Link Here
210
			tryInfo = flowInfo;
210
			tryInfo = flowInfo;
211
		} else {
211
		} else {
212
			tryInfo = this.tryBlock.analyseCode(currentScope, handlingContext, flowInfo.copy());
212
			tryInfo = this.tryBlock.analyseCode(currentScope, handlingContext, flowInfo.copy());
213
			if ((tryInfo.tagBits & FlowInfo.UNREACHABLE) != 0)
213
			if ((tryInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0)
214
				this.bits |= ASTNode.IsTryBlockExiting;
214
				this.bits |= ASTNode.IsTryBlockExiting;
215
		}
215
		}
216
216
(-)compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java (-6 / +6 lines)
Lines 192-198 Link Here
192
	if (this.ignoreFurtherInvestigation)
192
	if (this.ignoreFurtherInvestigation)
193
		return flowInfo;
193
		return flowInfo;
194
	try {
194
	try {
195
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) {
195
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) {
196
			this.bits |= ASTNode.IsReachable;
196
			this.bits |= ASTNode.IsReachable;
197
			LocalTypeBinding localType = (LocalTypeBinding) this.binding;
197
			LocalTypeBinding localType = (LocalTypeBinding) this.binding;
198
			localType.setConstantPoolName(currentScope.compilationUnitScope().computeConstantPoolName(localType));
198
			localType.setConstantPoolName(currentScope.compilationUnitScope().computeConstantPoolName(localType));
Lines 230-236 Link Here
230
	if (this.ignoreFurtherInvestigation)
230
	if (this.ignoreFurtherInvestigation)
231
		return;
231
		return;
232
	try {
232
	try {
233
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) {
233
		if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) {
234
			this.bits |= ASTNode.IsReachable;
234
			this.bits |= ASTNode.IsReachable;
235
			LocalTypeBinding localType = (LocalTypeBinding) this.binding;
235
			LocalTypeBinding localType = (LocalTypeBinding) this.binding;
236
			localType.setConstantPoolName(currentScope.compilationUnitScope().computeConstantPoolName(localType));
236
			localType.setConstantPoolName(currentScope.compilationUnitScope().computeConstantPoolName(localType));
Lines 633-639 Link Here
633
		for (int i = 0, count = this.fields.length; i < count; i++) {
633
		for (int i = 0, count = this.fields.length; i < count; i++) {
634
			FieldDeclaration field = this.fields[i];
634
			FieldDeclaration field = this.fields[i];
635
			if (field.isStatic()) {
635
			if (field.isStatic()) {
636
				if ((staticFieldInfo.tagBits & FlowInfo.UNREACHABLE) != 0)
636
				if ((staticFieldInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0)
637
					field.bits &= ~ASTNode.IsReachable;
637
					field.bits &= ~ASTNode.IsReachable;
638
638
639
				/*if (field.isField()){
639
				/*if (field.isField()){
Lines 649-655 Link Here
649
					staticFieldInfo = FlowInfo.initial(this.maxFieldCount).setReachMode(FlowInfo.UNREACHABLE_OR_DEAD);
649
					staticFieldInfo = FlowInfo.initial(this.maxFieldCount).setReachMode(FlowInfo.UNREACHABLE_OR_DEAD);
650
				}
650
				}
651
			} else {
651
			} else {
652
				if ((nonStaticFieldInfo.tagBits & FlowInfo.UNREACHABLE) != 0)
652
				if ((nonStaticFieldInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0)
653
					field.bits &= ~ASTNode.IsReachable;
653
					field.bits &= ~ASTNode.IsReachable;
654
654
655
				/*if (field.isField()){
655
				/*if (field.isField()){
Lines 725-731 Link Here
725
 * 15.9.2
725
 * 15.9.2
726
 */
726
 */
727
public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
727
public void manageEnclosingInstanceAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
728
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) return;
728
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) return;
729
	NestedTypeBinding nestedType = (NestedTypeBinding) this.binding;
729
	NestedTypeBinding nestedType = (NestedTypeBinding) this.binding;
730
730
731
	MethodScope methodScope = currentScope.methodScope();
731
	MethodScope methodScope = currentScope.methodScope();
Lines 776-782 Link Here
776
 * Local member cannot be static.
776
 * Local member cannot be static.
777
 */
777
 */
778
public void manageEnclosingInstanceAccessIfNecessary(ClassScope currentScope, FlowInfo flowInfo) {
778
public void manageEnclosingInstanceAccessIfNecessary(ClassScope currentScope, FlowInfo flowInfo) {
779
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) {
779
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) {
780
	NestedTypeBinding nestedType = (NestedTypeBinding) this.binding;
780
	NestedTypeBinding nestedType = (NestedTypeBinding) this.binding;
781
	nestedType.addSyntheticArgumentAndField(this.binding.enclosingType());
781
	nestedType.addSyntheticArgumentAndField(this.binding.enclosingType());
782
	}
782
	}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java (-5 / +4 lines)
Lines 120-130 Link Here
120
			// code generation can be optimized when no need to continue in the loop
120
			// code generation can be optimized when no need to continue in the loop
121
			exitBranch = flowInfo.copy();
121
			exitBranch = flowInfo.copy();
122
			// need to start over from flowInfo so as to get null inits
122
			// need to start over from flowInfo so as to get null inits
123
123
            int combinedTagBits = actionInfo.tagBits & loopingContext.initsOnContinue.tagBits;
124
			if ((actionInfo.tagBits &
124
			if ((combinedTagBits & FlowInfo.UNREACHABLE) != 0) {
125
					loopingContext.initsOnContinue.tagBits &
125
				if ((combinedTagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0)
126
					FlowInfo.UNREACHABLE) != 0) {
126
					this.continueLabel = null;
127
				this.continueLabel = null;
128
				exitBranch.addInitializationsFrom(condInfo.initsWhenFalse());
127
				exitBranch.addInitializationsFrom(condInfo.initsWhenFalse());
129
			} else {
128
			} else {
130
				condLoopContext.complainOnDeferredFinalChecks(currentScope,
129
				condLoopContext.complainOnDeferredFinalChecks(currentScope,
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetFieldReference.java (-2 / +2 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 278-284 Link Here
278
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo, boolean isReadAccess){
278
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo, boolean isReadAccess){
279
	// The private access will be managed through the code generation
279
	// The private access will be managed through the code generation
280
280
281
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) return;
281
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) return;
282
}
282
}
283
public TypeBinding resolveType(BlockScope scope) {
283
public TypeBinding resolveType(BlockScope scope) {
284
	// Answer the signature type of the field.
284
	// Answer the signature type of the field.
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 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 168-174 Link Here
168
}
168
}
169
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
169
public void manageSyntheticAccessIfNecessary(BlockScope currentScope, FlowInfo flowInfo) {
170
170
171
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) == 0) {
171
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0) {
172
		// if method from parameterized type got found, use the original method at codegen time
172
		// if method from parameterized type got found, use the original method at codegen time
173
		MethodBinding codegenBinding = this.binding.original();
173
		MethodBinding codegenBinding = this.binding.original();
174
		if (codegenBinding != this.binding) {
174
		if (codegenBinding != this.binding) {
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java (-2 / +2 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 576-582 Link Here
576
		return;
576
		return;
577
	}
577
	}
578
578
579
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE) != 0) return;
579
	if ((flowInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) return;
580
	//If inlinable field, forget the access emulation, the code gen will directly target it
580
	//If inlinable field, forget the access emulation, the code gen will directly target it
581
	if (this.constant != Constant.NotAConstant)
581
	if (this.constant != Constant.NotAConstant)
582
		return;
582
		return;
(-)Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/ConformTest.java (-176 / +201 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2010 IBM Corporation and others.
2
 * Copyright (c) 2005, 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 6501-6682 Link Here
6501
6501
6502
	CompilerOptions compilerOptions = new CompilerOptions(getCompilerOptions());
6502
	CompilerOptions compilerOptions = new CompilerOptions(getCompilerOptions());
6503
	String expectedOutput = compilerOptions.targetJDK <= ClassFileConstants.JDK1_5 ?
6503
	String expectedOutput = compilerOptions.targetJDK <= ClassFileConstants.JDK1_5 ?
6504
			"  // Method descriptor #15 (Z)V\n" +
6504
			"  // Method descriptor #15 (Z)V\n" + 
6505
			"  // Stack: 4, Locals: 8\n" +
6505
			"  // Stack: 4, Locals: 8\n" + 
6506
			"  private void foo(boolean delete);\n" +
6506
			"  private void foo(boolean delete);\n" + 
6507
			"     0  aload_0 [this]\n" +
6507
			"     0  aload_0 [this]\n" + 
6508
			"     1  invokevirtual X.bar() : java.lang.String [16]\n" +
6508
			"     1  invokevirtual X.bar() : java.lang.String [16]\n" + 
6509
			"     4  astore_2 [s]\n" +
6509
			"     4  astore_2 [s]\n" + 
6510
			"     5  new java.lang.StringBuffer [20]\n" +
6510
			"     5  new java.lang.StringBuffer [20]\n" + 
6511
			"     8  dup\n" +
6511
			"     8  dup\n" + 
6512
			"     9  invokespecial java.lang.StringBuffer() [22]\n" +
6512
			"     9  invokespecial java.lang.StringBuffer() [22]\n" + 
6513
			"    12  astore_3 [buffer]\n" +
6513
			"    12  astore_3 [buffer]\n" + 
6514
			"    13  iconst_1\n" +
6514
			"    13  iconst_1\n" + 
6515
			"    14  anewarray java.lang.String [23]\n" +
6515
			"    14  anewarray java.lang.String [23]\n" + 
6516
			"    17  dup\n" +
6516
			"    17  dup\n" + 
6517
			"    18  iconst_0\n" +
6517
			"    18  iconst_0\n" + 
6518
			"    19  ldc <String \"\"> [25]\n" +
6518
			"    19  ldc <String \"\"> [25]\n" + 
6519
			"    21  aastore\n" +
6519
			"    21  aastore\n" + 
6520
			"    22  astore 4 [datas]\n" +
6520
			"    22  astore 4 [datas]\n" + 
6521
			"    24  iconst_1\n" +
6521
			"    24  iconst_1\n" + 
6522
			"    25  anewarray java.lang.Object [3]\n" +
6522
			"    25  anewarray java.lang.Object [3]\n" + 
6523
			"    28  dup\n" +
6523
			"    28  dup\n" + 
6524
			"    29  iconst_0\n" +
6524
			"    29  iconst_0\n" + 
6525
			"    30  aload_2 [s]\n" +
6525
			"    30  aload_2 [s]\n" + 
6526
			"    31  aastore\n" +
6526
			"    31  aastore\n" + 
6527
			"    32  astore 5 [data]\n" +
6527
			"    32  astore 5 [data]\n" + 
6528
			"    34  aload_3 [buffer]\n" +
6528
			"    34  aload_3 [buffer]\n" + 
6529
			"    35  aload 4 [datas]\n" +
6529
			"    35  aload 4 [datas]\n" + 
6530
			"    37  invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [27]\n" +
6530
			"    37  invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [27]\n" + 
6531
			"    40  aload 5 [data]\n" +
6531
			"    40  aload 5 [data]\n" + 
6532
			"    42  invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [27]\n" +
6532
			"    42  invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [27]\n" + 
6533
			"    45  pop\n" +
6533
			"    45  pop\n" + 
6534
			"    46  goto 54\n" +
6534
			"    46  goto 62\n" + 
6535
			"    49  astore 6 [e]\n" +
6535
			"    49  astore 6 [e]\n" + 
6536
			"    51  aload 6 [e]\n" +
6536
			"    51  aload 6 [e]\n" + 
6537
			"    53  athrow\n" +
6537
			"    53  ifnull 59\n" + 
6538
			"    54  iload_1 [delete]\n" +
6538
			"    56  aload 6 [e]\n" + 
6539
			"    55  ifeq 85\n" +
6539
			"    58  athrow\n" + 
6540
			"    58  aload_3 [buffer]\n" +
6540
			"    59  aconst_null\n" + 
6541
			"    59  iconst_0\n" +
6541
			"    60  astore_3 [buffer]\n" + 
6542
			"    60  aload_3 [buffer]\n" +
6542
			"    61  return\n" + 
6543
			"    61  invokevirtual java.lang.StringBuffer.length() : int [31]\n" +
6543
			"    62  iload_1 [delete]\n" + 
6544
			"    64  invokevirtual java.lang.StringBuffer.delete(int, int) : java.lang.StringBuffer [35]\n" +
6544
			"    63  ifeq 93\n" + 
6545
			"    67  pop\n" +
6545
			"    66  aload_3 [buffer]\n" + 
6546
			"    68  goto 85\n" +
6546
			"    67  iconst_0\n" + 
6547
			"    71  astore 4\n" +
6547
			"    68  aload_3 [buffer]\n" + 
6548
			"    73  aconst_null\n" +
6548
			"    69  invokevirtual java.lang.StringBuffer.length() : int [31]\n" + 
6549
			"    74  astore_3 [buffer]\n" +
6549
			"    72  invokevirtual java.lang.StringBuffer.delete(int, int) : java.lang.StringBuffer [35]\n" + 
6550
			"    75  goto 87\n" +
6550
			"    75  pop\n" + 
6551
			"    78  astore 7\n" +
6551
			"    76  goto 93\n" + 
6552
			"    80  aconst_null\n" +
6552
			"    79  astore 4\n" + 
6553
			"    81  astore_3 [buffer]\n" +
6553
			"    81  aconst_null\n" + 
6554
			"    82  aload 7\n" +
6554
			"    82  astore_3 [buffer]\n" + 
6555
			"    84  athrow\n" +
6555
			"    83  goto 95\n" + 
6556
			"    85  aconst_null\n" +
6556
			"    86  astore 7\n" + 
6557
			"    86  astore_3 [buffer]\n" +
6557
			"    88  aconst_null\n" + 
6558
			"    87  return\n" +
6558
			"    89  astore_3 [buffer]\n" + 
6559
			"      Exception Table:\n" +
6559
			"    90  aload 7\n" + 
6560
			"        [pc: 34, pc: 46] -> 49 when : java.lang.Exception\n" +
6560
			"    92  athrow\n" + 
6561
			"        [pc: 13, pc: 68] -> 71 when : java.lang.Exception\n" +
6561
			"    93  aconst_null\n" + 
6562
			"        [pc: 13, pc: 73] -> 78 when : any\n" +
6562
			"    94  astore_3 [buffer]\n" + 
6563
			"      Line numbers:\n" +
6563
			"    95  return\n" + 
6564
			"        [pc: 0, line: 4]\n" +
6564
			"      Exception Table:\n" + 
6565
			"        [pc: 5, line: 5]\n" +
6565
			"        [pc: 34, pc: 46] -> 49 when : java.lang.Exception\n" + 
6566
			"        [pc: 13, line: 9]\n" +
6566
			"        [pc: 13, pc: 59] -> 79 when : java.lang.Exception\n" + 
6567
			"        [pc: 24, line: 10]\n" +
6567
			"        [pc: 62, pc: 76] -> 79 when : java.lang.Exception\n" + 
6568
			"        [pc: 34, line: 12]\n" +
6568
			"        [pc: 13, pc: 59] -> 86 when : any\n" + 
6569
			"        [pc: 49, line: 13]\n" +
6569
			"        [pc: 62, pc: 81] -> 86 when : any\n" + 
6570
			"        [pc: 51, line: 15]\n" +
6570
			"      Line numbers:\n" + 
6571
			"        [pc: 54, line: 19]\n" +
6571
			"        [pc: 0, line: 4]\n" + 
6572
			"        [pc: 58, line: 20]\n" +
6572
			"        [pc: 5, line: 5]\n" + 
6573
			"        [pc: 71, line: 22]\n" +
6573
			"        [pc: 13, line: 9]\n" + 
6574
			"        [pc: 73, line: 24]\n" +
6574
			"        [pc: 24, line: 10]\n" + 
6575
			"        [pc: 78, line: 23]\n" +
6575
			"        [pc: 34, line: 12]\n" + 
6576
			"        [pc: 80, line: 24]\n" +
6576
			"        [pc: 49, line: 13]\n" + 
6577
			"        [pc: 82, line: 25]\n" +
6577
			"        [pc: 51, line: 14]\n" + 
6578
			"        [pc: 85, line: 24]\n" +
6578
			"        [pc: 56, line: 15]\n" + 
6579
			"        [pc: 87, line: 26]\n" +
6579
			"        [pc: 59, line: 24]\n" + 
6580
			"      Local variable table:\n" +
6580
			"        [pc: 61, line: 16]\n" + 
6581
			"        [pc: 0, pc: 88] local: this index: 0 type: X\n" +
6581
			"        [pc: 62, line: 19]\n" + 
6582
			"        [pc: 0, pc: 88] local: delete index: 1 type: boolean\n" +
6582
			"        [pc: 66, line: 20]\n" + 
6583
			"        [pc: 5, pc: 88] local: s index: 2 type: java.lang.String\n" +
6583
			"        [pc: 79, line: 22]\n" + 
6584
			"        [pc: 13, pc: 88] local: buffer index: 3 type: java.lang.StringBuffer\n" +
6584
			"        [pc: 81, line: 24]\n" + 
6585
			"        [pc: 24, pc: 71] local: datas index: 4 type: java.lang.String[]\n" +
6585
			"        [pc: 86, line: 23]\n" + 
6586
			"        [pc: 34, pc: 71] local: data index: 5 type: java.lang.Object[]\n" +
6586
			"        [pc: 88, line: 24]\n" + 
6587
			"        [pc: 51, pc: 54] local: e index: 6 type: java.lang.Exception\n"
6587
			"        [pc: 90, line: 25]\n" + 
6588
			"        [pc: 93, line: 24]\n" + 
6589
			"        [pc: 95, line: 26]\n" + 
6590
			"      Local variable table:\n" + 
6591
			"        [pc: 0, pc: 96] local: this index: 0 type: X\n" + 
6592
			"        [pc: 0, pc: 96] local: delete index: 1 type: boolean\n" + 
6593
			"        [pc: 5, pc: 96] local: s index: 2 type: java.lang.String\n" + 
6594
			"        [pc: 13, pc: 96] local: buffer index: 3 type: java.lang.StringBuffer\n" + 
6595
			"        [pc: 24, pc: 59] local: datas index: 4 type: java.lang.String[]\n" + 
6596
			"        [pc: 62, pc: 79] local: datas index: 4 type: java.lang.String[]\n" + 
6597
			"        [pc: 34, pc: 59] local: data index: 5 type: java.lang.Object[]\n" + 
6598
			"        [pc: 62, pc: 79] local: data index: 5 type: java.lang.Object[]\n" + 
6599
			"        [pc: 51, pc: 59] local: e index: 6 type: java.lang.Exception\n"
6588
		:	"  // Method descriptor #15 (Z)V\n" +
6600
		:	"  // Method descriptor #15 (Z)V\n" +
6589
			"  // Stack: 4, Locals: 8\n" +
6601
			"  // Stack: 4, Locals: 8\n" + 
6590
			"  private void foo(boolean delete);\n" +
6602
			"  private void foo(boolean delete);\n" + 
6591
			"     0  aload_0 [this]\n" +
6603
			"     0  aload_0 [this]\n" + 
6592
			"     1  invokevirtual X.bar() : java.lang.String [16]\n" +
6604
			"     1  invokevirtual X.bar() : java.lang.String [16]\n" + 
6593
			"     4  astore_2 [s]\n" +
6605
			"     4  astore_2 [s]\n" + 
6594
			"     5  new java.lang.StringBuffer [20]\n" +
6606
			"     5  new java.lang.StringBuffer [20]\n" + 
6595
			"     8  dup\n" +
6607
			"     8  dup\n" + 
6596
			"     9  invokespecial java.lang.StringBuffer() [22]\n" +
6608
			"     9  invokespecial java.lang.StringBuffer() [22]\n" + 
6597
			"    12  astore_3 [buffer]\n" +
6609
			"    12  astore_3 [buffer]\n" + 
6598
			"    13  iconst_1\n" +
6610
			"    13  iconst_1\n" + 
6599
			"    14  anewarray java.lang.String [23]\n" +
6611
			"    14  anewarray java.lang.String [23]\n" + 
6600
			"    17  dup\n" +
6612
			"    17  dup\n" + 
6601
			"    18  iconst_0\n" +
6613
			"    18  iconst_0\n" + 
6602
			"    19  ldc <String \"\"> [25]\n" +
6614
			"    19  ldc <String \"\"> [25]\n" + 
6603
			"    21  aastore\n" +
6615
			"    21  aastore\n" + 
6604
			"    22  astore 4 [datas]\n" +
6616
			"    22  astore 4 [datas]\n" + 
6605
			"    24  iconst_1\n" +
6617
			"    24  iconst_1\n" + 
6606
			"    25  anewarray java.lang.Object [3]\n" +
6618
			"    25  anewarray java.lang.Object [3]\n" + 
6607
			"    28  dup\n" +
6619
			"    28  dup\n" + 
6608
			"    29  iconst_0\n" +
6620
			"    29  iconst_0\n" + 
6609
			"    30  aload_2 [s]\n" +
6621
			"    30  aload_2 [s]\n" + 
6610
			"    31  aastore\n" +
6622
			"    31  aastore\n" + 
6611
			"    32  astore 5 [data]\n" +
6623
			"    32  astore 5 [data]\n" + 
6612
			"    34  aload_3 [buffer]\n" +
6624
			"    34  aload_3 [buffer]\n" + 
6613
			"    35  aload 4 [datas]\n" +
6625
			"    35  aload 4 [datas]\n" + 
6614
			"    37  invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [27]\n" +
6626
			"    37  invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [27]\n" + 
6615
			"    40  aload 5 [data]\n" +
6627
			"    40  aload 5 [data]\n" + 
6616
			"    42  invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [27]\n" +
6628
			"    42  invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [27]\n" + 
6617
			"    45  pop\n" +
6629
			"    45  pop\n" + 
6618
			"    46  goto 54\n" +
6630
			"    46  goto 62\n" + 
6619
			"    49  astore 6 [e]\n" +
6631
			"    49  astore 6 [e]\n" + 
6620
			"    51  aload 6 [e]\n" +
6632
			"    51  aload 6 [e]\n" + 
6621
			"    53  athrow\n" +
6633
			"    53  ifnull 59\n" + 
6622
			"    54  iload_1 [delete]\n" +
6634
			"    56  aload 6 [e]\n" + 
6623
			"    55  ifeq 85\n" +
6635
			"    58  athrow\n" + 
6624
			"    58  aload_3 [buffer]\n" +
6636
			"    59  aconst_null\n" + 
6625
			"    59  iconst_0\n" +
6637
			"    60  astore_3 [buffer]\n" + 
6626
			"    60  aload_3 [buffer]\n" +
6638
			"    61  return\n" + 
6627
			"    61  invokevirtual java.lang.StringBuffer.length() : int [31]\n" +
6639
			"    62  iload_1 [delete]\n" + 
6628
			"    64  invokevirtual java.lang.StringBuffer.delete(int, int) : java.lang.StringBuffer [35]\n" +
6640
			"    63  ifeq 93\n" + 
6629
			"    67  pop\n" +
6641
			"    66  aload_3 [buffer]\n" + 
6630
			"    68  goto 85\n" +
6642
			"    67  iconst_0\n" + 
6631
			"    71  astore 4\n" +
6643
			"    68  aload_3 [buffer]\n" + 
6632
			"    73  aconst_null\n" +
6644
			"    69  invokevirtual java.lang.StringBuffer.length() : int [31]\n" + 
6633
			"    74  astore_3 [buffer]\n" +
6645
			"    72  invokevirtual java.lang.StringBuffer.delete(int, int) : java.lang.StringBuffer [35]\n" + 
6634
			"    75  goto 87\n" +
6646
			"    75  pop\n" + 
6635
			"    78  astore 7\n" +
6647
			"    76  goto 93\n" + 
6636
			"    80  aconst_null\n" +
6648
			"    79  astore 4\n" + 
6637
			"    81  astore_3 [buffer]\n" + 
6649
			"    81  aconst_null\n" + 
6638
			"    82  aload 7\n" +
6650
			"    82  astore_3 [buffer]\n" + 
6639
			"    84  athrow\n" +
6651
			"    83  goto 95\n" + 
6640
			"    85  aconst_null\n" +
6652
			"    86  astore 7\n" + 
6641
			"    86  astore_3 [buffer]\n" +
6653
			"    88  aconst_null\n" + 
6642
			"    87  return\n" +
6654
			"    89  astore_3 [buffer]\n" + 
6643
			"      Exception Table:\n" +
6655
			"    90  aload 7\n" + 
6644
			"        [pc: 34, pc: 46] -> 49 when : java.lang.Exception\n" +
6656
			"    92  athrow\n" + 
6645
			"        [pc: 13, pc: 68] -> 71 when : java.lang.Exception\n" +
6657
			"    93  aconst_null\n" + 
6646
			"        [pc: 13, pc: 73] -> 78 when : any\n" +
6658
			"    94  astore_3 [buffer]\n" + 
6647
			"      Line numbers:\n" +
6659
			"    95  return\n" + 
6648
			"        [pc: 0, line: 4]\n" +
6660
			"      Exception Table:\n" + 
6649
			"        [pc: 5, line: 5]\n" +
6661
			"        [pc: 34, pc: 46] -> 49 when : java.lang.Exception\n" + 
6650
			"        [pc: 13, line: 9]\n" +
6662
			"        [pc: 13, pc: 59] -> 79 when : java.lang.Exception\n" + 
6651
			"        [pc: 24, line: 10]\n" +
6663
			"        [pc: 62, pc: 76] -> 79 when : java.lang.Exception\n" + 
6652
			"        [pc: 34, line: 12]\n" +
6664
			"        [pc: 13, pc: 59] -> 86 when : any\n" + 
6653
			"        [pc: 49, line: 13]\n" +
6665
			"        [pc: 62, pc: 81] -> 86 when : any\n" + 
6654
			"        [pc: 51, line: 15]\n" +
6666
			"      Line numbers:\n" + 
6655
			"        [pc: 54, line: 19]\n" +
6667
			"        [pc: 0, line: 4]\n" + 
6656
			"        [pc: 58, line: 20]\n" +
6668
			"        [pc: 5, line: 5]\n" + 
6657
			"        [pc: 71, line: 22]\n" +
6669
			"        [pc: 13, line: 9]\n" + 
6658
			"        [pc: 73, line: 24]\n" +
6670
			"        [pc: 24, line: 10]\n" + 
6659
			"        [pc: 78, line: 23]\n" +
6671
			"        [pc: 34, line: 12]\n" + 
6660
			"        [pc: 80, line: 24]\n" +
6672
			"        [pc: 49, line: 13]\n" + 
6661
			"        [pc: 82, line: 25]\n" +
6673
			"        [pc: 51, line: 14]\n" + 
6662
			"        [pc: 85, line: 24]\n" +
6674
			"        [pc: 56, line: 15]\n" + 
6663
			"        [pc: 87, line: 26]\n" +
6675
			"        [pc: 59, line: 24]\n" + 
6664
			"      Local variable table:\n" +
6676
			"        [pc: 61, line: 16]\n" + 
6665
			"        [pc: 0, pc: 88] local: this index: 0 type: X\n" +
6677
			"        [pc: 62, line: 19]\n" + 
6666
			"        [pc: 0, pc: 88] local: delete index: 1 type: boolean\n" +
6678
			"        [pc: 66, line: 20]\n" + 
6667
			"        [pc: 5, pc: 88] local: s index: 2 type: java.lang.String\n" +
6679
			"        [pc: 79, line: 22]\n" + 
6668
			"        [pc: 13, pc: 88] local: buffer index: 3 type: java.lang.StringBuffer\n" +
6680
			"        [pc: 81, line: 24]\n" + 
6669
			"        [pc: 24, pc: 71] local: datas index: 4 type: java.lang.String[]\n" +
6681
			"        [pc: 86, line: 23]\n" + 
6670
			"        [pc: 34, pc: 71] local: data index: 5 type: java.lang.Object[]\n" +
6682
			"        [pc: 88, line: 24]\n" + 
6671
			"        [pc: 51, pc: 54] local: e index: 6 type: java.lang.Exception\n" +
6683
			"        [pc: 90, line: 25]\n" + 
6672
			"      Stack map table: number of frames 7\n" +
6684
			"        [pc: 93, line: 24]\n" + 
6673
			"        [pc: 49, full, stack: {java.lang.Exception}, locals: {X, int, java.lang.String, java.lang.StringBuffer, java.lang.String[], java.lang.Object[]}]\n" +
6685
			"        [pc: 95, line: 26]\n" + 
6674
			"        [pc: 54, same]\n" +
6686
			"      Local variable table:\n" + 
6675
			"        [pc: 68, same]\n" +
6687
			"        [pc: 0, pc: 96] local: this index: 0 type: X\n" + 
6676
			"        [pc: 71, full, stack: {java.lang.Exception}, locals: {X, int, java.lang.String, java.lang.StringBuffer}]\n" +
6688
			"        [pc: 0, pc: 96] local: delete index: 1 type: boolean\n" + 
6677
			"        [pc: 78, same_locals_1_stack_item, stack: {java.lang.Throwable}]\n" +
6689
			"        [pc: 5, pc: 96] local: s index: 2 type: java.lang.String\n" + 
6678
			"        [pc: 85, same]\n" +
6690
			"        [pc: 13, pc: 96] local: buffer index: 3 type: java.lang.StringBuffer\n" + 
6679
			"        [pc: 87, same]\n";
6691
			"        [pc: 24, pc: 59] local: datas index: 4 type: java.lang.String[]\n" + 
6692
			"        [pc: 62, pc: 79] local: datas index: 4 type: java.lang.String[]\n" + 
6693
			"        [pc: 34, pc: 59] local: data index: 5 type: java.lang.Object[]\n" + 
6694
			"        [pc: 62, pc: 79] local: data index: 5 type: java.lang.Object[]\n" + 
6695
			"        [pc: 51, pc: 59] local: e index: 6 type: java.lang.Exception\n" + 
6696
			"      Stack map table: number of frames 8\n" + 
6697
			"        [pc: 49, full, stack: {java.lang.Exception}, locals: {X, int, java.lang.String, java.lang.StringBuffer, java.lang.String[], java.lang.Object[]}]\n" + 
6698
			"        [pc: 59, chop 2 local(s)]\n" + 
6699
			"        [pc: 62, append: {java.lang.String[], java.lang.Object[]}]\n" + 
6700
			"        [pc: 76, same]\n" + 
6701
			"        [pc: 79, full, stack: {java.lang.Exception}, locals: {X, int, java.lang.String, java.lang.StringBuffer}]\n" + 
6702
			"        [pc: 86, same_locals_1_stack_item, stack: {java.lang.Throwable}]\n" + 
6703
			"        [pc: 93, same]\n" + 
6704
			"        [pc: 95, same]\n";
6680
6705
6681
	File f = new File(OUTPUT_DIR + File.separator + "X.class");
6706
	File f = new File(OUTPUT_DIR + File.separator + "X.class");
6682
	byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
6707
	byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(f);
(-)src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java (-121 / +125 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2010 IBM Corporation and others.
2
 * Copyright (c) 2003, 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 360-488 Link Here
360
360
361
	String expectedOutput =
361
	String expectedOutput =
362
		"  // Method descriptor #15 ([Ljava/lang/String;)V\n" +
362
		"  // Method descriptor #15 ([Ljava/lang/String;)V\n" +
363
		"  // Stack: 3, Locals: 4\n" +
363
		"  // Stack: 3, Locals: 4\n" + 
364
		"  public static void main(java.lang.String[] args);\n" +
364
		"  public static void main(java.lang.String[] args);\n" + 
365
		"     0  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
365
		"     0  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
366
		"     3  ldc <String \"1\"> [22]\n" +
366
		"     3  ldc <String \"1\"> [22]\n" + 
367
		"     5  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
367
		"     5  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + 
368
		"     8  aconst_null\n" +
368
		"     8  aconst_null\n" + 
369
		"     9  goto 13\n" +
369
		"     9  goto 13\n" + 
370
		"    12  aconst_null\n" +
370
		"    12  aconst_null\n" + 
371
		"    13  aconst_null\n" +
371
		"    13  aconst_null\n" + 
372
		"    14  goto 18\n" +
372
		"    14  goto 18\n" + 
373
		"    17  aconst_null\n" +
373
		"    17  aconst_null\n" + 
374
		"    18  if_acmpne 29\n" +
374
		"    18  if_acmpne 29\n" + 
375
		"    21  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
375
		"    21  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
376
		"    24  ldc <String \"2\"> [30]\n" +
376
		"    24  ldc <String \"2\"> [30]\n" + 
377
		"    26  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
377
		"    26  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + 
378
		"    29  new java.lang.StringBuffer [32]\n" +
378
		"    29  new java.lang.StringBuffer [32]\n" + 
379
		"    32  dup\n" +
379
		"    32  dup\n" + 
380
		"    33  ldc <String \"[\"> [34]\n" +
380
		"    33  ldc <String \"[\"> [34]\n" + 
381
		"    35  invokespecial java.lang.StringBuffer(java.lang.String) [36]\n" +
381
		"    35  invokespecial java.lang.StringBuffer(java.lang.String) [36]\n" + 
382
		"    38  aconst_null\n" +
382
		"    38  aconst_null\n" + 
383
		"    39  invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [38]\n" +
383
		"    39  invokevirtual java.lang.StringBuffer.append(java.lang.Object) : java.lang.StringBuffer [38]\n" + 
384
		"    42  ldc <String \"]\"> [42]\n" +
384
		"    42  ldc <String \"]\"> [42]\n" + 
385
		"    44  invokevirtual java.lang.StringBuffer.append(java.lang.String) : java.lang.StringBuffer [44]\n" +
385
		"    44  invokevirtual java.lang.StringBuffer.append(java.lang.String) : java.lang.StringBuffer [44]\n" + 
386
		"    47  invokevirtual java.lang.StringBuffer.toString() : java.lang.String [47]\n" +
386
		"    47  invokevirtual java.lang.StringBuffer.toString() : java.lang.String [47]\n" + 
387
		"    50  ldc <String \"[null]\"> [51]\n" +
387
		"    50  ldc <String \"[null]\"> [51]\n" + 
388
		"    52  if_acmpne 59\n" +
388
		"    52  if_acmpne 59\n" + 
389
		"    55  iconst_1\n" +
389
		"    55  iconst_1\n" + 
390
		"    56  goto 60\n" +
390
		"    56  goto 60\n" + 
391
		"    59  iconst_0\n" +
391
		"    59  iconst_0\n" + 
392
		"    60  istore_1 [b]\n" +
392
		"    60  istore_1 [b]\n" + 
393
		"    61  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
393
		"    61  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
394
		"    64  ldc <String \"3\"> [53]\n" +
394
		"    64  ldc <String \"3\"> [53]\n" + 
395
		"    66  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
395
		"    66  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + 
396
		"    69  aconst_null\n" +
396
		"    69  aconst_null\n" + 
397
		"    70  astore_2 [s]\n" +
397
		"    70  astore_2 [s]\n" + 
398
		"    71  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
398
		"    71  aload_2 [s]\n" + 
399
		"    74  ldc <String \"4\"> [55]\n" +
399
		"    72  ifnonnull 83\n" + 
400
		"    76  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
400
		"    75  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
401
		"    79  ldc <String \"aaa\"> [57]\n" +
401
		"    78  ldc <String \"4\"> [55]\n" + 
402
		"    81  astore_3 [s2]\n" +
402
		"    80  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + 
403
		"    82  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
403
		"    83  ldc <String \"aaa\"> [57]\n" + 
404
		"    85  ldc <String \"5\"> [59]\n" +
404
		"    85  astore_3 [s2]\n" + 
405
		"    87  invokevirtual java.io.PrintStream.println(java.lang.String) : void [61]\n" +
405
		"    86  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
406
		"    90  return\n" +
406
		"    89  ldc <String \"5\"> [59]\n" + 
407
		"      Line numbers:\n" +
407
		"    91  invokevirtual java.io.PrintStream.println(java.lang.String) : void [61]\n" + 
408
		"        [pc: 0, line: 3]\n" +
408
		"    94  return\n" + 
409
		"        [pc: 8, line: 4]\n" +
409
		"      Line numbers:\n" + 
410
		"        [pc: 21, line: 5]\n" +
410
		"        [pc: 0, line: 3]\n" + 
411
		"        [pc: 29, line: 6]\n" +
411
		"        [pc: 8, line: 4]\n" + 
412
		"        [pc: 61, line: 7]\n" +
412
		"        [pc: 21, line: 5]\n" + 
413
		"        [pc: 69, line: 8]\n" +
413
		"        [pc: 29, line: 6]\n" + 
414
		"        [pc: 71, line: 9]\n" +
414
		"        [pc: 61, line: 7]\n" + 
415
		"        [pc: 79, line: 10]\n" +
415
		"        [pc: 69, line: 8]\n" + 
416
		"        [pc: 82, line: 11]\n" +
416
		"        [pc: 71, line: 9]\n" + 
417
		"        [pc: 90, line: 12]\n" +
417
		"        [pc: 83, line: 10]\n" + 
418
		"      Local variable table:\n" +
418
		"        [pc: 86, line: 11]\n" + 
419
		"        [pc: 0, pc: 91] local: args index: 0 type: java.lang.String[]\n" +
419
		"        [pc: 94, line: 12]\n" + 
420
		"        [pc: 61, pc: 91] local: b index: 1 type: boolean\n" +
420
		"      Local variable table:\n" + 
421
		"        [pc: 71, pc: 91] local: s index: 2 type: java.lang.String\n" +
421
		"        [pc: 0, pc: 95] local: args index: 0 type: java.lang.String[]\n" + 
422
		"        [pc: 82, pc: 91] local: s2 index: 3 type: java.lang.String\n";
422
		"        [pc: 61, pc: 95] local: b index: 1 type: boolean\n" + 
423
		"        [pc: 71, pc: 95] local: s index: 2 type: java.lang.String\n" + 
424
		"        [pc: 86, pc: 95] local: s2 index: 3 type: java.lang.String\n";
423
425
424
	String expectedOutput15 =
426
	String expectedOutput15 =
425
		"  // Method descriptor #15 ([Ljava/lang/String;)V\n" +
427
		"  // Method descriptor #15 ([Ljava/lang/String;)V\n" +
426
		"  // Stack: 3, Locals: 4\n" +
428
		"  // Stack: 3, Locals: 4\n" + 
427
		"  public static void main(java.lang.String[] args);\n" +
429
		"  public static void main(java.lang.String[] args);\n" + 
428
		"     0  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
430
		"     0  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
429
		"     3  ldc <String \"1\"> [22]\n" +
431
		"     3  ldc <String \"1\"> [22]\n" + 
430
		"     5  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
432
		"     5  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + 
431
		"     8  aconst_null\n" +
433
		"     8  aconst_null\n" + 
432
		"     9  goto 13\n" +
434
		"     9  goto 13\n" + 
433
		"    12  aconst_null\n" +
435
		"    12  aconst_null\n" + 
434
		"    13  aconst_null\n" +
436
		"    13  aconst_null\n" + 
435
		"    14  goto 18\n" +
437
		"    14  goto 18\n" + 
436
		"    17  aconst_null\n" +
438
		"    17  aconst_null\n" + 
437
		"    18  if_acmpne 29\n" +
439
		"    18  if_acmpne 29\n" + 
438
		"    21  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
440
		"    21  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
439
		"    24  ldc <String \"2\"> [30]\n" +
441
		"    24  ldc <String \"2\"> [30]\n" + 
440
		"    26  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
442
		"    26  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + 
441
		"    29  new java.lang.StringBuilder [32]\n" +
443
		"    29  new java.lang.StringBuilder [32]\n" + 
442
		"    32  dup\n" +
444
		"    32  dup\n" + 
443
		"    33  ldc <String \"[\"> [34]\n" +
445
		"    33  ldc <String \"[\"> [34]\n" + 
444
		"    35  invokespecial java.lang.StringBuilder(java.lang.String) [36]\n" +
446
		"    35  invokespecial java.lang.StringBuilder(java.lang.String) [36]\n" + 
445
		"    38  aconst_null\n" +
447
		"    38  aconst_null\n" + 
446
		"    39  invokevirtual java.lang.StringBuilder.append(java.lang.Object) : java.lang.StringBuilder [38]\n" +
448
		"    39  invokevirtual java.lang.StringBuilder.append(java.lang.Object) : java.lang.StringBuilder [38]\n" + 
447
		"    42  ldc <String \"]\"> [42]\n" +
449
		"    42  ldc <String \"]\"> [42]\n" + 
448
		"    44  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [44]\n" +
450
		"    44  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [44]\n" + 
449
		"    47  invokevirtual java.lang.StringBuilder.toString() : java.lang.String [47]\n" +
451
		"    47  invokevirtual java.lang.StringBuilder.toString() : java.lang.String [47]\n" + 
450
		"    50  ldc <String \"[null]\"> [51]\n" +
452
		"    50  ldc <String \"[null]\"> [51]\n" + 
451
		"    52  if_acmpne 59\n" +
453
		"    52  if_acmpne 59\n" + 
452
		"    55  iconst_1\n" +
454
		"    55  iconst_1\n" + 
453
		"    56  goto 60\n" +
455
		"    56  goto 60\n" + 
454
		"    59  iconst_0\n" +
456
		"    59  iconst_0\n" + 
455
		"    60  istore_1 [b]\n" +
457
		"    60  istore_1 [b]\n" + 
456
		"    61  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
458
		"    61  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
457
		"    64  ldc <String \"3\"> [53]\n" +
459
		"    64  ldc <String \"3\"> [53]\n" + 
458
		"    66  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
460
		"    66  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + 
459
		"    69  aconst_null\n" +
461
		"    69  aconst_null\n" + 
460
		"    70  astore_2 [s]\n" +
462
		"    70  astore_2 [s]\n" + 
461
		"    71  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
463
		"    71  aload_2 [s]\n" + 
462
		"    74  ldc <String \"4\"> [55]\n" +
464
		"    72  ifnonnull 83\n" + 
463
		"    76  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" +
465
		"    75  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
464
		"    79  ldc <String \"aaa\"> [57]\n" +
466
		"    78  ldc <String \"4\"> [55]\n" + 
465
		"    81  astore_3 [s2]\n" +
467
		"    80  invokevirtual java.io.PrintStream.print(java.lang.String) : void [24]\n" + 
466
		"    82  getstatic java.lang.System.out : java.io.PrintStream [16]\n" +
468
		"    83  ldc <String \"aaa\"> [57]\n" + 
467
		"    85  ldc <String \"5\"> [59]\n" +
469
		"    85  astore_3 [s2]\n" + 
468
		"    87  invokevirtual java.io.PrintStream.println(java.lang.String) : void [61]\n" +
470
		"    86  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
469
		"    90  return\n" +
471
		"    89  ldc <String \"5\"> [59]\n" + 
470
		"      Line numbers:\n" +
472
		"    91  invokevirtual java.io.PrintStream.println(java.lang.String) : void [61]\n" + 
471
		"        [pc: 0, line: 3]\n" +
473
		"    94  return\n" + 
472
		"        [pc: 8, line: 4]\n" +
474
		"      Line numbers:\n" + 
473
		"        [pc: 21, line: 5]\n" +
475
		"        [pc: 0, line: 3]\n" + 
474
		"        [pc: 29, line: 6]\n" +
476
		"        [pc: 8, line: 4]\n" + 
475
		"        [pc: 61, line: 7]\n" +
477
		"        [pc: 21, line: 5]\n" + 
476
		"        [pc: 69, line: 8]\n" +
478
		"        [pc: 29, line: 6]\n" + 
477
		"        [pc: 71, line: 9]\n" +
479
		"        [pc: 61, line: 7]\n" + 
478
		"        [pc: 79, line: 10]\n" +
480
		"        [pc: 69, line: 8]\n" + 
479
		"        [pc: 82, line: 11]\n" +
481
		"        [pc: 71, line: 9]\n" + 
480
		"        [pc: 90, line: 12]\n" +
482
		"        [pc: 83, line: 10]\n" + 
481
		"      Local variable table:\n" +
483
		"        [pc: 86, line: 11]\n" + 
482
		"        [pc: 0, pc: 91] local: args index: 0 type: java.lang.String[]\n" +
484
		"        [pc: 94, line: 12]\n" + 
483
		"        [pc: 61, pc: 91] local: b index: 1 type: boolean\n" +
485
		"      Local variable table:\n" + 
484
		"        [pc: 71, pc: 91] local: s index: 2 type: java.lang.String\n" +
486
		"        [pc: 0, pc: 95] local: args index: 0 type: java.lang.String[]\n" + 
485
		"        [pc: 82, pc: 91] local: s2 index: 3 type: java.lang.String\n";
487
		"        [pc: 61, pc: 95] local: b index: 1 type: boolean\n" + 
488
		"        [pc: 71, pc: 95] local: s index: 2 type: java.lang.String\n" + 
489
		"        [pc: 86, pc: 95] local: s2 index: 3 type: java.lang.String\n";
486
490
487
	if (this.complianceLevel >= ClassFileConstants.JDK1_5) {
491
	if (this.complianceLevel >= ClassFileConstants.JDK1_5) {
488
		int index = actualOutput.indexOf(expectedOutput15);
492
		int index = actualOutput.indexOf(expectedOutput15);
(-)src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java (-4 / +172 lines)
Lines 43-49 Link Here
43
// Only the highest compliance level is run; add the VM argument
43
// Only the highest compliance level is run; add the VM argument
44
// -Dcompliance=1.4 (for example) to lower it if needed
44
// -Dcompliance=1.4 (for example) to lower it if needed
45
static {
45
static {
46
//		TESTS_NAMES = new String[] { "testBug336428e" };
46
//		TESTS_NAMES = new String[] { "testBug326950" };
47
//		TESTS_NUMBERS = new int[] { 561 };
47
//		TESTS_NUMBERS = new int[] { 561 };
48
//		TESTS_RANGE = new int[] { 1, 2049 };
48
//		TESTS_RANGE = new int[] { 1, 2049 };
49
}
49
}
Lines 11781-11790 Link Here
11781
		"     2  aconst_null\n" + 
11781
		"     2  aconst_null\n" + 
11782
		"     3  astore_2 [s2]\n" + 
11782
		"     3  astore_2 [s2]\n" + 
11783
		"     4  aload_1 [s]\n" + 
11783
		"     4  aload_1 [s]\n" + 
11784
		"     5  ifnull 12\n" + 
11784
		"     5  ifnull 26\n" + 
11785
		"     8  aload_2 [s2]\n" + 
11785
		"     8  aload_2 [s2]\n" + 
11786
		"     9  ifnull 12\n" + 
11786
		"     9  ifnull 26\n" + 
11787
		"    12  return\n";
11787
		"    12  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
11788
		"    15  aload_1 [s]\n" + 
11789
		"    16  invokevirtual java.io.PrintStream.println(java.lang.String) : void [22]\n" + 
11790
		"    19  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
11791
		"    22  aload_2 [s2]\n" + 
11792
		"    23  invokevirtual java.io.PrintStream.println(java.lang.String) : void [22]\n" + 
11793
		"    26  return\n";
11788
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
11794
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
11789
}
11795
}
11790
11796
Lines 14238-14241 Link Here
14238
		"Dead code\n" + 
14244
		"Dead code\n" + 
14239
		"----------\n");
14245
		"----------\n");
14240
}
14246
}
14247
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=326950
14248
public void testBug326950a() throws Exception {
14249
	Map options = getCompilerOptions();
14250
	options.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.WARNING);
14251
	options.put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.WARNING);
14252
	options.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.WARNING);
14253
	this.runConformTest(
14254
		new String[] {
14255
			"X.java",
14256
			"public class X {\n" + 
14257
			"	public static void main(String[] args) {\n" + 
14258
			"		String s = null;\n" +
14259
			"		if (s == null) {\n" + 
14260
			"			System.out.println(\"SUCCESS\");\n" + 
14261
			"		} else {\n" +
14262
			"			System.out.println(\"Dead code, but don't optimize me out\");\n" +
14263
			"		}\n" + 
14264
			"	}\n" + 
14265
			"}",
14266
		},
14267
		"SUCCESS",
14268
		null,
14269
		true,
14270
		null,
14271
		options,
14272
		null);
14273
	String expectedOutput =
14274
		"  public static void main(java.lang.String[] args);\n" + 
14275
		"     0  aconst_null\n" + 
14276
		"     1  astore_1 [s]\n" + 
14277
		"     2  aload_1 [s]\n" + 
14278
		"     3  ifnonnull 17\n" + 
14279
		"     6  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
14280
		"     9  ldc <String \"SUCCESS\"> [22]\n" + 
14281
		"    11  invokevirtual java.io.PrintStream.println(java.lang.String) : void [24]\n" + 
14282
		"    14  goto 25\n" + 
14283
		"    17  getstatic java.lang.System.out : java.io.PrintStream [16]\n" + 
14284
		"    20  ldc <String \"Dead code, but don\'t optimize me out\"> [30]\n" + 
14285
		"    22  invokevirtual java.io.PrintStream.println(java.lang.String) : void [24]\n" + 
14286
		"    25  return\n";
14287
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
14288
}
14289
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=326950
14290
// Code marked dead due to if(false), etc. can be optimized out
14291
public void testBug326950b() throws Exception {
14292
	Map options = getCompilerOptions();
14293
	options.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.WARNING);
14294
	options.put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.WARNING);
14295
	options.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.WARNING);
14296
	this.runConformTest(
14297
		new String[] {
14298
			"X.java",
14299
			"public class X {\n" + 
14300
			"	public static void main(String[] args) {\n" +
14301
			"		int i = 0;\n" + 
14302
			"		if (false) {\n" + 
14303
			"			System.out.println(\"Deadcode and you can optimize me out\");\n" + 
14304
			"		}\n" +
14305
			"		if (true) {\n" +
14306
			"			i++;\n" +
14307
			"		} else {\n" +
14308
			"			System.out.println(\"Deadcode and you can optimize me out\");\n" +
14309
			"		}\n" +
14310
			"	}\n" + 
14311
			"}",
14312
		},
14313
		"",
14314
		null,
14315
		true,
14316
		null,
14317
		options,
14318
		null);
14319
	String expectedOutput =
14320
		"  public static void main(java.lang.String[] args);\n" + 
14321
		"    0  iconst_0\n" + 
14322
		"    1  istore_1 [i]\n" + 
14323
		"    2  iinc 1 1 [i]\n" + 
14324
		"    5  return\n";
14325
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
14326
}
14327
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=326950
14328
// Free return should be generated for a method even if it ends with dead code
14329
public void testBug326950c() throws Exception {
14330
	Map options = getCompilerOptions();
14331
	options.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.WARNING);
14332
	options.put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.WARNING);
14333
	options.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.WARNING);
14334
	this.runConformTest(
14335
		new String[] {
14336
			"X.java",
14337
			"public class X {\n" + 
14338
			"	public void foo(String[] args) {\n" + 
14339
			"		String s = \"\";\n" +
14340
			"		int i = 0;\n" +
14341
			"		if (s != null) {\n" + 
14342
			"			return;\n" + 
14343
			"		}\n" +
14344
			"		i++;\n" +
14345
			"	}\n" + 
14346
			"}",
14347
		},
14348
		"",
14349
		null,
14350
		true,
14351
		null,
14352
		options,
14353
		null);
14354
	String expectedOutput =
14355
		"  public void foo(java.lang.String[] args);\n" + 
14356
		"     0  ldc <String \"\"> [16]\n" + 
14357
		"     2  astore_2 [s]\n" + 
14358
		"     3  iconst_0\n" + 
14359
		"     4  istore_3 [i]\n" + 
14360
		"     5  aload_2 [s]\n" + 
14361
		"     6  ifnull 10\n" + 
14362
		"     9  return\n" + 
14363
		"    10  iinc 3 1 [i]\n" + 
14364
		"    13  return\n";
14365
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
14366
}
14367
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=326950
14368
// Free return should be generated for a constructor even if it ends with dead code
14369
public void testBug326950d() throws Exception {
14370
	Map options = getCompilerOptions();
14371
	options.put(CompilerOptions.OPTION_ReportNullReference, CompilerOptions.WARNING);
14372
	options.put(CompilerOptions.OPTION_ReportPotentialNullReference, CompilerOptions.WARNING);
14373
	options.put(CompilerOptions.OPTION_ReportRedundantNullCheck, CompilerOptions.WARNING);
14374
	this.runConformTest(
14375
		new String[] {
14376
			"X.java",
14377
			"public class X {\n" + 
14378
			"	X() {\n" + 
14379
			"		String s = \"\";\n" +
14380
			"		int i = 0;\n" +
14381
			"		if (s != null) {\n" + 
14382
			"			return;\n" + 
14383
			"		}\n" +
14384
			"		i++;\n" +
14385
			"	}\n" + 
14386
			"}",
14387
		},
14388
		"",
14389
		null,
14390
		true,
14391
		null,
14392
		options,
14393
		null);
14394
	String expectedOutput =
14395
		"  X();\n" + 
14396
		"     0  aload_0 [this]\n" + 
14397
		"     1  invokespecial java.lang.Object() [8]\n" + 
14398
		"     4  ldc <String \"\"> [10]\n" + 
14399
		"     6  astore_1 [s]\n" + 
14400
		"     7  iconst_0\n" + 
14401
		"     8  istore_2 [i]\n" + 
14402
		"     9  aload_1 [s]\n" + 
14403
		"    10  ifnull 14\n" + 
14404
		"    13  return\n" + 
14405
		"    14  iinc 2 1 [i]\n" + 
14406
		"    17  return\n";
14407
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
14408
}
14241
}
14409
}

Return to bug 326950