# HG changeset patch # User iignatyev # Date 1502765388 0 # Node ID 3d71dbbe1c942bcb75e29117cebced4f84c0c2bb # Parent f4ded11e0f74b634472c5a4fdad1c7c613567162# Parent 0cffd1dd151d3607869900f4836640d71be3f453 Merge diff -r f4ded11e0f74 -r 3d71dbbe1c94 hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJimageEntry.java --- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJimageEntry.java Mon Aug 14 21:04:57 2017 -0400 +++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJimageEntry.java Tue Aug 15 02:49:48 2017 +0000 @@ -43,9 +43,16 @@ return Arrays.stream(reader.getEntryNames()) .filter(name -> name.endsWith(".class")) .filter(name -> !name.endsWith("module-info.class")) + .map(ClassPathJimageEntry::toFileName) .map(Utils::fileNameToClassName); } + private static String toFileName(String name) { + final char nameSeparator = '/'; + assert name.charAt(0) == nameSeparator : name; + return name.substring(name.indexOf(nameSeparator, 1) + 1); + } + @Override protected String description() { return "# jimage: " + root; diff -r f4ded11e0f74 -r 3d71dbbe1c94 hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java --- a/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java Mon Aug 14 21:04:57 2017 -0400 +++ b/hotspot/test/testlibrary/ctw/src/sun/hotspot/tools/ctw/Utils.java Tue Aug 15 02:49:48 2017 +0000 @@ -203,18 +203,14 @@ * Converts the filename to classname. * * @param filename filename to convert - * @return corresponding classname. + * @return corresponding classname * @throws AssertionError if filename isn't valid filename for class file - * {@link #isClassFile(String)} */ public static String fileNameToClassName(String filename) { assert isClassFile(filename); - // workaround for the class naming in jimage : // final char nameSeparator = '/'; - int nameStart = filename.charAt(0) == nameSeparator - ? filename.indexOf(nameSeparator, 1) + 1 - : 0; - return filename.substring(nameStart, filename.length() - CLASSFILE_EXT.length()) + return filename.substring(0, filename.length() - CLASSFILE_EXT.length()) .replace(nameSeparator, '.'); }