Skip to content

Commit acdce2a

Browse files
CopilotedburnsCopilot
committed
feat(java): implement ToolDefinition.from* lambda overloads (Phase 4.2) (#1857)
* Initial plan * feat(java): implement ToolDefinition.from* overloads for lambda-defined tools (Phase 4.2) Co-authored-by: edburns <75821+edburns@users.noreply.github.com> * Fix review comments: typed defaults, array items schema, primitive cast - buildSchemaFromParams: parse default values to declared type before placing in JSON schema (avoids String defaults for numeric/boolean) - schemaForClass: emit items schema for Java array types using getComponentType() for schema fidelity - coerceDefaultValue: use boxed valueOf() instead of type.cast() for primitive types to avoid ClassCastException Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix review round 3: ToolResultObject passthrough, Optional* schema - formatResult: pass ToolResultObject through directly instead of JSON-serializing, preserving structured result semantics - schemaForClass: add OptionalInt/OptionalLong/OptionalDouble support to match compile-time SchemaGenerator behavior Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix review round 4: Optional* coercion in coerceArg - Return OptionalInt.empty()/OptionalLong.empty()/OptionalDouble.empty() for missing non-required params instead of null - Construct Optional*.of(...) from Number when value is present - Avoids NPE and aligns with annotation-processor behavior Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix review round 5: null-future guards, Optional* cast safety, @SInCE tags - All async fromAsync*/fromAsyncWithToolInvocation handlers now check for null future and return failedFuture with clear NPE message - Optional* coercion catches ClassCastException for non-numeric values and throws IllegalArgumentException with diagnostic message - Fixed @SInCE 1.0.2 -> 1.0.6 on all new API entries (15 in ToolDefinition, 1 in Param) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: edburns <75821+edburns@users.noreply.github.com> Co-authored-by: Ed Burns <edburns@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5031181 commit acdce2a

2 files changed

Lines changed: 850 additions & 3 deletions

File tree

0 commit comments

Comments
 (0)