Project: JDT
Bug 33533 Inlining method with assert has unexpected result
Reported: 2003-02-28 08:14:46 | Status: resolved fixed

I2003-02-14 Situation: I have a class Assert that has a static method notNull which I want to inline in an attempt of switching to JDK 1.4's assert facility. The notNull method looks like: public static final void notNull(Object ref, String message) { assert ref != null : message; } A method that uses the notNull method looks like: void method(String param1, String param2, String param3) { Assert.notNull(param1, "param1 != null"); Assert.notNull(param2, "param2 != null"); Assert.notNull(param3, "param3 != null"); } Unfortunately, after inlinig, it looks like: void method(String param1, String param2) { assert param1 != null : "param1 != null"; Object ref = param2; assert ref != null : "param2 != null"; Object ref1 = param3; assert ref1 != null : "param3 != null"; } What I had expected was something like: void method(String param1, String param2) { assert param1 != null : "param1 != null"; assert param2 != null : "param2 != null"; assert param3 != null : "param3 != null"; }

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/argument_in/TestOneRead.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/argument_in/TestTwoReads.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/argument_in/TestWrite.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/argument_out/TestOneRead.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/argument_out/TestTwoReads.java org.eclipse.jdt.ui.tests.refactoring/resources/InlineMethodWorkspace/TestCases/argument_out/TestWrite.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/InlineMethodTests.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/CallInliner.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ParameterData.java