Community
Participate
Working Groups
Build ID: I20080530-1730 Method DiagnoseParser#checkPrimaryDistance contains this if-structure: if (j > repair.distance) { ... } else if (j == repair.distance && k > repair.misspellIndex) { ... } else if (j == repair.distance && k > repair.misspellIndex && isBetterSymbol(symbol, repair.symbol)) { ... } The third branch can obviously never be reached. Additionally, isBetterSymbol constantly returns false. I was going to add specific logic to isBetterSymbol, but this might be riding a dead horse. So my question is: is this code unfinished or obsolete or both? ;-)
This code has bug, it should be 'j == repair.distance && k == repair.misspellIndex && isBetterSymbol(symbol, repair.symbol)'. This code is useless because isBetterSymbol() return always false. I think that this code has been released by accident. If my memory is good, i investigated how to replace 'interface' by 'class' in syntax error diagnosis and this code is a part of these investigation. So we should remove this useless code or we should add the complete support to replace 'interface' by 'class' in diagnosis (we should also replace non terminal symbols like 'InterfaceHeader' by 'ClassHeader' and do the same for other constructs like the 'enum').
Created attachment 107583 [details] Proposed fix This patch remove the useless code.
Released for 3.5M1.
Verified for 3.5M1 using I20080805-1307