Skip to content

Commit

Permalink
Fix class cast exception from UnknownType.
Browse files Browse the repository at this point in the history
  • Loading branch information
traceyyoshima committed Mar 7, 2023
1 parent 69d3900 commit 806ddd9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/main/java/org/openrewrite/kotlin/KotlinTypeMapping.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ private JavaType.FullyQualified classType(Object classType, String signature, @N
String classFqn = convertClassIdToFqn(sym.getClassId());

JavaType.FullyQualified fq = typeCache.get(classFqn);
if (fq instanceof JavaType.Unknown) {
return fq;
}

JavaType.Class clazz = (JavaType.Class) (fq instanceof JavaType.Parameterized ? ((JavaType.Parameterized) fq).getType() : fq);
if (clazz == null) {
clazz = new JavaType.Class(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1042,13 +1042,13 @@ public J visitFunctionCall(FirFunctionCall functionCall, ExecutionContext ctx) {
j = mapBinaryOperation(functionCall);
}
} else {
j = mapFunctionalCall(functionCall, origin == FirFunctionCallOrigin.Infix);
j = mapFunctionCall(functionCall, origin == FirFunctionCallOrigin.Infix);
}

return j;
}

private J mapFunctionalCall(FirFunctionCall functionCall, boolean isInfix) {
private J mapFunctionCall(FirFunctionCall functionCall, boolean isInfix) {
Space prefix = whitespace();

FirNamedReference namedReference = functionCall.getCalleeReference();
Expand Down

0 comments on commit 806ddd9

Please sign in to comment.