0N/A/*
2362N/A * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A
0N/A/* HelloWorld:
0N/A *
1389N/A * Sample target application for HPROF tests
0N/A *
0N/A */
0N/A
0N/A/* Just some classes that create a variety of references */
0N/A
0N/Aclass AAAA {
0N/A public int AAAA_i;
0N/A public static int AAAA_si;
0N/A public Object AAAA_j;
0N/A public static Object AAAA_sj;
0N/A public long AAAA_k;
0N/A public static long AAAA_sk;
0N/A}
0N/A
0N/Ainterface IIII {
0N/A Object o = new Object();
0N/A}
0N/A
0N/Aclass BBBB extends AAAA implements IIII {
0N/A public byte BBBB_ii;
0N/A public static byte BBBB_sii;
0N/A public Object BBBB_jj;
0N/A public static Object BBBB_sjj;
0N/A public short BBBB_kk;
0N/A public static short BBBB_skk;
0N/A}
0N/A
0N/Aclass REFS {
0N/A private static String s1 = new String("REFS_string1");
0N/A private String is2 = new String("REFS_string2");
0N/A private static String s3 = new String("REFS_string3");
0N/A private static String s4 = new String("REFS_string4");
0N/A private String is5 = new String("REFS_string5");
0N/A
0N/A private AAAA aaaa;
0N/A private BBBB bbbb;
0N/A
0N/A public void test() {
0N/A aaaa = new AAAA();
0N/A bbbb = new BBBB();
0N/A
0N/A aaaa.AAAA_i = 1;
0N/A AAAA.AAAA_si = 2;
0N/A aaaa.AAAA_j = s1;
0N/A AAAA.AAAA_sj = is2;
0N/A aaaa.AAAA_k = 5;
0N/A AAAA.AAAA_sk = 6;
0N/A
0N/A bbbb.BBBB_ii = 11;
0N/A BBBB.BBBB_sii = 22;
0N/A bbbb.BBBB_jj = s3;
0N/A BBBB.BBBB_sjj = s4;
0N/A bbbb.BBBB_kk = 55;
0N/A BBBB.BBBB_skk = 66;
0N/A
0N/A bbbb.AAAA_i = 111;
0N/A bbbb.AAAA_j = is5;
0N/A bbbb.AAAA_k = 555;
0N/A }
0N/A}
0N/A
0N/A/* Fairly simple hello world program that does some exercises first. */
0N/A
0N/Apublic class HelloWorld {
0N/A public static void main(String args[]) {
0N/A
0N/A /* References exercise. */
0N/A REFS r = new REFS();
0N/A r.test();
0N/A
0N/A /* Use a generic type exercise. */
0N/A java.util.List<String> l = new java.util.ArrayList<String>();
0N/A String.format("%s", "");
0N/A
0N/A /* Create a class that has lots of different bytecodes exercise. */
0N/A /* (Don't run it!) */
0N/A UseAllBytecodes x = new UseAllBytecodes(1,2);
0N/A
0N/A /* Just some code with branches exercise. */
0N/A try {
0N/A if ( args.length == 0 ) {
0N/A System.out.println("No arguments passed in (doesn't matter)");
0N/A } else {
0N/A System.out.println("Arguments passed in (doesn't matter)");
0N/A }
0N/A } catch ( Throwable e ) {
0N/A System.out.println("ERROR: System.out.println() did a throw");
0N/A } finally {
0N/A System.out.println("Hello, world!");
0N/A }
0N/A }
0N/A}