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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java (-9 / +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 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/Statement.java (-1 / +1 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
		//this.bits &= ~ASTNode.IsReachable;
76
		if (flowInfo == FlowInfo.DEAD_END) {
76
		if (flowInfo == FlowInfo.DEAD_END) {
77
			if (previousComplaintLevel < COMPLAINED_UNREACHABLE) {
77
			if (previousComplaintLevel < COMPLAINED_UNREACHABLE) {
78
				scope.problemReporter().unreachableCode(this);
78
				scope.problemReporter().unreachableCode(this);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java (-4 / +4 lines)
Lines 633-640 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) != 0)
637
					field.bits &= ~ASTNode.IsReachable;
637
//					field.bits &= ~ASTNode.IsReachable;
638
638
639
				/*if (field.isField()){
639
				/*if (field.isField()){
640
					staticInitializerContext.handledExceptions = NoExceptions; // no exception is allowed jls8.3.2
640
					staticInitializerContext.handledExceptions = NoExceptions; // no exception is allowed jls8.3.2
Lines 649-656 Link Here
649
					staticFieldInfo = FlowInfo.initial(this.maxFieldCount).setReachMode(FlowInfo.UNREACHABLE);
649
					staticFieldInfo = FlowInfo.initial(this.maxFieldCount).setReachMode(FlowInfo.UNREACHABLE);
650
				}
650
				}
651
			} else {
651
			} else {
652
				if ((nonStaticFieldInfo.tagBits & FlowInfo.UNREACHABLE) != 0)
652
//				if ((nonStaticFieldInfo.tagBits & FlowInfo.UNREACHABLE) != 0)
653
					field.bits &= ~ASTNode.IsReachable;
653
//					field.bits &= ~ASTNode.IsReachable;
654
654
655
				/*if (field.isField()){
655
				/*if (field.isField()){
656
					initializerContext.handledExceptions = NoExceptions; // no exception is allowed jls8.3.2
656
					initializerContext.handledExceptions = NoExceptions; // no exception is allowed jls8.3.2

Return to bug 326950