ISSUE DESCRIPTION [BUG] @Tool methods not inherited from superclas @Tool methods not…
- User
ISSUE DESCRIPTION
[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.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /langchain4j, current file: none) bash-$
- Assistant
I'll start by exploring the repository structure and locating how
@Toolmethods are discovered. - Assistant
Let me search more specifically for tool-related source files.
- Assistant
I'll inspect how tools are discovered from classes.
- Assistant
getDeclaredMethods()skips inherited methods — next I'll checkToolServiceand related discovery code. - Assistant
That's odd - no output? Let me try again with a different approach.
- Assistant
I'll open
ToolServiceandDefaultToolExecutornext. - Assistant
I'll inspect
getAnnotatedMethodand existing tests for inheritance behavior. - Assistant
I'll check the helper and documentation around inherited tools.
- Assistant
I'll review the existing tests and hierarchy-related utilities.
- Assistant
Checking for existing method-hierarchy helpers and reviewing related agentic code.
- Assistant
I'll read the tools registration flow and DefaultToolExecutor constructor paths.
- Assistant
I'll check Spring integration and any other tool scanners that need the same fix.
- Assistant
Checking class metadata provider usage for tool discovery.
- Assistant
I'll add a shared helper to discover
@Toolmethods across the class hierarchy, then wire it into the call sites. - Assistant
Updating
ToolSpecificationsto walk the superclass chain for@Toolmethods. - Assistant
Cleaning unused imports and updating ToolService.
- Assistant
I'll open the file at the top and remove the unused import.
- Assistant
I'll enhance
toolMethodsFromso it still works with proxies viagetAnnotatedMethod. - Assistant
Now update the toolMethodsFrom body to use getAnnotatedMethod.
- Assistant
Need to goto the line first.
- Assistant
Now I can replace.
- Assistant
Updating
ToolService.findToolsto use the shared discovery helper. - Assistant
I'll update ToolService.findTools and imports.
- Assistant
Need to go to top of file
- Assistant
Now replace imports and findTools.
- Assistant
Optional might still be used elsewhere in the file. Let me check and update findTools.
- Assistant
I removed getAnnotatedMethod import but it's still used. I'll rewrite findTools to use toolMethodsFrom.
- Assistant
Updating
DefaultToolExecutorand theAiServicesdocs next. - Assistant
Update findMethod and AiServices docs.
- Assistant
Update AiServices docs.
- Assistant
I'll create a temporary verification script and compile the changed modules.
- Assistant
HOME isn't set—I'll configure it and retry the build.
- Assistant
Build seems to have succeeded (quiet mode). Let me compile and run the check script.
- Assistant
Running existing unit tests for the affected components.
- Assistant
Checking for other outdated references and verifying multi-level inheritance.
- Assistant
Checking docs for stale mentions of ignored inheritance.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.5-35B-A3BCompare side by side →
Qwen/Qwen3.5-35B-A3BCompare side by side →