Skip to content

Commit

Permalink
Make hashcode and protobuf size cached, change model records to class…
Browse files Browse the repository at this point in the history
…es (#344)

Signed-off-by: jasperpotts <[email protected]>
Co-authored-by: jasperpotts <[email protected]>
  • Loading branch information
jasperpotts and jasperpotts authored Feb 14, 2025
1 parent 381ac5b commit cdb221f
Show file tree
Hide file tree
Showing 10 changed files with 680 additions and 429 deletions.
3 changes: 3 additions & 0 deletions pbj-core/hiero-dependency-versions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ dependencies.constraints {
api("io.helidon.common.features:helidon-common-features-processor:$helidon") {
because("io.helidon.common.features.processor")
}
api("io.helidon.config.metadata:helidon-config-metadata-codegen:$helidon") {
because("io.helidon.config.metadata.codegen")
}
api("io.helidon.config:helidon-config-metadata-processor:$helidon") {
because("io.helidon.config.metadata.processor")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public final class Common {
/** Number of bits used to represent the tag type */
static final int TAG_TYPE_BITS = 3;

private static final Pattern COMPARABLE_PATTERN = Pattern.compile("[)] implements Comparable<\\w+> [{]");
private static final Pattern COMPARABLE_PATTERN = Pattern.compile("implements Comparable<\\w+>\\s*\\{");

/**
* Makes a tag value given a field number and wire type.
Expand Down Expand Up @@ -156,8 +156,10 @@ public static String cleanJavaDocComment(String fieldComment) {
return cleanDocStr(
fieldComment
.replaceAll("/\\*\\*[\n\r\s\t]*\\*[\t\s]*|[\n\r\s\t]*\\*/", "") // remove java doc
.replaceAll("\n\s+\\*\s+", "\n") // remove indenting and *
.replaceAll("\n\s+\\*\s*\n", "\n\n") // remove indenting and *
.replaceAll("(^|\n)\s+\\*(\s+|\n|$)", "\n") // remove indenting and *
.replaceAll(
"(^|\n)\s+\\*(\s+|\n|$)",
"\n\n") // remove lines starting with * as these were empty lines
.replaceAll("/\\*\\*", "") // remove indenting and /** at beginning of comment.
.trim() // Remove leading and trailing spaces.
);
Expand Down Expand Up @@ -307,7 +309,7 @@ public static String getFieldsHashCode(final List<Field> fields, String generate
}
}
}
return generatedCodeSoFar.indent(DEFAULT_INDENT * 2);
return generatedCodeSoFar.indent(DEFAULT_INDENT * 3);
}

/**
Expand Down Expand Up @@ -723,7 +725,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 (COMPARABLE_PATTERN.matcher(line).matches()) {
if (COMPARABLE_PATTERN.matcher(line).find()) {
return;
}
}
Expand Down
Loading

0 comments on commit cdb221f

Please sign in to comment.