Project: JDT
Bug 11337 Extract method parameter detection
Reported: 2002-03-14 04:53:11 | Status: verified fixed

When I extract selected ('*') lines of code from: void Disassemble(String aggregateName, String telegramName, byte bytes []) throws Exception { String fullTelegramName = aggregateName + "." + telegramName; TTelegramDef telegramDef = GetExistingTelegramDef(telegramName); System.out.println(telegramDef); // ByteArrayInputStream is = new ByteArrayInputStream(bytes); // int bitValue = 0; int bitPos = -1; // for (int i = 0; i < telegramDef.GetFieldCount(); i++) { TFieldDef field = telegramDef.GetField(i); if (field.GetName().equals("skip")) { bitPos = -1; continue; } // String fullFieldName = fullTelegramName + "." + field.GetName(); switch (field.GetType()) { case TFieldDef.TYPE_INT : { * byte b1 = (byte) is.read(); * byte b2 = (byte) is.read(); * if ((b1 == -1) || (b2 == -1)) * throw new Exception ("Not enough data in telegram, name: " + telegramName + " bytes: " + Debug.DumpBytes(bytes)); * int value = (b1 << 8) + b2; m_DE.Set(fullFieldName, value); } break; case TFieldDef.TYPE_BIT : break; case TFieldDef.TYPE_STR : break; default : throw new Exception("Unknown field type: " + field.GetType()); } // switch field type } // for all fields // m_DE.Commit(); } It produces: private int GetIntFromBytes(String telegramName, ByteArrayInputStream is) throws Exception { byte b1 = (byte) is.read(); byte b2 = (byte) is.read(); if ((b1 == -1) || (b2 == -1)) throw new Exception("Not enough data in telegram, name: " + telegramName + " bytes: " + Debug.DumpBytes(bytes)); int value = (b1 << 8) + b2; return value; } But there is no parameter with name "bytes".

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/T11337.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/T11337_1.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/locals_in/A_test565.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/locals_out/A_test565.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/flow/FlowAnalyzer.java