Skip to content

Commit bfcfe29

Browse files
committed
or(OrEmpty)
1 parent 91b3fb5 commit bfcfe29

File tree

1 file changed

+2
-3
lines changed
  • dot-parse/src/main/java/com/google/common/labs/parse

1 file changed

+2
-3
lines changed

dot-parse/src/main/java/com/google/common/labs/parse/Parser.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ public static <T> Parser<T> anyOf(Parser<? extends T>... parsers) {
353353
}
354354

355355
/** Matches if {@code this} or {@code that} matches. */
356-
public final Parser<T> or(Parser<T> that) {
356+
public final Parser<T> or(Parser<? extends T> that) {
357357
return anyOf(this, that);
358358
}
359359

@@ -363,9 +363,8 @@ public final Parser<T> or(Parser<T> that) {
363363
*
364364
* @since 9.4
365365
*/
366-
@SuppressWarnings("unchecked") // Parser<T> is covariant
367366
public final Parser<T>.OrEmpty or(Parser<? extends T>.OrEmpty that) {
368-
return or((Parser<T>) that.notEmpty()).new OrEmpty(that.defaultSupplier);
367+
return or(that.notEmpty()).new OrEmpty(that.defaultSupplier);
369368
}
370369

371370
/** Returns a parser that applies this parser at least once, greedily. */

0 commit comments

Comments
 (0)