Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 495439

Summary: org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoringProcessor.canBeAccessedFrom(IMember, IType, ITypeHierarchy) contains incorrect stub check
Product: [Eclipse Project] JDT Reporter: Raffi Khatchadourian <raffi.khatchadourian>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: raffi.khatchadourian
Version: 3.1   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard: stalebug

Description Raffi Khatchadourian CLA 2016-06-03 16:51:14 EDT
The method org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoringProcessor.canBeAccessedFrom(IMember, IType, ITypeHierarchy) checks if a stub exists that corresponds to the given IMember:

if (member instanceof IMethod) {
				final IMethod method = (IMethod) member;
				final IMethod stub = target.getMethod(method.getElementName(), method.getParameterTypes());
				if (stub.exists())
					return true;
					
However, the code that looks up the stub in the target naively assumes that the receiver of the method is of the target type. However, the receiver can be any type, or, it could even be a static method. For example, a static method defined in a different type with the same name and parameters would pass as a stub when it actually isn't.

					

-- Configuration Details --
Product: Eclipse 4.5.2.20160218-0600 (org.eclipse.epp.package.committers.product)
Installed Features:
 org.eclipse.jdt 3.11.2.v20160212-1500
Comment 1 Eclipse Genie CLA 2020-05-20 11:59:40 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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.