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 230247 Details for
Bug 313036
[rename] Renaming a class changes class inheritance and leads to behavioral change
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch using InsertEdit.
eclipse.jdt.ui.patch (text/plain), 3.35 KB, created by
Martin Mathew
on 2013-04-29 06:52:16 EDT
(
hide
)
Description:
Patch using InsertEdit.
Filename:
MIME Type:
Creator:
Martin Mathew
Created:
2013-04-29 06:52:16 EDT
Size:
3.35 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >diff --git core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameTypeProcessor.java core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameTypeProcessor.java >index b015f3a..04d1c7c 100644 >--- core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameTypeProcessor.java >+++ core refactoring/org/eclipse/jdt/internal/corext/refactoring/rename/RenameTypeProcessor.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * 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 >@@ -36,6 +36,7 @@ > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IResource; > >+import org.eclipse.text.edits.InsertEdit; > import org.eclipse.text.edits.ReplaceEdit; > > import org.eclipse.ltk.core.refactoring.Change; >@@ -982,12 +983,32 @@ > if (cusWithReferencesToConflictingTypes.length > 0) { > cus: for (ICompilationUnit cu : cusWithReferencesToConflictingTypes) { > String packageName= fType.getPackageFragment().getElementName(); >- if (((IPackageFragment) cu.getParent()).getElementName().equals(packageName)) { >- boolean hasOnDemandImport= false; >+ IPackageFragment packageFragment= (IPackageFragment) cu.getParent(); >+ if (packageFragment.getElementName().equals(packageName)) { > IImportDeclaration[] imports= cu.getImports(); > for (IImportDeclaration importDecl : imports) { > if (importDecl.isOnDemand()) { >- hasOnDemandImport= true; >+ // the renamed type in the same package will shadow the *-imported type >+ IJavaElement imported= convertFromImportDeclaration(importDecl); >+ if (imported != null) { >+ ICompilationUnit[] cus= ((IPackageFragment) imported).getCompilationUnits(); >+ for (int i= 0; i < cus.length; i++) { >+ IType[] types= cus[i].getTypes(); >+ for (IType iType : types) { >+ if (JdtFlags.isPublic(iType) && iType.getElementName().equals(getNewElementName())) { >+ String importElementName= importDecl.getElementName(); >+ int offset= cu.getSource().indexOf(importElementName) + importElementName.length() + 1; >+ importElementName= imported.getElementName() + '.' + getNewElementName(); >+ >+ pm.beginTask("", 1); //$NON-NLS-1$ >+ String name= RefactoringCoreMessages.InlineMethodRefactoring_edit_import; >+ InsertEdit insertEdit= new InsertEdit(offset, "\nimport " + importElementName.trim() + ';'); //$NON-NLS-1$ >+ TextChangeCompatibility.addTextEdit(fChangeManager.get(cu), name, insertEdit, CATEGORY_TYPE_RENAME); >+ pm.worked(1); >+ } >+ } >+ } >+ } > } else { > String importName= importDecl.getElementName(); > int packageLength= importName.length() - getNewElementName().length() - 1; >@@ -997,10 +1018,6 @@ > continue cus; // explicit import from another package => no problem > } > } >- } >- if (hasOnDemandImport) { >- // the renamed type in the same package will shadow the *-imported type >- conflicts.add(cu); > } > } > }
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 313036
:
230247
|
230256