/** hard coded linenumbers in other tests - DO NOT CHANGE
* @test/nodynamiccopyright/
* @bug 4300412
* @summary Test GetLocal* and SetLocal* functions
*
* @author Serguei Spitsyn
*
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g GetSetLocalTest.java
* @run main GetSetLocalTest
*/
/********** target program **********/
class GetSetLocalTarg {
int intVar = 10;
}
/*
* The line numbers of this method *MUST NOT* be changed
* because the testing algorithm counts on this layout!
* It's in calls to resumeTo("GetSetLocalTarg", line).
*/
int result;
{
{ boolean bool_1 = false;
intArg++;
}
boolean bool_2 = true;
intArg++;
}
{
{ byte byte_1 = 1;
intArg++;
}
byte byte_2 = 2;
intArg++;
}
{
{ char char_1 = '1';
intArg++;
}
char char_2 = '2';
intArg++;
}
{
{ short short_1 = 1;
intArg++;
}
short short_2 = 2;
intArg++;
}
{
{ int int_1 = 1;
intArg++;
}
int int_2 = 2;
intArg++;
}
{
{ long long_1 = 1;
intArg++;
}
long long_2 = 2;
intArg++;
}
{
{ float float_1 = 1;
intArg++;
}
float float_2 = 2;
intArg++;
}
{
{ double double_1 = 1;
intArg++;
}
double double_2 = 2;
intArg++;
}
{
intArg++;
}
intArg++;
}
{
intArg++;
}
intArg++; // <-- Last stop is at this point.
// Only obj_2 and intArg are valid
// Note: even result is not valid here!
}
return result;
}
}
/********** test program **********/
super(args);
}
}
/********** test assist **********/
" ReferenceTypes named: " + className);
return null;
}
" methods named: " + methodName);
return null;
}
}
try {
}
failure(" Failure: AbsentInformationException has been thrown");
return null;
}
int index = 0;
}
println("");
return localVars;
}
println("\n checkGetSetAllVariables for method at particular frame location: ");
int index = 0;
try {
failure(" Failure: AbsentInformationException is expected");
}
println(" is not valid");
failure(" Failure: AbsentInformationException was not expected");
}
}
}
println("");
}
println("");
// Sorry, there is no way to get (and print)
// a local variable slot numbers using JDI!
}
int index = 0;
println("\n Visible variables at this point are: ");
}
}
}
}
}
}
}
}
}
}
}
// To get the new value which has been set
println("");
// Check if set was done properly
println(" Success: Value was set correctly!");
} else {
failure(" Failure: Value was NOT set correctly!");
}
println("");
}
// To get the new value which has been set
println("");
// Check if set was done properly
println(" Success: Value was set correctly!");
} else {
failure(" Failure: Value was NOT set correctly!");
}
println("");
}
// To get the new value which has been set
println("");
// Check if set was done properly
println(" Success: Value was set correctly!");
} else {
failure(" Failure: Value was NOT set correctly!");
}
println("");
}
// To get the new value which has been set
println("");
// Check if set was done properly
println(" Success: Value was set correctly!");
} else {
failure(" Failure: Value was NOT set correctly!");
}
println("");
}
// To get the new value which has been set
println("");
// Check if set was done properly
println(" Success: Value was set correctly!");
} else {
failure(" Failure: Value was NOT set correctly!");
}
println("");
}
// To get the new value which has been set
println("");
// Check if set was done properly
println(" Success: Value was set correctly!");
} else {
failure(" Failure: Value was NOT set correctly!");
}
println("");
}
// To get the new value which has been set
println("");
// Check if set was done properly
println(" Success: Value was set correctly!");
} else {
failure(" Failure: Value was NOT set correctly!");
}
println("");
}
// To get the new value which has been set
println("");
// Check if set was done properly
println(" Success: Value was set correctly!");
} else {
failure(" Failure: Value was NOT set correctly!");
}
println("");
}
// To get the new value which has been set
println("");
// Check if set was done properly
println(" Success: String was set correctly!");
} else {
failure(" Failure: String was NOT set correctly!");
}
println("");
}
// To get the new value which has been set
println("");
println(" Success: Object was set correctly!");
} else {
failure(" Failure: Object was NOT set correctly!");
}
println("");
}
try {
println(" Get: No ClassCastException error!");
println(" Success: Get: ClassCastException error has cought as expected!");
}
try {
println(" Set: No InvalidTypeException with Integer error!");
println(" Success: Set: InvalidTypeException with Integer error has cought as expected!");
}
}
try {
println(" Get: No ClassCastException error!");
println(" Success: Get: ClassCastException with Float error has cought as expected!");
}
try {
println(" Set: No InvalidTypeException with Float error!");
println(" Success: Set: InvalidTypeException error has cought as expected!");
}
}
try {
println(" Get: No ClassCastException error!");
println(" Success: Get: ClassCastException with Double error has cought as expected!");
}
try {
println(" Set: No InvalidTypeException with Double error!");
println(" Success: Set: InvalidTypeException error has cought as expected!");
}
}
int index = 0;
println("\n Set variable values:");
case 'Z': // Boolean Type
break;
case 'B': // Byte Type
break;
case 'C': // Char Type
break;
case 'S': // Short Type
break;
case 'I': // Integer Type
}
break;
case 'J': // Long Type
break;
case 'F': // Float Type
break;
case 'D': // Double Type
break;
case 'L':
}
}
break;
default:
failure(" Failure: List of local variables has a wrong entry!");
};
}
}
/********** test core **********/
/*
* Get to the top of main() to determine targetClass and mainThread
*/
println("startToMain(GetSetLocalTarg)");
println("targetClass");
println("mainThread");
println("EventRequestManager");
}
/*
* resume until the end
*/
/*
* deal with results of test
* if anything has called failure("foo") testFailed will be true
*/
if (!testFailed) {
println("GetSetLocalTest: passed");
} else {
throw new Exception("GetSetLocalTest: failed");
}
}
}