Skip to content

Commit

Permalink
Better error message when missing context parameter (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
slinkydeveloper authored Jul 25, 2024
1 parent cf60abf commit 4455eec
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,10 @@ private void validateMethodSignature(
}

private void validateFirstParameterType(Class<?> clazz, ExecutableElement element) {
if (!types.isSameType(
element.getParameters().get(0).asType(),
elements.getTypeElement(clazz.getCanonicalName()).asType())) {
if (element.getParameters().isEmpty()
|| !types.isSameType(
element.getParameters().get(0).asType(),
elements.getTypeElement(clazz.getCanonicalName()).asType())) {
messager.printMessage(
Diagnostic.Kind.ERROR,
"The method signature must have " + clazz.getCanonicalName() + " as first parameter",
Expand Down

0 comments on commit 4455eec

Please sign in to comment.