Project: JDT
Bug 46216 [inline] Inline local should add explicit cast for primitive types
Reported: 2003-11-06 12:34:57 | Status: verified fixed

Try to inline variable l in the following code: public class Inline { public long inline(int i) { long l = i; return l << 50; } } and you will get public class Inline { public long inline(int i) { return i << 50; } } which is wrong. The "return" statement should be return (long) i << 50; First the cast, then the shift, not the other way round. (Shifting an int by 50 is equivalent to shifting it by 18)

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/InlineConstant/canInline/test14/out/GrueziWohl.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineTemp/canInline/A_test33_in.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineTemp/canInline/A_test33_out.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/InlineTempTests.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/dom/ASTNodes.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/InlineTempRefactoring.java