Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManju Mathew2014-01-16 03:03:11 +0000
committerMarkus Keller2014-02-20 14:25:32 +0000
commitc656ba52079370b803406e5b65ffe3b2c3f6e8f6 (patch)
tree44d41a093bcd0292f9e24530d0a507f6a8b71618
parent49534294940bfe1365d2ad361891a453c1c036ab (diff)
downloadeclipse.jdt.ui-c656ba52079370b803406e5b65ffe3b2c3f6e8f6.tar.gz
eclipse.jdt.ui-c656ba52079370b803406e5b65ffe3b2c3f6e8f6.tar.xz
eclipse.jdt.ui-c656ba52079370b803406e5b65ffe3b2c3f6e8f6.zip
Fixed Bug 406786- [1.8][extract method] Extract Method refactoring in
interfaces not handled
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test5.java11
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test5.java15
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests18.java6
-rw-r--r--org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodRefactoring.java4
4 files changed, 33 insertions, 3 deletions
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test5.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test5.java
new file mode 100644
index 0000000000..741135a75b
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test5.java
@@ -0,0 +1,11 @@
+package defaultMethods_in;
+
+public interface A_test5 {
+ default int foo() {
+ /*[*/return 0;/*]*/
+ }
+
+ static int foo() {
+ return 0;
+ }
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test5.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test5.java
new file mode 100644
index 0000000000..a88cbb8de3
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test5.java
@@ -0,0 +1,15 @@
+package defaultMethods_out;
+
+public interface A_test5 {
+ default int foo() {
+ return extracted();
+ }
+
+ static int extracted() {
+ /*[*/return 0;/*]*/
+ }
+
+ static int foo() {
+ return extracted();
+ }
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests18.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests18.java
index 3cc9c5609b..65144210b8 100644
--- a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests18.java
+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests18.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 IBM Corporation and others.
+ * Copyright (c) 2013, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -79,6 +79,10 @@ public class ExtractMethodTests18 extends ExtractMethodTests {
defaultMethodsTest(1, Modifier.PUBLIC);
}
+ public void test5() throws Exception {
+ defaultMethodsTest(0, Modifier.PUBLIC);
+ }
+
//====================================================================================
// Testing Static Methods
//====================================================================================
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodRefactoring.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodRefactoring.java
index 6ed9c56a02..90fc02373b 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodRefactoring.java
+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodRefactoring.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -1009,7 +1009,7 @@ public class ExtractMethodRefactoring extends Refactoring {
currentParent= currentParent.getParent();
} while (!shouldBeStatic && currentParent != null && currentParent != fDestination);
- if (shouldBeStatic || fAnalyzer.getForceStatic()) {
+ if (shouldBeStatic || fAnalyzer.getForceStatic() || forceStatic()) {
modifiers|= Modifier.STATIC;
} else if (isDestinationInterface) {
modifiers|= Modifier.DEFAULT;

Back to the top