gcj/249: Innerclass cannot access protected method declared in foreign-package superclass of parent
bryce@albatross.co.nz
bryce@albatross.co.nz
Sun May 28 21:50:00 GMT 2000
>Number: 249
>Category: gcj
>Synopsis: Innerclass cannot access protected method declared in foreign-package superclass of parent
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun May 28 21:50:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Bryce McKinlay
>Release: gcc version 2.96 20000525 (experimental) w/ PR177 fix
>Organization:
>Environment:
>Description:
An inner class should have the same access as its enclosing
class with regard to accessing methods and fields in other
top level classes.
Protected methods in a superclass of the enclosing class
should be accessible from the inner class, even if the
superclass is in a foreign package. But gcj gets the
following error:
$ gcj AnonTest.java pkg1/Base.java -o at --main=AnonTest
AnonTest.java: In class `AnonTest$Inner':
AnonTest.java: In method `test()':
AnonTest.java:9: Can't access protected method `void pkg1.Base.a()' from `AnonTest$Inner'.
a();
^
1 error
>How-To-Repeat:
Try to compile this test case:
// AnonTest.java
import pkg1.*;
public class AnonTest extends Base
{
class Inner
{
void test()
{
a();
}
}
}
// pkg1/Base.java
package pkg1;
public class Base
{
protected void a() {}
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Java-prs
mailing list