This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


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

Arguments to constructor evaluated in wrong order.



import java.util.StringTokenizer;

public class Bug {
    public static void main(String[] args) {
        StringTokenizer s = new StringTokenizer("one two", " ");
        Bug b = new Bug(s.nextToken(), s.nextToken());
    }

    Bug(String one, String two) {
        System.out.println("one: "+one);
        System.out.println("two: "+two);
    }
}

mjr::mjr$ javac Bug.java
mjr::mjr$ java -cp . Bug
one: one
two: two
mjr::mjr$ gcj --main=Bug -o bug Bug.java
mjr::mjr$ ./bug
one: two
two: one

I'm running a build of the 3.0 branch from a couple days ago. Methods
don't have this problem, it's only constructors, afaict.


-- 
"...it must be held that third-party electronic monitoring, subject
only to the self-restraint of law enforcement officials, has no place
in our society..." Mark Roberts | mjr@statesmean.com


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