From 1b0098693c81176861963331d9be5bde0e4d39c3 Mon Sep 17 00:00:00 2001 From: Peter Gafert Date: Sun, 24 Jan 2021 20:31:53 +0100 Subject: [PATCH] rename `importAsmType` -> `importAsmTypeFromDescriptor` A method taking a `String` as parameter should clearly state what format the string has. A `String` is not an "ASM type". Signed-off-by: Peter Gafert --- .../com/tngtech/archunit/core/importer/AccessRecord.java | 2 +- .../archunit/core/importer/JavaClassDescriptorImporter.java | 2 +- .../tngtech/archunit/core/importer/JavaClassProcessor.java | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/archunit/src/main/java/com/tngtech/archunit/core/importer/AccessRecord.java b/archunit/src/main/java/com/tngtech/archunit/core/importer/AccessRecord.java index 8a0dc24e99..79c2c679fe 100644 --- a/archunit/src/main/java/com/tngtech/archunit/core/importer/AccessRecord.java +++ b/archunit/src/main/java/com/tngtech/archunit/core/importer/AccessRecord.java @@ -233,7 +233,7 @@ public JavaCodeUnit getCaller() { @Override public FieldAccessTarget getTarget() { Supplier> fieldSupplier = new FieldTargetSupplier(targetOwner.getAllFields(), record.target); - JavaClass fieldType = classes.getOrResolve(JavaClassDescriptorImporter.importAsmType(record.target.desc).getFullyQualifiedClassName()); + JavaClass fieldType = classes.getOrResolve(JavaClassDescriptorImporter.importAsmTypeFromDescriptor(record.target.desc).getFullyQualifiedClassName()); return new FieldAccessTargetBuilder() .withOwner(targetOwner) .withName(record.target.name) diff --git a/archunit/src/main/java/com/tngtech/archunit/core/importer/JavaClassDescriptorImporter.java b/archunit/src/main/java/com/tngtech/archunit/core/importer/JavaClassDescriptorImporter.java index fbaa371d83..5d317da71f 100644 --- a/archunit/src/main/java/com/tngtech/archunit/core/importer/JavaClassDescriptorImporter.java +++ b/archunit/src/main/java/com/tngtech/archunit/core/importer/JavaClassDescriptorImporter.java @@ -42,7 +42,7 @@ static Object importAsmTypeIfPossible(Object value) { return isAsmType(value) ? importAsmType((Type) value) : value; } - static JavaClassDescriptor importAsmType(String typeDescriptor) { + static JavaClassDescriptor importAsmTypeFromDescriptor(String typeDescriptor) { return importAsmType(Type.getType(typeDescriptor)); } diff --git a/archunit/src/main/java/com/tngtech/archunit/core/importer/JavaClassProcessor.java b/archunit/src/main/java/com/tngtech/archunit/core/importer/JavaClassProcessor.java index a578d7b568..4c3ffc3b7d 100644 --- a/archunit/src/main/java/com/tngtech/archunit/core/importer/JavaClassProcessor.java +++ b/archunit/src/main/java/com/tngtech/archunit/core/importer/JavaClassProcessor.java @@ -206,7 +206,7 @@ public FieldVisitor visitField(int access, String name, String desc, String sign DomainBuilders.JavaFieldBuilder fieldBuilder = new DomainBuilders.JavaFieldBuilder() .withName(name) - .withType(JavaClassDescriptorImporter.importAsmType(desc)) + .withType(JavaClassDescriptorImporter.importAsmTypeFromDescriptor(desc)) .withModifiers(JavaModifier.getModifiersForField(access)) .withDescriptor(desc); declarationHandler.onDeclaredField(fieldBuilder); @@ -500,7 +500,7 @@ public void visitEnd() { } private static DomainBuilders.JavaAnnotationBuilder annotationBuilderFor(String desc) { - return new DomainBuilders.JavaAnnotationBuilder().withType(JavaClassDescriptorImporter.importAsmType(desc)); + return new DomainBuilders.JavaAnnotationBuilder().withType(JavaClassDescriptorImporter.importAsmTypeFromDescriptor(desc)); } private static class AnnotationProcessor extends AnnotationVisitor { @@ -736,7 +736,7 @@ private static ValueBuilder javaEnumBuilder(final String desc, final String valu public Optional build(T owner, ImportContext importContext) { return Optional.of( new DomainBuilders.JavaEnumConstantBuilder() - .withDeclaringClass(importContext.resolveClass(JavaClassDescriptorImporter.importAsmType(desc).getFullyQualifiedClassName())) + .withDeclaringClass(importContext.resolveClass(JavaClassDescriptorImporter.importAsmTypeFromDescriptor(desc).getFullyQualifiedClassName())) .withName(value) .build()); }