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 241085 Details for
Bug 428704
[move method] Move method within the same CU results in compiler error when the method parameter type name is qualified
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
Bug428704.eclipse.jdt.ui.patch (text/plain), 8.22 KB, created by
Martin Mathew
on 2014-03-21 01:13:18 EDT
(
hide
)
Description:
Patch + Tests
Filename:
MIME Type:
Creator:
Martin Mathew
Created:
2014-03-21 01:13:18 EDT
Size:
8.22 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui.tests.refactoring >diff --git resources/MoveInstanceMethod/canMove/test66/in/A.java resources/MoveInstanceMethod/canMove/test66/in/A.java >new file mode 100644 >index 0000000..ba8d97c >--- /dev/null >+++ resources/MoveInstanceMethod/canMove/test66/in/A.java >@@ -0,0 +1,8 @@ >+public class A { >+ public void foo(java.io.FileNotFoundException arg, B b) >+ throws java.io.EOFException { >+ } >+} >+ >+class B { >+} >diff --git resources/MoveInstanceMethod/canMove/test66/out/A.java resources/MoveInstanceMethod/canMove/test66/out/A.java >new file mode 100644 >index 0000000..507b201 >--- /dev/null >+++ resources/MoveInstanceMethod/canMove/test66/out/A.java >@@ -0,0 +1,11 @@ >+import java.io.FileNotFoundException; >+ >+public class A { >+} >+ >+class B { >+ >+ public void foo(FileNotFoundException arg) >+ throws java.io.EOFException { >+ } >+} >diff --git test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInstanceMethodTests.java test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInstanceMethodTests.java >index 8bd6974..5ebe3fb 100644 >--- test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInstanceMethodTests.java >+++ test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInstanceMethodTests.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 >@@ -563,6 +563,11 @@ > public void test65() throws Exception { > helper1(new String[] { "A" }, "A", 3, 17, 3, 18, PARAMETER, "c", false, false); > } >+ >+ // bug 428704 >+ public void test66() throws Exception { >+ helper1(new String[] { "p1.A"}, "p1.A", 2, 18, 2, 18, PARAMETER, "b", true, true); >+ } > > // Move mA1 to field fB, do not inline delegator > public void test3() throws Exception { >#P org.eclipse.jdt.ui >diff --git core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/MoveInstanceMethodProcessor.java core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/MoveInstanceMethodProcessor.java >index 2cf23c2..446462c 100644 >--- core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/MoveInstanceMethodProcessor.java >+++ core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/MoveInstanceMethodProcessor.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 >@@ -2263,7 +2263,8 @@ > * @throws CoreException > * if an error occurs > */ >- protected void createMethodCopy(IDocument document, MethodDeclaration declaration, ASTRewrite rewrite, Map<ICompilationUnit, CompilationUnitRewrite> rewrites, Map<IMember, IncomingMemberVisibilityAdjustment> adjustments, RefactoringStatus status, IProgressMonitor monitor) throws CoreException { >+ protected void createMethodCopy(IDocument document, MethodDeclaration declaration, ASTRewrite rewrite, Map<ICompilationUnit, CompilationUnitRewrite> rewrites, >+ Map<IMember, IncomingMemberVisibilityAdjustment> adjustments, RefactoringStatus status, IProgressMonitor monitor) throws CoreException { > Assert.isNotNull(document); > Assert.isNotNull(declaration); > Assert.isNotNull(rewrite); >@@ -2272,39 +2273,39 @@ > Assert.isNotNull(status); > Assert.isNotNull(monitor); > final CompilationUnitRewrite rewriter= getCompilationUnitRewrite(rewrites, getTargetType().getCompilationUnit()); >- try { >- rewrite.set(declaration, MethodDeclaration.NAME_PROPERTY, rewrite.getAST().newSimpleName(fMethodName), null); >- boolean same= false; >- final IMethodBinding binding= declaration.resolveBinding(); >- if (binding != null) { >- final ITypeBinding declaring= binding.getDeclaringClass(); >- if (declaring != null && Bindings.equals(declaring.getPackage(), fTarget.getType().getPackage())) >- same= true; >- final Modifier.ModifierKeyword keyword= same ? null : Modifier.ModifierKeyword.PUBLIC_KEYWORD; >- if (MemberVisibilityAdjustor.hasLowerVisibility(binding.getModifiers(), same ? Modifier.NONE : keyword == null ? Modifier.NONE : keyword.toFlagValue()) && MemberVisibilityAdjustor.needsVisibilityAdjustments(fMethod, keyword, adjustments)) { >- final MemberVisibilityAdjustor.IncomingMemberVisibilityAdjustment adjustment= new MemberVisibilityAdjustor.IncomingMemberVisibilityAdjustment(fMethod, keyword, RefactoringStatus.createStatus(RefactoringStatus.WARNING, Messages.format(RefactoringCoreMessages.MemberVisibilityAdjustor_change_visibility_method_warning, new String[] { MemberVisibilityAdjustor.getLabel(fMethod), MemberVisibilityAdjustor.getLabel(keyword) }), JavaStatusContext.create(fMethod), null, RefactoringStatusEntry.NO_CODE, null)); >- ModifierRewrite.create(rewrite, declaration).setVisibility(keyword == null ? Modifier.NONE : keyword.toFlagValue(), null); >- adjustment.setNeedsRewriting(false); >- adjustments.put(fMethod, adjustment); >- } >+ rewrite.set(declaration, MethodDeclaration.NAME_PROPERTY, rewrite.getAST().newSimpleName(fMethodName), null); >+ boolean same= false; >+ final IMethodBinding binding= declaration.resolveBinding(); >+ if (binding != null) { >+ final ITypeBinding declaring= binding.getDeclaringClass(); >+ if (declaring != null && Bindings.equals(declaring.getPackage(), fTarget.getType().getPackage())) >+ same= true; >+ final Modifier.ModifierKeyword keyword= same ? null : Modifier.ModifierKeyword.PUBLIC_KEYWORD; >+ if (MemberVisibilityAdjustor.hasLowerVisibility(binding.getModifiers(), same ? Modifier.NONE : keyword == null ? Modifier.NONE : keyword.toFlagValue()) >+ && MemberVisibilityAdjustor.needsVisibilityAdjustments(fMethod, keyword, adjustments)) { >+ final MemberVisibilityAdjustor.IncomingMemberVisibilityAdjustment adjustment= new MemberVisibilityAdjustor.IncomingMemberVisibilityAdjustment(fMethod, keyword, >+ RefactoringStatus.createStatus( >+ RefactoringStatus.WARNING, >+ Messages.format(RefactoringCoreMessages.MemberVisibilityAdjustor_change_visibility_method_warning, new String[] { MemberVisibilityAdjustor.getLabel(fMethod), >+ MemberVisibilityAdjustor.getLabel(keyword) }), JavaStatusContext.create(fMethod), null, RefactoringStatusEntry.NO_CODE, null)); >+ ModifierRewrite.create(rewrite, declaration).setVisibility(keyword == null ? Modifier.NONE : keyword.toFlagValue(), null); >+ adjustment.setNeedsRewriting(false); >+ adjustments.put(fMethod, adjustment); > } >- for (IExtendedModifier modifier : (List<IExtendedModifier>) declaration.modifiers()) { >- if (modifier.isAnnotation()) { >- Annotation annotation= (Annotation) modifier; >- ITypeBinding typeBinding= annotation.resolveTypeBinding(); >- if (typeBinding != null && typeBinding.getQualifiedName().equals("java.lang.Override")) { //$NON-NLS-1$ >- rewrite.remove(annotation, null); >- } >- } >- } >- createMethodArguments(rewrites, rewrite, declaration, adjustments, status); >- createMethodTypeParameters(rewrite, declaration, status); >- createMethodComment(rewrite, declaration); >- createMethodBody(rewriter, rewrite, declaration); >- } finally { >- if (fMethod.getCompilationUnit().equals(getTargetType().getCompilationUnit())) >- rewriter.clearImportRewrites(); > } >+ for (IExtendedModifier modifier : (List<IExtendedModifier>) declaration.modifiers()) { >+ if (modifier.isAnnotation()) { >+ Annotation annotation= (Annotation) modifier; >+ ITypeBinding typeBinding= annotation.resolveTypeBinding(); >+ if (typeBinding != null && typeBinding.getQualifiedName().equals("java.lang.Override")) { //$NON-NLS-1$ >+ rewrite.remove(annotation, null); >+ } >+ } >+ } >+ createMethodArguments(rewrites, rewrite, declaration, adjustments, status); >+ createMethodTypeParameters(rewrite, declaration, status); >+ createMethodComment(rewrite, declaration); >+ createMethodBody(rewriter, rewrite, declaration); > } > > /**
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 428704
: 241085