Package: gcj-3.0
Version: 1:3.0.4-6
Severity: normal

Hi.  I have the following piece of code that compiles correctly but then
gives an error when run.  It involves calling a default constructor for
an inner class.

If gcj won't accept this default constructor, it should give a compile
error.  If gcj will accept this default constructor, it should run
without errors.

Currently it compiles cleanly but produces broken bytecode; you don't
have a clue that anything's wrong until you happen to run that
particular piece of code.  This can be quite a problem in a large
project where it becomes difficult to test the execution of every possible
path through the software for compile breakages.

  public class Test {
      public static void main(String[] args) {
          new Test().sayHi();
      }

      public void sayHi() {
          new Foo().sayHi();
      }

      private class Foo {
          public void sayHi() {
              System.out.println("Hi");
          }
      }
  }

[EMAIL PROTECTED]:/tmp> javac Test.java
[EMAIL PROTECTED]:/tmp> java Test
Hi
[EMAIL PROTECTED]:/tmp> gcj -C Test.java
[EMAIL PROTECTED]:/tmp> java Test
Exception in thread "main" java.lang.VerifyError: (class: Test$Foo,
method: <init> signature: (LTest;)V) Expecting to find object/array on
stack
        at Test.sayHi(Test.java:10)
        at Test.main(Test.java:6)

Thanks - Ben.

-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux espresso 2.4.18-686 #2 Wed Mar 20 20:21:31 EST 2002 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages gcj-3.0 depends on:
ii  gcc-3.0                       1:3.0.4-6  The GNU C compiler.
ii  gcc-3.0-base                  1:3.0.4-6  The GNU Compiler Collection (base 
ii  java-common                   0.13       Base of all Java packages
ii  libc6                         2.2.5-4    GNU C Library: Shared libraries an
ii  libgcc1                       1:3.0.4-6  GCC support library.
ii  libgcj2                       1:3.0.4-6  Java runtime library for use with 
ii  libgcj2-dev                   1:3.0.4-6  Java development headers and stati
ii  zlib1g                        1:1.1.4-1  compression library - runtime



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]


Reply via email to