Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 234655 Details for
Bug 406786
[1.8][extract method] Extract Method refactoring in interfaces not handled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch + Tests
Bug-406786-ExtractMethod-refactoring.patch (text/plain), 65.37 KB, created by
Noopur Gupta
on 2013-08-22 07:01:01 EDT
(
hide
)
Description:
Patch + Tests
Filename:
MIME Type:
Creator:
Noopur Gupta
Created:
2013-08-22 07:01:01 EDT
Size:
65.37 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test1.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test1.java >new file mode 100644 >index 0000000..64b8db1 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test1.java >@@ -0,0 +1,7 @@ >+package defaultMethods_in; >+ >+public interface A_test1 { >+ default int foo() { >+ /*[*/return 0;/*]*/ >+ } >+} >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test1a.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test1a.java >new file mode 100644 >index 0000000..0a834ec >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test1a.java >@@ -0,0 +1,7 @@ >+package defaultMethods_in; >+ >+public interface A_test1a { >+ public default int foo() { >+ /*[*/return 0;/*]*/ >+ } >+} >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test2.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test2.java >new file mode 100644 >index 0000000..6bcff89 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test2.java >@@ -0,0 +1,9 @@ >+package defaultMethods_in; >+ >+public class A_test2 { >+ interface B { >+ default int foo() { >+ /*[*/return 0;/*]*/ >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test2a.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test2a.java >new file mode 100644 >index 0000000..df92ee3 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test2a.java >@@ -0,0 +1,9 @@ >+package defaultMethods_in; >+ >+public class A_test2a { >+ interface B { >+ public default int foo() { >+ /*[*/return 0;/*]*/ >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test3.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test3.java >new file mode 100644 >index 0000000..3215a2d >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test3.java >@@ -0,0 +1,9 @@ >+package defaultMethods_in; >+ >+public interface A_test3 { >+ interface B { >+ default int foo() { >+ /*[*/return 0;/*]*/ >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test3a.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test3a.java >new file mode 100644 >index 0000000..1b2a88d >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test3a.java >@@ -0,0 +1,9 @@ >+package defaultMethods_in; >+ >+public interface A_test3a { >+ interface B { >+ public default int foo() { >+ /*[*/return 0;/*]*/ >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test4.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test4.java >new file mode 100644 >index 0000000..97a255b >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_in/A_test4.java >@@ -0,0 +1,12 @@ >+package staticMethods_in; >+ >+interface A_test4 { >+ default void foo() { >+ Runnable r= new Runnable() { >+ @Override >+ public void run() { >+ /*[*/int i = 0;/*]*/ >+ } >+ }; >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test1.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test1.java >new file mode 100644 >index 0000000..e8bda77 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test1.java >@@ -0,0 +1,9 @@ >+package defaultMethods_out; >+ >+public interface A_test1 { >+ default int foo() { >+ return extracted(); >+ } >+ >+ default int extracted(){/*[*/return 0;/*]*/} >+} >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test1a.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test1a.java >new file mode 100644 >index 0000000..92ec302 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test1a.java >@@ -0,0 +1,9 @@ >+package defaultMethods_out; >+ >+public interface A_test1a { >+ public default int foo() { >+ return extracted(); >+ } >+ >+ public default int extracted(){/*[*/return 0;/*]*/} >+} >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test2.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test2.java >new file mode 100644 >index 0000000..d464599 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test2.java >@@ -0,0 +1,13 @@ >+package defaultMethods_out; >+ >+public class A_test2 { >+ interface B { >+ default int foo() { >+ return extracted(); >+ } >+ } >+ >+ protected static int extracted() { >+ /*[*/return 0;/*]*/ >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test2a.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test2a.java >new file mode 100644 >index 0000000..98cb960 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test2a.java >@@ -0,0 +1,13 @@ >+package defaultMethods_out; >+ >+public class A_test2a { >+ interface B { >+ public default int foo() { >+ return extracted(); >+ } >+ } >+ >+ protected static int extracted() { >+ /*[*/return 0;/*]*/ >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test3.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test3.java >new file mode 100644 >index 0000000..a998876 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test3.java >@@ -0,0 +1,13 @@ >+package defaultMethods_out; >+ >+public interface A_test3 { >+ interface B { >+ default int foo() { >+ return extracted(); >+ } >+ } >+ >+ static int extracted() { >+ /*[*/return 0;/*]*/ >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test3a.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test3a.java >new file mode 100644 >index 0000000..58412dd >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test3a.java >@@ -0,0 +1,13 @@ >+package defaultMethods_out; >+ >+public interface A_test3a { >+ interface B { >+ public default int foo() { >+ return extracted(); >+ } >+ } >+ >+ static int extracted() { >+ /*[*/return 0;/*]*/ >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test4.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test4.java >new file mode 100644 >index 0000000..61ce975 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/defaultMethods18_out/A_test4.java >@@ -0,0 +1,14 @@ >+package staticMethods_in; >+ >+interface A_test4 { >+ default void foo() { >+ Runnable r= new Runnable() { >+ @Override >+ public void run() { >+ extracted(); >+ } >+ }; >+ } >+ >+ default void extracted(){/*[*/int i = 0;/*]*/} >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_in/A_test201.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_in/A_test201.java >new file mode 100644 >index 0000000..20446f9 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_in/A_test201.java >@@ -0,0 +1,9 @@ >+package destination18_in; >+ >+public class A_test201 { >+ interface B { >+ @interface C { >+ int i= /*[*/0;/*]*/ >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_in/A_test202.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_in/A_test202.java >new file mode 100644 >index 0000000..9361e42 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_in/A_test202.java >@@ -0,0 +1,11 @@ >+package destination_in; >+ >+public class A_test202 { >+ @interface C { >+ interface B { >+ default void foo() { >+ int i= /*[*/0;/*]*/ >+ } >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_in/A_test203.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_in/A_test203.java >new file mode 100644 >index 0000000..5222c15 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_in/A_test203.java >@@ -0,0 +1,11 @@ >+package destination_in; >+ >+public class A_test203 { >+ @interface C { >+ interface B { >+ default void foo() { >+ int i= /*[*/0;/*]*/ >+ } >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_in/A_test204.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_in/A_test204.java >new file mode 100644 >index 0000000..00dbf32 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_in/A_test204.java >@@ -0,0 +1,9 @@ >+package destination18_in; >+ >+public class A_test204 { >+ interface B { >+ @interface C { >+ int i= /*[*/0;/*]*/ >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_out/A_test201.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_out/A_test201.java >new file mode 100644 >index 0000000..a6df533 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_out/A_test201.java >@@ -0,0 +1,13 @@ >+package destination_in; >+ >+public class A_test201 { >+ interface B { >+ @interface C { >+ int i= /*[*/extracted();/*]*/ >+ } >+ >+ static int extracted() { >+ return 0; >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_out/A_test202.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_out/A_test202.java >new file mode 100644 >index 0000000..eb365c3 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_out/A_test202.java >@@ -0,0 +1,13 @@ >+package destination_in; >+ >+public class A_test202 { >+ @interface C { >+ interface B { >+ default void foo() { >+ int i= /*[*/extracted();/*]*/ >+ } >+ >+ default int extracted(){return 0;} >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_out/A_test203.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_out/A_test203.java >new file mode 100644 >index 0000000..108222e >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_out/A_test203.java >@@ -0,0 +1,15 @@ >+package destination_in; >+ >+public class A_test203 { >+ @interface C { >+ interface B { >+ default void foo() { >+ int i= /*[*/extracted();/*]*/ >+ } >+ } >+ } >+ >+ protected static int extracted() { >+ return 0; >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_out/A_test204.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_out/A_test204.java >new file mode 100644 >index 0000000..179b5a9 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination18_out/A_test204.java >@@ -0,0 +1,13 @@ >+package destination18_in; >+ >+public class A_test204 { >+ interface B { >+ @interface C { >+ int i= /*[*/extracted();/*]*/ >+ } >+ } >+ >+ protected static int extracted() { >+ return 0; >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_in/A_test1059.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_in/A_test1059.java >new file mode 100644 >index 0000000..c9c82c3 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_in/A_test1059.java >@@ -0,0 +1,9 @@ >+package destination_in; >+ >+public class A_test1059 { >+ interface B { >+ @interface C { >+ int i= /*[*/0;/*]*/ >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_in/A_test1060.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_in/A_test1060.java >new file mode 100644 >index 0000000..bc81492 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_in/A_test1060.java >@@ -0,0 +1,11 @@ >+package destination_in; >+ >+public class A_test1060 { >+ interface B { >+ class C { >+ int foo() { >+ /*[*/return 0;/*]*/ >+ } >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_in/A_test1061.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_in/A_test1061.java >new file mode 100644 >index 0000000..9810e3f >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_in/A_test1061.java >@@ -0,0 +1,11 @@ >+package destination_in; >+ >+public class A_test1061 { >+ static class B { >+ class C { >+ int foo() { >+ /*[*/return 0;/*]*/ >+ } >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_in/A_test1062.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_in/A_test1062.java >new file mode 100644 >index 0000000..7c64ea8 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_in/A_test1062.java >@@ -0,0 +1,11 @@ >+package destination_in; >+ >+public class A_test1062 { >+ static class B { >+ class C { >+ int foo() { >+ /*[*/return 0;/*]*/ >+ } >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_out/A_test1059.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_out/A_test1059.java >new file mode 100644 >index 0000000..29504e9 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_out/A_test1059.java >@@ -0,0 +1,13 @@ >+package destination_in; >+ >+public class A_test1059 { >+ interface B { >+ @interface C { >+ int i= /*[*/extracted();/*]*/ >+ } >+ } >+ >+ protected static int extracted() { >+ return 0; >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_out/A_test1060.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_out/A_test1060.java >new file mode 100644 >index 0000000..dee74a6 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_out/A_test1060.java >@@ -0,0 +1,15 @@ >+package destination_in; >+ >+public class A_test1060 { >+ interface B { >+ class C { >+ int foo() { >+ return extracted(); >+ } >+ } >+ } >+ >+ protected static int extracted() { >+ /*[*/return 0;/*]*/ >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_out/A_test1061.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_out/A_test1061.java >new file mode 100644 >index 0000000..0b4002f >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_out/A_test1061.java >@@ -0,0 +1,15 @@ >+package destination_in; >+ >+public class A_test1061 { >+ static class B { >+ class C { >+ int foo() { >+ return extracted(); >+ } >+ } >+ >+ protected int extracted() { >+ /*[*/return 0;/*]*/ >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_out/A_test1062.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_out/A_test1062.java >new file mode 100644 >index 0000000..2b8992b >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/destination_out/A_test1062.java >@@ -0,0 +1,15 @@ >+package destination_in; >+ >+public class A_test1062 { >+ static class B { >+ class C { >+ int foo() { >+ return extracted(); >+ } >+ } >+ } >+ >+ protected static int extracted() { >+ /*[*/return 0;/*]*/ >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test101.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test101.java >new file mode 100644 >index 0000000..debc458 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test101.java >@@ -0,0 +1,9 @@ >+package staticMethods_in; >+ >+public interface A_test101 { >+ class B { >+ int foo() { >+ /*[*/return 0;/*]*/ >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test102.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test102.java >new file mode 100644 >index 0000000..9515e57 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test102.java >@@ -0,0 +1,9 @@ >+package staticMethods_in; >+ >+interface A_test102 { >+ class B { >+ static { >+ /*[*/int i= 0;/*]*/ >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test103.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test103.java >new file mode 100644 >index 0000000..21f9f73 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test103.java >@@ -0,0 +1,6 @@ >+package staticMethods_in; >+ >+interface A_test103 { >+ int i= 0; >+ int j= /*[*/i + 10;/*]*/ >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test104.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test104.java >new file mode 100644 >index 0000000..d05459b >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test104.java >@@ -0,0 +1,11 @@ >+package staticMethods_in; >+ >+interface A_test104 { >+ Runnable r= new Runnable() { >+ @Override >+ public void run() { >+ /*[*/int i = 0;/*]*/ >+ System.out.println(i); >+ } >+ }; >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test105.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test105.java >new file mode 100644 >index 0000000..aa3e547 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test105.java >@@ -0,0 +1,11 @@ >+package staticMethods_in; >+ >+interface A_test105 { >+ enum E { >+ A { >+ int foo() { >+ /*[*/return 0;/*]*/ >+ } >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test106.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test106.java >new file mode 100644 >index 0000000..b4086ba >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test106.java >@@ -0,0 +1,10 @@ >+package staticMethods_in; >+ >+interface A_test106 { >+ enum E { >+ A; >+ int foo() { >+ /*[*/return 0;/*]*/ >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test107.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test107.java >new file mode 100644 >index 0000000..7cc10a5 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_in/A_test107.java >@@ -0,0 +1,9 @@ >+package staticMethods_in; >+ >+interface A_test107 { >+ class B { >+ { >+ /*[*/int i= 0;/*]*/ >+ } >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test101.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test101.java >new file mode 100644 >index 0000000..46d0c8a >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test101.java >@@ -0,0 +1,13 @@ >+package staticMethods_out; >+ >+public interface A_test101 { >+ class B { >+ int foo() { >+ return extracted(); >+ } >+ } >+ >+ static int extracted() { >+ /*[*/return 0;/*]*/ >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test102.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test102.java >new file mode 100644 >index 0000000..b5c0880 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test102.java >@@ -0,0 +1,13 @@ >+package staticMethods_in; >+ >+interface A_test102 { >+ class B { >+ static { >+ extracted(); >+ } >+ } >+ >+ static void extracted() { >+ /*[*/int i= 0;/*]*/ >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test103.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test103.java >new file mode 100644 >index 0000000..4547149 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test103.java >@@ -0,0 +1,9 @@ >+package staticMethods_in; >+ >+interface A_test103 { >+ int i= 0; >+ int j= /*[*/extracted();/*]*/ >+ static int extracted() { >+ return i + 10; >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test104.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test104.java >new file mode 100644 >index 0000000..ea247bc >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test104.java >@@ -0,0 +1,16 @@ >+package staticMethods_in; >+ >+interface A_test104 { >+ static int extracted() { >+ /*[*/int i = 0;/*]*/ >+ return i; >+ } >+ >+ Runnable r= new Runnable() { >+ @Override >+ public void run() { >+ int i = extracted(); >+ System.out.println(i); >+ } >+ }; >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test105.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test105.java >new file mode 100644 >index 0000000..07af08d >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test105.java >@@ -0,0 +1,15 @@ >+package staticMethods_in; >+ >+interface A_test105 { >+ enum E { >+ A { >+ int foo() { >+ return extracted(); >+ } >+ } >+ } >+ >+ static int extracted() { >+ /*[*/return 0;/*]*/ >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test106.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test106.java >new file mode 100644 >index 0000000..a55d5bb >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test106.java >@@ -0,0 +1,14 @@ >+package staticMethods_in; >+ >+interface A_test106 { >+ enum E { >+ A; >+ int foo() { >+ return extracted(); >+ } >+ } >+ >+ static int extracted() { >+ /*[*/return 0;/*]*/ >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test107.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test107.java >new file mode 100644 >index 0000000..a938446 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/staticMethods18_out/A_test107.java >@@ -0,0 +1,13 @@ >+package staticMethods_in; >+ >+interface A_test107 { >+ class B { >+ { >+ extracted(); >+ } >+ } >+ >+ static void extracted() { >+ /*[*/int i= 0;/*]*/ >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/AllRefactoringTests.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/AllRefactoringTests.java >index 4310a79..d115d9b 100644 >--- a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/AllRefactoringTests.java >+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/AllRefactoringTests.java >@@ -1,9 +1,13 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2011 IBM Corporation and others. >+ * Copyright (c) 2000, 2013 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 > * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. > * > * Contributors: > * IBM Corporation - initial API and implementation >@@ -24,6 +28,7 @@ > //--code > suite.addTest(ExtractMethodTests.suite()); > suite.addTest(ExtractMethodTests17.suite()); >+ suite.addTest(ExtractMethodTests18.suite()); > suite.addTest(InlineMethodTests.suite()); > suite.addTest(ReplaceInvocationsTests.suite()); > suite.addTest(SefTests.suite()); >diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTestSetup18.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTestSetup18.java >new file mode 100644 >index 0000000..0176215 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTestSetup18.java >@@ -0,0 +1,57 @@ >+/******************************************************************************* >+ * Copyright (c) 2013 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.ui.tests.refactoring; >+ >+import junit.framework.Test; >+ >+import org.eclipse.ltk.core.refactoring.RefactoringCore; >+ >+import org.eclipse.jdt.core.IPackageFragment; >+import org.eclipse.jdt.core.IPackageFragmentRoot; >+ >+public class ExtractMethodTestSetup18 extends Java18Setup { >+ >+ private IPackageFragment fDefaultMethodsPackage; >+ private IPackageFragment fStaticMethodsPackage; >+ private IPackageFragment fDestinationPackage; >+ >+ public ExtractMethodTestSetup18(Test test) { >+ super(test); >+ } >+ >+ protected void setUp() throws Exception { >+ super.setUp(); >+ >+ RefactoringCore.getUndoManager().flush(); >+ >+ IPackageFragmentRoot root= getDefaultSourceFolder(); >+ fDefaultMethodsPackage= root.createPackageFragment("defaultMethods18_in", true, null); >+ fStaticMethodsPackage= root.createPackageFragment("staticMethods18_in", true, null); >+ fDestinationPackage= root.createPackageFragment("destination18_in", true, null); >+ } >+ >+ public IPackageFragment getDefaultMethodsPackage() { >+ return fDefaultMethodsPackage; >+ } >+ >+ public IPackageFragment getStaticMethodsPackage() { >+ return fStaticMethodsPackage; >+ } >+ >+ public IPackageFragment getDestinationPackage() { >+ return fDestinationPackage; >+ } >+} >+ >diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests.java >index 6d649d8..1394446 100644 >--- a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests.java >+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests.java >@@ -1,9 +1,13 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2012 IBM Corporation and others. >+ * Copyright (c) 2000, 2013 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 > * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. > * > * Contributors: > * IBM Corporation - initial API and implementation >@@ -84,11 +88,15 @@ > } > > protected void performTest(IPackageFragment packageFragment, String id, int mode, String outputFolder, String[] newNames, int[] newOrder, int destination) throws Exception { >+ performTest(packageFragment, id, mode, outputFolder, newNames, newOrder, destination, Modifier.PROTECTED); >+ } >+ >+ protected void performTest(IPackageFragment packageFragment, String id, int mode, String outputFolder, String[] newNames, int[] newOrder, int destination, int visibility) throws Exception { > ICompilationUnit unit= createCU(packageFragment, id); > int[] selection= getSelection(); > ExtractMethodRefactoring refactoring= new ExtractMethodRefactoring(unit, selection[0], selection[1]); > refactoring.setMethodName("extracted"); >- refactoring.setVisibility(Modifier.PROTECTED); >+ refactoring.setVisibility(visibility); > TestModelProvider.clearDelta(); > RefactoringStatus status= refactoring.checkInitialConditions(new NullProgressMonitor()); > switch (mode) { >@@ -1974,6 +1982,22 @@ > destinationTest(2); > } > >+ public void test1059() throws Exception { >+ destinationTest(0); >+ } >+ >+ public void test1060() throws Exception { >+ destinationTest(1); >+ } >+ >+ public void test1061() throws Exception { >+ destinationTest(1); >+ } >+ >+ public void test1062() throws Exception { >+ destinationTest(2); >+ } >+ > //---- Test Generics -------------------------------------------------- > > public void test1100() throws Exception { >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 >new file mode 100644 >index 0000000..3cc9c56 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests18.java >@@ -0,0 +1,133 @@ >+/******************************************************************************* >+ * Copyright (c) 2013 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.ui.tests.refactoring; >+ >+import junit.framework.Test; >+ >+import org.eclipse.jdt.core.dom.Modifier; >+ >+public class ExtractMethodTests18 extends ExtractMethodTests { >+ private static ExtractMethodTestSetup18 fgTestSetup; >+ >+ public ExtractMethodTests18(String name) { >+ super(name); >+ } >+ >+ public static Test suite() { >+ fgTestSetup= new ExtractMethodTestSetup18(new NoSuperTestsSuite(ExtractMethodTests18.class)); >+ return fgTestSetup; >+ } >+ >+ public static Test setUpTest(Test test) { >+ fgTestSetup= new ExtractMethodTestSetup18(test); >+ return fgTestSetup; >+ } >+ >+ protected void defaultMethodsTest(int destination, int visibility) throws Exception { >+ performTest(fgTestSetup.getDefaultMethodsPackage(), "A", COMPARE_WITH_OUTPUT, "defaultMethods18_out", null, null, destination, visibility); >+ } >+ >+ protected void staticMethodsTest(int destination, int visibility) throws Exception { >+ performTest(fgTestSetup.getStaticMethodsPackage(), "A", COMPARE_WITH_OUTPUT, "staticMethods18_out", null, null, destination, visibility); >+ } >+ >+ protected void destinationTest(int destination, int visibility) throws Exception { >+ performTest(fgTestSetup.getDestinationPackage(), "A", COMPARE_WITH_OUTPUT, "destination18_out", null, null, destination, visibility); >+ } >+ >+ //==================================================================================== >+ // Testing Default Methods >+ //==================================================================================== >+ >+ public void test1() throws Exception { >+ defaultMethodsTest(0, Modifier.PUBLIC); >+ } >+ >+ public void test1a() throws Exception { >+ defaultMethodsTest(0, Modifier.PUBLIC); >+ } >+ >+ public void test2() throws Exception { >+ defaultMethodsTest(1, Modifier.PROTECTED); >+ } >+ >+ public void test2a() throws Exception { >+ defaultMethodsTest(1, Modifier.PROTECTED); >+ } >+ >+ public void test3() throws Exception { >+ defaultMethodsTest(1, Modifier.PUBLIC); >+ } >+ >+ public void test3a() throws Exception { >+ defaultMethodsTest(1, Modifier.PUBLIC); >+ } >+ >+ public void test4() throws Exception { >+ defaultMethodsTest(1, Modifier.PUBLIC); >+ } >+ >+ //==================================================================================== >+ // Testing Static Methods >+ //==================================================================================== >+ >+ public void test101() throws Exception { >+ staticMethodsTest(1, Modifier.PUBLIC); >+ } >+ >+ public void test102() throws Exception { >+ staticMethodsTest(1, Modifier.PUBLIC); >+ } >+ >+ public void test103() throws Exception { >+ staticMethodsTest(0, Modifier.PUBLIC); >+ } >+ >+ public void test104() throws Exception { >+ staticMethodsTest(1, Modifier.PUBLIC); >+ } >+ >+ public void test105() throws Exception { >+ staticMethodsTest(2, Modifier.PUBLIC); >+ } >+ >+ public void test106() throws Exception { >+ staticMethodsTest(1, Modifier.PUBLIC); >+ } >+ >+ public void test107() throws Exception { >+ staticMethodsTest(1, Modifier.PUBLIC); >+ } >+ >+ //==================================================================================== >+ // Testing Destination Types >+ //==================================================================================== >+ >+ public void test201() throws Exception { >+ destinationTest(0, Modifier.PUBLIC); >+ } >+ >+ public void test202() throws Exception { >+ destinationTest(0, Modifier.PUBLIC); >+ } >+ >+ public void test203() throws Exception { >+ destinationTest(1, Modifier.PROTECTED); >+ } >+ >+ public void test204() throws Exception { >+ destinationTest(1, Modifier.PROTECTED); >+ } >+} >diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/Checks.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/Checks.java >index 26f731a..91ab0d0 100644 >--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/Checks.java >+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/Checks.java >@@ -1,9 +1,13 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2012 IBM Corporation and others. >+ * Copyright (c) 2000, 2013 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 > * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. > * > * Contributors: > * IBM Corporation - initial API and implementation >@@ -310,13 +314,17 @@ > */ > public static RefactoringStatus checkMethodInType(ITypeBinding type, String methodName, ITypeBinding[] parameters) { > RefactoringStatus result= new RefactoringStatus(); >- if (methodName.equals(type.getName())) >- result.addWarning(RefactoringCoreMessages.Checks_methodName_constructor); > IMethodBinding method= org.eclipse.jdt.internal.corext.dom.Bindings.findMethodInType(type, methodName, parameters); >- if (method != null) >- result.addError(Messages.format(RefactoringCoreMessages.Checks_methodName_exists, >- new Object[] {BasicElementLabels.getJavaElementName(methodName), BasicElementLabels.getJavaElementName(type.getName())}), >- JavaStatusContext.create(method)); >+ if (method != null) { >+ if (method.isConstructor()) { >+ result.addWarning(Messages.format(RefactoringCoreMessages.Checks_methodName_constructor, >+ new Object[] { BasicElementLabels.getJavaElementName(type.getName()) })); >+ } else { >+ result.addError(Messages.format(RefactoringCoreMessages.Checks_methodName_exists, >+ new Object[] { BasicElementLabels.getJavaElementName(methodName), BasicElementLabels.getJavaElementName(type.getName()) }), >+ JavaStatusContext.create(method)); >+ } >+ } > return result; > } > >@@ -354,9 +362,14 @@ > new Object[] {BasicElementLabels.getJavaElementName(methodName), BasicElementLabels.getJavaElementName(dc.getName())}), > JavaStatusContext.create(method)); > } else { >- result.addError(Messages.format(RefactoringCoreMessages.Checks_methodName_overrides, >- new Object[] {BasicElementLabels.getJavaElementName(methodName), BasicElementLabels.getJavaElementName(dc.getName())}), >- JavaStatusContext.create(method)); >+ if (method.isConstructor()) { >+ result.addWarning(Messages.format(RefactoringCoreMessages.Checks_methodName_constructor, >+ new Object[] { BasicElementLabels.getJavaElementName(dc.getName()) })); >+ } else { >+ result.addError(Messages.format(RefactoringCoreMessages.Checks_methodName_overrides, >+ new Object[] { BasicElementLabels.getJavaElementName(methodName), BasicElementLabels.getJavaElementName(dc.getName()) }), >+ JavaStatusContext.create(method)); >+ } > } > } > return result; >diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java >index 2c6aef5..f8a53b4 100644 >--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java >+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java >@@ -1,9 +1,13 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2011 IBM Corporation and others. >+ * Copyright (c) 2000, 2013 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 > * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. > * > * Contributors: > * IBM Corporation - initial API and implementation >@@ -561,6 +565,8 @@ > > public static String ExtractMethodAnalyzer_leftHandSideOfAssignment; > >+ public static String ExtractMethodAnalyzer_no_valid_destination_type; >+ > public static String ExtractMethodAnalyzer_only_method_body; > > public static String ExtractMethodAnalyzer_parent_mismatch; >diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodAnalyzer.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodAnalyzer.java >index 54bde91..8cf0d80 100644 >--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodAnalyzer.java >+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodAnalyzer.java >@@ -1,9 +1,13 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2012 IBM Corporation and others. >+ * Copyright (c) 2000, 2013 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 > * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. > * > * Contributors: > * IBM Corporation - initial API and implementation >@@ -31,6 +35,7 @@ > import org.eclipse.jdt.core.dom.ASTNode; > import org.eclipse.jdt.core.dom.ASTVisitor; > import org.eclipse.jdt.core.dom.Annotation; >+import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; > import org.eclipse.jdt.core.dom.AnonymousClassDeclaration; > import org.eclipse.jdt.core.dom.Assignment; > import org.eclipse.jdt.core.dom.Block; >@@ -64,6 +69,7 @@ > import org.eclipse.jdt.core.dom.ThisExpression; > import org.eclipse.jdt.core.dom.TryStatement; > import org.eclipse.jdt.core.dom.Type; >+import org.eclipse.jdt.core.dom.TypeDeclaration; > import org.eclipse.jdt.core.dom.VariableDeclaration; > import org.eclipse.jdt.core.dom.VariableDeclarationExpression; > import org.eclipse.jdt.core.dom.VariableDeclarationFragment; >@@ -86,10 +92,12 @@ > import org.eclipse.jdt.internal.corext.refactoring.code.flow.InOutFlowAnalyzer; > import org.eclipse.jdt.internal.corext.refactoring.code.flow.InputFlowAnalyzer; > import org.eclipse.jdt.internal.corext.refactoring.util.CodeAnalyzer; >+import org.eclipse.jdt.internal.corext.util.JavaModelUtil; > import org.eclipse.jdt.internal.corext.util.Messages; > > import org.eclipse.jdt.ui.JavaElementLabels; > >+import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; > import org.eclipse.jdt.internal.ui.viewsupport.BasicElementLabels; > import org.eclipse.jdt.internal.ui.viewsupport.BindingLabelProvider; > >@@ -198,11 +206,30 @@ > > //---- Activation checking --------------------------------------------------------------------------- > >+ boolean isValidDestination(ASTNode node) { >+ boolean isInterface= node instanceof TypeDeclaration && ((TypeDeclaration) node).isInterface(); >+ return !(node instanceof AnnotationTypeDeclaration) && >+ !(isInterface && !JavaModelUtil.is18OrHigher(fCUnit.getJavaProject())); >+ } >+ > public RefactoringStatus checkInitialConditions(ImportRewrite rewriter) { > RefactoringStatus result= getStatus(); > checkExpression(result); > if (result.hasFatalError()) > return result; >+ >+ List<ASTNode> validDestinations= new ArrayList<ASTNode>(); >+ ASTNode destination= ASTResolving.findParentType(fEnclosingBodyDeclaration.getParent()); >+ while (destination != null) { >+ if (isValidDestination(destination)) { >+ validDestinations.add(destination); >+ } >+ destination= ASTResolving.findParentType(destination.getParent()); >+ } >+ if (validDestinations.size() == 0) { >+ result.addFatalError(RefactoringCoreMessages.ExtractMethodAnalyzer_no_valid_destination_type); >+ return result; >+ } > > fReturnKind= UNDEFINED; > fMaxVariableId= LocalVariableIndex.perform(fEnclosingBodyDeclaration); >@@ -318,7 +345,13 @@ > ITypeBinding[] arguments= getArgumentTypes(); > ITypeBinding type= ASTNodes.getEnclosingType(destination); > status.merge(Checks.checkMethodInType(type, methodName, arguments)); >- status.merge(Checks.checkMethodInHierarchy(type.getSuperclass(), methodName, null, arguments)); >+ ITypeBinding superClass= type.getSuperclass(); >+ if (superClass != null) { >+ status.merge(Checks.checkMethodInHierarchy(superClass, methodName, null, arguments)); >+ } >+ for (ITypeBinding superInterface : type.getInterfaces()) { >+ status.merge(Checks.checkMethodInHierarchy(superInterface, methodName, null, arguments)); >+ } > } > > private ITypeBinding[] getArgumentTypes() { >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 0279d0b..2fd205a 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,9 +1,13 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2012 IBM Corporation and others. >+ * Copyright (c) 2000, 2013 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 > * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. > * > * Contributors: > * IBM Corporation - initial API and implementation >@@ -75,7 +79,6 @@ > import org.eclipse.jdt.core.dom.MethodDeclaration; > import org.eclipse.jdt.core.dom.MethodInvocation; > import org.eclipse.jdt.core.dom.Modifier; >-import org.eclipse.jdt.core.dom.Name; > import org.eclipse.jdt.core.dom.ParenthesizedExpression; > import org.eclipse.jdt.core.dom.QualifiedName; > import org.eclipse.jdt.core.dom.ReturnStatement; >@@ -528,7 +531,7 @@ > TextEditGroup insertDesc= new TextEditGroup(Messages.format(RefactoringCoreMessages.ExtractMethodRefactoring_add_method, BasicElementLabels.getJavaElementName(fMethodName))); > result.addTextEditGroup(insertDesc); > >- if (fDestination == fDestinations[0]) { >+ if (fDestination == ASTResolving.findParentType(declaration.getParent())) { > ChildListPropertyDescriptor desc= (ChildListPropertyDescriptor)declaration.getLocationInParent(); > ListRewrite container= fRewriter.getListRewrite(declaration.getParent(), desc); > container.insertAfter(mm, declaration, insertDesc); >@@ -741,6 +744,10 @@ > return fGenerateJavadoc; > } > >+ public boolean isDestinationInterface() { >+ return fDestination instanceof TypeDeclaration && ((TypeDeclaration) fDestination).isInterface(); >+ } >+ > //---- Helper methods ------------------------------------------------------------------------ > > private void initializeParameterInfos() { >@@ -789,27 +796,24 @@ > private void initializeDestinations() { > List<ASTNode> result= new ArrayList<ASTNode>(); > BodyDeclaration decl= fAnalyzer.getEnclosingBodyDeclaration(); >- ASTNode current= getNextParent(decl); >- result.add(current); >- if (decl instanceof MethodDeclaration || decl instanceof Initializer || decl instanceof FieldDeclaration) { >+ ASTNode current= ASTResolving.findParentType(decl.getParent()); >+ if (fAnalyzer.isValidDestination(current)) { >+ result.add(current); >+ } >+ if (current != null && (decl instanceof MethodDeclaration || decl instanceof Initializer || decl instanceof FieldDeclaration)) { > ITypeBinding binding= ASTNodes.getEnclosingType(current); >- ASTNode next= getNextParent(current); >+ ASTNode next= ASTResolving.findParentType(current.getParent()); > while (next != null && binding != null && binding.isNested()) { >- result.add(next); >+ if (fAnalyzer.isValidDestination(next)) { >+ result.add(next); >+ } > current= next; > binding= ASTNodes.getEnclosingType(current); >- next= getNextParent(next); >+ next= ASTResolving.findParentType(next.getParent()); > } > } > fDestinations= result.toArray(new ASTNode[result.size()]); > fDestination= fDestinations[fDestinationIndex]; >- } >- >- private ASTNode getNextParent(ASTNode node) { >- do { >- node= node.getParent(); >- } while (node != null && !(node instanceof AbstractTypeDeclaration || node instanceof AnonymousClassDeclaration)); >- return node; > } > > private RefactoringStatus mergeTextSelectionStatus(RefactoringStatus status) { >@@ -974,18 +978,27 @@ > MethodDeclaration result= fAST.newMethodDeclaration(); > > int modifiers= fVisibility; >- ASTNode enclosingBodyDeclaration= fAnalyzer.getEnclosingBodyDeclaration(); >- while (enclosingBodyDeclaration != null && enclosingBodyDeclaration.getParent() != fDestination) { >- enclosingBodyDeclaration= enclosingBodyDeclaration.getParent(); >+ BodyDeclaration enclosingBodyDeclaration= fAnalyzer.getEnclosingBodyDeclaration(); >+ boolean isDestinationInterface= isDestinationInterface(); >+ if (isDestinationInterface && !(enclosingBodyDeclaration instanceof MethodDeclaration && >+ enclosingBodyDeclaration.getParent() == fDestination && >+ Modifier.isPublic(enclosingBodyDeclaration.getModifiers()))) { >+ modifiers= Modifier.NONE; > } >- if (enclosingBodyDeclaration instanceof BodyDeclaration) { // should always be the case >- int enclosingModifiers= ((BodyDeclaration)enclosingBodyDeclaration).getModifiers(); >- boolean shouldBeStatic= Modifier.isStatic(enclosingModifiers) >- || enclosingBodyDeclaration instanceof EnumDeclaration >- || fAnalyzer.getForceStatic(); >- if (shouldBeStatic) { >- modifiers|= Modifier.STATIC; >+ >+ boolean shouldBeStatic= false; >+ ASTNode currentParent= enclosingBodyDeclaration; >+ do { >+ if (currentParent instanceof BodyDeclaration) { >+ shouldBeStatic= shouldBeStatic || JdtFlags.isStatic((BodyDeclaration) currentParent); > } >+ currentParent= currentParent.getParent(); >+ } while (!shouldBeStatic && currentParent != null && currentParent != fDestination); >+ >+ if (shouldBeStatic || fAnalyzer.getForceStatic()) { >+ modifiers|= Modifier.STATIC; >+ } else if (isDestinationInterface) { >+ modifiers|= Modifier.DEFAULT; > } > > ITypeBinding[] typeVariables= computeLocalTypeVariables(); >@@ -1018,11 +1031,11 @@ > parameters.add(parameter); > } > >- List<Name> exceptions= result.thrownExceptions(); >+ List<Type> exceptions= result.thrownExceptionTypes(); > ITypeBinding[] exceptionTypes= fAnalyzer.getExceptions(fThrowRuntimeExceptions); > for (int i= 0; i < exceptionTypes.length; i++) { > ITypeBinding exceptionType= exceptionTypes[i]; >- exceptions.add(ASTNodeFactory.newName(fAST, fImportRewriter.addImport(exceptionType, context))); >+ exceptions.add(ASTNodeFactory.newType(fAST, fImportRewriter.addImport(exceptionType, context))); > } > return result; > } >diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties >index 044df0d..3df1c0b 100644 >--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties >+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties >@@ -36,7 +36,7 @@ > Checks_no_dot=Type name cannot contain a dot (.). > Checks_cu_name_used=Compilation unit ''{0}'' already exists > Checks_method_native=Method ''{1}'' in type ''{0}'' is native. Running the modified program will cause {2}. >-Checks_methodName_constructor=New method name has constructor name. >+Checks_methodName_constructor=New method has same name as constructor of type ''{0}''. > Checks_methodName_exists=Method ''{0}'' already exists in type ''{1}''. > Checks_methodName_overrides=New method ''{0}'' overrides an existing method in type ''{1}''. > Checks_methodName_returnTypeClash=New method ''{0}'' overrides a method declared in type ''{1}'' that uses a different return type. >@@ -124,14 +124,15 @@ > ExtractMethodAnalyzer_cannot_extract_type_reference=Cannot extract a single type reference. > ExtractMethodAnalyzer_cannot_extract_switch_case=Cannot extract the expression of a case statement. > ExtractMethodAnalyzer_cannot_extract_method_name_reference=Cannot extract a single method name. >-ExtractMethodAnalyzer_cannot_extract_part_of_qualified_name=Can not extract part of a qualified name >+ExtractMethodAnalyzer_cannot_extract_part_of_qualified_name=Cannot extract part of a qualified name > ExtractMethodAnalyzer_cannot_extract_name_in_declaration=Cannot extract the name part of a declaration. >-ExtractMethodAnalyzer_compile_errors_no_parent_binding=The selection cannot cannot be analyzed because of compilation errors in the enclosing type. To perform the operation you will need to fix the errors. >+ExtractMethodAnalyzer_compile_errors_no_parent_binding=The selection cannot be analyzed because of compilation errors in the enclosing type. To perform the operation you will need to fix the errors. > ExtractMethodAnalyzer_ambiguous_return_value=Ambiguous return value: Expression, access to local or return statement extracted. > ExtractMethodAnalyzer_compile_errors=The method''s body cannot be analyzed because of compilation errors in method ''{0}''. To perform the operation you will need to fix the errors. > ExtractMethodAnalyzer_leftHandSideOfAssignment=Cannot extract the left-hand side of an assignment. > ExtractMethodAnalyzer_single_expression_or_set=Can only extract a single expression or a set of statements. > ExtractMethodAnalyzer_cannot_extract_null_type=Cannot extract null expression. >+ExtractMethodAnalyzer_no_valid_destination_type=No valid destination type exists. > ExtractMethodAnalyzer_resource_in_try_with_resources=Cannot extract a resource declared in a 'try-with-resources' statement. > > ExtractMethodRefactoring_name=Extract Method >diff --git a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/code/ExtractMethodInputPage.java b/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/code/ExtractMethodInputPage.java >index b0617aa..fc13157 100644 >--- a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/code/ExtractMethodInputPage.java >+++ b/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/code/ExtractMethodInputPage.java >@@ -1,9 +1,13 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2012 IBM Corporation and others. >+ * Copyright (c) 2000, 2013 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 > * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. > * > * Contributors: > * IBM Corporation - initial API and implementation >@@ -24,6 +28,7 @@ > import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Combo; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Label; > import org.eclipse.swt.widgets.Text; > >@@ -70,6 +75,7 @@ > private boolean fFirstTime; > private JavaSourceViewer fSignaturePreview; > private IDialogSettings fSettings; >+ private Composite accessModifiersGroup; > > private static final String DESCRIPTION = RefactoringMessages.ExtractMethodInputPage_description; > private static final String THROW_RUNTIME_EXCEPTIONS= "ThrowRuntimeExceptions"; //$NON-NLS-1$ >@@ -121,6 +127,7 @@ > @Override > public void widgetSelected(SelectionEvent e) { > fRefactoring.setDestination(combo.getSelectionIndex()); >+ updateAccessModifiers(); > updatePreview(getText()); > } > }); >@@ -129,11 +136,11 @@ > label= new Label(result, SWT.NONE); > label.setText(RefactoringMessages.ExtractMethodInputPage_access_Modifiers); > >- Composite group= new Composite(result, SWT.NONE); >- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); >+ accessModifiersGroup= new Composite(result, SWT.NONE); >+ accessModifiersGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); > layout= new GridLayout(); > layout.numColumns= 4; layout.marginWidth= 0; >- group.setLayout(layout); >+ accessModifiersGroup.setLayout(layout); > > String[] labels= new String[] { > RefactoringMessages.ExtractMethodInputPage_public, >@@ -144,7 +151,7 @@ > Integer[] data= new Integer[] {new Integer(Modifier.PUBLIC), new Integer(Modifier.PROTECTED), new Integer(Modifier.NONE), new Integer(Modifier.PRIVATE)}; > Integer visibility= new Integer(fRefactoring.getVisibility()); > for (int i= 0; i < labels.length; i++) { >- Button radio= new Button(group, SWT.RADIO); >+ Button radio= new Button(accessModifiersGroup, SWT.RADIO); > radio.setText(labels[i]); > radio.setData(data[i]); > if (data[i].equals(visibility)) >@@ -158,7 +165,8 @@ > } > }); > } >- layouter.perform(label, group, 1); >+ updateAccessModifiers(); >+ layouter.perform(label, accessModifiersGroup, 1); > > if (!fRefactoring.getParameterInfos().isEmpty()) { > ChangeParametersControl cp= new ChangeParametersControl(result, SWT.NONE, >@@ -234,7 +242,35 @@ > Dialog.applyDialogFont(result); > PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IJavaHelpContextIds.EXTRACT_METHOD_WIZARD_PAGE); > } >- >+ >+ private void updateAccessModifiers() { >+ final Control[] radioButtons= accessModifiersGroup.getChildren(); >+ if (fRefactoring.isDestinationInterface()) { >+ Integer visibility= new Integer(Modifier.PUBLIC); >+ fRefactoring.setVisibility(visibility.intValue()); >+ for (int i= 0; i < radioButtons.length; i++) { >+ radioButtons[i].setEnabled(false); >+ if (radioButtons[i].getData().equals(visibility)) { >+ ((Button) radioButtons[i]).setSelection(true); >+ } else { >+ ((Button) radioButtons[i]).setSelection(false); >+ } >+ } >+ } else { >+ final String accessModifier= fSettings.get(ACCESS_MODIFIER); >+ Integer visibility= accessModifier != null ? new Integer(accessModifier) : new Integer(fRefactoring.getVisibility()); >+ fRefactoring.setVisibility(visibility.intValue()); >+ for (int i= 0; i < radioButtons.length; i++) { >+ radioButtons[i].setEnabled(true); >+ if (radioButtons[i].getData().equals(visibility)) { >+ ((Button) radioButtons[i]).setSelection(true); >+ } else { >+ ((Button) radioButtons[i]).setSelection(false); >+ } >+ } >+ } >+ } >+ > private String getLabel(ASTNode node) { > if (node instanceof AbstractTypeDeclaration) { > return ((AbstractTypeDeclaration)node).getName().getIdentifier(); >diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/ASTResolving.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/ASTResolving.java >index db17f58..9627df6 100644 >--- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/ASTResolving.java >+++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/ASTResolving.java >@@ -5,6 +5,10 @@ > * which accompanies this distribution, and is available at > * http://www.eclipse.org/legal/epl-v10.html > * >+ * This is an implementation of an early-draft specification developed under the Java >+ * Community Process (JCP) and is made available for testing and evaluation purposes >+ * only. The code is not compatible with any specification of the JCP. >+ * > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >@@ -651,11 +655,14 @@ > } > > /** >- * Finds the parent type of a node. >+ * Finds the ancestor type of <code>node</code> (includes <code>node</code> in the search). > * >- * @param node the node inside the type to find >- * @param treatModifiersOutside if set, modifiers are not part of their type, but of the type's parent >- * @return returns either a AbstractTypeDeclaration or an AnonymousTypeDeclaration >+ * @param node the node to start the search from, can be <code>null</code> >+ * @param treatModifiersOutside if set, modifiers are not part of their type, but of the type's >+ * parent >+ * @return returns the ancestor type of <code>node</code> (AbstractTypeDeclaration or >+ * AnonymousTypeDeclaration) if any (including <code>node</code>), <code>null</code> >+ * otherwise > */ > public static ASTNode findParentType(ASTNode node, boolean treatModifiersOutside) { > StructuralPropertyDescriptor lastLocation= null; >@@ -675,6 +682,14 @@ > return null; > } > >+ /** >+ * Finds the ancestor type of <code>node</code> (includes <code>node</code> in the search). >+ * >+ * @param node the node to start the search from, can be <code>null</code> >+ * @return returns the ancestor type of <code>node</code> (AbstractTypeDeclaration or >+ * AnonymousTypeDeclaration) if any (including <code>node</code>), <code>null</code> >+ * otherwise >+ */ > public static ASTNode findParentType(ASTNode node) { > return findParentType(node, false); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 406786
:
234655
|
236008
|
239048