/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
A simple Java class definition that helps self-test the runtime
their _quick variants.
See src/share/java/runtime/selftest.c for details of the test
environment.
*/
/* Used to be sun/misc/SelfTest.java */
interface UseAllBytecodesInterface
{
}
{
public int multi[][][];
public UseAllBytecodes()
{
/* This constructor is not intended to ever be run. It is here
to force CONSTANT_Methodref constants into the CP */
set_i1(11);
set_i2(22);
set_f1(1.1f);
set_f2(2.2f);
set_d1(1.0);
set_d2(2.0);
set_l1(3);
set_l2(4);
set_si1(33);
set_si2(44);
set_sf1(3.3f);
set_sf2(4.4f);
set_sd1(3.0);
set_sd2(4.0);
set_sl1(5);
set_sl2(6);
test_areturn();
test_athrow1();
test_athrow2();
test_athrow3();
test_athrow4();
/* This puts a CONSTANT_InterfaceMethodref into the CP */
/* This creates an array and puts it into the CP */
}
{
}
{
}
/* These methods should return something other than their
arguments, so the self test can easily determine that
the correct value was returned. */
{
return i1 + 1;
}
{
return i2 + 1;
}
{
return f1 + 1.0e34f;
}
{
return f2 + 1.0e34f;
}
{
return d1 + 1.0e234;
}
{
return d2 + 1.0e234;
}
{
return l1 + 1;
}
{
return l2 + 1;
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
return this;
}
/* This method does the same thing as set_i1.
It is here to test the invokeinterface opcode. */
{
}
/* The following 10 methods test various permutations of
try-and-catch. */
{
try
{
si1 = -1;
throw new NullPointerException();
}
catch (Exception e)
{
si1 = 1;
}
}
public static void test_athrow2()
{
int i = 1;
try
{
si1 = -1;
test_athrow1();
}
catch (Exception e)
{
// This should *not* catch the exception;
// should be caught in test_athrow1.
si1 = i + 1;
}
}
public static void test_athrow3()
{
int i = 1;
try
{
// Ultimately throws NullPointerException
si1 = -1;
si2 = -1;
test_athrow5();
}
catch (NullPointerException np)
{
si1 = i + 1;
}
catch (NoSuchMethodException e)
{
si2 = i + 1;
}
si1++; // total is 3
}
public static void test_athrow4()
{
int i = 2;
try
{
// Ultimately throws NoSuchMethodException
si1 = -1;
si2 = -1;
test_athrow7();
}
catch (NullPointerException e)
{
si1 = i + 1;
}
catch (NoSuchMethodException nsm)
{
si2 = i + 1;
}
si2++; // total is 4
}
{
throw new NoSuchMethodException();
}
{
throw new NullPointerException();
}
{
test_athrow6();
}
{
}
{
test_athrow8();
}
{
}
}