use of com.tngtech.archunit.core.importer.JavaCodeUnitSignatureImporter.JavaCodeUnitSignature in project ArchUnit by TNG.
the class JavaClassProcessor method visitMethod.
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
if (importAborted()) {
return super.visitMethod(access, name, desc, signature, exceptions);
}
LOG.trace("Analyzing method {}.{}:{}", className, name, desc);
CodeUnit codeUnit = new CodeUnit(name, desc, className);
accessHandler.setContext(codeUnit);
JavaClassDescriptor rawReturnType = JavaClassDescriptorImporter.importAsmMethodReturnType(desc);
DomainBuilders.JavaCodeUnitBuilder<?, ?> codeUnitBuilder = addCodeUnitBuilder(name, codeUnit.getRawParameterTypeNames(), rawReturnType.getFullyQualifiedClassName());
JavaCodeUnitSignature codeUnitSignature = JavaCodeUnitSignatureImporter.parseAsmMethodSignature(signature, declarationHandler);
List<JavaClassDescriptor> throwsDeclarations = typesFrom(exceptions);
codeUnitBuilder.withName(name).withModifiers(JavaModifier.getModifiersForMethod(access)).withTypeParameters(codeUnitSignature.getTypeParameterBuilders()).withParameterTypes(codeUnitSignature.getParameterTypes(), codeUnit.getRawParameterTypes()).withReturnType(codeUnitSignature.getReturnType(), rawReturnType).withDescriptor(desc).withThrowsClause(throwsDeclarations);
declarationHandler.onDeclaredThrowsClause(fullyQualifiedClassNamesOf(throwsDeclarations));
return new MethodProcessor(className, accessHandler, codeUnitBuilder, declarationHandler);
}
Aggregations