A simple test shows that although canGetSourceDebugExtension() is true,
sourceDebugExtension() throws UnsupportedOperationException.
% java SourceDebugExtensionTest
run args: [SourceDebugExtensionTarg]
JVM version:1.4.0-internal
JDI version: 1.4
JVM description: Java Debug Interface (Reference Implementation) version 1.4
Java Debug Wire Protocol (Reference Implementation) version 1.4
JVM Debug Interface version 1.1
JVM version 1.4.0-internal (Java HotSpot(TM) Client VM, interpreted mode)
canGetSourceDebugExtension() is true
Exception in thread "main" java.lang.UnsupportedOperationException
at com.sun.tools.jdi.JDWPException.toJDIException(JDWPException.java:41)
at com.sun.tools.jdi.ReferenceTypeImpl.sourceDebugExtension(ReferenceTypeImpl.java:601)
at SourceDebugExtensionTest.runTests(SourceDebugExtensionTest.java:51)
at TestScaffold.startTests(TestScaffold.java:301)
at SourceDebugExtensionTest.main(SourceDebugExtensionTest.java:31)
----
Significant code of test:
if (!vm().canGetSourceDebugExtension()) {
failure("FAIL: canGetSourceDebugExtension() is false");
} else {
println("canGetSourceDebugExtension() is true");
}
String expected = "An expected attribute string";
String sde = targetClass.sourceDebugExtension();
if (!sde.equals(expected)) {
failure("FAIL: got '" + sde +
"' expected: '" + expected + "'");
}
sourceDebugExtension() throws UnsupportedOperationException.
% java SourceDebugExtensionTest
run args: [SourceDebugExtensionTarg]
JVM version:1.4.0-internal
JDI version: 1.4
JVM description: Java Debug Interface (Reference Implementation) version 1.4
Java Debug Wire Protocol (Reference Implementation) version 1.4
JVM Debug Interface version 1.1
JVM version 1.4.0-internal (Java HotSpot(TM) Client VM, interpreted mode)
canGetSourceDebugExtension() is true
Exception in thread "main" java.lang.UnsupportedOperationException
at com.sun.tools.jdi.JDWPException.toJDIException(JDWPException.java:41)
at com.sun.tools.jdi.ReferenceTypeImpl.sourceDebugExtension(ReferenceTypeImpl.java:601)
at SourceDebugExtensionTest.runTests(SourceDebugExtensionTest.java:51)
at TestScaffold.startTests(TestScaffold.java:301)
at SourceDebugExtensionTest.main(SourceDebugExtensionTest.java:31)
----
Significant code of test:
if (!vm().canGetSourceDebugExtension()) {
failure("FAIL: canGetSourceDebugExtension() is false");
} else {
println("canGetSourceDebugExtension() is true");
}
String expected = "An expected attribute string";
String sde = targetClass.sourceDebugExtension();
if (!sde.equals(expected)) {
failure("FAIL: got '" + sde +
"' expected: '" + expected + "'");
}