This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

java/2423: false reporting of "Final variable initialization error" in constructor



>Number:         2423
>Category:       java
>Synopsis:       false reporting of "Final variable initialization error" in constructor
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 29 19:36:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     sdlee@csis.hku.hk
>Release:        gcc-20010320 snapshot
>Organization:
>Environment:
bash$ ~/y/bin/gcj -dumpmachine
i686-pc-linux-gnu
bash$ ~/y/bin/gcj -dumpversion
3.0
>Description:
Sun's javac (JDK version 1.3 for Linux/x86) and
IBM's jikes (Version 1.11, 10 Jan 2000)
both accept a constructor that contains
an execution path that does not initialize
all final variables, but exits by throwing an exception.
'gcj' does not accept it.  The behaviour is the same whether
the thrown exception is checked or unchecked (or is an Error
rather than an Exception).

Compiling such a class with jikes and javac and then
compiling the resulting .class file with gcj results
in a native binary executable that seems to work correctly,
though.
>How-To-Repeat:
public class A {
    public static void main(String[] a) {
	new A().go();
    }

    private final boolean b;

    private A() {
	//b = true; // without this line, GCJ chokes!
	throw new RuntimeException("Haha");
    }

    private void go() {
	System.out.println("Hello!");
    }
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]