--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: gcj-4.1: Compilation bug with java.awt.Component.x
- From: Eugen Dedu <Eugen.Dedu@pu-pm.univ-fcomte.fr>
- Date: Thu, 15 Mar 2007 11:04:07 +0100
- Message-id: <20070315100407.9565.78484.reportbug@localhost.localdomain>
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
--- End Message ---
--- Begin Message ---
- To: Eugen Dedu <Eugen.Dedu@pu-pm.univ-fcomte.fr>, 414983-done@bugs.debian.org
- Subject: Re: Bug#414983: gcj-4.1: Compilation bug with java.awt.Component.x
- From: Matthias Klose <doko@cs.tu-berlin.de>
- Date: Mon, 23 Jul 2007 09:19:23 +0200
- Message-id: <18084.22139.219309.997536@gargle.gargle.HOWL>
- In-reply-to: <20070315100407.9565.78484.reportbug@localhost.localdomain>
- References: <20070315100407.9565.78484.reportbug@localhost.localdomain>
Version: 4.1.2-14
fixed in gcj-4.1 and gcj-4.2 in unstable.
Eugen Dedu writes:
> 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);
--- End Message ---