convert_anonymous_to_lambda
Replace anonymous class implementations of functional interfaces with lambda expressions. Requires file path and zero-based line/column of the 'new' keyword.
Instructions
Convert an anonymous class implementing a functional interface to a lambda expression.
Returns the text edit needed to convert the anonymous class to a lambda. The caller should apply this edit to perform the conversion.
USAGE: Position cursor on the 'new' keyword of the anonymous class OUTPUT: Edit to replace anonymous class with lambda
IMPORTANT: Uses ZERO-BASED coordinates. REQUIREMENTS: The anonymous class must implement a functional interface (exactly one abstract method).
Requires load_project to be called first.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"filePath": "<filePath>",
"line": "<line>",
"column": "<column>"
},
"name": "convert_anonymous_to_lambda"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| line | Yes | Zero-based line number of anonymous class (on 'new' keyword) | |
| column | Yes | Zero-based column number | |
| filePath | Yes | Path to source file |