When I execute textDocument/callHierarchy/outgoingCalls on the following method which has a method reference :: style invocation, it does not detect it:
public void testCollections() {
List<String> list = List.of("A");
list.stream()
.map(testProjectService::addItem) <-- THIS
.toList();
}
Call Hierarchy Output:
0 = {CallHierarchyOutgoingCall@6385} "CallHierarchyOutgoingCall [
to = CallHierarchyItem [
name = "of(E) <E> : List<E>"
detail = "java.util.List"
kind = Method
tags = null
uri = "jdt://contents/java.base/java.util/List.class?=test-project/%5C/Library%5C/Java%5C/JavaVirtualMachines%5C/jdk-21.0.2.jdk%5C/Contents%5C/Home%5C/lib%5C/jrt-fs.jar%60java.base=/javadoc_location=/https:%5C/%5C/docs.oracle.com%5C/en%5C/java%5C/javase%5C/21%5C/docs%5C/api%5C/=/=/maven.pomderived=/true=/%3Cjava.util(List.class"
range = Range [
start = Position [
line = 923
character = 4
]
end = Position [
line = 937
character = 5
]
]
selectionRange = Range [
start = Position [
line = 935
character = 23
]
end = Position [
line = 935
character = 25
]
]
data = null
]
fromRanges = ArrayList (
Range [
start = Position [
line = 36
character = 28
]
end = Position [
"
1 = {CallHierarchyOutgoingCall@6386} "CallHierarchyOutgoingCall [
to = CallHierarchyItem [
name = "stream() : Stream<E>"
detail = "java.util.Collection"
kind = Method
tags = null
uri = "jdt://contents/java.base/java.util/Collection.class?=test-project/%5C/Library%5C/Java%5C/JavaVirtualMachines%5C/jdk-21.0.2.jdk%5C/Contents%5C/Home%5C/lib%5C/jrt-fs.jar%60java.base=/javadoc_location=/https:%5C/%5C/docs.oracle.com%5C/en%5C/java%5C/javase%5C/21%5C/docs%5C/api%5C/=/=/maven.pomderived=/true=/%3Cjava.util(Collection.class"
range = Range [
start = Position [
line = 733
character = 4
]
end = Position [
line = 750
character = 5
]
]
selectionRange = Range [
start = Position [
line = 748
character = 22
]
end = Position [
line = 748
character = 28
]
]
data = null
]
fromRanges = ArrayList (
Range [
start = Position [
line = 37
character = 8
]
e"
2 = {CallHierarchyOutgoingCall@6387} "CallHierarchyOutgoingCall [
to = CallHierarchyItem [
name = "map(Function<? super T, ? extends R>) <R> : Stream<R>"
detail = "java.util.stream.Stream"
kind = Method
tags = null
uri = "jdt://contents/java.base/java.util.stream/Stream.class?=test-project/%5C/Library%5C/Java%5C/JavaVirtualMachines%5C/jdk-21.0.2.jdk%5C/Contents%5C/Home%5C/lib%5C/jrt-fs.jar%60java.base=/javadoc_location=/https:%5C/%5C/docs.oracle.com%5C/en%5C/java%5C/javase%5C/21%5C/docs%5C/api%5C/=/=/maven.pomderived=/true=/%3Cjava.util.stream(Stream.class"
range = Range [
start = Position [
line = 180
character = 4
]
end = Position [
line = 193
character = 63
]
]
selectionRange = Range [
start = Position [
line = 193
character = 18
]
end = Position [
line = 193
character = 21
]
]
data = null
]
fromRanges = ArrayList (
Range [
start = Position [
line"
3 = {CallHierarchyOutgoingCall@6388} "CallHierarchyOutgoingCall [
to = CallHierarchyItem [
name = "toList() : List<T>"
detail = "java.util.stream.Stream"
kind = Method
tags = null
uri = "jdt://contents/java.base/java.util.stream/Stream.class?=test-project/%5C/Library%5C/Java%5C/JavaVirtualMachines%5C/jdk-21.0.2.jdk%5C/Contents%5C/Home%5C/lib%5C/jrt-fs.jar%60java.base=/javadoc_location=/https:%5C/%5C/docs.oracle.com%5C/en%5C/java%5C/javase%5C/21%5C/docs%5C/api%5C/=/=/maven.pomderived=/true=/%3Cjava.util.stream(Stream.class"
range = Range [
start = Position [
line = 1166
character = 4
]
end = Position [
line = 1198
character = 5
]
]
selectionRange = Range [
start = Position [
line = 1196
character = 20
]
end = Position [
line = 1196
character = 26
]
]
data = null
]
fromRanges = ArrayList (
Range [
start = Position [
line = 37
character = 8
"
When I change the method reference to a lambda, I see the method invocation in the response from callHierarchy.
public void testCollections() {
List<String> list = List.of("A");
list.stream()
.map(item -> testProjectService.addItem(item)) <-- THIS IS NOW USING A LAMBDA
.toList();
}
0 = {CallHierarchyOutgoingCall@6358} "CallHierarchyOutgoingCall [
...
...
...
4 = {CallHierarchyOutgoingCall@6362} "CallHierarchyOutgoingCall [
to = CallHierarchyItem [
name = "addItem(String) : String"
detail = "com.example.TestProjectService"
kind = Method
tags = null
uri = "file:///Users/deepak/java-monorepo/test-project/src/main/java/com/example/TestProjectService.java"
range = Range [
start = Position [
line = 7
character = 4
]
end = Position [
line = 7
character = 32
]
]
selectionRange = Range [
start = Position [
line = 7
character = 11
]
end = Position [
line = 7
character = 18
]
]
data = null
]
fromRanges = ArrayList (
Range [
start = Position [
line = 38
character = 29
]
end = Position [
line = 38
character = 61
]
]
)
]"
Did I miss something that is causing this to happen?
Running on MacOS Ventura 13.3
JDT LS Version: 1.44.0
Java version: jdk-21.0.2
org.eclipse.lsp4j Java client version (via maven): 0.24.0
When I execute
textDocument/callHierarchy/outgoingCallson the following method which has a method reference::style invocation, it does not detect it:When I change the method reference to a lambda, I see the method invocation in the response from callHierarchy.
Did I miss something that is causing this to happen?
Running on MacOS Ventura 13.3
JDT LS Version: 1.44.0
Java version: jdk-21.0.2
org.eclipse.lsp4j Java client version (via maven): 0.24.0