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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java (-13 / +7 lines)
Lines 1632-1640 Link Here
1632
 * Macro for building a class descriptor object
1632
 * Macro for building a class descriptor object
1633
 */
1633
 */
1634
public void generateClassLiteralAccessForType(TypeBinding accessedType, FieldBinding syntheticFieldBinding) {
1634
public void generateClassLiteralAccessForType(TypeBinding accessedType, FieldBinding syntheticFieldBinding) {
1635
	BranchLabel endLabel;
1636
	ExceptionLabel anyExceptionHandler;
1637
	int saveStackSize;
1638
	if (accessedType.isBaseType() && accessedType != TypeBinding.NULL) {
1635
	if (accessedType.isBaseType() && accessedType != TypeBinding.NULL) {
1639
		this.getTYPE(accessedType.id);
1636
		this.getTYPE(accessedType.id);
1640
		return;
1637
		return;
Lines 1644-1650 Link Here
1644
		// generation using the new ldc_w bytecode
1641
		// generation using the new ldc_w bytecode
1645
		this.ldc(accessedType);
1642
		this.ldc(accessedType);
1646
	} else {
1643
	} else {
1647
		endLabel = new BranchLabel(this);
1644
		BranchLabel endLabel = new BranchLabel(this);
1648
		if (syntheticFieldBinding != null) { // non interface case
1645
		if (syntheticFieldBinding != null) { // non interface case
1649
			this.getstatic(syntheticFieldBinding);
1646
			this.getstatic(syntheticFieldBinding);
1650
			this.dup();
1647
			this.dup();
Lines 1663-1670 Link Here
1663
	
1660
	
1664
		// Wrap the code in an exception handler to convert a ClassNotFoundException into a NoClassDefError
1661
		// Wrap the code in an exception handler to convert a ClassNotFoundException into a NoClassDefError
1665
	
1662
	
1666
		anyExceptionHandler = new ExceptionLabel(this, TypeBinding.NULL /*represents ClassNotFoundException*/);
1663
		ExceptionLabel classNotFoundExceptionHandler = new ExceptionLabel(this, TypeBinding.NULL /*represents ClassNotFoundException*/);
1667
		anyExceptionHandler.placeStart();
1664
		classNotFoundExceptionHandler.placeStart();
1668
		this.ldc(accessedType == TypeBinding.NULL ? "java.lang.Object" : String.valueOf(accessedType.constantPoolName()).replace('/', '.')); //$NON-NLS-1$
1665
		this.ldc(accessedType == TypeBinding.NULL ? "java.lang.Object" : String.valueOf(accessedType.constantPoolName()).replace('/', '.')); //$NON-NLS-1$
1669
		this.invokeClassForName();
1666
		this.invokeClassForName();
1670
	
1667
	
Lines 1685-1707 Link Here
1685
		/* We need to protect the runtime code from binary inconsistencies
1682
		/* We need to protect the runtime code from binary inconsistencies
1686
		in case the accessedType is missing, the ClassNotFoundException has to be converted
1683
		in case the accessedType is missing, the ClassNotFoundException has to be converted
1687
		into a NoClassDefError(old ex message), we thus need to build an exception handler for this one. */
1684
		into a NoClassDefError(old ex message), we thus need to build an exception handler for this one. */
1688
		anyExceptionHandler.placeEnd();
1685
		classNotFoundExceptionHandler.placeEnd();
1689
	
1686
	
1690
		if (syntheticFieldBinding != null) { // non interface case
1687
		if (syntheticFieldBinding != null) { // non interface case
1691
			this.dup();
1688
			this.dup();
1692
			this.putstatic(syntheticFieldBinding);
1689
			this.putstatic(syntheticFieldBinding);
1693
		}
1690
		}
1694
		this.goto_(endLabel);
1691
		this.goto_(endLabel);
1695
	
1692
1696
	
1697
		// Generate the body of the exception handler
1693
		// Generate the body of the exception handler
1698
		saveStackSize = stackDepth;
1699
		stackDepth = 1;
1700
		/* ClassNotFoundException on stack -- the class literal could be doing more things
1694
		/* ClassNotFoundException on stack -- the class literal could be doing more things
1701
		on the stack, which means that the stack may not be empty at this point in the
1695
		on the stack, which means that the stack may not be empty at this point in the
1702
		above code gen. So we save its state and restart it from 1. */
1696
		above code gen. So we save its state and restart it from 1. */
1703
	
1697
	
1704
		anyExceptionHandler.place();
1698
		this.pushExceptionOnStack(TypeBinding.NULL);/*represents ClassNotFoundException*/
1699
		classNotFoundExceptionHandler.place();
1705
	
1700
	
1706
		// Transform the current exception, and repush and throw a 
1701
		// Transform the current exception, and repush and throw a 
1707
		// NoClassDefFoundError(ClassNotFound.getMessage())
1702
		// NoClassDefFoundError(ClassNotFound.getMessage())
Lines 1716-1722 Link Here
1716
		// Send the constructor taking a message string as an argument
1711
		// Send the constructor taking a message string as an argument
1717
		this.invokeNoClassDefFoundErrorStringConstructor();
1712
		this.invokeNoClassDefFoundErrorStringConstructor();
1718
		this.athrow();
1713
		this.athrow();
1719
		stackDepth = saveStackSize;
1720
		endLabel.place();
1714
		endLabel.place();
1721
	}
1715
	}
1722
}
1716
}

Return to bug 204002