Skip to content

Commit ab4d42e

Browse files
committed
refactoring
1 parent 5f31cb7 commit ab4d42e

File tree

1 file changed

+6
-5
lines changed
  • compiler/src/main/java/io/jbock/simple/processor/util

1 file changed

+6
-5
lines changed

compiler/src/main/java/io/jbock/simple/processor/util/Printing.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@ public final class Printing {
1414

1515
public static final String INDENT = " ";
1616
public static final String DOUBLE_INDENT = INDENT + INDENT;
17-
17+
1818
public static String elementToString(Element element) {
1919
if (element.getKind() == ElementKind.PARAMETER) {
2020
return Visitors.PARAMETER_VISITOR.visit(element).getSimpleName().toString();
2121
}
22-
if (!(element instanceof ExecutableElement)) {
23-
throw new IllegalArgumentException("unexpected kind: " + element.getKind());
22+
ExecutableElement executableElement = EXECUTABLE_ELEMENT_VISITOR.visit(element);
23+
if (executableElement == null) {
24+
throw new UnsupportedOperationException("Can't determine string for element " + element);
2425
}
25-
StringBuilder result = enclosingTypeAndMemberName((ExecutableElement) element);
26-
result.append(EXECUTABLE_ELEMENT_VISITOR.visit(element).getParameters().stream()
26+
StringBuilder result = enclosingTypeAndMemberName(executableElement);
27+
result.append(executableElement.getParameters().stream()
2728
.map(parameter -> TypeName.get(parameter.asType()).toString())
2829
.collect(joining(", ", "(", ")")));
2930
return result.toString();

0 commit comments

Comments
 (0)