Skip to content

Commit

Permalink
MNEMONIC-793: Optimising performance of buildEntityMethodSpecs
Browse files Browse the repository at this point in the history
  • Loading branch information
katarinaking authored and AI-Memory committed Aug 21, 2023
1 parent d14d796 commit 46766b3
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -895,13 +895,13 @@ protected void buildEntityMethodSpecs(TypeSpec.Builder typespecbuilder) throws A
String factoryproxyname = m_fieldsinfo.get("factoryproxy").name;
String genericfieldname = m_fieldsinfo.get("genericfield").name;
String reclaimctxname = m_fieldsinfo.get("reclaimcontext").name;
for (String name : m_entitymtdinfo.keySet()) {
methodinfo = m_entitymtdinfo.get(name);
for (Map.Entry<String, MethodInfo> entry : m_entitymtdinfo.entrySet()) {
methodinfo = entry.getValue();
code = CodeBlock.builder();
arg0 = methodinfo.elem.getParameters().get(0);
arg1 = methodinfo.elem.getParameters().get(1);
arg2 = methodinfo.elem.getParameters().get(2);
switch (name) {
switch (entry.getKey()) {
case "initializeDurableEntity":
arg3 = methodinfo.elem.getParameters().get(3);
arg4 = methodinfo.elem.getParameters().get(4);
Expand Down Expand Up @@ -950,7 +950,7 @@ protected void buildEntityMethodSpecs(TypeSpec.Builder typespecbuilder) throws A
// code.endControlFlow();
code.addStatement("initializeDurableEntity($1L, $2L, $3L, $4L, $5L)", arg0, arg1, arg2, arg4, arg5);
code.beginControlFlow("if (0L == $1L)", arg3);
code.addStatement("throw new RestoreDurableEntityError(\"Input handler is null on $1N.\")", name);
code.addStatement("throw new RestoreDurableEntityError(\"Input handler is null on $1N.\")", entry.getKey());
code.endControlFlow();
code.addStatement("$1N = $2N.retrieveChunk($3L, $4N, $5N)",
holdername, allocname, arg3, autoreclaimname, reclaimctxname);
Expand All @@ -960,7 +960,7 @@ protected void buildEntityMethodSpecs(TypeSpec.Builder typespecbuilder) throws A
code.addStatement("initializeAfterRestore()");
break;
default:
throw new AnnotationProcessingException(null, "Method %s is not supported.", name);
throw new AnnotationProcessingException(null, "Method %s is not supported.", entry.getKey());
}
typespecbuilder.addMethod(methodinfo.specbuilder.addCode(code.build()).build());
}
Expand Down

0 comments on commit 46766b3

Please sign in to comment.