/* * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * 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.
*/
/* * This test has a debuggee which calls an instance method * for each kind of JDI value return type. * * The debugger sets breakpoints in all methods. When a breakpoint * is hit the debugger requests an early return and supplies a new * return value. The new value is not compatible with the method's * return type so an InvalidTypeException should be thrown. * * Each value is stored in a static var in the debuggee. The debugger * gets the values from these static vars to pass back to the * debuggee in forceEarlyReturn. * * This test was created out of EarlyReturnTest.java. Not all of the * debuggee methods are actually used, just the ones needed to test * for correct operation. I left the others in just in case they come * in handy in the future.
*/
class EarlyReturnNegativeTarg { /* * These are the values that will be used by methods * returning normally.
*/ static URL[] urls = new URL[1]; publicstaticbyte byteValue = 89; publicstaticchar charValue = 'x'; publicstaticdouble doubleValue = 2.2; publicstaticfloat floatValue = 3.3f; publicstaticint intValue = 1; publicstaticlong longValue = Long.MAX_VALUE; publicstaticshort shortValue = 8; publicstaticboolean booleanValue = false;
publicstaticvoid main(String[] args) throws Exception { /* * The debugger will stop at the start of main, * set breakpoints and then do a resume.
*/
System.err.println("debugee in main");
EarlyReturnNegativeTarg xx = new EarlyReturnNegativeTarg();
/* There are some incompatible classes of values. In the following, * we test each combination.
*/ if ("shortf".equals(methodName)){
doEarly(tr, origMethodName, booleanVV);
doEarly(tr, origMethodName, objectVV);
doEarly(tr, origMethodName, voidVV);
doEarly(tr, origMethodName, intArrayVV);
doEarly(tr, origMethodName, objectArrayVV);
/* * We set and enable breakpoints on all of the interesting * methods called by doit(). In the breakpointReached() * handler we force an early return with a different return * value. *
*/
/* Create Value objects to be passed in forceEarlyReturn calls */
Field theValueField = targetClass.fieldByName("byteValue");
byteVV = (ByteValue)targetClass.getValue(theValueField);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.