Skip to content

Commit

Permalink
Addressed a review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
imalygin committed Jan 12, 2024
1 parent 85408e4 commit f10c738
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

/**
Expand All @@ -32,9 +33,10 @@ public final class Common {
public static final int TYPE_LENGTH_DELIMITED = 2;
/** Wire format code for fixed 32bit number */
public static final int TYPE_FIXED32 = 5;
private static final Pattern COMPARABLE_PATTERN = Pattern.compile("class\\s+\\w+\\s+implements\\s+Comparable");


/**
/**
* Makes a tag value given a field number and wire type.
*
* @param wireType the wire type part of tag
Expand Down Expand Up @@ -633,7 +635,7 @@ private static void verifyComparable(final Field field, File destinationSrcDir)
try (BufferedReader reader = new BufferedReader(new FileReader(javaFile))) {
String line;
while ((line = reader.readLine()) != null) {
if (line.contains("implements Comparable")) {
if (COMPARABLE_PATTERN.matcher(line).matches()) {
return;
}
}
Expand Down

0 comments on commit f10c738

Please sign in to comment.