publicstaticvoid main(String args[]) throws Exception { new AllLineLocations(args).startTests();
}
AllLineLocations(String args[]) { super(args);
}
protectedvoid runTests() throws Exception {
/* *Gettoapointwheretheclassesareloaded.
*/
BreakpointEvent bp = startTo("RefTypes", "loadClasses", "()V");
stepOut(bp.thread());
/* *Theseclassesshouldhavenolinenumbers,exceptfor *oneintheimplicitconstructor.
*/
ReferenceType rt = findReferenceType("AllAbstract"); if (rt == null) { thrownew Exception("AllAbstract: not loaded");
}
List list = rt.allLineLocations(); if (list.size() != 1) { thrownew Exception("AllAbstract: incorrect number of line locations");
} if (rt.locationsOfLine(5000).size() != 0) { thrownew Exception("AllAbstract: incorrect locationsOfLine");
}
Method method = findMethod(rt, "<init>", "()V"); if (method == null) { thrownew Exception("AllAbstract.<init> not found");
}
List list2 = method.allLineLocations(); if (!list2.equals(list)) { thrownew Exception("AllAbstract: line locations in wrong method");
} if (method.locationsOfLine(5000).size() != 0) { thrownew Exception("AllAbstract: incorrect locationsOfLine");
}
System.out.println("AllAbstract: passed");
rt = findReferenceType("AllNative"); if (rt == null) { thrownew Exception("AllNative: not loaded");
}
list = rt.allLineLocations(); if (list.size() != 1) { thrownew Exception("AllNative: incorrect number of line locations");
} if (rt.locationsOfLine(5000).size() != 0) { thrownew Exception("AllNative: incorrect locationsOfLine");
}
method = findMethod(rt, "<init>", "()V"); if (method == null) { thrownew Exception("AllNative.<init> not found");
}
list2 = method.allLineLocations(); if (!list2.equals(list)) { thrownew Exception("AllNative: line locations in wrong method");
} if (method.locationsOfLine(5000).size() != 0) { thrownew Exception("AllNative: incorrect locationsOfLine");
}
System.out.println("AllNative: passed");
rt = findReferenceType("Interface"); if (rt == null) { thrownew Exception("Interface: not loaded");
}
list = rt.allLineLocations(); if (list.size() != 0) { thrownew Exception("Interface: locations reported for abstract methods");
}
System.out.println("Interface: passed");
/* *Theseclasseshavelinenumbersinonemethodand *intheimplicitconstructor.
*/
rt = findReferenceType("Abstract"); if (rt == null) { thrownew Exception("Abstract: not loaded");
}
list = rt.allLineLocations(); if (list.size() != 5) { thrownew Exception("Abstract: incorrect number of line locations");
}
method = findMethod(rt, "b", "()V"); if (method == null) { thrownew Exception("Abstract.b not found");
}
list2 = method.allLineLocations();
list.removeAll(list2);
// Remaining location should be in constructor if ((list.size() != 1) ||
!(((Location)list.get(0)).method().name().equals("<init>"))) { thrownew Exception("Abstract: line locations in wrong method");
} if (method.locationsOfLine(20).size() != 1) { thrownew Exception("Abstract method: incorrect locationsOfLine");
} if (method.locationsOfLine(5000).size() != 0) { thrownew Exception("Abstract method: incorrect locationsOfLine");
}
method = findMethod(rt, "a", "()V"); if (method.locationsOfLine(5000).size() != 0) { thrownew Exception("Abstract method: incorrect locationsOfLine");
}
System.out.println("Abstract: passed");
rt = findReferenceType("Native"); if (rt == null) { thrownew Exception("Native: not loaded");
}
list = rt.allLineLocations(); if (list.size() != 5) { thrownew Exception("Native: incorrect number of line locations");
} if (rt.locationsOfLine(5000).size() != 0) { thrownew Exception("Native: incorrect locationsOfLine");
}
method = findMethod(rt, "b", "()V"); if (method == null) { thrownew Exception("Native.b not found");
}
list2 = method.allLineLocations();
list.removeAll(list2);
// Remaining location should be in constructor if ((list.size() != 1) ||
!(((Location)list.get(0)).method().name().equals("<init>"))) { thrownew Exception("Native: line locations in wrong method");
} if (method.locationsOfLine(30).size() != 1) { thrownew Exception("Native method: incorrect locationsOfLine");
} if (method.locationsOfLine(5000).size() != 0) { thrownew Exception("Native method: incorrect locationsOfLine");
}
method = findMethod(rt, "a", "()V"); if (method.locationsOfLine(5000).size() != 0) { thrownew Exception("Native method: incorrect locationsOfLine");
}
System.out.println("Native: passed");
rt = findReferenceType("AbstractAndNative"); if (rt == null) { thrownew Exception("AbstractAndNative: not loaded");
}
list = rt.allLineLocations(); if (list.size() != 5) { thrownew Exception("AbstractAndNative: incorrect number of line locations");
} if (rt.locationsOfLine(5000).size() != 0) { thrownew Exception("AbstractAndNative: incorrect locationsOfLine");
}
method = findMethod(rt, "c", "()V"); if (method == null) { thrownew Exception("AbstractAndNative.c not found");
}
list2 = method.allLineLocations();
list.removeAll(list2);
// Remaining location should be in constructor if ((list.size() != 1) ||
!(((Location)list.get(0)).method().name().equals("<init>"))) { thrownew Exception("AbstractAndNative: line locations in wrong method");
}
System.out.println("AbstractAndNative: passed");
// Allow application to complete
resumeToVMDisconnect();
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet am 2026-06-10)
¤
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.