< prev index next >
test/jdk/com/sun/tools/jextract/Runner.java
Print this page
*** 297,327 ****
actualClz = writer.results();
expectedCL = mfm.getTheClassLoader();
actualCL = new ClassLoader() {
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
! byte[] byteCode = actualClz.get(canonicalize(name));
if (byteCode == null) throw new ClassNotFoundException(name);
return defineClass(name, byteCode, 0, byteCode.length);
}
};
System.out.println("Done compile, ready for test");
assertEquals(actualClz.keySet().stream()
- .map(Runner::normalize)
.collect(Collectors.toSet()),
mfm.listClasses());
System.out.println("Compile result validated.");
}
private static String normalize(String classname) {
return classname.replace('/', '.');
}
- private static String canonicalize(String classname) {
- return classname.replace('.', '/');
- }
-
private static Path[] paths(String testDir, String[] files, boolean platformDependent) {
boolean isWindows = System.getProperty("os.name").startsWith("Windows");
return Arrays.stream(files)
.map(f -> Paths.get(testDir, "compare", isWindows && platformDependent ? "windows" : "", f))
.toArray(Path[]::new);
--- 297,322 ----
actualClz = writer.results();
expectedCL = mfm.getTheClassLoader();
actualCL = new ClassLoader() {
@Override
protected Class<?> findClass(String name) throws ClassNotFoundException {
! byte[] byteCode = actualClz.get(name);
if (byteCode == null) throw new ClassNotFoundException(name);
return defineClass(name, byteCode, 0, byteCode.length);
}
};
System.out.println("Done compile, ready for test");
assertEquals(actualClz.keySet().stream()
.collect(Collectors.toSet()),
mfm.listClasses());
System.out.println("Compile result validated.");
}
private static String normalize(String classname) {
return classname.replace('/', '.');
}
private static Path[] paths(String testDir, String[] files, boolean platformDependent) {
boolean isWindows = System.getProperty("os.name").startsWith("Windows");
return Arrays.stream(files)
.map(f -> Paths.get(testDir, "compare", isWindows && platformDependent ? "windows" : "", f))
.toArray(Path[]::new);
< prev index next >