Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
BoykoAlex committed Jan 16, 2025
2 parents 05cb65e + 8adb263 commit 58ee5ae
Show file tree
Hide file tree
Showing 61 changed files with 166 additions and 262 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Version: @QUALIFIER@\n\
Build Id: @BUILD_ID@\n\
Revision: @REVISION@\n\
\n\
Copyright (c) 2007 - 2024 Broadcom\n\
Copyright (c) 2007 - 2025 Broadcom\n\
All rights reserved. Visit https://spring.io/tools\n\
\n\
This product includes software developed by the\n\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Version: @QUALIFIER@\n\
Build Id: @BUILD_ID@\n\
Revision: @REVISION@\n\
\n\
Copyright (c) 2007 - 2024 Broadcom\n\
Copyright (c) 2007 - 2025 Broadcom\n\
All rights reserved. Visit https://spring.io/tools\n\
\n\
This product includes software developed by the\n\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This feature contains the Eclipse-UI-specific STS 4 components

# "copyright" property - text of the Copyright
copyright=\
Copyright (c) 2024 Broadcom
Copyright (c) 2025 Broadcom

################ end of copyright property ####################################

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Spring Boot Language Server

# "copyright" property - text of the Copyright
copyright=\
Copyright (c) 2024 Broadcom
Copyright (c) 2025 Broadcom

################ end of copyright property ####################################

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ BOSH Manifest Language Server

# "copyright" property - text of the Copyright
copyright=\
Copyright (c) 2024 Broadcom
Copyright (c) 2025 Broadcom

################ end of copyright property ####################################

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description=\
This feature provides the language server to support editing cloud foundry manifest files

copyright=\
Copyright (c) 2024 Broadcom
Copyright (c) 2025 Broadcom

################ end of copyright property ####################################

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Integeation of the Cloud Foundry Manifest Language Server Extension into the Gen

# "copyright" property - text of the Copyright
copyright=\
Copyright (c) 2024 Broadcom
Copyright (c) 2025 Broadcom

################ end of copyright property ####################################

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Concourse Pipeline and Task Language Server

# "copyright" property - text of the Copyright
copyright=\
Copyright (c) 2024 Broadcom
Copyright (c) 2025 Broadcom

################ end of copyright property ####################################

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2023, 2024 VMware, Inc.
* Copyright (c) 2023, 2025 VMware, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2024 Pivotal, Inc.
* Copyright (c) 2017, 2025 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand All @@ -25,7 +25,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -57,7 +56,6 @@
import org.springframework.ide.vscode.boot.java.BootJavaLanguageServerComponents;
import org.springframework.ide.vscode.boot.java.annotations.AnnotationHierarchyAwareLookup;
import org.springframework.ide.vscode.boot.java.handlers.EnhancedSymbolInformation;
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
import org.springframework.ide.vscode.boot.java.handlers.SymbolProvider;
import org.springframework.ide.vscode.boot.java.reconcilers.JdtReconciler;
import org.springframework.ide.vscode.boot.java.utils.CompilationUnitCache;
Expand Down Expand Up @@ -747,42 +745,6 @@ public List<? extends WorkspaceSymbol> getSymbols(String docURI) {
}
}

public List<SymbolAddOnInformation> getAllAdditionalInformation(Predicate<SymbolAddOnInformation> filter) {
if (filter != null) {
synchronized(symbols) {
return symbols.stream()
.map(s -> s.getAdditionalInformation())
.filter(Objects::nonNull)
.flatMap(i -> Arrays.stream(i))
.filter(filter)
.collect(Collectors.toList());
}
}
else {
return Collections.emptyList();
}
}

public List<? extends SymbolAddOnInformation> getAdditonalInformation(String docURI) {
List<EnhancedSymbolInformation> info = this.symbolsByDoc.get(docURI);

if (info != null) {
synchronized(info) {
ImmutableList.Builder<SymbolAddOnInformation> builder = ImmutableList.builder();
for (EnhancedSymbolInformation enhanced : info) {
SymbolAddOnInformation[] additionalInformation = enhanced.getAdditionalInformation();
if (additionalInformation != null) {
builder.add(additionalInformation);
}
}
return builder.build();
}
}
else {
return Collections.emptyList();
}
}

@Override
public CompletableFuture<List<Bean>> beans(BeansParams params) {
String projectName = params.getProjectName();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2024 Pivotal, Inc.
* Copyright (c) 2019, 2025 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2023, 2024 VMware, Inc.
* Copyright (c) 2023, 2025 VMware, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2024 Pivotal, Inc.
* Copyright (c) 2019, 2025 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -34,7 +34,6 @@
import org.eclipse.lsp4j.Location;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
import org.springframework.ide.vscode.commons.protocol.spring.AnnotationMetadata;
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
import org.springframework.ide.vscode.commons.protocol.spring.DefaultValues;
Expand All @@ -52,9 +51,6 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;

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

public static Gson createGson() {
return new GsonBuilder()
.registerTypeAdapter(SymbolAddOnInformation.class, new SymbolAddOnInformationAdapter())
.registerTypeAdapter(Bean.class, new BeanJsonAdapter())
.registerTypeAdapter(InjectionPoint.class, new InjectionPointJsonAdapter())
.registerTypeAdapter(IndexCacheStore.class, new IndexCacheStoreAdapter())
Expand Down Expand Up @@ -426,33 +421,6 @@ public IndexCacheStore<?> deserialize(JsonElement json, Type typeOfT, JsonDeseri

}

/**
* gson adapter to store subtype information for symbol addon informations
*/
private static class SymbolAddOnInformationAdapter implements JsonSerializer<SymbolAddOnInformation>, JsonDeserializer<SymbolAddOnInformation> {

@Override
public JsonElement serialize(SymbolAddOnInformation addonInfo, Type typeOfSrc, JsonSerializationContext context) {
JsonObject result = new JsonObject();
result.add("type", new JsonPrimitive(addonInfo.getClass().getName()));
result.add("data", context.serialize(addonInfo));
return result;
}

@Override
public SymbolAddOnInformation deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException {
JsonObject parsedObject = json.getAsJsonObject();
String className = parsedObject.get("type").getAsString();
JsonElement element = parsedObject.get("data");

try {
return context.deserialize(element, Class.forName(className));
} catch (ClassNotFoundException cnfe) {
throw new JsonParseException("cannot parse data from unknown SymbolAddOnInformation subtype: " + type, cnfe);
}
}
}

/**
* gson adapter to store subtype information for beans
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2024 Broadcom
* Copyright (c) 2024, 2025 Broadcom
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -41,7 +41,6 @@
import org.eclipse.lsp4j.Location;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ide.vscode.boot.java.handlers.SymbolAddOnInformation;
import org.springframework.ide.vscode.commons.protocol.spring.AnnotationMetadata;
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
import org.springframework.ide.vscode.commons.protocol.spring.DefaultValues;
Expand Down Expand Up @@ -371,7 +370,6 @@ private <T extends IndexCacheable> Pair<IndexCacheStore<T>, Integer> retrieveSto
public static Gson createGson() {
return new GsonBuilder()
.registerTypeAdapter(DeltaStorage.class, new DeltaStorageAdapter())
.registerTypeAdapter(SymbolAddOnInformation.class, new SymbolAddOnInformationAdapter())
.registerTypeAdapter(Bean.class, new BeanJsonAdapter())
.registerTypeAdapter(InjectionPoint.class, new InjectionPointJsonAdapter())
.registerTypeAdapter(IndexCacheStore.class, new IndexCacheStoreAdapter())
Expand Down Expand Up @@ -637,30 +635,6 @@ public DeltaStorage<?> deserialize(JsonElement json, Type type, JsonDeserializat
}
}

private static class SymbolAddOnInformationAdapter implements JsonSerializer<SymbolAddOnInformation>, JsonDeserializer<SymbolAddOnInformation> {

@Override
public JsonElement serialize(SymbolAddOnInformation addonInfo, Type typeOfSrc, JsonSerializationContext context) {
JsonObject result = new JsonObject();
result.add("type", new JsonPrimitive(addonInfo.getClass().getName()));
result.add("data", context.serialize(addonInfo));
return result;
}

@Override
public SymbolAddOnInformation deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException {
JsonObject parsedObject = json.getAsJsonObject();
String className = parsedObject.get("type").getAsString();
JsonElement element = parsedObject.get("data");

try {
return context.deserialize(element, Class.forName(className));
} catch (ClassNotFoundException cnfe) {
throw new JsonParseException("cannot parse data from unknown SymbolAddOnInformation subtype: " + type, cnfe);
}
}
}

private static class BeanJsonAdapter implements JsonDeserializer<Bean> {

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2016, 2024 Pivotal, Inc.
* Copyright (c) 2016, 2025 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2024 Pivotal, Inc.
* Copyright (c) 2017, 2025 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand All @@ -18,6 +18,7 @@

import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.Annotation;
import org.eclipse.jdt.core.dom.Block;
import org.eclipse.jdt.core.dom.IAnnotationBinding;
import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.MethodDeclaration;
Expand All @@ -39,8 +40,8 @@
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
import org.springframework.ide.vscode.boot.java.utils.CachedSymbol;
import org.springframework.ide.vscode.boot.java.utils.FunctionUtils;
import org.springframework.ide.vscode.boot.java.utils.SpringIndexerJavaContext;
import org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava.SCAN_PASS;
import org.springframework.ide.vscode.boot.java.utils.SpringIndexerJavaContext;
import org.springframework.ide.vscode.commons.protocol.spring.AnnotationMetadata;
import org.springframework.ide.vscode.commons.protocol.spring.Bean;
import org.springframework.ide.vscode.commons.protocol.spring.InjectionPoint;
Expand All @@ -62,7 +63,6 @@
public class BeansSymbolProvider extends AbstractSymbolProvider {

private static final Logger log = LoggerFactory.getLogger(BeansSymbolProvider.class);

private static final String[] NAME_ATTRIBUTES = {"value", "name"};

@Override
Expand All @@ -73,21 +73,23 @@ public void addSymbols(Annotation node, ITypeBinding typeBinding, Collection<ITy
if (parent == null || !(parent instanceof MethodDeclaration)) return;

MethodDeclaration method = (MethodDeclaration) parent;

if (isMethodAbstract(method)) return;

List<SpringIndexElement> childElements = new ArrayList<>();

boolean isWebfluxRouter = WebfluxRouterSymbolProvider.isWebfluxRouterBean(method);

// for webflux details, we need full method body ASTs
if (isWebfluxRouter && SCAN_PASS.ONE.equals(context.getPass())) {
context.getNextPassFiles().add(context.getFile());
return;
}

List<SpringIndexElement> childElements = new ArrayList<>();

if (isWebfluxRouter) {
WebfluxRouterSymbolProvider.createWebfluxElements(method, context, doc, childElements);
Block methodBody = method.getBody();
if ((methodBody == null || methodBody.statements() == null || methodBody.statements().size() == 0)
&& SCAN_PASS.ONE.equals(context.getPass())) {
context.getNextPassFiles().add(context.getFile());
return;
}
else {
WebfluxRouterSymbolProvider.createWebfluxElements(method, context, doc, childElements);
}
}

boolean isFunction = isFunctionBean(method);
Expand All @@ -103,8 +105,7 @@ public void addSymbols(Annotation node, ITypeBinding typeBinding, Collection<ITy
new WorkspaceSymbol(
beanLabel(isFunction, nameAndRegion.getT1(), beanType.getName(), "@Bean" + markerString),
SymbolKind.Interface,
Either.forLeft(location)),
null
Either.forLeft(location))
);

InjectionPoint[] injectionPoints = ASTUtils.findInjectionPoints(method, doc);
Expand Down Expand Up @@ -142,7 +143,7 @@ protected void addSymbolsPass1(TypeDeclaration typeDeclaration, SpringIndexerJav
Either.forLeft(beanLocation));

context.getGeneratedSymbols().add(new CachedSymbol(context.getDocURI(), context.getLastModified(),
new EnhancedSymbolInformation(symbol, null)));
new EnhancedSymbolInformation(symbol)));


ITypeBinding concreteBeanType = typeDeclaration.resolveBinding();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2017, 2024 Pivotal, Inc.
* Copyright (c) 2017, 2025 Pivotal, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -62,7 +62,7 @@ protected void addSymbolsPass1(Annotation node, ITypeBinding annotationType, Col
}
else if (Annotations.NAMED_ANNOTATIONS.contains(annotationType.getQualifiedName())) {
WorkspaceSymbol symbol = DefaultSymbolProvider.provideDefaultSymbol(node, doc);
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol, null);
EnhancedSymbolInformation enhancedSymbol = new EnhancedSymbolInformation(symbol);
context.getGeneratedSymbols().add(new CachedSymbol(context.getDocURI(), context.getLastModified(), enhancedSymbol));
}
}
Expand Down Expand Up @@ -108,7 +108,7 @@ protected Tuple.Two<EnhancedSymbolInformation, Bean> createSymbol(Annotation nod

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

return Tuple.two(new EnhancedSymbolInformation(symbol, null), beanDefinition);
return Tuple.two(new EnhancedSymbolInformation(symbol), beanDefinition);
}

protected String beanLabel(String searchPrefix, String annotationTypeName, Collection<String> metaAnnotationNames, String beanName, String beanType) {
Expand Down
Loading

0 comments on commit 58ee5ae

Please sign in to comment.