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

Bug 302935

Summary: [refactoring][getter] Adding getter with same name as an inner classes' method breaks inner class
Product: [Eclipse Project] JDT Reporter: Robin Message <rhm31>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: markus.kell.r
Version: 3.6   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug
Attachments:
Description Flags
Test case - apply quick fix generate getter/setter to the title field in Outer and silently break the inner class none

Description Robin Message CLA 2010-02-16 06:40:07 EST
Build Identifier: 20090619-0625

When adding a getter/setter with the refactoring tools, any inner classes start using the getter and setter. However, if the inner class has a method that clashes with the new getter name, then that method is called by the inner class, instead of the getter.

It can be fixed by generating Outer.this.get... instead of just get... methods.

I noticed this quickly due to a sudden failure, but I could see this creating hard to find bugs.

Reproducible: Always

Steps to Reproduce:
1. Create a getter on a field in a class, e.g. getTitle on the title field
2. If the class has an inner class, and that inner class has a method getTitle, then all references to the field (title) will now call getTitle, which is an inner class method. They should call Outer.this.getTitle instead.
Comment 1 Robin Message CLA 2010-02-16 06:42:42 EST
Created attachment 159167 [details]
Test case - apply quick fix generate getter/setter to the title field in Outer and silently break the inner class
Comment 2 Eclipse Genie CLA 2020-03-16 19:40:50 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.