[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#414983: gcj-4.1: Compilation bug with java.awt.Component.x



Package: gcj-4.1
Version: 4.1.1-20
Severity: normal

Hi,

The following program gives error at compilation:

import javax.swing.*;
import java.awt.*;

public class B
{
    int x = 0;
    class MonJPanel extends JPanel{
    protected void paintComponent (Graphics g){
        g.fillOval(x-1,9,52,52);
        }
    }
}

The error is:

snoopy:~/Balle$ javac B.java 
B.java: In class 'B$MonJPanel':
B.java: In method 'B$MonJPanel.paintComponent(java.awt.Graphics)':
B.java:9: error: Can't access package-private field
'java.awt.Component.x' from 'B$MonJPanel'.
            g.fillOval(x-1,9,52,52);
                          ^
1 error

Why does it try to use x from class Component instead of class B?

If I change x by xx, the compilation is ok.

Cheers,
Eugen Dedu

-- System Information:
Debian Release: 4.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: powerpc (ppc)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-powerpc
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages gcj-4.1 depends on:
ii  gcc-4.1                 4.1.1-21         The GNU C compiler
ii  gcj-4.1-base            4.1.1-20         The GNU Compiler Collection (gcj b
ii  gij-4.1                 4.1.1-20         The GNU Java bytecode interpreter
ii  java-common             0.25             Base of all Java packages
ii  libc6                   2.3.6.ds1-13     GNU C Library: Shared libraries
ii  libc6-dev               2.3.6.ds1-13     GNU C Library: Development Librari
ii  libgcc1                 1:4.2-20060923-1 GCC support library
ii  libgcj7-0               4.1.1-20         Java runtime library for use with 
ii  libgcj7-dev             4.1.1-20         Java development headers and stati
ii  libgcj7-jar             4.1.1-20         Java runtime library for use with 
ii  zlib1g                  1:1.2.3-13       compression library - runtime

Versions of packages gcj-4.1 recommends:
ii  fastjar                       1:4.1.1-21 Jar creation utility

-- no debconf information



Reply to: