Bug 459446 - Refactoring: Update similarly named variables and methods" should pass different elements and RenameArguments
Summary: Refactoring: Update similarly named variables and methods" should pass differ...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.5   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-09 07:11 EST by Carsten Pfeiffer CLA
Modified: 2023-08-14 06:24 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Pfeiffer CLA 2015-02-09 07:11:13 EST
The JDT rename type refactoring has the option to "Update similarly named variables and methods". When checked, it will basically perform two kinds of refactorings: 
1) rename the type
2) rename all corresponding fields with a similar name as the type

Participants can take part in both refactorings.

The problem is that the participants for the second (field) refactoring are loaded and initialized for the IType being renamed  and correspondingly get a RenameTypeArgument, while in fact they are supposed to handle the renaming of IField elements.

So "normal" rename-field participants can not participate in this refactoring. In order to become involved, they have to be additionally enabled for IType elements and then use internal JDT API to figure out which elements are to be renamed, and what are the new names.

It would be much simpler of they would get loaded and initialized for the actual fields being renamed.

See this stacktrace where the loading of our RenameFieldParticipant occurs (as a workaround, we enable it for IType and use internal JDT API, as mentioned):

Thread [ModalContext] (Suspended (breakpoint at line 43 in RenameFieldParticipant))	
	RenameFieldParticipant.<init>() line: 43	
	NativeConstructorAccessorImpl.newInstance0(Constructor, Object[]) line: not available [native method]	
	NativeConstructorAccessorImpl.newInstance(Object[]) line: 57	
	DelegatingConstructorAccessorImpl.newInstance(Object[]) line: 45	
	Constructor<T>.newInstance(Object...) line: 526	
	Class<T>.newInstance() line: 379	
	EquinoxRegistryStrategy(RegistryStrategyOSGI).createExecutableExtension(RegistryContributor, String, String) line: 184	
	ExtensionRegistry.createExecutableExtension(RegistryContributor, String, String) line: 905	
	ConfigurationElementMulti(ConfigurationElement).createExecutableExtension(String) line: 243	
	ConfigurationElementHandle.createExecutableExtension(String) line: 55	
	ParticipantDescriptor.createParticipant() line: 85	
	ParticipantExtensionPoint.getParticipants(RefactoringStatus, RefactoringProcessor, Object, RefactoringArguments, IParticipantDescriptorFilter, String[], SharableParticipants) line: 98	
	ParticipantManager.loadRenameParticipants(RefactoringStatus, RefactoringProcessor, Object, RenameArguments, IParticipantDescriptorFilter, String[], SharableParticipants) line: 74	
	RenameModifications.loadParticipants(RefactoringStatus, RefactoringProcessor, String[], SharableParticipants) line: 193	
	RenameTypeProcessor(JavaRenameProcessor).loadParticipants(RefactoringStatus, SharableParticipants) line: 41	
	RenameRefactoring(ProcessorBasedRefactoring).checkFinalConditions(IProgressMonitor) line: 233	
	CheckConditionsOperation.run(IProgressMonitor) line: 85	
	CreateChangeOperation.run(IProgressMonitor) line: 121	
	Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 2313	
	WorkbenchRunnableAdapter.run(IProgressMonitor) line: 87	
	ModalContext$ModalContextThread.run() line: 122
Comment 1 Manoj N Palat CLA 2015-02-09 07:27:02 EST
Moving to JDT UI for comments
Comment 2 Eclipse Genie CLA 2019-08-28 16:46:19 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 3 Eclipse Genie CLA 2021-08-22 17:10:13 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 4 Eclipse Genie CLA 2023-08-14 06:24:19 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.