Summary: | [5.0] ITypeBinding.canAssign not aware of type boxing | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Martin Aeschlimann <martinae> |
Component: | Core | Assignee: | Jerome Lanneluc <jerome_lanneluc> |
Status: | VERIFIED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | markus.kell.r |
Version: | 3.0 | ||
Target Milestone: | 3.1 M4 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Martin Aeschlimann
2004-12-08 06:27:25 EST
Autoboxing support is being added gradually. Changed TypeBinding#isAssignmentCompatible(...) to check also if the argument is boxing compatible with the receiver. Added regression test CompatibilityRuleTests#test023(). Verified for 3.1 M4 using build I200412142000. To verify it I've used ASTView 1.0.2 + following code: package b80455; public class Test { void foo() { Integer itg = new Integer(0); int ibt = 0; if (itg == ibt) System.out.println("equals"); } } + breakpoint in ASTViewLabelProvider.getText(Object obj) condition: ((ASTNode)obj).getNodeType() == ASTNode.IF_STATEMENT + code snippet in Debugger Display view: org.eclipse.jdt.core.dom.IfStatement ifStatement = (org.eclipse.jdt.core.dom.IfStatement) obj; org.eclipse.jdt.core.dom.InfixExpression expression = (org.eclipse.jdt.core.dom.InfixExpression) ifStatement.getExpression(); org.eclipse.jdt.core.dom.ITypeBinding leftBinding = expression.getLeftOperand().resolveTypeBinding(); org.eclipse.jdt.core.dom.ITypeBinding rightBinding = expression.getRightOperand().resolveTypeBinding(); rightBinding.isAssignmentCompatible(leftBinding); Test can easilier be done using new feature of ASTView to compare bindings: - Select a binding and choose 'add to comparison tree' in the context menu - Then select the other binding you want to compare with the first one, - In the comparison tray you can see the result of the test Thanks Martin for the tip :-) |