Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 280819 - [quick fix] Wrong quick fixes when accessing protected field in subclass in different package
Summary: [quick fix] Wrong quick fixes when accessing protected field in subclass in d...
Status: RESOLVED DUPLICATE of bug 65876
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-18 15:07 EDT by Bassam Jabbour CLA
Modified: 2009-06-22 04:53 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 Bassam Jabbour CLA 2009-06-18 15:07:09 EDT
When trying to access protected fields of base class objects in subclasses in another package, the compiler rightfully signals an error, but the proposed Quickfix, in this case changing the field visibility to protected, doesn't help; maybe it should suggest changing visibility to public?
Comment 1 Olivier Thomann CLA 2009-06-18 15:46:49 EDT
Moving to JDT/UI.
Could you please provide an example that fails?
Comment 2 Bassam Jabbour CLA 2009-06-19 06:50:57 EDT
[file 1]
package a;

public class Base {
    protected int myField;
}

[file 2]
package b;
import a.Base;

public class Child extends Base {
    public void aMethod(Base parent) {
        System.out.println (parent.myField);
    }
}

This example rightfully fails to compile, but the proposed Quickfix is "change visibility of myField to protected", which is already the case.
Comment 3 Dani Megert CLA 2009-06-22 04:53:15 EDT

*** This bug has been marked as a duplicate of bug 65876 ***