diff --git a/pbj-core/pbj-compiler/src/main/java/com/hedera/pbj/compiler/impl/Common.java b/pbj-core/pbj-compiler/src/main/java/com/hedera/pbj/compiler/impl/Common.java index d5ec05de..0ad0f0ab 100644 --- a/pbj-core/pbj-compiler/src/main/java/com/hedera/pbj/compiler/impl/Common.java +++ b/pbj-core/pbj-compiler/src/main/java/com/hedera/pbj/compiler/impl/Common.java @@ -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; /** @@ -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 @@ -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; } }