Skip to content

Commit 778cacf

Browse files
committed
GH-1041: finally removing main obsolete symbol add-on information interface
1 parent ad39b9f commit 778cacf

18 files changed

+65
-194
lines changed

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/app/SpringSymbolIndex.java

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2017, 2024 Pivotal, Inc.
2+
* Copyright (c) 2017, 2025 Pivotal, Inc.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -25,7 +25,6 @@
2525
import java.util.Iterator;
2626
import java.util.List;
2727
import java.util.Map;
28-
import java.util.Objects;
2928
import java.util.Optional;
3029
import java.util.Set;
3130
import java.util.concurrent.CompletableFuture;
@@ -57,7 +56,6 @@
5756
import org.springframework.ide.vscode.boot.java.BootJavaLanguageServerComponents;
5857
import org.springframework.ide.vscode.boot.java.annotations.AnnotationHierarchyAwareLookup;
5958
import org.springframework.ide.vscode.boot.java.handlers.EnhancedSymbolInformation;
60-
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
6159
import org.springframework.ide.vscode.boot.java.handlers.SymbolProvider;
6260
import org.springframework.ide.vscode.boot.java.reconcilers.JdtReconciler;
6361
import org.springframework.ide.vscode.boot.java.utils.CompilationUnitCache;
@@ -747,42 +745,6 @@ public List<? extends WorkspaceSymbol> getSymbols(String docURI) {
747745
}
748746
}
749747

750-
public List<SymbolAddOnInformation> getAllAdditionalInformation(Predicate<SymbolAddOnInformation> filter) {
751-
if (filter != null) {
752-
synchronized(symbols) {
753-
return symbols.stream()
754-
.map(s -> s.getAdditionalInformation())
755-
.filter(Objects::nonNull)
756-
.flatMap(i -> Arrays.stream(i))
757-
.filter(filter)
758-
.collect(Collectors.toList());
759-
}
760-
}
761-
else {
762-
return Collections.emptyList();
763-
}
764-
}
765-
766-
public List<? extends SymbolAddOnInformation> getAdditonalInformation(String docURI) {
767-
List<EnhancedSymbolInformation> info = this.symbolsByDoc.get(docURI);
768-
769-
if (info != null) {
770-
synchronized(info) {
771-
ImmutableList.Builder<SymbolAddOnInformation> builder = ImmutableList.builder();
772-
for (EnhancedSymbolInformation enhanced : info) {
773-
SymbolAddOnInformation[] additionalInformation = enhanced.getAdditionalInformation();
774-
if (additionalInformation != null) {
775-
builder.add(additionalInformation);
776-
}
777-
}
778-
return builder.build();
779-
}
780-
}
781-
else {
782-
return Collections.emptyList();
783-
}
784-
}
785-
786748
@Override
787749
public CompletableFuture<List<Bean>> beans(BeansParams params) {
788750
String projectName = params.getProjectName();

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/index/cache/IndexCacheOnDisc.java

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import org.eclipse.lsp4j.Location;
3535
import org.slf4j.Logger;
3636
import org.slf4j.LoggerFactory;
37-
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
3837
import org.springframework.ide.vscode.commons.protocol.spring.AnnotationMetadata;
3938
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
4039
import org.springframework.ide.vscode.commons.protocol.spring.DefaultValues;
@@ -52,9 +51,6 @@
5251
import com.google.gson.JsonElement;
5352
import com.google.gson.JsonObject;
5453
import com.google.gson.JsonParseException;
55-
import com.google.gson.JsonPrimitive;
56-
import com.google.gson.JsonSerializationContext;
57-
import com.google.gson.JsonSerializer;
5854
import com.google.gson.reflect.TypeToken;
5955
import com.google.gson.stream.JsonReader;
6056

@@ -351,7 +347,6 @@ else if (key != null && !key.equals(cacheKey)
351347

352348
public static Gson createGson() {
353349
return new GsonBuilder()
354-
.registerTypeAdapter(SymbolAddOnInformation.class, new SymbolAddOnInformationAdapter())
355350
.registerTypeAdapter(Bean.class, new BeanJsonAdapter())
356351
.registerTypeAdapter(InjectionPoint.class, new InjectionPointJsonAdapter())
357352
.registerTypeAdapter(IndexCacheStore.class, new IndexCacheStoreAdapter())
@@ -426,33 +421,6 @@ public IndexCacheStore<?> deserialize(JsonElement json, Type typeOfT, JsonDeseri
426421

427422
}
428423

429-
/**
430-
* gson adapter to store subtype information for symbol addon informations
431-
*/
432-
private static class SymbolAddOnInformationAdapter implements JsonSerializer<SymbolAddOnInformation>, JsonDeserializer<SymbolAddOnInformation> {
433-
434-
@Override
435-
public JsonElement serialize(SymbolAddOnInformation addonInfo, Type typeOfSrc, JsonSerializationContext context) {
436-
JsonObject result = new JsonObject();
437-
result.add("type", new JsonPrimitive(addonInfo.getClass().getName()));
438-
result.add("data", context.serialize(addonInfo));
439-
return result;
440-
}
441-
442-
@Override
443-
public SymbolAddOnInformation deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException {
444-
JsonObject parsedObject = json.getAsJsonObject();
445-
String className = parsedObject.get("type").getAsString();
446-
JsonElement element = parsedObject.get("data");
447-
448-
try {
449-
return context.deserialize(element, Class.forName(className));
450-
} catch (ClassNotFoundException cnfe) {
451-
throw new JsonParseException("cannot parse data from unknown SymbolAddOnInformation subtype: " + type, cnfe);
452-
}
453-
}
454-
}
455-
456424
/**
457425
* gson adapter to store subtype information for beans
458426
*/

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/index/cache/IndexCacheOnDiscDeltaBased.java

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import org.eclipse.lsp4j.Location;
4242
import org.slf4j.Logger;
4343
import org.slf4j.LoggerFactory;
44-
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
4544
import org.springframework.ide.vscode.commons.protocol.spring.AnnotationMetadata;
4645
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
4746
import org.springframework.ide.vscode.commons.protocol.spring.DefaultValues;
@@ -371,7 +370,6 @@ private <T extends IndexCacheable> Pair<IndexCacheStore<T>, Integer> retrieveSto
371370
public static Gson createGson() {
372371
return new GsonBuilder()
373372
.registerTypeAdapter(DeltaStorage.class, new DeltaStorageAdapter())
374-
.registerTypeAdapter(SymbolAddOnInformation.class, new SymbolAddOnInformationAdapter())
375373
.registerTypeAdapter(Bean.class, new BeanJsonAdapter())
376374
.registerTypeAdapter(InjectionPoint.class, new InjectionPointJsonAdapter())
377375
.registerTypeAdapter(IndexCacheStore.class, new IndexCacheStoreAdapter())
@@ -637,30 +635,6 @@ public DeltaStorage<?> deserialize(JsonElement json, Type type, JsonDeserializat
637635
}
638636
}
639637

640-
private static class SymbolAddOnInformationAdapter implements JsonSerializer<SymbolAddOnInformation>, JsonDeserializer<SymbolAddOnInformation> {
641-
642-
@Override
643-
public JsonElement serialize(SymbolAddOnInformation addonInfo, Type typeOfSrc, JsonSerializationContext context) {
644-
JsonObject result = new JsonObject();
645-
result.add("type", new JsonPrimitive(addonInfo.getClass().getName()));
646-
result.add("data", context.serialize(addonInfo));
647-
return result;
648-
}
649-
650-
@Override
651-
public SymbolAddOnInformation deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException {
652-
JsonObject parsedObject = json.getAsJsonObject();
653-
String className = parsedObject.get("type").getAsString();
654-
JsonElement element = parsedObject.get("data");
655-
656-
try {
657-
return context.deserialize(element, Class.forName(className));
658-
} catch (ClassNotFoundException cnfe) {
659-
throw new JsonParseException("cannot parse data from unknown SymbolAddOnInformation subtype: " + type, cnfe);
660-
}
661-
}
662-
}
663-
664638
private static class BeanJsonAdapter implements JsonDeserializer<Bean> {
665639

666640
@Override

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/beans/BeansSymbolProvider.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
4040
import org.springframework.ide.vscode.boot.java.utils.CachedSymbol;
4141
import org.springframework.ide.vscode.boot.java.utils.FunctionUtils;
42-
import org.springframework.ide.vscode.boot.java.utils.SpringIndexerJavaContext;
4342
import org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava.SCAN_PASS;
43+
import org.springframework.ide.vscode.boot.java.utils.SpringIndexerJavaContext;
4444
import org.springframework.ide.vscode.commons.protocol.spring.AnnotationMetadata;
4545
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
4646
import org.springframework.ide.vscode.commons.protocol.spring.InjectionPoint;
@@ -103,8 +103,7 @@ public void addSymbols(Annotation node, ITypeBinding typeBinding, Collection<ITy
103103
new WorkspaceSymbol(
104104
beanLabel(isFunction, nameAndRegion.getT1(), beanType.getName(), "@Bean" + markerString),
105105
SymbolKind.Interface,
106-
Either.forLeft(location)),
107-
null
106+
Either.forLeft(location))
108107
);
109108

110109
InjectionPoint[] injectionPoints = ASTUtils.findInjectionPoints(method, doc);
@@ -142,7 +141,7 @@ protected void addSymbolsPass1(TypeDeclaration typeDeclaration, SpringIndexerJav
142141
Either.forLeft(beanLocation));
143142

144143
context.getGeneratedSymbols().add(new CachedSymbol(context.getDocURI(), context.getLastModified(),
145-
new EnhancedSymbolInformation(symbol, null)));
144+
new EnhancedSymbolInformation(symbol)));
146145

147146

148147
ITypeBinding concreteBeanType = typeDeclaration.resolveBinding();

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/beans/ComponentSymbolProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected void addSymbolsPass1(Annotation node, ITypeBinding annotationType, Col
6262
}
6363
else if (Annotations.NAMED_ANNOTATIONS.contains(annotationType.getQualifiedName())) {
6464
WorkspaceSymbol symbol = DefaultSymbolProvider.provideDefaultSymbol(node, doc);
65-
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol, null);
65+
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol);
6666
context.getGeneratedSymbols().add(new CachedSymbol(context.getDocURI(), context.getLastModified(), enhancedSymbol));
6767
}
6868
}
@@ -108,7 +108,7 @@ protected Tuple.Two<EnhancedSymbolInformation, Bean> createSymbol(Annotation nod
108108

109109
Bean beanDefinition = new Bean(beanName, beanType.getQualifiedName(), location, injectionPoints, supertypes, annotations, isConfiguration);
110110

111-
return Tuple.two(new EnhancedSymbolInformation(symbol, null), beanDefinition);
111+
return Tuple.two(new EnhancedSymbolInformation(symbol), beanDefinition);
112112
}
113113

114114
protected String beanLabel(String searchPrefix, String annotationTypeName, Collection<String> metaAnnotationNames, String beanName, String beanType) {

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/beans/FeignClientSymbolProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ private Two<EnhancedSymbolInformation, Bean> createSymbol(Annotation node, IType
9797

9898
Bean beanDefinition = new Bean(beanName, beanType == null ? "" : beanType.getQualifiedName(), location, injectionPoints, supertypes, annotations, false);
9999

100-
return Tuple.two(new EnhancedSymbolInformation(symbol, null), beanDefinition);
100+
return Tuple.two(new EnhancedSymbolInformation(symbol), beanDefinition);
101101
}
102102

103103
protected String beanLabel(String searchPrefix, String annotationTypeName, Collection<String> metaAnnotationNames, String beanName, String beanType) {

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/data/DataRepositorySymbolProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protected void addSymbolsPass1(TypeDeclaration typeDeclaration, SpringIndexerJav
6363
SymbolKind.Interface,
6464
Either.forLeft(location));
6565

66-
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol, null);
66+
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol);
6767

6868
InjectionPoint[] injectionPoints = ASTUtils.findInjectionPoints(typeDeclaration, doc);
6969

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/handlers/EnhancedSymbolInformation.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2018, 2022 Pivotal, Inc.
2+
* Copyright (c) 2018, 2025 Pivotal, Inc.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -18,21 +18,15 @@
1818
public class EnhancedSymbolInformation {
1919

2020
private final WorkspaceSymbol symbol;
21-
private final SymbolAddOnInformation[] additionalInformation;
2221

23-
public EnhancedSymbolInformation(WorkspaceSymbol symbol, SymbolAddOnInformation[] additionalInformation) {
22+
public EnhancedSymbolInformation(WorkspaceSymbol symbol) {
2423
this.symbol = symbol;
25-
this.additionalInformation = additionalInformation;
2624
}
2725

2826
public WorkspaceSymbol getSymbol() {
2927
return symbol;
3028
}
3129

32-
public SymbolAddOnInformation[] getAdditionalInformation() {
33-
return additionalInformation;
34-
}
35-
3630
@Override
3731
public String toString() {
3832
return "EnhancedSymbolInformation [symbol=" + symbol + "]";

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/handlers/SymbolAddOnInformation.java

Lines changed: 0 additions & 17 deletions
This file was deleted.

headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/requestmapping/RequestMappingSymbolProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2017, 2024 Pivotal, Inc.
2+
* Copyright (c) 2017, 2025 Pivotal, Inc.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -69,7 +69,7 @@ protected void addSymbolsPass1(Annotation node, ITypeBinding annotationType, Col
6969
.filter(Objects::nonNull).map(p -> {
7070
return combinePath(parent, p);
7171
}))
72-
.map(p -> RouteUtils.createRouteSymbol(location, p, methods, contentTypes, acceptTypes, null))
72+
.map(p -> RouteUtils.createRouteSymbol(location, p, methods, contentTypes, acceptTypes))
7373
.forEach((enhancedSymbol) -> context.getGeneratedSymbols().add(new CachedSymbol(context.getDocURI(), context.getLastModified(), enhancedSymbol)));
7474
} catch (Exception e) {
7575
log.error("problem occured while scanning for request mapping symbols from " + doc.getUri(), e);

0 commit comments

Comments
 (0)