< prev index next >

test/tools/javac/StringConcat/access/Test.java

Print this page




   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 







  24 /*
  25  * @test
  26  * @bug     8151223
  27  * @summary String concatenation fails with implicit toString() on package-private class
  28  * @modules jdk.jdeps/com.sun.tools.classfile


  29  * @compile -XDstringConcat=indy              Holder.java PublicClass.java PublicInterface.java Public_PublicClass.java Public_PublicInterface.java Public_PrivateInterface1.java Public_PrivateInterface2.java Test.java
  30  * @run main Test


  31  * @compile -XDstringConcat=indyWithConstants Holder.java PublicClass.java PublicInterface.java Public_PublicClass.java Public_PublicInterface.java Public_PrivateInterface1.java Public_PrivateInterface2.java Test.java
  32  * @run main Test
  33  */
  34 
  35 import com.sun.tools.classfile.*;
  36 import com.sun.tools.classfile.ConstantPool.*;
  37 
  38 import java.io.File;
  39 import java.util.ArrayList;
  40 import java.util.List;
  41 
  42 public class Test {
  43     static List<String> actualTypes;
  44 
  45     public static void main(String[] argv) throws Exception {
  46         readIndyTypes();
  47 
  48         p1.Holder holder = new p1.Holder();
  49 
  50         int idx = 0;
  51 
  52         // ----------------------------------------------------------------------------
  53 
  54         // public Private_PublicClass            c1 = new Private_PublicClass();
  55         test("" + holder.c1, idx++, "(Lp1/PublicClass;)Ljava/lang/String;");
  56 
  57         // public Private_PublicInterface        c2 = new Private_PublicInterface();
  58         test("" + holder.c2, idx++, "(Ljava/lang/Object;)Ljava/lang/String;");
  59 
  60         // public Private_PrivateInterface1      c3 = new Private_PrivateInterface1();




   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import com.sun.tools.classfile.*;
  25 import com.sun.tools.classfile.ConstantPool.*;
  26 
  27 import java.io.File;
  28 import java.util.ArrayList;
  29 import java.util.List;
  30 
  31 /*
  32  * @test
  33  * @bug     8151223
  34  * @summary String concatenation fails with implicit toString() on package-private class
  35  * @modules jdk.jdeps/com.sun.tools.classfile
  36  *
  37  * @clean *
  38  * @compile -XDstringConcat=indy              Holder.java PublicClass.java PublicInterface.java Public_PublicClass.java Public_PublicInterface.java Public_PrivateInterface1.java Public_PrivateInterface2.java Test.java
  39  * @run main Test
  40  *
  41  * @clean *
  42  * @compile -XDstringConcat=indyWithConstants Holder.java PublicClass.java PublicInterface.java Public_PublicClass.java Public_PublicInterface.java Public_PrivateInterface1.java Public_PrivateInterface2.java Test.java
  43  * @run main Test
  44  */







  45 
  46 public class Test {
  47     static List<String> actualTypes;
  48 
  49     public static void main(String[] argv) throws Exception {
  50         readIndyTypes();
  51 
  52         p1.Holder holder = new p1.Holder();
  53 
  54         int idx = 0;
  55 
  56         // ----------------------------------------------------------------------------
  57 
  58         // public Private_PublicClass            c1 = new Private_PublicClass();
  59         test("" + holder.c1, idx++, "(Lp1/PublicClass;)Ljava/lang/String;");
  60 
  61         // public Private_PublicInterface        c2 = new Private_PublicInterface();
  62         test("" + holder.c2, idx++, "(Ljava/lang/Object;)Ljava/lang/String;");
  63 
  64         // public Private_PrivateInterface1      c3 = new Private_PrivateInterface1();


< prev index next >