/** * Find all classes that are required by given class file. * * @param file * a ".class" file * @return set of strings, each contains a full qualified class name (forward slash as package separator) */ public static Set<String> getRequiredClasses(IFile file) { Set<String> classes = new TreeSet<>(); IClassFile classFile = JavaCore.createClassFileFrom(file); IClassFileReader reader = ToolFactory.createDefaultClassFileReader(classFile, IClassFileReader.CONSTANT_POOL); if (reader == null) { // class not compiled return classes; } IConstantPool pool = reader.getConstantPool(); for (int i = 0; i < pool.getConstantPoolCount(); i++) { if (pool.getEntryKind(i) == IConstantPoolConstant.CONSTANT_Class) { IConstantPoolEntry entry = pool.decodeEntry(i); String classname = new String(entry.getClassInfoName()); // don't return inner classes int index = classname.indexOf('$'); if (index != -1) { classname = classname.substring(0, index); } classes.add(classname); } } return classes; }
IConstantPool pool = cfr.getConstantPool(); int length = pool.getConstantPoolCount(); for (int i = 1; i < length; i++) {
buffer.append(Messages.bind(Messages.disassembler_opentypedeclaration)); if (checkMode(mode, SYSTEM)) { disassemble(classFileReader.getConstantPool(), buffer, lineSeparator, 1); disassemble((IBootstrapMethodsAttribute) bootstrapMethods, buffer, lineSeparator, 0, classFileReader.getConstantPool());
disassemble(classFileReader.getConstantPool(), buffer, lineSeparator, 1); disassemble((IBootstrapMethodsAttribute) bootstrapMethods, buffer, lineSeparator, 0, classFileReader.getConstantPool());
disassemble(classFileReader.getConstantPool(), buffer, lineSeparator, 1); disassemble((IBootstrapMethodsAttribute) bootstrapMethods, buffer, lineSeparator, 0, classFileReader.getConstantPool());
disassemble(classFileReader.getConstantPool(), buffer, lineSeparator, 1); disassemble((IBootstrapMethodsAttribute) bootstrapMethods, buffer, lineSeparator, 0, classFileReader.getConstantPool());
disassemble(classFileReader.getConstantPool(), buffer, lineSeparator, 1); disassemble((IBootstrapMethodsAttribute) bootstrapMethods, buffer, lineSeparator, 0, classFileReader.getConstantPool());
buffer.append(Messages.bind(Messages.disassembler_opentypedeclaration)); if (checkMode(mode, SYSTEM)) { disassemble(classFileReader.getConstantPool(), buffer, lineSeparator, 1); disassemble((IBootstrapMethodsAttribute) bootstrapMethods, buffer, lineSeparator, 0, classFileReader.getConstantPool());
disassemble(classFileReader.getConstantPool(), buffer, lineSeparator, 1);