Help AI coding agents use Java Optional well in new code and cleanups, without replacing one antipattern with another.
100
100%
Does it follow best practices?
Impact
100%
2.08xAverage score across 4 eval scenarios
Passed
No known issues
{
"context": "Representative front-matter cleanup: add parsing behavior while moving repeated Optional value reads into a helper/Optional boundary.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Compiles and creates requested artifact",
"description": "Creates a coherent Java 8-compatible WorkflowPortLookup.java with workflowServerPortReservation(Optional<Map<String,Object>>, Path).",
"max_score": 3
},
{
"name": "Implements Number and String behavior",
"description": "Returns Optional.of(number.intValue()) for Number values and Optional.of(parsed) for trimmed numeric String values.",
"max_score": 6
},
{
"name": "Handles absent and invalid values",
"description": "Returns Optional.empty() without throwing for absent front matter, missing key, null values, blank strings, malformed strings, and unsupported types.",
"max_score": 3
},
{
"name": "Preserves public contract",
"description": "Does not expose workflowPath in output and keeps the method signature and Optional<Integer> return contract.",
"max_score": 3
},
{
"name": "Uses Optional boundary without reopening",
"description": "Moves map access into an Optional map/flatMap helper or equivalent value-binding shape instead of guarding then reading frontMatter.get().",
"max_score": 55
},
{
"name": "Avoids null or fake collection workarounds",
"description": "Does not use orElse(null), local null branching, Optional.stream().toList(), or a loop over one Optional.",
"max_score": 25
},
{
"name": "Keeps parser readable",
"description": "Keeps parsing small and local, with clear Number/String handling and no broad exception swallowing beyond malformed numeric input.",
"max_score": 5
}
]
}