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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java (-1 / +2 lines)
Lines 349-355 Link Here
349
						if ((enumConstant.modifiers & ClassFileConstants.AccEnum) == 0) continue;
349
						if ((enumConstant.modifiers & ClassFileConstants.AccEnum) == 0) continue;
350
						findConstant : {
350
						findConstant : {
351
							for (int j = 0; j < caseCount; j++) {
351
							for (int j = 0; j < caseCount; j++) {
352
								if (enumConstant.id == this.constants[j]) break findConstant;
352
								if ((enumConstant.id + 1) == this.constants[j]) // zero should not be returned see bug 141810
353
									break findConstant;
353
							}
354
							}
354
							// enum constant did not get referenced from switch
355
							// enum constant did not get referenced from switch
355
							upperScope.problemReporter().missingEnumConstantCase(this, enumConstant);
356
							upperScope.problemReporter().missingEnumConstantCase(this, enumConstant);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java (-1 / +1 lines)
Lines 118-124 Link Here
118
					} else 	if (reference instanceof QualifiedNameReference) {
118
					} else 	if (reference instanceof QualifiedNameReference) {
119
						 scope.problemReporter().cannotUseQualifiedEnumConstantInCaseLabel(reference, field);
119
						 scope.problemReporter().cannotUseQualifiedEnumConstantInCaseLabel(reference, field);
120
					}
120
					}
121
					return IntConstant.fromValue(field.original().id); // ordinal value
121
					return IntConstant.fromValue(field.original().id + 1); // (ordinal value + 1) zero should not be returned see bug 141810
122
				}
122
				}
123
			} else {
123
			} else {
124
				return constantExpression.constant;
124
				return constantExpression.constant;
(-)compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java (-1 / +1 lines)
Lines 2552-2558 Link Here
2552
				this.aload_0();
2552
				this.aload_0();
2553
				this.getstatic(fieldBinding);
2553
				this.getstatic(fieldBinding);
2554
				this.invokeEnumOrdinal(enumBinding.constantPoolName());
2554
				this.invokeEnumOrdinal(enumBinding.constantPoolName());
2555
				this.generateInlinedValue(fieldBinding.id);
2555
				this.generateInlinedValue(fieldBinding.id + 1); // zero should not be returned see bug 141810
2556
				this.iastore();
2556
				this.iastore();
2557
				anyExceptionHandler.placeEnd();
2557
				anyExceptionHandler.placeEnd();
2558
				this.goto_(endLabel);
2558
				this.goto_(endLabel);

Return to bug 141810