Community
Participate
Working Groups
Consider the below interface: package pack3; public interface Bug1 { public static void statictM1(String s) { System.out.println(s);//Select 's' and press Ctrl+1 } } Invoke Quick Assist on 's' and select 'Extract Method', NPE is thrown. The problem is in ExtractMethodAnalyzer#checkInput(..) where type.getSuperclass() is invoked, the Javadoc for #getSuperclass() clearly states that it will return null if the typebinding is an interface. Below is the stacktrace: at org.eclipse.jdt.internal.corext.dom.Bindings.findMethodInType(Bindings.java:358) at org.eclipse.jdt.internal.corext.dom.Bindings.findMethodInHierarchy(Bindings.java:385) at org.eclipse.jdt.internal.corext.refactoring.Checks.checkMethodInHierarchy(Checks.java:338) at org.eclipse.jdt.internal.corext.refactoring.code.ExtractMethodAnalyzer.checkInput(ExtractMethodAnalyzer.java:321) at org.eclipse.jdt.internal.corext.refactoring.code.ExtractMethodRefactoring.checkFinalConditions(ExtractMethodRefactoring.java:474) The other concerns regarding this bug is 1. Should we allow 'Extract Method' on an interface. 2. If allowed what should be the the signature of the extracted method. No doubt, it has to be public. If the method is extracted from a default interface method, then we keep the extracted method as 'default' and if extracted from a static method then let the extracted method be 'static'. Markus, kindly share your thoughts.
*** This bug has been marked as a duplicate of bug 406786 ***