6390045: Unexpected error "cannot access java.lang.Void" with '-target cldc1.0' with -source >=1.5

Tue, 11 Aug 2009 01:12:13 +0100

author
mcimadamore
date
Tue, 11 Aug 2009 01:12:13 +0100
changeset 357
abe992640c5a
parent 356
d5f6c475f475
child 358
62073a5becc5

6390045: Unexpected error "cannot access java.lang.Void" with '-target cldc1.0' with -source >=1.5
Summary: javac needs to synthetize a fake java.lang.Void symbol if one is not given on the classpath
Reviewed-by: jjg

src/share/classes/com/sun/tools/javac/code/Symtab.java file | annotate | diff | comparison | revisions
test/tools/javac/6390045/T6390045a.java file | annotate | diff | comparison | revisions
test/tools/javac/6390045/T6390045b.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/javac/code/Symtab.java	Tue Aug 11 01:11:37 2009 +0100
     1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symtab.java	Tue Aug 11 01:12:13 2009 +0100
     1.3 @@ -193,7 +193,7 @@
     1.4  
     1.5      public void initType(Type type, String name, String bname) {
     1.6          initType(type, name);
     1.7 -        boxedName[type.tag] = names.fromString("java.lang." + bname);
     1.8 +            boxedName[type.tag] = names.fromString("java.lang." + bname);
     1.9      }
    1.10  
    1.11      /** The class symbol that owns all predefined symbols.
    1.12 @@ -467,6 +467,7 @@
    1.13          synthesizeMHTypeIfMissing(invokeDynamicType);
    1.14          synthesizeBoxTypeIfMissing(doubleType);
    1.15          synthesizeBoxTypeIfMissing(floatType);
    1.16 +        synthesizeBoxTypeIfMissing(voidType);
    1.17  
    1.18          // Enter a synthetic class that is used to mark Sun
    1.19          // proprietary classes in ct.sym.  This class does not have a
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/test/tools/javac/6390045/T6390045a.java	Tue Aug 11 01:12:13 2009 +0100
     2.3 @@ -0,0 +1,38 @@
     2.4 +/*
     2.5 + * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
     2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.7 + *
     2.8 + * This code is free software; you can redistribute it and/or modify it
     2.9 + * under the terms of the GNU General Public License version 2 only, as
    2.10 + * published by the Free Software Foundation.
    2.11 + *
    2.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    2.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    2.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    2.15 + * version 2 for more details (a copy is included in the LICENSE file that
    2.16 + * accompanied this code).
    2.17 + *
    2.18 + * You should have received a copy of the GNU General Public License version
    2.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    2.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    2.21 + *
    2.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    2.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    2.24 + * have any questions.
    2.25 + */
    2.26 +
    2.27 +/*
    2.28 + * @test
    2.29 + * @bug 6390045
    2.30 + * @summary Unexpected error "cannot access java.lang.Void" with '-target cldc1.0' with -source >=1.5
    2.31 + *
    2.32 + * @author mcimadamore
    2.33 + * @compile -XDfailcomplete=java.lang.Void T6390045a.java
    2.34 + */
    2.35 +
    2.36 +class T6390045a {
    2.37 +    boolean b;
    2.38 +    short s;
    2.39 +    Object o;
    2.40 +    Object p = b ? o : s;
    2.41 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/test/tools/javac/6390045/T6390045b.java	Tue Aug 11 01:12:13 2009 +0100
     3.3 @@ -0,0 +1,38 @@
     3.4 +/*
     3.5 + * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
     3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.7 + *
     3.8 + * This code is free software; you can redistribute it and/or modify it
     3.9 + * under the terms of the GNU General Public License version 2 only, as
    3.10 + * published by the Free Software Foundation.
    3.11 + *
    3.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    3.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    3.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    3.15 + * version 2 for more details (a copy is included in the LICENSE file that
    3.16 + * accompanied this code).
    3.17 + *
    3.18 + * You should have received a copy of the GNU General Public License version
    3.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    3.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    3.21 + *
    3.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    3.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    3.24 + * have any questions.
    3.25 + */
    3.26 +
    3.27 +/*
    3.28 + * @test
    3.29 + * @bug 6390045
    3.30 + * @summary Unexpected error "cannot access java.lang.Void" with '-target cldc1.0' with -source >=1.5
    3.31 + *
    3.32 + * @author mcimadamore
    3.33 + * @compile -XDfailcomplete=java.lang.Void T6390045b.java
    3.34 + */
    3.35 +
    3.36 +class T6390045b {
    3.37 +    short s;
    3.38 +    Object o;
    3.39 +    Object p = choose(o, s);
    3.40 +    <T> T choose(T t1, T t2) { return t1; }
    3.41 +}

mercurial