Skip to content

Commit

Permalink
Improve defaultErrorMessage() for AsSuperVisitor (typetools#6928)
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst authored Dec 17, 2024
1 parent 1c8b2ab commit f8f11f7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,22 @@ private boolean areErasedJavaTypesEquivalent(
return types.isSameType(underlyingTypeA, underlyingTypeB);
}

@Override
public String defaultErrorMessage(
AnnotatedTypeMirror type, AnnotatedTypeMirror superType, Void p) {
// Message is on one line, without line breaks, because in a stack trace only the first line
// of the message may be shown.
return String.format(
"%s: unexpected combination: type: [%s %s] %s superType: [%s %s] %s",
this.getClass().getSimpleName(),
type.getKind(),
type.getClass(),
type,
superType.getKind(),
superType.getClass(),
superType);
}

// <editor-fold defaultstate="collapsed" desc="visitArray_Other methods">
@Override
public AnnotatedTypeMirror visitArray_Array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ default String defaultErrorMessage(
// Message is on one line, without line breaks, because in a stack trace only the first line
// of the message may be shown.
return String.format(
"%s: unexpected combination: type: [%s %s] %s supertype: [%s %s] %s",
"%s: unexpected combination: type1: [%s %s] %s type2: [%s %s] %s",
this.getClass().getSimpleName(),
type1.getKind(),
type1.getClass(),
Expand Down

0 comments on commit f8f11f7

Please sign in to comment.