JarAnalyzer implements Callable<FileAnalyzer>, JarEntryWriter, FileAnalyzer { public static String getFqClassname(String _jar_entry_name) { String cn = null; if (_jar_entry_name.endsWith(".class")) { if (!_jar_entry_name.endsWith("package-info.class") && !_jar_entry_name.endsWith("module-info.class")) { final StringBuffer fqn = new StringBuffer(); final Path p = Paths.get(_jar_entry_name); final Iterator<Path> i = p.iterator(); while (i.hasNext()) { String element = i.next().toString(); if (element.endsWith(".class")) element = element.substring(0, element.length() - 6); if (JarAnalyzer.isJavaIdentifier(element)) { if (fqn.length() != 0) fqn.append('.'); fqn.append(element); } else { JarAnalyzer.log.warn( "JAR entry [" + _jar_entry_name + "] cannot be transformed to a fully-qualified Java class identifier, because" + " [" + element + "] is not a valid identifier"); return null; } } cn = fqn.toString(); } } return cn; }  @Override String[] getSupportedFileExtensions(); @Override final boolean canAnalyze(File _file); @Override synchronized void analyze(final File _file); void setInstrument(boolean _instrument); Path getPath(); void setParent(JarAnalyzer ja); JarAnalyzer getParent(); long getFileSize(); long getInstrumentedFileSize(); void setWorkDir(Path _p); void setRename(boolean _b); void setLibraryId(LibraryId _id); Library getLibrary(); synchronized String getSHA1(); String getFileName(); FileAnalyzer call(); final File getInstrumentedArchive(); Set<String> getClassNames(); boolean hasJARConstructs(); @Override boolean hasChilds(); @Override Set<FileAnalyzer> getChilds(boolean _recursive); synchronized Set<ConstructId> getConstructIds(); String toString(); InstrumentationControl getInstrumentationControl(); @Override InputStream getInputStream(String _regex, JarEntry _entry); @Override Map<ConstructId, Construct> getConstructs(); List<org.eclipse.steady.shared.json.model.ConstructId> getSharedConstructs(); @Override boolean containsConstruct(ConstructId _id); @Override Construct getConstruct(ConstructId _id); @Override boolean equals(Object obj); @Override int hashCode(); static boolean isJavaIdentifier(String _name); static String getFqClassname(String _jar_entry_name); static void setAppContext(Application _ctx); static Application getAppContext(); static void insertClasspath(String _url);  }
@Test public void testGetFqClassname() { String je = "Foo.class"; String fqn = JarAnalyzer.getFqClassname(je); assertEquals("Foo", fqn); je = "1.0/com/sun/tools/xjc/grammar/IgnoreItem.class"; fqn = JarAnalyzer.getFqClassname(je); assertEquals(null, fqn); je = "com/sun/tools/xjc/grammar/IgnoreItem.class"; fqn = JarAnalyzer.getFqClassname(je); assertEquals("com.sun.tools.xjc.grammar.IgnoreItem", fqn); }