/*
* 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.
*/
/**
* @test
* @bug 4326648 4768329
* @summary Test to verify that table entries are generated for all final
* locals when a class is built for debug, even if they could be
* inlined otherwise.
*
* @author Tim Bell
*
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g FinalLocalsTest.java
* @run main FinalLocalsTest
*/
/********** target program **********/
class FinalLocalsTarg {
public void test1 (final int t, int k){
final int z = 0;
if (true) {
final float r = 10.00f;
boolean b = true;
}
}
public void hi(){
return;
}
new FinalLocalsTarg().hi();
return;
}
}
/********** test program **********/
super(args);
}
}
/********** test core **********/
/*
* Take a String containing comma separated values
* and return those values in a TreeSet.
*/
while (tt.hasMoreTokens()) {
in + " is not allowed");
}
}
return result;
}
" to got = " + got);
while (! expectedSet.isEmpty()) {
} else {
}
}
//assert expectedSet.isEmpty() : name + " expected set should have been emptied";
}
}
}
}
try {
switch (which) {
case VARIABLES:
break;
case BYNAME:
break;
case ARGUMENTS:
break;
default:
throw new InternalException("should not happen");
}
}
}
}
}
/*
* Get to the top of main()
* to determine targetClass and mainThread
*/
/*
* Get to a point where the classes are loaded.
*/
throw new Exception("FinalLocalsTarg: not loaded");
}
/*
* Inspect the LocalVariableTable attributes for method "test1"
* NOTE: .class files compiled with some versions of javac will
* give results listed in different order. That's OK.
*/
throw new Exception("Method not found");
}
"t,k,s1,z,r,b");
"s1");
"t,k");
/*
* All Done. Resume the target listening for events
*/
/*
* deal with results of test
* if anything has called failure("foo") testFailed will be true
*/
if (!testFailed) {
println("FinalLocalsTest: passed");
} else {
throw new Exception("FinalLocalsTest: failed");
}
}
}