Search in sources :

Example 1 with ClassSignatureVisitor

use of com.buschmais.jqassistant.plugin.java.impl.scanner.visitor.generics.ClassSignatureVisitor in project jqa-java-plugin by buschmais.

the class ClassVisitor method visit.

@Override
public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) {
    Class<? extends ClassFileDescriptor> javaType = getJavaType(access);
    String fullQualifiedName = SignatureHelper.getObjectType(name);
    cachedType = visitorHelper.createType(fullQualifiedName, fileDescriptor, javaType);
    visitorHelper.getTypeVariableResolver().push();
    ClassFileDescriptor classFileDescriptor = cachedType.getTypeDescriptor();
    classFileDescriptor.setByteCodeVersion(version);
    if (hasFlag(access, Opcodes.ACC_ABSTRACT) && !hasFlag(access, Opcodes.ACC_INTERFACE)) {
        classFileDescriptor.setAbstract(Boolean.TRUE);
    }
    setModifiers(access, classFileDescriptor);
    if (signature == null) {
        if (superName != null) {
            TypeDescriptor superClassType = visitorHelper.resolveType(SignatureHelper.getObjectType(superName), cachedType).getTypeDescriptor();
            classFileDescriptor.setSuperClass(superClassType);
        }
        for (int i = 0; interfaces != null && i < interfaces.length; i++) {
            TypeDescriptor interfaceType = visitorHelper.resolveType(SignatureHelper.getObjectType(interfaces[i]), cachedType).getTypeDescriptor();
            classFileDescriptor.getInterfaces().add(interfaceType);
        }
    } else {
        new SignatureReader(signature).accept(new ClassSignatureVisitor(cachedType, visitorHelper));
    }
}
Also used : SignatureReader(org.objectweb.asm.signature.SignatureReader) ClassSignatureVisitor(com.buschmais.jqassistant.plugin.java.impl.scanner.visitor.generics.ClassSignatureVisitor)

Aggregations

ClassSignatureVisitor (com.buschmais.jqassistant.plugin.java.impl.scanner.visitor.generics.ClassSignatureVisitor)1 SignatureReader (org.objectweb.asm.signature.SignatureReader)1