From dd830b569cf49bf59f0a7baabe83d3821c6dcb48 Mon Sep 17 00:00:00 2001 From: Jinbo Wang Date: Wed, 18 Dec 2019 23:37:26 +0800 Subject: [PATCH] GH-508: Adopt the upstream lsp4j snapshot for call hierarchy Signed-off-by: Jinbo Wang --- .../core/internal/handlers/CallHierarchyHandler.java | 12 +++--------- .../org.eclipse.jdt.ls.tp.target | 2 +- .../internal/handlers/CallHierarchyHandlerTest.java | 10 ++++------ 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/CallHierarchyHandler.java b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/CallHierarchyHandler.java index 12ed547adf..62f3e37d68 100644 --- a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/CallHierarchyHandler.java +++ b/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/handlers/CallHierarchyHandler.java @@ -190,10 +190,7 @@ private List getIncomingCallItemsAt(String uri, int l } CallHierarchyItem symbol = toCallHierarchyItem(call.getMember()); List ranges = toCallRanges(call.getMethodCall().getCallLocations()); - CallHierarchyIncomingCall incomingCall = new CallHierarchyIncomingCall(); - incomingCall.setFrom(symbol); - incomingCall.setFromRanges(ranges.toArray(new Range[0])); - result.add(incomingCall); + result.add(new CallHierarchyIncomingCall(symbol, ranges)); } return result; @@ -225,10 +222,7 @@ private List getOutgoingCallItemsAt(String uri, int l } CallHierarchyItem symbol = toCallHierarchyItem(call.getMember()); List ranges = toCallRanges(call.getMethodCall().getCallLocations()); - CallHierarchyOutgoingCall outgoingCall = new CallHierarchyOutgoingCall(); - outgoingCall.setTo(symbol); - outgoingCall.setFromRanges(ranges.toArray(new Range[0])); - result.add(outgoingCall); + result.add(new CallHierarchyOutgoingCall(symbol, ranges)); } return result; @@ -271,7 +265,7 @@ private CallHierarchyItem toCallHierarchyItem(IMember member) throws JavaModelEx IType declaringType = member.getDeclaringType(); item.setDetail(declaringType == null ? null : declaringType.getFullyQualifiedName()); if (JDTUtils.isDeprecated(member)) { - item.setTags(new SymbolTag[] { SymbolTag.Deprecated }); + item.setTags(Arrays.asList(SymbolTag.Deprecated)); } return item; diff --git a/org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target b/org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target index 970aed0308..2117fe4583 100644 --- a/org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target +++ b/org.eclipse.jdt.ls.target/org.eclipse.jdt.ls.tp.target @@ -43,7 +43,7 @@ - + diff --git a/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/CallHierarchyHandlerTest.java b/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/CallHierarchyHandlerTest.java index af40e06b5e..ba3aeee0ff 100644 --- a/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/CallHierarchyHandlerTest.java +++ b/org.eclipse.jdt.ls.tests/src/org/eclipse/jdt/ls/core/internal/handlers/CallHierarchyHandlerTest.java @@ -240,9 +240,9 @@ static CallHierarchyItem assertItem(CallHierarchyItem item, String name, SymbolK assertEquals(detail, item.getDetail()); if (deprecated) { assertNotNull(item.getTags()); - assertTrue(Stream.of(item.getTags()).anyMatch(tag -> tag == SymbolTag.Deprecated)); + assertTrue(item.getTags().stream().anyMatch(tag -> tag == SymbolTag.Deprecated)); } else { - assertTrue(item.getTags() == null || item.getTags().length == 0 || !Stream.of(item.getTags()).anyMatch(tag -> tag == SymbolTag.Deprecated)); + assertTrue(item.getTags() == null || item.getTags().isEmpty() || !item.getTags().stream().anyMatch(tag -> tag == SymbolTag.Deprecated)); } assertEquals(selectionStartLine, item.getSelectionRange().getStart().getLine()); @@ -255,14 +255,12 @@ static List prepareCallHierarchy(String uri, int line, int ch } static List getIncomingCalls(CallHierarchyItem item) { - CallHierarchyIncomingCallsParams params = new CallHierarchyIncomingCallsParams(); - params.setItem(item); + CallHierarchyIncomingCallsParams params = new CallHierarchyIncomingCallsParams(item); return new CallHierarchyHandler().callHierarchyIncomingCalls(params, new NullProgressMonitor()); } static List getOutgoings(CallHierarchyItem item) { - CallHierarchyOutgoingCallsParams params = new CallHierarchyOutgoingCallsParams(); - params.setItem(item); + CallHierarchyOutgoingCallsParams params = new CallHierarchyOutgoingCallsParams(item); return new CallHierarchyHandler().callHierarchyOutgoingCalls(params, new NullProgressMonitor()); }