java/2424: gjc thinks a final variable is reassigned when it is not

sdlee@csis.hku.hk sdlee@csis.hku.hk
Thu Mar 29 19:45:00 GMT 2001


>Number:         2424
>Category:       java
>Synopsis:       gjc thinks a final variable is reassigned when it is not
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 29 19:36:04 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     sdlee@csis.hku.hk
>Release:        gcc-20010320 snapshot
>Organization:
>Environment:
bash$ gcj -dumpversion
3.0
bash$ gcj -dumpmachine
i686-pc-linux-gnu
>Description:
When a final variable is assigned (in a constructor)
via different execution paths, gcj thinks it is being
reassigned.  This behaviour is different from javac and
jikes.
>How-To-Repeat:
public class A {
    public static void main(String[] a) {
	new A(0).go();
	new A(1).go();
    }

    private final boolean b;

    private A(int i) {
	if (i==0)
	    b = false;
	else
	    b = true;
    }

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

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



More information about the Gcc-bugs mailing list