Bug 21818 - "Methods can't be overridden to be more private."
Summary: "Methods can't be overridden to be more private."
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
Keywords: rejects-valid
Depends on: 28067
  Show dependency treegraph
Reported: 2005-05-30 14:14 UTC by Timo Lindfors
Modified: 2007-01-09 20:47 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2005-05-30 14:20:15


Note You need to log in before you can comment on or make changes to this bug.
Description Timo Lindfors 2005-05-30 14:14:49 UTC
Steps to reproduce:
1. Compile they attached testcase with gcj -C DoubleClickJList.java

Expected results:
1. DoubleClickJList.class is created and no errors are shown.

Actual results:
$ /home/lindi/installdir-2005-05-22/gcc/bin/gcj -C DoubleClickJList.java
DoubleClickJList.java:3: error: Methods can't be overridden to be more private.
Method 'DoubleClickJList.init()' is not private in class 'javax.swing.JList'.
        private void init() {
1 error

import javax.swing.*;
public class DoubleClickJList extends JList {
        private void init() {

I am not sure if this is a bug or a feature (I have not read any official specs)
but jikes 1.22 and SUN's JVM 1.5.0 seem to compile the testcase just fine. This
means that some free software projects seem to depend on this behavior.

Version info:
gcj (GCC) 4.1.0 20050522 (experimental)
Fedora Core with linux 2.6.11-1.14_FC3
Comment 1 Andrew Pinski 2005-05-30 14:20:15 UTC
Confirmed, this is just namespace spilling in the library.
Comment 2 Andrew Pinski 2005-05-30 14:33:03 UTC
Nope, I am wrong, this is a front-end bug:
copper:~>cat t/JList.java
package t;
public class JList
  void init(){}
copper:~>cat DoubleClickJList.java 
import t.JList;
public class DoubleClickJList extends JList {
        private void init() {
Comment 3 Tom Tromey 2007-01-09 20:47:42 UTC
All gcj front end bugs have been fixed by the gcj-eclipse branch merge.
I'm mass-closing the affected PRs.
If you believe one of these was closed in error, please reopen it
with a note explaining why.