Community
Participate
Working Groups
Build 3.2RC7 Along the lines of bug 144858. In presence of duplicate fields or methods; the compiler discards all instances of the offending construct. This means that more secondary errors may arise and be quite misleading outside of context, and other tools based on the AST (DOM AST for instance) may behave suboptimally as lacking some of the binding information. What if: - it still created the bindings, and attached them to the AST node - it would leave at least one entry in binding arrays to reduce amount of secondary errors. e.g. we currently complain about missing both #foo() and #baz() public class X { void foo() { } void foo() { } void bar() { foo(); baz(); } }
To be investigated during M7
Nice to have. I wouldn't change this at this point in the release cycle. Removing 3.3M7 target
From this testcase, we delete both duplicate fields & methods (but we keep the first duplicate superinterface, member type & thrown exception) : class X<T> implements I, I { int i; boolean i; void bar() { M m = new M(); m.foo(); if (i) { try { test(); } catch ( Ex e ) {} } } public void test() throws Ex, Ex {} // do not complain about extra Ex class M { void foo() {} void foo() {} } class M {} } interface I { void test() throws Ex, Ex; // do not complain about extra Ex } @SuppressWarnings("serial") class Ex extends Exception {}
Created attachment 115077 [details] Proposed patch with testcase for duplicate fields This patch keeps the first duplicate field & removes the rest
Created attachment 115301 [details] Proposed patch with testcases
Fix released for 3.5M3 Updated tests in 8 different test classes including NegativeTest and MethodVerifyTest
Created attachment 115727 [details] Proposed patch with testcases Releasing this patch instead. Both duplicate fields and methods will receive errors but the binding for the first field/method will still exist to reduce secondary errors.
Verified for 3.5M3 using I20081026-2000 build.
See bug 255035 for additional change when a duplicate method did not have a return type