gcj/300: wrong field is accessed from inner class
osk@hem.passagen.se
osk@hem.passagen.se
Fri Aug 4 07:16:00 GMT 2000
>Number: 300
>Category: gcj
>Synopsis: wrong field is accessed from inner class
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: apbianco
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Aug 04 07:16:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Oskar Liljeblad
>Release: unknown-1.0
>Organization:
>Environment:
>Description:
(This may be related to #291)
Compile the code below using "gcj Test.java -o Test --main=Test"
and execute Test. The output is:
Test: modCount=0
foo: modCount=134741808
If you compile in two steps, you get an error:
$ gcj -C Test.java
$ gcj -o Test --main=Test Test*.class
Test.java: In class `Test$1':
Test.java: In method `foo()':
Test.java:11: verification error at PC=13
Test.java:11: incorrect type for field reference
$
Oskar Liljeblad (osk@hem.passagen.se)
>How-To-Repeat:
abstract class Super {
int modCount = 0;
}
class Test extends Super {
private static interface Inner {
void foo();
}
private final Inner i = new Inner() {
public void foo() {
System.out.println("foo: modCount="+modCount);
}
};
public Test() {
System.out.println("Test: modCount="+modCount);
i.foo();
}
public static void main(String[] args) {
new Test();
}
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Java-prs
mailing list