Bug 35437

Summary: can't call protected methods from derived classes in other pkg
Product: [Eclipse Project] JDT Reporter: Eric DeFazio <mdefazio>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 RC4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Eric DeFazio CLA 2003-03-20 21:08:03 EST
(RC2) Eclipse will throw a compilation error when you try to invoke a protected 
method from a derived class in another pkg.

i.e. Base Class = 
package javaoverview.methods;

public class MethodAccessibilityBase
{   
    protected void protectedMethod ()
    {
        System.out.println ("Can be invoked by subclasses");        
    }
}

Derived = 
package javaoverview.methods.anotherpackage;

import javaoverview.methods.MethodAccessibilityBase;

public class MethodAccessibilityDerivedAnotherPackage extends 
MethodAccessibilityBase
{
    public void invokeMethods()
    {
     MethodAccessibilityBase lClassToCallMethodOn = new MethodAccessibilityBase
();
     lClassToCallMethodOn.protectedMethod();
    }
}
Comment 1 Eric DeFazio CLA 2003-03-21 00:08:33 EST
Whoops, guess I should doublecheck my work, and not submit bug reports when I 
am up for 20 hours straight... Sorry
Comment 2 Olivier Thomann CLA 2003-03-21 12:44:08 EST
Set milestone.