Skip to content

Commit 4ee8738

Browse files
committed
quick reject varargs in optional matcher
1 parent 880ab90 commit 4ee8738

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

compiler/src/main/java/net/jbock/convert/match/OptionalMatcher.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ public class OptionalMatcher implements Matcher {
3232
public <M extends AnnotatedMethod>
3333
Optional<Match<M>> tryMatch(
3434
M sourceMethod) {
35+
if (sourceMethod.isVarargsParameter()) {
36+
return Optional.empty(); // A VarargsParameter cannot match as an Optional.
37+
}
3538
TypeMirror returnType = sourceMethod.returnType();
3639
return getOptionalPrimitive(sourceMethod, returnType)
3740
.or(() -> matchOptional(sourceMethod, returnType));

0 commit comments

Comments
 (0)