Community
Participate
Working Groups
Build Identifier: 20100617-1415 When a method is annotated with @Override although it doesn't override/implement a super type method, Eclipse proposes to declare the method in the super type as quick fix. When the method has varargs, the method added by Eclipse will be declared with an array instead, and thus produce a warning. 2 possible workarounds: - modify the generated method signature after using the quick fix - use the "Pull Up" refactoring instead, which generates the right method signature. However this adds the @Override annotation a second time, which produces another compilation error. Reproducible: Always Steps to Reproduce: 1. Copy the code below in a new java editor 2. On the "withVarargs" method (which does not compile), apply the proposed quick fix: "Create 'withVarargs()' in super type 'MySuperType' 3. Eclipse adds the method 'void withVarargs(int[] foo);' to MySuperType public class CreateInSuperType implements MySuperType { @Override public void withVarargs(int... foo) { } } interface MySuperType { }
Move to JDT/UI
Ha! The type parameters are also not copied (invoke quick fix on foo). See NewDefiningMethodProposal.addNewTypeParameters(...) :) ----------------------------------------------------------------- public class CreateInSuperType implements MySuperType { @Override public void withVarargs(int... foo) { } @Override public <T> void foo(T t) { } } interface MySuperType { } ----------------------------------------------------------------
We should probably reuse some of the code from org.eclipse.jdt.internal.corext.refactoring.structure.HierarchyProcessor.
Just to say that I could still reproduce this issue in Eclipse Juno, Build id: 20120614-1722.
I just ran into this while reviewing bug 514213, in particular when I stumbled upon an empty method NewDefiningMethodProposal.addNewTypeParameters(..):
The following empty methods may have an excuse, which should then be documented: - NewMethodCorrectionProposal.addNewExceptions(..) - NewMethodCorrectionProposal.addNewTypeParameters(..)
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/189566
Released for 4.23 M2
Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/189566 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=94c259455ef647cc32609b0fe8fc04889016f90f
Verified for 4.23 M2 using I20220216