/*
* 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 4642611
* @summary Test that method.allLineLocations() should
* throw AbsentInformationException exception
*
* @author Serguei Spitsyn
*
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g:none NoLocInfoTest.java
* @run main NoLocInfoTest
*/
/********** target program **********/
interface InterfaceNoLocInfoTarg {
int instanceMeth();
int instanceMeth1();
}
protected int fld;
// Constructor
fld = 1000;
}
public abstract int instanceMeth();
public int instanceMeth1() {
fld = 999;
fld = instanceMeth();
return 0;
}
}
// Class has a default constructor
}
public static int staticMeth() {
int i = 2;
return i;
}
public int instanceMeth() {
int i = 0;
i++;
return i + staticMeth();
}
private void voidInstanceMeth() {}
static native int staticNativeMeth();
native boolean instanceNativeMeth();
}
/********** test program **********/
super(args);
}
}
/********** test assist **********/
" ReferenceTypes named: " + className);
return null;
}
" methods named: " + methodName);
return null;
}
}
try {
failure("Failure: com.sun.jdi.AbsentInformationException was expected; " +
}
println("Success: com.sun.jdi.AbsentInformationException thrown as expected");
}
println("");
}
try {
if (size == 0) {
} else {
}
}
failure("Failure: com.sun.jdi.AbsentInformationException was not expected; ");
}
println("");
}
/********** test core **********/
/*
* Get to the top of main() to get everything loaded
*/
startToMain("NoLocInfoTarg");
println("\n Abstract Methods:");
// For abtsract methods allLineLocations() always returns empty List
println("\n Native Methods:");
// For native methods allLineLocations() always returns empty List
println("\n Non-Abstract Methods of Abstract class:");
println("\n Methods of Non-Abstract class:");
/*
* resume until the end
*/
/*
* deal with results of test
* if anything has called failure("foo") testFailed will be true
*/
if (!testFailed) {
println("NoLocInfoTest: passed");
} else {
throw new Exception("NoLocInfoTest: failed");
}
}
}