Untitled conversation
- User
[BUG] @Tool methods not inherited from superclas
@Toolmethods not inherited from superclass. I think this is a bug as this is something that should work.I didn't 100% verify this, but my inherited tools weren't being called and the LLM was stating that it didn't know what tool to call. Once I put the tool methods back in the concrete class, things worked, so I'm assuming that this bug report is true.
This should be done in LC4J too if it already doesn't work there.
Interface
No new interfaces are introduced.
- Assistant
Now let me check the
AgenticServicesusage and existing tests: - Assistant
Now I'll implement. First, add a hierarchy-aware method scanner in core
Utils: - Assistant
Now update
ToolSpecifications.toolSpecificationsFrom(Class): - Assistant
Now update
ToolService.findTools: - Assistant
Now
DefaultToolExecutor.findMethod: - Assistant
Now let's add tests. First look at existing test styles:
- Assistant
Now add tests. First to
ToolSpecificationsTest: - Assistant
Now add a direct test for the Utils helper (including the generic/bridge case):
- Assistant
Now add a
findToolsinheritance test inToolServiceTest: - Assistant
Now build and run the relevant tests:
- Assistant
The
${org.mockito...}argLine placeholder needs the full lifecycle. Use thetestphase: - Assistant
All targeted tests pass. Now run the full unit test suites of both affected modules to check for regressions:
- Assistant
While that runs, let me check for any other
@Toolscanning sites: - Assistant
The only failure is
UrlDocumentLoaderTest.should_load_text_document— ajava.net.ConnectException: Connection timed outfetching an external URL, which is a network/sandbox limitation unrelated to this change (langchain4j-core: 1090/1090 passed; langchain4j: 1384/1385 passed, the 1 error being that network test).Summary
Fixed the bug where
@Toolmethods declared in a superclass were not discovered, so the LLM never saw them as available tools.Root cause: three places scanned only , which returns methods declared directly on the concrete class — never inherited ones.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.