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 236550 Details for
Bug 394030
[extract method] Extracting expression of parameterized type that is passed as argument to this constructor yields compilation error
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]
updated patch
Bug 394030.patch (text/plain), 8.42 KB, created by
Samrat Dhillon
on 2013-10-16 09:43:17 EDT
(
hide
)
Description:
updated patch
Filename:
MIME Type:
Creator:
Samrat Dhillon
Created:
2013-10-16 09:43:17 EDT
Size:
8.42 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/generics_in/A_test1121.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/generics_in/A_test1121.java >new file mode 100644 >index 0000000..03a4bd9 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/generics_in/A_test1121.java >@@ -0,0 +1,11 @@ >+package generics_in; >+import java.util.Map; >+ >+public class A_test1121<V> { >+ public A_test1121(Map<?, ? extends V> c) { >+ this(/*[*/c.size()/*]*/); >+ } >+ >+ public A_test1121(int size) { >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/generics_in/A_test1122.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/generics_in/A_test1122.java >new file mode 100644 >index 0000000..3a25954 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/generics_in/A_test1122.java >@@ -0,0 +1,10 @@ >+package generics_in; >+import java.util.ArrayList; >+import java.util.List; >+ >+public class A_test1122{ >+ public <E> void foo() { >+ List<? extends E> t = new ArrayList<E>(); >+ /*[*/t.size();/*]*/ >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/generics_out/A_test1121.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/generics_out/A_test1121.java >new file mode 100644 >index 0000000..be2f261 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/generics_out/A_test1121.java >@@ -0,0 +1,15 @@ >+package generics_out; >+import java.util.Map; >+ >+public class A_test1121<V> { >+ public A_test1121(Map<?, ? extends V> c) { >+ this(extracted(c)); >+ } >+ >+ protected static <V> int extracted(Map<?, ? extends V> c) { >+ return /*[*/c.size()/*]*/; >+ } >+ >+ public A_test1121(int size) { >+ } >+} >\ No newline at end of file >diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/generics_out/A_test1122.java b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/generics_out/A_test1122.java >new file mode 100644 >index 0000000..a582ad3 >--- /dev/null >+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/generics_out/A_test1122.java >@@ -0,0 +1,14 @@ >+package generics_out; >+import java.util.ArrayList; >+import java.util.List; >+ >+public class A_test1122{ >+ public <E> void foo() { >+ List<? extends E> t = new ArrayList<E>(); >+ extracted(t); >+ } >+ >+ protected <E> void extracted(List<? extends E> t) { >+ /*[*/t.size();/*]*/ >+ } >+} >\ No newline at end of file >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 0825182..353153d 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 >@@ -14,6 +14,7 @@ > * Benjamin Muskalla <bmuskalla@eclipsesource.com> - [extract method] should declare method static if extracted from anonymous in static method - https://bugs.eclipse.org/bugs/show_bug.cgi?id=152004 > * Benjamin Muskalla <bmuskalla@eclipsesource.com> - [extract method] extracting return value results in compile error - https://bugs.eclipse.org/bugs/show_bug.cgi?id=264606 > * Samrat Dhillon <samrat.dhillon@gmail.com> - [extract method] Extracted method should be declared static if extracted expression is also used in another static method https://bugs.eclipse.org/bugs/show_bug.cgi?id=393098 >+ * Samrat Dhillon <samrat.dhillon@gmail.com> - [extract method] Extracting expression of parameterized type that is passed as argument to this constructor yields compilation error https://bugs.eclipse.org/bugs/show_bug.cgi?id=394030 > *******************************************************************************/ > package org.eclipse.jdt.ui.tests.refactoring; > >@@ -2072,6 +2073,14 @@ > public void test1120() throws Exception { > genericTest(); //https://bugs.eclipse.org/bugs/show_bug.cgi?id=369295 > } >+ >+ public void test1121() throws Exception { >+ genericTest(); >+ } >+ >+ public void test1122() throws Exception { >+ genericTest(); >+ } > > //---- Test enums --------------------------------- > >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 1ca75f6..9a996cd 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 >@@ -11,6 +11,7 @@ > * Benjamin Muskalla <bmuskalla@eclipsesource.com> - [extract method] Extract method and continue https://bugs.eclipse.org/bugs/show_bug.cgi?id=48056 > * Benjamin Muskalla <bmuskalla@eclipsesource.com> - [extract method] should declare method static if extracted from anonymous in static method - https://bugs.eclipse.org/bugs/show_bug.cgi?id=152004 > * Samrat Dhillon <samrat.dhillon@gmail.com> - [extract method] Extracted method should be declared static if extracted expression is also used in another static method https://bugs.eclipse.org/bugs/show_bug.cgi?id=393098 >+ * Samrat Dhillon <samrat.dhillon@gmail.com> - [extract method] Extracting expression of parameterized type that is passed as argument to this constructor yields compilation error https://bugs.eclipse.org/bugs/show_bug.cgi?id=394030 > *******************************************************************************/ > package org.eclipse.jdt.internal.corext.refactoring.code; > >@@ -1002,7 +1003,7 @@ > } > } > >- ITypeBinding[] typeVariables= computeLocalTypeVariables(); >+ ITypeBinding[] typeVariables= computeLocalTypeVariables(modifiers); > List<TypeParameter> typeParameters= result.typeParameters(); > for (int i= 0; i < typeVariables.length; i++) { > TypeParameter parameter= fAST.newTypeParameter(); >@@ -1041,20 +1042,20 @@ > return result; > } > >- private ITypeBinding[] computeLocalTypeVariables() { >+ private ITypeBinding[] computeLocalTypeVariables(int modifier) { > List<ITypeBinding> result= new ArrayList<ITypeBinding>(Arrays.asList(fAnalyzer.getTypeVariables())); > for (int i= 0; i < fParameterInfos.size(); i++) { > ParameterInfo info= fParameterInfos.get(i); >- processVariable(result, info.getOldBinding()); >+ processVariable(result, info.getOldBinding(), modifier); > } > IVariableBinding[] methodLocals= fAnalyzer.getMethodLocals(); > for (int i= 0; i < methodLocals.length; i++) { >- processVariable(result, methodLocals[i]); >+ processVariable(result, methodLocals[i], modifier); > } > return result.toArray(new ITypeBinding[result.size()]); > } > >- private void processVariable(List<ITypeBinding> result, IVariableBinding variable) { >+ private void processVariable(List<ITypeBinding> result, IVariableBinding variable, int modifier) { > if (variable == null) > return; > ITypeBinding binding= variable.getType(); >@@ -1066,8 +1067,25 @@ > ASTNode decl= fRoot.findDeclaringNode(arg); > if (decl != null && decl.getParent() instanceof MethodDeclaration) { > result.add(arg); >+ }else{ >+ if(decl != null && decl.getParent() instanceof TypeDeclaration && Modifier.isStatic(modifier)){ >+ result.add(arg); >+ } >+ } >+ }else{ >+ ITypeBinding bound = arg.getBound(); >+ if(arg.isWildcardType() && bound!=null && !result.contains(bound)){ >+ ASTNode decl= fRoot.findDeclaringNode(bound); >+ if (decl != null && decl.getParent() instanceof MethodDeclaration) { >+ result.add(bound); >+ }else{ >+ if(decl != null && decl.getParent() instanceof TypeDeclaration && Modifier.isStatic(modifier)){ >+ result.add(bound); >+ } >+ } > } > } >+ > } > } > }
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 394030
:
236344
| 236550