Fri, 01 Aug 2008 15:23:18 -0700
6627362: javac generates code that uses array.clone, which is not available on JavaCard
6627364: javac needs Float and Double on the bootclasspath even when not directly used
6627366: javac needs Cloneable and Serializable on the classpath even when not directly used
Reviewed-by: darcy
1.1 --- a/src/share/classes/com/sun/tools/javac/code/Symtab.java Mon Jul 28 10:22:10 2008 +0100 1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symtab.java Fri Aug 01 15:23:18 2008 -0700 1.3 @@ -75,6 +75,7 @@ 1.4 1.5 private final Name.Table names; 1.6 private final ClassReader reader; 1.7 + private final Target target; 1.8 1.9 /** A symbol for the root package. 1.10 */ 1.11 @@ -144,6 +145,7 @@ 1.12 public final Type suppressWarningsType; 1.13 public final Type inheritedType; 1.14 public final Type proprietaryType; 1.15 + public final Type systemType; 1.16 1.17 /** The symbol representing the length field of an array. 1.18 */ 1.19 @@ -272,6 +274,55 @@ 1.20 return reader.enterClass(names.fromString(s)).type; 1.21 } 1.22 1.23 + public void synthesizeEmptyInterfaceIfMissing(final Type type) { 1.24 + final Completer completer = type.tsym.completer; 1.25 + if (completer != null) { 1.26 + type.tsym.completer = new Completer() { 1.27 + public void complete(Symbol sym) throws CompletionFailure { 1.28 + try { 1.29 + completer.complete(sym); 1.30 + } catch (CompletionFailure e) { 1.31 + sym.flags_field |= (PUBLIC | INTERFACE); 1.32 + ((ClassType) sym.type).supertype_field = objectType; 1.33 + } 1.34 + } 1.35 + }; 1.36 + } 1.37 + } 1.38 + 1.39 + public void synthesizeBoxTypeIfMissing(final Type type) { 1.40 + ClassSymbol sym = reader.enterClass(boxedName[type.tag]); 1.41 + final Completer completer = sym.completer; 1.42 + if (completer != null) { 1.43 + sym.completer = new Completer() { 1.44 + public void complete(Symbol sym) throws CompletionFailure { 1.45 + try { 1.46 + completer.complete(sym); 1.47 + } catch (CompletionFailure e) { 1.48 + sym.flags_field |= PUBLIC; 1.49 + ((ClassType) sym.type).supertype_field = objectType; 1.50 + Name n = target.boxWithConstructors() ? names.init : names.valueOf; 1.51 + MethodSymbol boxMethod = 1.52 + new MethodSymbol(PUBLIC | STATIC, 1.53 + n, 1.54 + new MethodType(List.of(type), sym.type, 1.55 + List.<Type>nil(), methodClass), 1.56 + sym); 1.57 + sym.members().enter(boxMethod); 1.58 + MethodSymbol unboxMethod = 1.59 + new MethodSymbol(PUBLIC, 1.60 + type.tsym.name.append(names.Value), // x.intValue() 1.61 + new MethodType(List.<Type>nil(), type, 1.62 + List.<Type>nil(), methodClass), 1.63 + sym); 1.64 + sym.members().enter(unboxMethod); 1.65 + } 1.66 + } 1.67 + }; 1.68 + } 1.69 + 1.70 + } 1.71 + 1.72 /** Constructor; enters all predefined identifiers and operators 1.73 * into symbol table. 1.74 */ 1.75 @@ -279,6 +330,7 @@ 1.76 context.put(symtabKey, this); 1.77 1.78 names = Name.Table.instance(context); 1.79 + target = Target.instance(context); 1.80 1.81 // Create the unknown type 1.82 unknownType = new Type(TypeTags.UNKNOWN, null); 1.83 @@ -373,7 +425,7 @@ 1.84 collectionsType = enterClass("java.util.Collections"); 1.85 comparableType = enterClass("java.lang.Comparable"); 1.86 arraysType = enterClass("java.util.Arrays"); 1.87 - iterableType = Target.instance(context).hasIterable() 1.88 + iterableType = target.hasIterable() 1.89 ? enterClass("java.lang.Iterable") 1.90 : enterClass("java.util.Collection"); 1.91 iteratorType = enterClass("java.util.Iterator"); 1.92 @@ -383,6 +435,12 @@ 1.93 deprecatedType = enterClass("java.lang.Deprecated"); 1.94 suppressWarningsType = enterClass("java.lang.SuppressWarnings"); 1.95 inheritedType = enterClass("java.lang.annotation.Inherited"); 1.96 + systemType = enterClass("java.lang.System"); 1.97 + 1.98 + synthesizeEmptyInterfaceIfMissing(cloneableType); 1.99 + synthesizeEmptyInterfaceIfMissing(serializableType); 1.100 + synthesizeBoxTypeIfMissing(doubleType); 1.101 + synthesizeBoxTypeIfMissing(floatType); 1.102 1.103 // Enter a synthetic class that is used to mark Sun 1.104 // proprietary classes in ct.sym. This class does not have a
2.1 --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java Mon Jul 28 10:22:10 2008 +0100 2.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java Fri Aug 01 15:23:18 2008 -0700 2.3 @@ -2110,16 +2110,64 @@ 2.4 2.5 Symbol valuesSym = lookupMethod(tree.pos(), names.values, 2.6 tree.type, List.<Type>nil()); 2.7 - JCTypeCast valuesResult = 2.8 - make.TypeCast(valuesSym.type.getReturnType(), 2.9 - make.App(make.Select(make.Ident(valuesVar), 2.10 - syms.arrayCloneMethod))); 2.11 + List<JCStatement> valuesBody; 2.12 + if (useClone()) { 2.13 + // return (T[]) $VALUES.clone(); 2.14 + JCTypeCast valuesResult = 2.15 + make.TypeCast(valuesSym.type.getReturnType(), 2.16 + make.App(make.Select(make.Ident(valuesVar), 2.17 + syms.arrayCloneMethod))); 2.18 + valuesBody = List.<JCStatement>of(make.Return(valuesResult)); 2.19 + } else { 2.20 + // template: T[] $result = new T[$values.length]; 2.21 + Name resultName = names.fromString(target.syntheticNameChar() + "result"); 2.22 + while (tree.sym.members().lookup(resultName).scope != null) // avoid name clash 2.23 + resultName = names.fromString(resultName + "" + target.syntheticNameChar()); 2.24 + VarSymbol resultVar = new VarSymbol(FINAL|SYNTHETIC, 2.25 + resultName, 2.26 + arrayType, 2.27 + valuesSym); 2.28 + JCNewArray resultArray = make.NewArray(make.Type(types.erasure(tree.type)), 2.29 + List.of(make.Select(make.Ident(valuesVar), syms.lengthVar)), 2.30 + null); 2.31 + resultArray.type = arrayType; 2.32 + JCVariableDecl decl = make.VarDef(resultVar, resultArray); 2.33 + 2.34 + // template: System.arraycopy($VALUES, 0, $result, 0, $VALUES.length); 2.35 + if (systemArraycopyMethod == null) { 2.36 + systemArraycopyMethod = 2.37 + new MethodSymbol(PUBLIC | STATIC, 2.38 + names.fromString("arraycopy"), 2.39 + new MethodType(List.<Type>of(syms.objectType, 2.40 + syms.intType, 2.41 + syms.objectType, 2.42 + syms.intType, 2.43 + syms.intType), 2.44 + syms.voidType, 2.45 + List.<Type>nil(), 2.46 + syms.methodClass), 2.47 + syms.systemType.tsym); 2.48 + } 2.49 + JCStatement copy = 2.50 + make.Exec(make.App(make.Select(make.Ident(syms.systemType.tsym), 2.51 + systemArraycopyMethod), 2.52 + List.of(make.Ident(valuesVar), make.Literal(0), 2.53 + make.Ident(resultVar), make.Literal(0), 2.54 + make.Select(make.Ident(valuesVar), syms.lengthVar)))); 2.55 + 2.56 + // template: return $result; 2.57 + JCStatement ret = make.Return(make.Ident(resultVar)); 2.58 + valuesBody = List.<JCStatement>of(decl, copy, ret); 2.59 + } 2.60 + 2.61 JCMethodDecl valuesDef = 2.62 - make.MethodDef((MethodSymbol)valuesSym, 2.63 - make.Block(0, List.<JCStatement>nil() 2.64 - .prepend(make.Return(valuesResult)))); 2.65 + make.MethodDef((MethodSymbol)valuesSym, make.Block(0, valuesBody)); 2.66 + 2.67 enumDefs.append(valuesDef); 2.68 2.69 + if (debugLower) 2.70 + System.err.println(tree.sym + ".valuesDef = " + valuesDef); 2.71 + 2.72 /** The template for the following code is: 2.73 * 2.74 * public static E valueOf(String name) { 2.75 @@ -2155,6 +2203,17 @@ 2.76 addEnumCompatibleMembers(tree); 2.77 } 2.78 } 2.79 + // where 2.80 + private MethodSymbol systemArraycopyMethod; 2.81 + private boolean useClone() { 2.82 + try { 2.83 + Scope.Entry e = syms.objectType.tsym.members().lookup(names.clone); 2.84 + return (e.sym != null); 2.85 + } 2.86 + catch (CompletionFailure e) { 2.87 + return false; 2.88 + } 2.89 + } 2.90 2.91 /** Translate an enumeration constant and its initializer. */ 2.92 private void visitEnumConstantDef(JCVariableDecl var, int ordinal) {
3.1 --- a/test/tools/javac/5045412/Bar.java Mon Jul 28 10:22:10 2008 +0100 3.2 +++ b/test/tools/javac/5045412/Bar.java Fri Aug 01 15:23:18 2008 -0700 3.3 @@ -1,13 +1,36 @@ 3.4 -/** 3.5 - * @test /nodynamiccopyright/ 3.6 - * @bug 5045412 3.7 - * @compile/fail/ref=out -XDstdout -XDrawDiagnostics -Xlint:serial -XDfailcomplete=java.io.Serializable Bar.java 3.8 +/* 3.9 + * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved. 3.10 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.11 + * 3.12 + * This code is free software; you can redistribute it and/or modify it 3.13 + * under the terms of the GNU General Public License version 2 only, as 3.14 + * published by the Free Software Foundation. 3.15 + * 3.16 + * This code is distributed in the hope that it will be useful, but WITHOUT 3.17 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 3.18 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3.19 + * version 2 for more details (a copy is included in the LICENSE file that 3.20 + * accompanied this code). 3.21 + * 3.22 + * You should have received a copy of the GNU General Public License version 3.23 + * 2 along with this work; if not, write to the Free Software Foundation, 3.24 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3.25 + * 3.26 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 3.27 + * CA 95054 USA or visit www.sun.com if you need additional information or 3.28 + * have any questions. 3.29 */ 3.30 3.31 /** 3.32 - * @test /nodynamiccopyright/ 3.33 - * @bug 5045412 3.34 - * @compile/fail/ref=out -XDstdout -XDrawDiagnostics -Xlint:serial -XDfailcomplete=java.io.Serializable Bar.java Foo.java 3.35 + * @test 3.36 + * @bug 5045412 6627366 3.37 + * @compile -Xlint:serial -XDfailcomplete=java.io.Serializable Bar.java 3.38 + */ 3.39 + 3.40 +/** 3.41 + * @test 3.42 + * @bug 5045412 6627366 3.43 + * @compile -Xlint:serial -XDfailcomplete=java.io.Serializable Bar.java Foo.java 3.44 */ 3.45 3.46 class Bar implements java.io.Serializable { }
4.1 --- a/test/tools/javac/5045412/Foo.java Mon Jul 28 10:22:10 2008 +0100 4.2 +++ b/test/tools/javac/5045412/Foo.java Fri Aug 01 15:23:18 2008 -0700 4.3 @@ -23,14 +23,14 @@ 4.4 4.5 /** 4.6 * @test 4.7 - * @bug 5045412 4.8 + * @bug 5045412 6627366 4.9 * @compile -Xlint:serial -XDfailcomplete=java.io.Serializable Foo.java 4.10 */ 4.11 4.12 /** 4.13 * @test 4.14 - * @bug 5045412 4.15 - * @compile/fail/ref=out -XDstdout -XDrawDiagnostics -Xlint:serial -XDfailcomplete=java.io.Serializable Foo.java Bar.java 4.16 + * @bug 5045412 6627366 4.17 + * @compile -Xlint:serial -XDfailcomplete=java.io.Serializable Foo.java Bar.java 4.18 */ 4.19 4.20 class Foo { }
5.1 --- a/test/tools/javac/5045412/out Mon Jul 28 10:22:10 2008 +0100 5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 5.3 @@ -1,2 +0,0 @@ 5.4 -Bar.java:13:29: compiler.err.cant.resolve.location: kindname.class, Serializable, , , kindname.package, java.io 5.5 -1 error
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/test/tools/javac/6627362/T6627362.java Fri Aug 01 15:23:18 2008 -0700 6.3 @@ -0,0 +1,133 @@ 6.4 +/* 6.5 + * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 6.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.7 + * 6.8 + * This code is free software; you can redistribute it and/or modify it 6.9 + * under the terms of the GNU General Public License version 2 only, as 6.10 + * published by the Free Software Foundation. 6.11 + * 6.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 6.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 6.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 6.15 + * version 2 for more details (a copy is included in the LICENSE file that 6.16 + * accompanied this code). 6.17 + * 6.18 + * You should have received a copy of the GNU General Public License version 6.19 + * 2 along with this work; if not, write to the Free Software Foundation, 6.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 6.21 + * 6.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 6.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 6.24 + * have any questions. 6.25 + */ 6.26 + 6.27 +/* 6.28 + * @test 6.29 + * @bug 6627362 6.30 + * @summary javac generates code that uses array.clone, 6.31 + * which is not available on JavaCard 6.32 + */ 6.33 + 6.34 +import java.io.*; 6.35 +import java.lang.reflect.*; 6.36 +import java.net.*; 6.37 +import java.util.*; 6.38 + 6.39 +public class T6627362 { 6.40 + static String testSrc = System.getProperty("test.src", "."); 6.41 + 6.42 + public static void main(String... args) throws Exception { 6.43 + new T6627362().run(); 6.44 + } 6.45 + 6.46 + public void run() throws Exception { 6.47 + testStandard(); 6.48 + testNoClone(); 6.49 + if (errors > 0) 6.50 + throw new Error(errors + " test cases failed"); 6.51 + } 6.52 + 6.53 + void testStandard() throws Exception { 6.54 + // compile and disassemble E.java, check for reference to Object.clone() 6.55 + File x = new File(testSrc, "x"); 6.56 + String[] jcArgs = { "-d", ".", 6.57 + new File(x, "E.java").getPath() }; 6.58 + compile(jcArgs); 6.59 + 6.60 + String[] jpArgs = { "-classpath", ".", "-c", "E" }; 6.61 + 6.62 + StringWriter sw = new StringWriter(); 6.63 + javap(new PrintWriter(sw, true), jpArgs); 6.64 + check(sw.toString(), "Method \"[LE;\".clone:()Ljava/lang/Object;"); 6.65 + callValues(); 6.66 + } 6.67 + 6.68 + void testNoClone() throws Exception { 6.69 + // compile and disassemble E.java, using modified Object.java, 6.70 + // check for reference to System.arraycopy 6.71 + File x = new File(testSrc, "x"); 6.72 + String[] jcArgs = { "-d", ".", 6.73 + new File(x, "E.java").getPath(), 6.74 + new File(x, "Object.java").getPath()}; 6.75 + compile(jcArgs); 6.76 + 6.77 + String[] jpArgs = { "-classpath", ".", "-c", "E" }; 6.78 + 6.79 + StringWriter sw = new StringWriter(); 6.80 + javap(new PrintWriter(sw, true), jpArgs); 6.81 + check(sw.toString(), "//Method java/lang/System.arraycopy:(Ljava/lang/Object;ILjava/lang/Object;II)V"); 6.82 + callValues(); 6.83 + } 6.84 + 6.85 + void compile(String... args) { 6.86 + int rc = com.sun.tools.javac.Main.compile(args); 6.87 + if (rc != 0) 6.88 + throw new Error("javac failed: " + Arrays.asList(args) + ": " + rc); 6.89 + } 6.90 + 6.91 + void javap(PrintWriter out, String... args) throws Exception { 6.92 + // for now, we have to exec javap 6.93 + File javaHome = new File(System.getProperty("java.home")); 6.94 + if (javaHome.getName().equals("jre")) 6.95 + javaHome = javaHome.getParentFile(); 6.96 + File javap = new File(new File(javaHome, "bin"), "javap"); 6.97 + String[] cmd = new String[args.length + 1]; 6.98 + cmd[0] = javap.getPath(); 6.99 + System.arraycopy(args, 0, cmd, 1, args.length); 6.100 + Process p = new ProcessBuilder(cmd).redirectErrorStream(true).start(); 6.101 + p.getOutputStream().close(); 6.102 + BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); 6.103 + String line; 6.104 + while ((line = in.readLine()) != null) 6.105 + out.println(line); 6.106 + int rc = p.waitFor(); 6.107 + if (rc != 0) 6.108 + throw new Error("javap failed: " + Arrays.asList(args) + ": " + rc); 6.109 + } 6.110 + 6.111 + void check(String s, String require) { 6.112 + if (s.indexOf(require) == -1) { 6.113 + System.err.println("Can't find " + require); 6.114 + errors++; 6.115 + } 6.116 + } 6.117 + 6.118 + void callValues() { 6.119 + try { 6.120 + File dot = new File(System.getProperty("user.dir")); 6.121 + ClassLoader cl = new URLClassLoader(new URL[] { dot.toURL() }); 6.122 + Class<?> e_class = cl.loadClass("E"); 6.123 + Method m = e_class.getMethod("values", new Class[] { }); 6.124 + //System.err.println(m); 6.125 + Object o = m.invoke(null, (Object[]) null); 6.126 + List<Object> v = Arrays.asList((Object[]) o); 6.127 + if (!v.toString().equals("[a, b, c]")) 6.128 + throw new Error("unexpected result for E.values(): " + v); 6.129 + } catch (Exception e) { 6.130 + throw new Error(e); 6.131 + } 6.132 + } 6.133 + 6.134 + int errors; 6.135 +} 6.136 +
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/test/tools/javac/6627362/x/E.java Fri Aug 01 15:23:18 2008 -0700 7.3 @@ -0,0 +1,26 @@ 7.4 +/* 7.5 + * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.7 + * 7.8 + * This code is free software; you can redistribute it and/or modify it 7.9 + * under the terms of the GNU General Public License version 2 only, as 7.10 + * published by the Free Software Foundation. 7.11 + * 7.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 7.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 7.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 7.15 + * version 2 for more details (a copy is included in the LICENSE file that 7.16 + * accompanied this code). 7.17 + * 7.18 + * You should have received a copy of the GNU General Public License version 7.19 + * 2 along with this work; if not, write to the Free Software Foundation, 7.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 7.21 + * 7.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 7.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 7.24 + * have any questions. 7.25 + */ 7.26 + 7.27 +public enum E { 7.28 + a, b, c 7.29 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/test/tools/javac/6627362/x/Object.java Fri Aug 01 15:23:18 2008 -0700 8.3 @@ -0,0 +1,30 @@ 8.4 +/* 8.5 + * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 8.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.7 + * 8.8 + * This code is free software; you can redistribute it and/or modify it 8.9 + * under the terms of the GNU General Public License version 2 only, as 8.10 + * published by the Free Software Foundation. 8.11 + * 8.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 8.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 8.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 8.15 + * version 2 for more details (a copy is included in the LICENSE file that 8.16 + * accompanied this code). 8.17 + * 8.18 + * You should have received a copy of the GNU General Public License version 8.19 + * 2 along with this work; if not, write to the Free Software Foundation, 8.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 8.21 + * 8.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 8.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 8.24 + * have any questions. 8.25 + */ 8.26 + 8.27 +package java.lang; 8.28 + 8.29 +/* 8.30 + * Object, without clone() 8.31 + */ 8.32 +public class Object { 8.33 +}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/test/tools/javac/synthesize/Boolean.java Fri Aug 01 15:23:18 2008 -0700 9.3 @@ -0,0 +1,41 @@ 9.4 +/* 9.5 + * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9.7 + * 9.8 + * This code is free software; you can redistribute it and/or modify it 9.9 + * under the terms of the GNU General Public License version 2 only, as 9.10 + * published by the Free Software Foundation. 9.11 + * 9.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 9.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 9.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 9.15 + * version 2 for more details (a copy is included in the LICENSE file that 9.16 + * accompanied this code). 9.17 + * 9.18 + * You should have received a copy of the GNU General Public License version 9.19 + * 2 along with this work; if not, write to the Free Software Foundation, 9.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 9.21 + * 9.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 9.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 9.24 + * have any questions. 9.25 + */ 9.26 + 9.27 +package java.lang; 9.28 + 9.29 +public class Boolean 9.30 +{ 9.31 + public static Boolean valueOf(boolean v) { 9.32 + return new Boolean(v); 9.33 + } 9.34 + 9.35 + public Boolean(boolean v) { 9.36 + value = v; 9.37 + } 9.38 + 9.39 + public boolean booleanValue() { 9.40 + return value; 9.41 + } 9.42 + 9.43 + private boolean value; 9.44 +}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/test/tools/javac/synthesize/Byte.java Fri Aug 01 15:23:18 2008 -0700 10.3 @@ -0,0 +1,41 @@ 10.4 +/* 10.5 + * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 10.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.7 + * 10.8 + * This code is free software; you can redistribute it and/or modify it 10.9 + * under the terms of the GNU General Public License version 2 only, as 10.10 + * published by the Free Software Foundation. 10.11 + * 10.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 10.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.15 + * version 2 for more details (a copy is included in the LICENSE file that 10.16 + * accompanied this code). 10.17 + * 10.18 + * You should have received a copy of the GNU General Public License version 10.19 + * 2 along with this work; if not, write to the Free Software Foundation, 10.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.21 + * 10.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 10.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 10.24 + * have any questions. 10.25 + */ 10.26 + 10.27 +package java.lang; 10.28 + 10.29 +public class Byte 10.30 +{ 10.31 + public static Byte valueOf(byte v) { 10.32 + return new Byte(v); 10.33 + } 10.34 + 10.35 + public Byte(byte v) { 10.36 + value = v; 10.37 + } 10.38 + 10.39 + public byte byteValue() { 10.40 + return value; 10.41 + } 10.42 + 10.43 + private byte value; 10.44 +}
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/test/tools/javac/synthesize/Character.java Fri Aug 01 15:23:18 2008 -0700 11.3 @@ -0,0 +1,41 @@ 11.4 +/* 11.5 + * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 11.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.7 + * 11.8 + * This code is free software; you can redistribute it and/or modify it 11.9 + * under the terms of the GNU General Public License version 2 only, as 11.10 + * published by the Free Software Foundation. 11.11 + * 11.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 11.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11.15 + * version 2 for more details (a copy is included in the LICENSE file that 11.16 + * accompanied this code). 11.17 + * 11.18 + * You should have received a copy of the GNU General Public License version 11.19 + * 2 along with this work; if not, write to the Free Software Foundation, 11.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 11.21 + * 11.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 11.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 11.24 + * have any questions. 11.25 + */ 11.26 + 11.27 +package java.lang; 11.28 + 11.29 +public class Character 11.30 +{ 11.31 + public static Character valueOf(char v) { 11.32 + return new Character(v); 11.33 + } 11.34 + 11.35 + public Character(char v) { 11.36 + value = v; 11.37 + } 11.38 + 11.39 + public char characterValue() { 11.40 + return value; 11.41 + } 11.42 + 11.43 + private char value; 11.44 +}
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/test/tools/javac/synthesize/Cloneable.java Fri Aug 01 15:23:18 2008 -0700 12.3 @@ -0,0 +1,27 @@ 12.4 +/* 12.5 + * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 12.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 12.7 + * 12.8 + * This code is free software; you can redistribute it and/or modify it 12.9 + * under the terms of the GNU General Public License version 2 only, as 12.10 + * published by the Free Software Foundation. 12.11 + * 12.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 12.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12.15 + * version 2 for more details (a copy is included in the LICENSE file that 12.16 + * accompanied this code). 12.17 + * 12.18 + * You should have received a copy of the GNU General Public License version 12.19 + * 2 along with this work; if not, write to the Free Software Foundation, 12.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 12.21 + * 12.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 12.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 12.24 + * have any questions. 12.25 + */ 12.26 + 12.27 +package java.lang; 12.28 + 12.29 +public interface Cloneable { 12.30 +}
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 13.2 +++ b/test/tools/javac/synthesize/Double.java Fri Aug 01 15:23:18 2008 -0700 13.3 @@ -0,0 +1,18 @@ 13.4 +package java.lang; 13.5 + 13.6 +public class Double extends Number 13.7 +{ 13.8 + public static Double valueOf(double v) { 13.9 + return new Double(v); 13.10 + } 13.11 + 13.12 + public Double(double v) { 13.13 + value = v; 13.14 + } 13.15 + 13.16 + public double doubleValue() { 13.17 + return value; 13.18 + } 13.19 + 13.20 + private double value; 13.21 +}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/test/tools/javac/synthesize/Float.java Fri Aug 01 15:23:18 2008 -0700 14.3 @@ -0,0 +1,18 @@ 14.4 +package java.lang; 14.5 + 14.6 +public class Float extends Number 14.7 +{ 14.8 + public static Float valueOf(float v) { 14.9 + return new Float(v); 14.10 + } 14.11 + 14.12 + public Float(float v) { 14.13 + value = v; 14.14 + } 14.15 + 14.16 + public float floatValue() { 14.17 + return value; 14.18 + } 14.19 + 14.20 + private float value; 14.21 +}
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 15.2 +++ b/test/tools/javac/synthesize/Integer.java Fri Aug 01 15:23:18 2008 -0700 15.3 @@ -0,0 +1,41 @@ 15.4 +/* 15.5 + * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 15.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.7 + * 15.8 + * This code is free software; you can redistribute it and/or modify it 15.9 + * under the terms of the GNU General Public License version 2 only, as 15.10 + * published by the Free Software Foundation. 15.11 + * 15.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 15.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15.15 + * version 2 for more details (a copy is included in the LICENSE file that 15.16 + * accompanied this code). 15.17 + * 15.18 + * You should have received a copy of the GNU General Public License version 15.19 + * 2 along with this work; if not, write to the Free Software Foundation, 15.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 15.21 + * 15.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 15.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 15.24 + * have any questions. 15.25 + */ 15.26 + 15.27 +package java.lang; 15.28 + 15.29 +public class Integer extends Number 15.30 +{ 15.31 + public static Integer valueOf(int v) { 15.32 + return new Integer(v); 15.33 + } 15.34 + 15.35 + public Integer(int v) { 15.36 + value = v; 15.37 + } 15.38 + 15.39 + public int integerValue() { 15.40 + return value; 15.41 + } 15.42 + 15.43 + private int value; 15.44 +}
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 16.2 +++ b/test/tools/javac/synthesize/Long.java Fri Aug 01 15:23:18 2008 -0700 16.3 @@ -0,0 +1,41 @@ 16.4 +/* 16.5 + * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 16.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.7 + * 16.8 + * This code is free software; you can redistribute it and/or modify it 16.9 + * under the terms of the GNU General Public License version 2 only, as 16.10 + * published by the Free Software Foundation. 16.11 + * 16.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 16.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16.15 + * version 2 for more details (a copy is included in the LICENSE file that 16.16 + * accompanied this code). 16.17 + * 16.18 + * You should have received a copy of the GNU General Public License version 16.19 + * 2 along with this work; if not, write to the Free Software Foundation, 16.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 16.21 + * 16.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 16.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 16.24 + * have any questions. 16.25 + */ 16.26 + 16.27 +package java.lang; 16.28 + 16.29 +public class Long extends Number 16.30 +{ 16.31 + public static Long valueOf(long v) { 16.32 + return new Long(v); 16.33 + } 16.34 + 16.35 + public Long(long v) { 16.36 + value = v; 16.37 + } 16.38 + 16.39 + public long longValue() { 16.40 + return value; 16.41 + } 16.42 + 16.43 + private long value; 16.44 +}
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 17.2 +++ b/test/tools/javac/synthesize/Main.java Fri Aug 01 15:23:18 2008 -0700 17.3 @@ -0,0 +1,122 @@ 17.4 +/* 17.5 + * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 17.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 17.7 + * 17.8 + * This code is free software; you can redistribute it and/or modify it 17.9 + * under the terms of the GNU General Public License version 2 only, as 17.10 + * published by the Free Software Foundation. 17.11 + * 17.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 17.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 17.15 + * version 2 for more details (a copy is included in the LICENSE file that 17.16 + * accompanied this code). 17.17 + * 17.18 + * You should have received a copy of the GNU General Public License version 17.19 + * 2 along with this work; if not, write to the Free Software Foundation, 17.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17.21 + * 17.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 17.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 17.24 + * have any questions. 17.25 + */ 17.26 + 17.27 +/* 17.28 + * @test 17.29 + * @bug 6627364 6627366 17.30 + * @summary Synthesize important classes if they are missing from the (boot)classpath 17.31 + */ 17.32 + 17.33 +import java.io.*; 17.34 +import java.util.*; 17.35 + 17.36 +public class Main 17.37 +{ 17.38 + File testSrc = new File(System.getProperty("test.src")); 17.39 + 17.40 + public static void main(String[] args) throws Exception { 17.41 + new Main().run(); 17.42 + } 17.43 + 17.44 + public void run() throws Exception { 17.45 + 17.46 + // compile with standard bootclasspath 17.47 + compile(true, "Test.java"); 17.48 + 17.49 + // compile with various missing system classes 17.50 + 17.51 + List<String> base_files = Arrays.asList( 17.52 + "Boolean.java", 17.53 + "Byte.java", 17.54 + "Character.java", 17.55 + "Integer.java", 17.56 + "Long.java", 17.57 + "Number.java", 17.58 + "Object.java", 17.59 + "Short.java", 17.60 + "Void.java" 17.61 + ); 17.62 + 17.63 + List<String> extra_files = Arrays.asList( 17.64 + "Double.java", 17.65 + "Float.java", 17.66 + "Cloneable.java", 17.67 + "Serializable.java" 17.68 + ); 17.69 + 17.70 + List<String> files = new ArrayList<String>(); 17.71 + files.addAll(base_files); 17.72 + files.add("Test.java"); 17.73 + 17.74 + compile(false, files); 17.75 + 17.76 + for (String f: extra_files) { 17.77 + files = new ArrayList<String>(); 17.78 + files.addAll(base_files); 17.79 + files.addAll(extra_files); 17.80 + files.remove(f); 17.81 + files.add("Test.java"); 17.82 + compile(false, files); 17.83 + } 17.84 + 17.85 + if (errors > 0) 17.86 + throw new Exception(errors + " errors occurred"); 17.87 + } 17.88 + 17.89 + void compile(boolean stdBootClassPath, String... files) { 17.90 + compile(stdBootClassPath, Arrays.asList(files)); 17.91 + } 17.92 + 17.93 + void compile(boolean stdBootClassPath, List<String> files) { 17.94 + File empty = new File("empty"); 17.95 + empty.mkdirs(); 17.96 + 17.97 + List<String> args = new ArrayList<String>(); 17.98 + args.add("-classpath"); 17.99 + args.add("empty"); 17.100 + 17.101 + if (!stdBootClassPath) { 17.102 + args.add("-bootclasspath"); 17.103 + args.add("empty"); 17.104 + } 17.105 + args.add("-d"); 17.106 + args.add("."); 17.107 + for (String f: files) 17.108 + args.add(new File(testSrc, f).getPath()); 17.109 + 17.110 + System.out.println("Compile: " + args); 17.111 + StringWriter out = new StringWriter(); 17.112 + int rc = com.sun.tools.javac.Main.compile(args.toArray(new String[args.size()]), 17.113 + new PrintWriter(out)); 17.114 + System.out.println(out.toString()); 17.115 + System.out.println("result: " + rc); 17.116 + System.out.println(); 17.117 + 17.118 + if (rc != 0) 17.119 + errors++; 17.120 + } 17.121 + 17.122 + private int errors; 17.123 +} 17.124 + 17.125 +
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 18.2 +++ b/test/tools/javac/synthesize/Number.java Fri Aug 01 15:23:18 2008 -0700 18.3 @@ -0,0 +1,29 @@ 18.4 +/* 18.5 + * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 18.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.7 + * 18.8 + * This code is free software; you can redistribute it and/or modify it 18.9 + * under the terms of the GNU General Public License version 2 only, as 18.10 + * published by the Free Software Foundation. 18.11 + * 18.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 18.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 18.15 + * version 2 for more details (a copy is included in the LICENSE file that 18.16 + * accompanied this code). 18.17 + * 18.18 + * You should have received a copy of the GNU General Public License version 18.19 + * 2 along with this work; if not, write to the Free Software Foundation, 18.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18.21 + * 18.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 18.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 18.24 + * have any questions. 18.25 + */ 18.26 + 18.27 +package java.lang; 18.28 + 18.29 +public class Number 18.30 +{ 18.31 + 18.32 +}
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 19.2 +++ b/test/tools/javac/synthesize/Object.java Fri Aug 01 15:23:18 2008 -0700 19.3 @@ -0,0 +1,28 @@ 19.4 +/* 19.5 + * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 19.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.7 + * 19.8 + * This code is free software; you can redistribute it and/or modify it 19.9 + * under the terms of the GNU General Public License version 2 only, as 19.10 + * published by the Free Software Foundation. 19.11 + * 19.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 19.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 19.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19.15 + * version 2 for more details (a copy is included in the LICENSE file that 19.16 + * accompanied this code). 19.17 + * 19.18 + * You should have received a copy of the GNU General Public License version 19.19 + * 2 along with this work; if not, write to the Free Software Foundation, 19.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19.21 + * 19.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 19.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 19.24 + * have any questions. 19.25 + */ 19.26 + 19.27 +package java.lang; 19.28 + 19.29 +public class Object 19.30 +{ 19.31 +}
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 20.2 +++ b/test/tools/javac/synthesize/Serializable.java Fri Aug 01 15:23:18 2008 -0700 20.3 @@ -0,0 +1,27 @@ 20.4 +/* 20.5 + * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 20.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.7 + * 20.8 + * This code is free software; you can redistribute it and/or modify it 20.9 + * under the terms of the GNU General Public License version 2 only, as 20.10 + * published by the Free Software Foundation. 20.11 + * 20.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 20.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 20.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 20.15 + * version 2 for more details (a copy is included in the LICENSE file that 20.16 + * accompanied this code). 20.17 + * 20.18 + * You should have received a copy of the GNU General Public License version 20.19 + * 2 along with this work; if not, write to the Free Software Foundation, 20.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20.21 + * 20.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 20.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 20.24 + * have any questions. 20.25 + */ 20.26 + 20.27 +package java.io; 20.28 + 20.29 +public interface Serializable { 20.30 +}
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 21.2 +++ b/test/tools/javac/synthesize/Short.java Fri Aug 01 15:23:18 2008 -0700 21.3 @@ -0,0 +1,41 @@ 21.4 +/* 21.5 + * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 21.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.7 + * 21.8 + * This code is free software; you can redistribute it and/or modify it 21.9 + * under the terms of the GNU General Public License version 2 only, as 21.10 + * published by the Free Software Foundation. 21.11 + * 21.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 21.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 21.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 21.15 + * version 2 for more details (a copy is included in the LICENSE file that 21.16 + * accompanied this code). 21.17 + * 21.18 + * You should have received a copy of the GNU General Public License version 21.19 + * 2 along with this work; if not, write to the Free Software Foundation, 21.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21.21 + * 21.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 21.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 21.24 + * have any questions. 21.25 + */ 21.26 + 21.27 +package java.lang; 21.28 + 21.29 +public class Short extends Number 21.30 +{ 21.31 + public static Short valueOf(short v) { 21.32 + return new Short(v); 21.33 + } 21.34 + 21.35 + public Short(short v) { 21.36 + value = v; 21.37 + } 21.38 + 21.39 + public short shortValue() { 21.40 + return value; 21.41 + } 21.42 + 21.43 + private short value; 21.44 +}
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 22.2 +++ b/test/tools/javac/synthesize/Test.java Fri Aug 01 15:23:18 2008 -0700 22.3 @@ -0,0 +1,32 @@ 22.4 +/* 22.5 + * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 22.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 22.7 + * 22.8 + * This code is free software; you can redistribute it and/or modify it 22.9 + * under the terms of the GNU General Public License version 2 only, as 22.10 + * published by the Free Software Foundation. 22.11 + * 22.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 22.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 22.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22.15 + * version 2 for more details (a copy is included in the LICENSE file that 22.16 + * accompanied this code). 22.17 + * 22.18 + * You should have received a copy of the GNU General Public License version 22.19 + * 2 along with this work; if not, write to the Free Software Foundation, 22.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 22.21 + * 22.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 22.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 22.24 + * have any questions. 22.25 + */ 22.26 + 22.27 +// This code (indirectly) requires the presence of 22.28 +// Cloneable and Serializable (supertypes for Java arrays) 22.29 +// Double and Float (for boxing/unboxing) 22.30 +public class Test 22.31 +{ 22.32 + Object f(boolean b, int[] array) { 22.33 + return b ? array : 2; 22.34 + } 22.35 +}
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 23.2 +++ b/test/tools/javac/synthesize/Void.java Fri Aug 01 15:23:18 2008 -0700 23.3 @@ -0,0 +1,29 @@ 23.4 +/* 23.5 + * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. 23.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.7 + * 23.8 + * This code is free software; you can redistribute it and/or modify it 23.9 + * under the terms of the GNU General Public License version 2 only, as 23.10 + * published by the Free Software Foundation. 23.11 + * 23.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 23.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 23.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23.15 + * version 2 for more details (a copy is included in the LICENSE file that 23.16 + * accompanied this code). 23.17 + * 23.18 + * You should have received a copy of the GNU General Public License version 23.19 + * 2 along with this work; if not, write to the Free Software Foundation, 23.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 23.21 + * 23.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 23.23 + * CA 95054 USA or visit www.sun.com if you need additional information or 23.24 + * have any questions. 23.25 + */ 23.26 + 23.27 +package java.lang; 23.28 + 23.29 +public class Void 23.30 +{ 23.31 + 23.32 +}