public void addSupperClass(String name){ if (name.endsWith(CLASS_EXTENSION)) { classNames.add(name.substring(0, name.length() - CLASS_EXTENSION.length())); } if (name.endsWith(CLASS_EXTENSION)) { DirectClassFile classFile; try { classFile = path.getClass(name); CstType superClass = classFile.getSuperclass(); if (superClass != null) { String superClassName=superClass.getClassType().getClassName(); classNames.add(superClassName); } } catch (FileNotFoundException e) { // throw new IOException("Class " + name + // " is missing form original class path " + path, e); } } } public void addRootsV2(String name){
addClassWithHierachy(superClass.getClassType().getClassName());
private void addClassWithHierachy(String classBinaryName) { if (classNames.contains(classBinaryName)) { return; } try { DirectClassFile classFile = path.getClass(classBinaryName + CLASS_EXTENSION); classNames.add(classBinaryName); CstType superClass = classFile.getSuperclass(); if (superClass != null) { addClassWithHierachy(superClass.getClassType().getClassName()); } TypeList interfaceList = classFile.getInterfaces(); int interfaceNumber = interfaceList.size(); for (int i = 0; i < interfaceNumber; i++) { addClassWithHierachy(interfaceList.getType(i).getClassName()); } } catch (FileNotFoundException e) { // Ignore: The referenced type is not in the path it must be part of the libraries. } } }
private void addDependencies(ConstantPool pool) { for (Constant constant : pool.getEntries()) { if (constant instanceof CstType) { checkDescriptor(((CstType) constant).getClassType()); } else if (constant instanceof CstFieldRef) { checkDescriptor(((CstFieldRef) constant).getType()); } else if (constant instanceof CstMethodRef) { Prototype proto = ((CstMethodRef) constant).getPrototype(); checkDescriptor(proto.getReturnType()); StdTypeList args = proto.getParameterTypes(); for (int i = 0; i < args.size(); i++) { checkDescriptor(args.get(i)); } } } }
private void addDependencies(DirectClassFile classFile) { for (Constant constant : classFile.getConstantPool().getEntries()) { if (constant instanceof CstType) { checkDescriptor(((CstType) constant).getClassType().getDescriptor()); } else if (constant instanceof CstFieldRef) { checkDescriptor(((CstFieldRef) constant).getType().getDescriptor()); } else if (constant instanceof CstBaseMethodRef) { checkPrototype(((CstBaseMethodRef) constant).getPrototype()); } } FieldList fields = classFile.getFields(); int nbField = fields.size(); for (int i = 0; i < nbField; i++) { checkDescriptor(fields.get(i).getDescriptor().getString()); } MethodList methods = classFile.getMethods(); int nbMethods = methods.size(); for (int i = 0; i < nbMethods; i++) { checkPrototype(Prototype.intern(methods.get(i).getDescriptor().getString())); } } private void checkPrototype(Prototype proto) {
private static void internInitial(CstType cst) { if (interns.putIfAbsent(cst.getClassType(), cst) != null) { throw new IllegalStateException("Attempted re-init of " + cst); } }
private static void internInitial(CstType cst) { if (interns.putIfAbsent(cst.getClassType(), cst) != null) { throw new IllegalStateException("Attempted re-init of " + cst); } }
/** * {@inheritDoc} * * <b>Note:</b> This returns the enumerated type. */ public Type getType() { return getDefiningClass().getClassType(); }
/** * {@inheritDoc} * * <b>Note:</b> This returns the enumerated type. */ @Override public Type getType() { return getDefiningClass().getClassType(); }
/** * {@inheritDoc} * * <b>Note:</b> This returns the enumerated type. */ public Type getType() { return getDefiningClass().getClassType(); }
/** * {@inheritDoc} * * <b>Note:</b> This returns the enumerated type. */ @Override public Type getType() { return getDefiningClass().getClassType(); }
/** * {@inheritDoc} * * <b>Note:</b> This returns the enumerated type. */ public Type getType() { return getDefiningClass().getClassType(); }
/** {@inheritDoc} */ public Type getType(int n) { int idx = bytes.getUnsignedShort(n * 2); return ((CstType) pool.get(idx)).getClassType(); }
/** {@inheritDoc} */ public Type getType(int n) { int idx = bytes.getUnsignedShort(n * 2); return ((CstType) pool.get(idx)).getClassType(); }
/** {@inheritDoc} */ public void visitNewarray(int offset, int length, CstType cst, ArrayList<Constant> intVals) { String commentOrSpace = (length == 1) ? " // " : " "; String typeName = cst.getClassType().getComponentType().toHuman(); observer.parsed(bytes, offset, length, header(offset) + commentOrSpace + typeName); }
/** {@inheritDoc} */ @Override public void visitNewarray(int offset, int length, CstType cst, ArrayList<Constant> intVals) { String commentOrSpace = (length == 1) ? " // " : " "; String typeName = cst.getClassType().getComponentType().toHuman(); observer.parsed(bytes, offset, length, header(offset) + commentOrSpace + typeName); }
/** {@inheritDoc} */ @Override public void visitNewarray(int offset, int length, CstType cst, ArrayList<Constant> intVals) { String commentOrSpace = (length == 1) ? " // " : " "; String typeName = cst.getClassType().getComponentType().toHuman(); observer.parsed(bytes, offset, length, header(offset) + commentOrSpace + typeName); }
/** {@inheritDoc} */ public void visitNewarray(int offset, int length, CstType cst, ArrayList<Constant> intVals) { String commentOrSpace = (length == 1) ? " // " : " "; String typeName = cst.getClassType().getComponentType().toHuman(); observer.parsed(bytes, offset, length, header(offset) + commentOrSpace + typeName); }
/** {@inheritDoc} */ public void visitNewarray(int offset, int length, CstType cst, ArrayList<Constant> intVals) { String commentOrSpace = (length == 1) ? " // " : " "; String typeName = cst.getClassType().getComponentType().toHuman(); observer.parsed(bytes, offset, length, header(offset) + commentOrSpace + typeName); }
/** {@inheritDoc} */ public void visitNewarray(int offset, int length, CstType cst, ArrayList<Constant> intVals) { String commentOrSpace = (length == 1) ? " // " : " "; String typeName = cst.getClassType().getComponentType().toHuman(); observer.parsed(bytes, offset, length, header(offset) + commentOrSpace + typeName); }