Search in sources :

Example 1 with TypeSignatureVisitor

use of net.sourceforge.pmd.dcd.asm.TypeSignatureVisitor in project pmd by pmd.

the class ConstructorNode method getMember.

@Override
public Constructor<?> getMember() {
    if (ClassLoaderUtil.CLINIT.equals(name)) {
        return null;
    } else {
        Constructor<?> constructor = constructorReference == null ? null : constructorReference.get();
        if (constructor == null) {
            SignatureReader signatureReader = new SignatureReader(desc);
            TypeSignatureVisitor visitor = new TypeSignatureVisitor();
            signatureReader.accept(visitor);
            constructor = ClassLoaderUtil.getConstructor(super.getClassNode().getType(), name, visitor.getMethodParameterTypes());
            constructorReference = new WeakReference<Constructor<?>>(constructor);
        }
        return constructor;
    }
}
Also used : Constructor(java.lang.reflect.Constructor) SignatureReader(org.objectweb.asm.signature.SignatureReader) TypeSignatureVisitor(net.sourceforge.pmd.dcd.asm.TypeSignatureVisitor)

Example 2 with TypeSignatureVisitor

use of net.sourceforge.pmd.dcd.asm.TypeSignatureVisitor in project pmd by pmd.

the class MethodNode method getMember.

@Override
public Method getMember() {
    Method method = methodReference == null ? null : methodReference.get();
    if (method == null) {
        SignatureReader signatureReader = new SignatureReader(desc);
        TypeSignatureVisitor visitor = new TypeSignatureVisitor();
        signatureReader.accept(visitor);
        method = ClassLoaderUtil.getMethod(super.getClassNode().getType(), name, visitor.getMethodParameterTypes());
        methodReference = new WeakReference<>(method);
    }
    return method;
}
Also used : SignatureReader(org.objectweb.asm.signature.SignatureReader) TypeSignatureVisitor(net.sourceforge.pmd.dcd.asm.TypeSignatureVisitor) Method(java.lang.reflect.Method)

Aggregations

TypeSignatureVisitor (net.sourceforge.pmd.dcd.asm.TypeSignatureVisitor)2 SignatureReader (org.objectweb.asm.signature.SignatureReader)2 Constructor (java.lang.reflect.Constructor)1 Method (java.lang.reflect.Method)1