Skip to content

Commit

Permalink
rename importAsmType -> importAsmTypeFromDescriptor
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
codecholeric committed Jan 30, 2021
1 parent 21a074a commit 1b00986
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public JavaCodeUnit getCaller() {
@Override
public FieldAccessTarget getTarget() {
Supplier<Optional<JavaField>> 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -736,7 +736,7 @@ private static ValueBuilder javaEnumBuilder(final String desc, final String valu
public <T extends HasDescription> Optional<Object> build(T owner, ImportContext importContext) {
return Optional.<Object>of(
new DomainBuilders.JavaEnumConstantBuilder()
.withDeclaringClass(importContext.resolveClass(JavaClassDescriptorImporter.importAsmType(desc).getFullyQualifiedClassName()))
.withDeclaringClass(importContext.resolveClass(JavaClassDescriptorImporter.importAsmTypeFromDescriptor(desc).getFullyQualifiedClassName()))
.withName(value)
.build());
}
Expand Down

0 comments on commit 1b00986

Please sign in to comment.