use of com.sun.jdi.ReferenceType in project jdk8u_jdk by JetBrains.
the class VisibleMethods method runTests.
/********** test core **********/
protected void runTests() throws Exception {
/*
* Run to String.<init>
*/
startToMain("CC");
ReferenceType ac = findReferenceType("AC");
List<String> visible = ac.visibleMethods().stream().map(Method::toString).collect(Collectors.toList());
System.out.println("visibleMethods(): " + visible);
verifyContains(visible, 1, "Two.m(java.lang.String)");
verifyContains(visible, 1, "One.m(java.lang.Object)");
verifyContains(visible, 0, "Super.m(java.lang.Object)");
verifyContains(visible, 0, "Super.m(java.lang.String)");
verifyContains(visible, 1, "Two.m1()", "One.m1()");
/*
* resume the target listening for events
*/
listenUntilVMDisconnect();
}
use of com.sun.jdi.ReferenceType in project intellij-community by JetBrains.
the class JavaScratchPositionManager method getPsiFileByLocation.
@Nullable
@Override
protected PsiFile getPsiFileByLocation(Project project, Location location) {
if (location == null) {
return null;
}
final ReferenceType refType = location.declaringType();
if (refType == null) {
return null;
}
final PsiFile psiFile = PsiManager.getInstance(project).findFile(myScratchFile);
if (!(psiFile instanceof PsiJavaFile)) {
return null;
}
final PsiClass[] classes = ((PsiJavaFile) psiFile).getClasses();
if (classes.length == 0) {
return null;
}
final String originalQName = refType.name();
for (PsiClass aClass : classes) {
if (StringUtil.equals(originalQName, aClass.getQualifiedName())) {
return psiFile;
}
}
final int dollar = originalQName.indexOf('$');
final String alternativeQName = dollar > 0 ? originalQName.substring(0, dollar) : null;
if (!StringUtil.isEmpty(alternativeQName)) {
for (PsiClass aClass : classes) {
if (StringUtil.equals(alternativeQName, aClass.getQualifiedName())) {
return psiFile;
}
}
}
return null;
}
use of com.sun.jdi.ReferenceType in project kotlin by JetBrains.
the class AbstractPositionManagerTest method assertBreakpointIsHandledCorrectly.
private static void assertBreakpointIsHandledCorrectly(Breakpoint breakpoint, PositionManager positionManager) throws NoDataException {
SourcePosition position = SourcePosition.createFromLine(breakpoint.file, breakpoint.lineNumber);
List<ReferenceType> classes = positionManager.getAllClasses(position);
assertNotNull(classes);
assertEquals(1, classes.size());
ReferenceType type = classes.get(0);
assertTrue("Type name " + type.name() + " doesn't match " + breakpoint.classNameRegexp + " for line " + (breakpoint.lineNumber + 1), type.name().matches(breakpoint.classNameRegexp));
// JDI names are of form "package.Class$InnerClass"
ReferenceType typeWithFqName = new MockReferenceType(type.name().replace('/', '.'));
Location location = new MockLocation(typeWithFqName, breakpoint.file.getName(), breakpoint.lineNumber + 1);
SourcePosition actualPosition = positionManager.getSourcePosition(location);
assertNotNull(actualPosition);
assertEquals(position.getFile(), actualPosition.getFile());
assertEquals(position.getLine(), actualPosition.getLine());
}
use of com.sun.jdi.ReferenceType in project che by eclipse.
the class JdiValueImpl method getVariables.
@Override
public JdiVariable[] getVariables() {
if (variables == null) {
if (isPrimitive()) {
variables = new JdiVariable[0];
} else {
if (isArray()) {
ArrayReference array = (ArrayReference) value;
int length = array.length();
variables = new JdiVariable[length];
for (int i = 0; i < length; i++) {
variables[i] = new JdiArrayElementImpl(i, array.getValue(i));
}
} else {
ObjectReference object = (ObjectReference) value;
ReferenceType type = object.referenceType();
List<Field> fields = type.allFields();
variables = new JdiVariable[fields.size()];
int i = 0;
for (Field f : fields) {
variables[i++] = new JdiFieldImpl(f, object);
}
// See JdiFieldImpl#compareTo(JdiFieldImpl).
Arrays.sort(variables);
}
}
}
return variables;
}
use of com.sun.jdi.ReferenceType in project gravel by gravel-st.
the class VMRemoteTarget method trapExceptions.
private void trapExceptions() {
ReferenceType referenceType = vm.classesByName("java.lang.Throwable").get(0);
vm.eventRequestManager().createExceptionRequest(referenceType, true, true).enable();
}
Aggregations