From 2d6b8ca47d5e58c28d87f08bfd5437790bf2ae59 Mon Sep 17 00:00:00 2001 From: Martin Lippert Date: Wed, 2 Nov 2022 11:59:54 +0100 Subject: [PATCH 01/10] update misc-p2-dependency repo version --- eclipse-distribution/pom.xml | 2 +- eclipse-language-servers/pom.xml | 2 +- headless-services/jdt-ls-extension/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eclipse-distribution/pom.xml b/eclipse-distribution/pom.xml index fdb9614c4..4ef92a011 100644 --- a/eclipse-distribution/pom.xml +++ b/eclipse-distribution/pom.xml @@ -101,7 +101,7 @@ 2.7.5 UTF-8 - 3.9.4.202003091750 + 3.9.4.202211021051 diff --git a/eclipse-language-servers/pom.xml b/eclipse-language-servers/pom.xml index 91c5b3cfd..90c84a630 100644 --- a/eclipse-language-servers/pom.xml +++ b/eclipse-language-servers/pom.xml @@ -97,7 +97,7 @@ TOOLS ${dist.type}/${dist.key}/${dist.project}/${dist.version} - 3.9.4.202003091750 + 3.9.4.202211021051 diff --git a/headless-services/jdt-ls-extension/pom.xml b/headless-services/jdt-ls-extension/pom.xml index 4ab6df29c..19bab0e51 100644 --- a/headless-services/jdt-ls-extension/pom.xml +++ b/headless-services/jdt-ls-extension/pom.xml @@ -50,7 +50,7 @@ true vmware - 3.9.4.201902271843 + 3.9.4.202211021051 From de524da1383ea0b27a4dfb04733629bcbe3e2d3a Mon Sep 17 00:00:00 2001 From: aboyko Date: Thu, 3 Nov 2022 16:34:36 -0400 Subject: [PATCH 02/10] Upgrade Rewrite dependencies to 7.32.1, 4.29 and 1.13 --- .../commons/commons-rewrite/pom.xml | 18 ++++++++++---- .../config/StsClasspathScanningLoader.java | 15 ++++++------ .../rewrite/config/StsEnvironment.java | 24 +++++++++++++++---- headless-services/commons/pom.xml | 6 ++--- .../java/rewrite/RewriteRecipeRepository.java | 4 ++-- 5 files changed, 45 insertions(+), 22 deletions(-) diff --git a/headless-services/commons/commons-rewrite/pom.xml b/headless-services/commons/commons-rewrite/pom.xml index 4be76ae2a..b626a14ec 100644 --- a/headless-services/commons/commons-rewrite/pom.xml +++ b/headless-services/commons/commons-rewrite/pom.xml @@ -27,13 +27,21 @@ commons-java ${project.version} - - + + + - io.github.classgraph - classgraph - 4.8.149 + de.danielbechler + java-object-diff + 0.95 + + + io.github.classgraph + classgraph + 4.8.149 + + org.openrewrite rewrite-properties diff --git a/headless-services/commons/commons-rewrite/src/main/java/org/springframework/ide/vscode/commons/rewrite/config/StsClasspathScanningLoader.java b/headless-services/commons/commons-rewrite/src/main/java/org/springframework/ide/vscode/commons/rewrite/config/StsClasspathScanningLoader.java index d60b0f402..c64566ef6 100644 --- a/headless-services/commons/commons-rewrite/src/main/java/org/springframework/ide/vscode/commons/rewrite/config/StsClasspathScanningLoader.java +++ b/headless-services/commons/commons-rewrite/src/main/java/org/springframework/ide/vscode/commons/rewrite/config/StsClasspathScanningLoader.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.springframework.ide.vscode.commons.rewrite.config; +import static java.util.Collections.emptyList; import static org.openrewrite.internal.RecipeIntrospectionUtils.constructRecipe; import static org.openrewrite.internal.RecipeIntrospectionUtils.recipeDescriptorFromRecipe; @@ -48,7 +49,7 @@ public class StsClasspathScanningLoader implements ResourceLoader, StsResourceLo private final List codeActionRepos = new ArrayList<>(); - public StsClasspathScanningLoader(Path p, Properties properties, ClassLoader classLoader) { + public StsClasspathScanningLoader(Path p, Properties properties, Collection dependencyResourceLoaders, ClassLoader classLoader) { if (Files.isDirectory(p)) { String dir = p.toString(); @@ -61,7 +62,7 @@ public class StsClasspathScanningLoader implements ResourceLoader, StsResourceLo .acceptPaths(dir) .ignoreParentClassLoaders() .overrideClassLoaders(classLoader) - .acceptPaths("META-INF/rewrite"), properties, classLoader); + .acceptPaths("META-INF/rewrite"), properties, dependencyResourceLoaders, classLoader); } else { String jarName = p.toFile().getName(); @@ -75,14 +76,14 @@ public class StsClasspathScanningLoader implements ResourceLoader, StsResourceLo .acceptJars(jarName) .ignoreParentClassLoaders() .overrideClassLoaders(classLoader) - .acceptPaths("META-INF/rewrite"), properties, classLoader); + .acceptPaths("META-INF/rewrite"), properties, dependencyResourceLoaders, classLoader); } } public StsClasspathScanningLoader(Properties properties, String[] acceptPackages) { scanClasses(new ClassGraph().acceptPackages(acceptPackages), getClass().getClassLoader()); - scanYaml(new ClassGraph().acceptPaths("META-INF/rewrite"), properties, null); + scanYaml(new ClassGraph().acceptPaths("META-INF/rewrite"), properties, emptyList(), null); } /** @@ -99,19 +100,19 @@ public class StsClasspathScanningLoader implements ResourceLoader, StsResourceLo scanYaml(new ClassGraph() .ignoreParentClassLoaders() .overrideClassLoaders(classLoader) - .acceptPaths("META-INF/rewrite"), properties, classLoader); + .acceptPaths("META-INF/rewrite"), properties, emptyList(), classLoader); } /** * This must be called _after_ scanClasses or the descriptors of declarative recipes will be missing any * non-declarative recipes they depend on that would be discovered by scanClasses */ - private void scanYaml(ClassGraph classGraph, Properties properties, @Nullable ClassLoader classLoader) { + private void scanYaml(ClassGraph classGraph, Properties properties, Collection dependencyResourceLoaders, @Nullable ClassLoader classLoader) { try (ScanResult scanResult = classGraph.enableMemoryMapping().scan()) { List yamlResourceLoaders = new ArrayList<>(); scanResult.getResourcesWithExtension("yml").forEachInputStreamIgnoringIOException((res, input) -> { - yamlResourceLoaders.add(new YamlResourceLoader(input, res.getURI(), properties, classLoader)); + yamlResourceLoaders.add(new YamlResourceLoader(input, res.getURI(), properties, classLoader, dependencyResourceLoaders)); }); // Extract in two passes so that the full list of recipes from all sources are known when computing recipe descriptors // Otherwise recipes which include recipes from other sources in their recipeList will have incomplete descriptors diff --git a/headless-services/commons/commons-rewrite/src/main/java/org/springframework/ide/vscode/commons/rewrite/config/StsEnvironment.java b/headless-services/commons/commons-rewrite/src/main/java/org/springframework/ide/vscode/commons/rewrite/config/StsEnvironment.java index a6bf8724a..0d9baff83 100644 --- a/headless-services/commons/commons-rewrite/src/main/java/org/springframework/ide/vscode/commons/rewrite/config/StsEnvironment.java +++ b/headless-services/commons/commons-rewrite/src/main/java/org/springframework/ide/vscode/commons/rewrite/config/StsEnvironment.java @@ -12,6 +12,7 @@ package org.springframework.ide.vscode.commons.rewrite.config; import java.lang.reflect.Field; import java.nio.file.Path; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Properties; @@ -19,9 +20,12 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.openrewrite.config.ClasspathScanningLoader; import org.openrewrite.config.Environment; import org.openrewrite.config.ResourceLoader; +import static java.util.Collections.emptyList; + public class StsEnvironment extends Environment { final private Supplier> codeActionRepos; @@ -51,12 +55,22 @@ public class StsEnvironment extends Environment { } @Override - public org.openrewrite.config.Environment.Builder scanJar(Path jar, ClassLoader classLoader) { - return load(new StsClasspathScanningLoader(jar, props, classLoader)); + public Environment.Builder scanJar(Path jar, Collection dependencies, ClassLoader classLoader) { + List list = new ArrayList<>(); + for (Path dep : dependencies) { + ClasspathScanningLoader classpathScanningLoader = new ClasspathScanningLoader(dep, props, emptyList(), classLoader); + list.add(classpathScanningLoader); + } + return load(new StsClasspathScanningLoader(jar, props, list, classLoader), list); } - - public org.openrewrite.config.Environment.Builder scanPath(Path dir, ClassLoader classLoader) { - return load(new StsClasspathScanningLoader(dir, props, classLoader)); + + public org.openrewrite.config.Environment.Builder scanPath(Path dir, Collection dependencies, ClassLoader classLoader) { + List list = new ArrayList<>(); + for (Path dep : dependencies) { + ClasspathScanningLoader classpathScanningLoader = new ClasspathScanningLoader(dep, props, emptyList(), classLoader); + list.add(classpathScanningLoader); + } + return load(new StsClasspathScanningLoader(dir, props, list, classLoader)); } @SuppressWarnings("unchecked") diff --git a/headless-services/commons/pom.xml b/headless-services/commons/pom.xml index d8fa1573f..d5edcd63c 100644 --- a/headless-services/commons/pom.xml +++ b/headless-services/commons/pom.xml @@ -109,9 +109,9 @@ 1.13 - 7.30.0 - 4.27.0 - 1.11.0 + 7.32.1 + 4.29.0 + 1.13.0 true vmware diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/rewrite/RewriteRecipeRepository.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/rewrite/RewriteRecipeRepository.java index 07735066e..b6c51858f 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/rewrite/RewriteRecipeRepository.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/rewrite/RewriteRecipeRepository.java @@ -232,7 +232,7 @@ public class RewriteRecipeRepository implements ApplicationContextAware { if (pathStr.endsWith(".jar")) { URLClassLoader classLoader = new URLClassLoader(new URL[] { f.toUri().toURL() }, getClass().getClassLoader()); - builder.scanJar(f, classLoader); + builder.scanJar(f, Collections.emptyList(), classLoader); } else if (pathStr.endsWith(".yml") || pathStr.endsWith(".yaml")) { builder.load(new YamlResourceLoader(new FileInputStream(f.toFile()), f.toUri(), new Properties())); } @@ -245,7 +245,7 @@ public class RewriteRecipeRepository implements ApplicationContextAware { Path d = Path.of(p); if (Files.isDirectory(d)) { URLClassLoader classLoader = new URLClassLoader(new URL[] { d.toUri().toURL()}, getClass().getClassLoader()); - builder.scanPath(d, classLoader); + builder.scanPath(d, Collections.emptyList(), classLoader); } } catch (Exception e) { log.error("Skipping folder " + p, e); From cb7813109e1a5b780cb07af39e17ff18fd799b56 Mon Sep 17 00:00:00 2001 From: aboyko Date: Fri, 4 Nov 2022 15:15:00 -0400 Subject: [PATCH 03/10] Separate Spring AOT validations into a dedicated category --- .../boot/common/SpringProblemCategories.java | 3 + .../boot/java/Boot3JavaProblemType.java | 7 -- .../boot/java/SpringAotJavaProblemType.java | 64 +++++++++++++ .../BeanPostProcessingIgnoreInAotProblem.java | 4 +- .../reconcile/NotRegisteredBeansProblem.java | 4 +- .../reconcile/PreciseBeanTypeProblem.java | 6 +- .../src/main/resources/problem-types.json | 58 +++++++---- .../boot/test/ProblemTypesMetadataTest.java | 2 + .../vscode/boot/test/ProblemTypesToJson.java | 3 +- .../vscode-spring-boot/package.json | 96 +++++++++++-------- 10 files changed, 171 insertions(+), 76 deletions(-) create mode 100644 headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/SpringAotJavaProblemType.java diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/common/SpringProblemCategories.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/common/SpringProblemCategories.java index 5b8a17997..ab6664dd6 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/common/SpringProblemCategories.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/common/SpringProblemCategories.java @@ -25,6 +25,9 @@ public class SpringProblemCategories { public static final ProblemCategory BOOT_3 = new ProblemCategory("boot3", "Boot 3.x Validation", new Toggle("Enablement", EnumSet.allOf(Toggle.Option.class), AUTO, "boot-java.validation.java.boot3")); + public static final ProblemCategory SPRING_AOT = new ProblemCategory("spring-aot", "Spring AOT Validation", + new Toggle("Enablement", EnumSet.of(OFF, ON), OFF, "boot-java.validation.java.spring-aot")); + public static final ProblemCategory PROPERTIES = new ProblemCategory("application-properties", "Properties Validation", null); public static final ProblemCategory YAML = new ProblemCategory("application-yaml", "YAML Properties Validation", null); diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/Boot3JavaProblemType.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/Boot3JavaProblemType.java index 0726e2233..b84585bb0 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/Boot3JavaProblemType.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/Boot3JavaProblemType.java @@ -11,7 +11,6 @@ package org.springframework.ide.vscode.boot.java; import static org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemSeverity.ERROR; -import static org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemSeverity.WARNING; import org.springframework.ide.vscode.boot.common.SpringProblemCategories; import org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemCategory; @@ -24,12 +23,6 @@ import org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemTy */ public enum Boot3JavaProblemType implements ProblemType { - JAVA_CONCRETE_BEAN_TYPE(WARNING, "Bean definition should have precise type for Spring 6 AOT", "Not precise bean defintion type"), - - JAVA_BEAN_POST_PROCESSOR_IGNORED_IN_AOT(WARNING, "'BeanPostProcessor' behaviour is ignored in Spring 6 AOT", "'BeanPostProcessor' behaviour is ignored in AOT"), - - JAVA_BEAN_NOT_REGISTERED_IN_AOT(WARNING, "Not registered as Bean", "Not registered as a Bean"), - JAVA_TYPE_NOT_SUPPORTED(ERROR, "Type no supported as of Spring Boot 3", "Type not supported as of Spring Boot 3"), FACTORIES_KEY_NOT_SUPPORTED(ERROR, "Spring factories key not supported", "Spring factories key not supported"); diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/SpringAotJavaProblemType.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/SpringAotJavaProblemType.java new file mode 100644 index 000000000..752522bcd --- /dev/null +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/SpringAotJavaProblemType.java @@ -0,0 +1,64 @@ +package org.springframework.ide.vscode.boot.java; + +import static org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemSeverity.WARNING; + +import org.springframework.ide.vscode.boot.common.SpringProblemCategories; +import org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemCategory; +import org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemSeverity; +import org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemType; + +public enum SpringAotJavaProblemType implements ProblemType { + + JAVA_CONCRETE_BEAN_TYPE(WARNING, "Bean definition should have precise type", "Not precise bean defintion type"), + + JAVA_BEAN_POST_PROCESSOR_IGNORED_IN_AOT(WARNING, "'BeanPostProcessor' behaviour is ignored", "'BeanPostProcessor' behaviour is ignored in AOT"), + + JAVA_BEAN_NOT_REGISTERED_IN_AOT(WARNING, "Not registered as Bean", "Not registered as a Bean"); + + private final ProblemSeverity defaultSeverity; + private String description; + private String label; + + private SpringAotJavaProblemType(ProblemSeverity defaultSeverity, String description) { + this(defaultSeverity, description, null); + } + + private SpringAotJavaProblemType(ProblemSeverity defaultSeverity, String description, String label) { + this.description = description; + this.defaultSeverity = defaultSeverity; + this.label = label; + } + + @Override + public ProblemSeverity getDefaultSeverity() { + return defaultSeverity; + } + + public String getLabel() { + if (label==null) { + label = createDefaultLabel(); + } + return label; + } + + @Override + public String getDescription() { + return description; + } + + private String createDefaultLabel() { + String label = this.toString().substring(5).toLowerCase().replace('_', ' '); + return Character.toUpperCase(label.charAt(0)) + label.substring(1); + } + + @Override + public String getCode() { + return name(); + } + + @Override + public ProblemCategory getCategory() { + return SpringProblemCategories.SPRING_AOT; + } + +} diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/rewrite/reconcile/BeanPostProcessingIgnoreInAotProblem.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/rewrite/reconcile/BeanPostProcessingIgnoreInAotProblem.java index f2e396582..dd2207972 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/rewrite/reconcile/BeanPostProcessingIgnoreInAotProblem.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/rewrite/reconcile/BeanPostProcessingIgnoreInAotProblem.java @@ -24,7 +24,7 @@ import org.openrewrite.java.tree.J.ClassDeclaration; import org.openrewrite.java.tree.J.MethodDeclaration; import org.openrewrite.marker.Range; import org.springframework.context.ApplicationContext; -import org.springframework.ide.vscode.boot.java.Boot3JavaProblemType; +import org.springframework.ide.vscode.boot.java.SpringAotJavaProblemType; import org.springframework.ide.vscode.commons.java.IJavaProject; import org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemType; import org.springframework.ide.vscode.commons.rewrite.config.RecipeCodeActionDescriptor; @@ -81,7 +81,7 @@ public class BeanPostProcessingIgnoreInAotProblem implements RecipeCodeActionDes @Override public ProblemType getProblemType() { - return Boot3JavaProblemType.JAVA_BEAN_POST_PROCESSOR_IGNORED_IN_AOT; + return SpringAotJavaProblemType.JAVA_BEAN_POST_PROCESSOR_IGNORED_IN_AOT; } } diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/rewrite/reconcile/NotRegisteredBeansProblem.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/rewrite/reconcile/NotRegisteredBeansProblem.java index d687d75e0..8b2521bd0 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/rewrite/reconcile/NotRegisteredBeansProblem.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/rewrite/reconcile/NotRegisteredBeansProblem.java @@ -31,7 +31,7 @@ import org.openrewrite.java.tree.JavaType.FullyQualified; import org.openrewrite.java.tree.TypeUtils; import org.springframework.context.ApplicationContext; import org.springframework.ide.vscode.boot.app.SpringSymbolIndex; -import org.springframework.ide.vscode.boot.java.Boot3JavaProblemType; +import org.springframework.ide.vscode.boot.java.SpringAotJavaProblemType; import org.springframework.ide.vscode.boot.java.beans.BeansSymbolAddOnInformation; import org.springframework.ide.vscode.boot.java.beans.ConfigBeanSymbolAddOnInformation; import org.springframework.ide.vscode.boot.java.handlers.EnhancedSymbolInformation; @@ -169,7 +169,7 @@ public class NotRegisteredBeansProblem implements RecipeCodeActionDescriptor { @Override public ProblemType getProblemType() { - return Boot3JavaProblemType.JAVA_BEAN_NOT_REGISTERED_IN_AOT; + return SpringAotJavaProblemType.JAVA_BEAN_NOT_REGISTERED_IN_AOT; } private static String typePattern(JavaType type) { diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/rewrite/reconcile/PreciseBeanTypeProblem.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/rewrite/reconcile/PreciseBeanTypeProblem.java index 0c22aab86..eba340f8e 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/rewrite/reconcile/PreciseBeanTypeProblem.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/rewrite/reconcile/PreciseBeanTypeProblem.java @@ -26,7 +26,7 @@ import org.openrewrite.java.tree.JavaType; import org.openrewrite.java.tree.TypeUtils; import org.openrewrite.marker.Range; import org.springframework.context.ApplicationContext; -import org.springframework.ide.vscode.boot.java.Boot3JavaProblemType; +import org.springframework.ide.vscode.boot.java.SpringAotJavaProblemType; import org.springframework.ide.vscode.commons.java.IJavaProject; import org.springframework.ide.vscode.commons.rewrite.config.RecipeCodeActionDescriptor; import org.springframework.ide.vscode.commons.rewrite.config.RecipeScope; @@ -95,8 +95,8 @@ public class PreciseBeanTypeProblem implements RecipeCodeActionDescriptor { } @Override - public Boot3JavaProblemType getProblemType() { - return Boot3JavaProblemType.JAVA_CONCRETE_BEAN_TYPE; + public SpringAotJavaProblemType getProblemType() { + return SpringAotJavaProblemType.JAVA_CONCRETE_BEAN_TYPE; } } diff --git a/headless-services/spring-boot-language-server/src/main/resources/problem-types.json b/headless-services/spring-boot-language-server/src/main/resources/problem-types.json index 2ff2e26a8..8a95f1c89 100644 --- a/headless-services/spring-boot-language-server/src/main/resources/problem-types.json +++ b/headless-services/spring-boot-language-server/src/main/resources/problem-types.json @@ -61,24 +61,6 @@ }, "order": 2, "problemTypes": [ - { - "code": "JAVA_CONCRETE_BEAN_TYPE", - "label": "Not precise bean defintion type", - "description": "Bean definition should have precise type for Spring 6 AOT", - "defaultSeverity": "WARNING" - }, - { - "code": "JAVA_BEAN_POST_PROCESSOR_IGNORED_IN_AOT", - "label": "'BeanPostProcessor' behaviour is ignored in AOT", - "description": "'BeanPostProcessor' behaviour is ignored in Spring 6 AOT", - "defaultSeverity": "WARNING" - }, - { - "code": "JAVA_BEAN_NOT_REGISTERED_IN_AOT", - "label": "Not registered as a Bean", - "description": "Not registered as Bean", - "defaultSeverity": "WARNING" - }, { "code": "JAVA_TYPE_NOT_SUPPORTED", "label": "Type not supported as of Spring Boot 3", @@ -93,10 +75,44 @@ } ] }, + { + "id": "spring-aot", + "label": "Spring AOT Validation", + "toggle": { + "label": "Enablement", + "values": [ + "OFF", + "ON" + ], + "preferenceKey": "boot-java.validation.java.spring-aot", + "defaultValue": "OFF" + }, + "order": 3, + "problemTypes": [ + { + "code": "JAVA_CONCRETE_BEAN_TYPE", + "label": "Not precise bean defintion type", + "description": "Bean definition should have precise type", + "defaultSeverity": "WARNING" + }, + { + "code": "JAVA_BEAN_POST_PROCESSOR_IGNORED_IN_AOT", + "label": "'BeanPostProcessor' behaviour is ignored in AOT", + "description": "'BeanPostProcessor' behaviour is ignored", + "defaultSeverity": "WARNING" + }, + { + "code": "JAVA_BEAN_NOT_REGISTERED_IN_AOT", + "label": "Not registered as a Bean", + "description": "Not registered as Bean", + "defaultSeverity": "WARNING" + } + ] + }, { "id": "application-properties", "label": "Properties Validation", - "order": 3, + "order": 4, "problemTypes": [ { "code": "PROP_INVALID_BEAN_NAVIGATION", @@ -169,7 +185,7 @@ { "id": "application-yaml", "label": "YAML Properties Validation", - "order": 4, + "order": 5, "problemTypes": [ { "code": "YAML_SYNTAX_ERROR", @@ -263,7 +279,7 @@ "preferenceKey": "boot-java.validation.spel.on", "defaultValue": "ON" }, - "order": 5, + "order": 6, "problemTypes": [ { "code": "JAVA_SPEL_EXPRESSION_SYNTAX", diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/test/ProblemTypesMetadataTest.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/test/ProblemTypesMetadataTest.java index c08e62568..9afa2fb76 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/test/ProblemTypesMetadataTest.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/test/ProblemTypesMetadataTest.java @@ -12,6 +12,7 @@ package org.springframework.ide.vscode.boot.test; import org.junit.jupiter.api.Test; import org.springframework.ide.vscode.boot.java.Boot2JavaProblemType; +import org.springframework.ide.vscode.boot.java.SpringAotJavaProblemType; import org.springframework.ide.vscode.boot.java.Boot3JavaProblemType; import org.springframework.ide.vscode.boot.java.SpelProblemType; import org.springframework.ide.vscode.boot.properties.reconcile.ApplicationPropertiesProblemType; @@ -29,6 +30,7 @@ public class ProblemTypesMetadataTest { reader.validate("application-yaml", ApplicationYamlProblemType.values()); reader.validate("boot2", Boot2JavaProblemType.values()); reader.validate("boot3", Boot3JavaProblemType.values()); + reader.validate("spring-aot", SpringAotJavaProblemType.values()); reader.validate("spel", SpelProblemType.values()); } diff --git a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/test/ProblemTypesToJson.java b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/test/ProblemTypesToJson.java index c9c0ac98b..012638594 100644 --- a/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/test/ProblemTypesToJson.java +++ b/headless-services/spring-boot-language-server/src/test/java/org/springframework/ide/vscode/boot/test/ProblemTypesToJson.java @@ -20,7 +20,6 @@ import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.Comparator; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -28,6 +27,7 @@ import java.util.stream.Stream; import org.apache.commons.io.FileUtils; import org.springframework.ide.vscode.boot.java.Boot2JavaProblemType; +import org.springframework.ide.vscode.boot.java.SpringAotJavaProblemType; import org.springframework.ide.vscode.boot.java.Boot3JavaProblemType; import org.springframework.ide.vscode.boot.java.SpelProblemType; import org.springframework.ide.vscode.boot.properties.reconcile.ApplicationPropertiesProblemType; @@ -174,6 +174,7 @@ public class ProblemTypesToJson { writer.collectProblemTypeData(Boot2JavaProblemType.values()); writer.collectProblemTypeData(ApplicationPropertiesProblemType.values()); writer.collectProblemTypeData(Boot3JavaProblemType.values()); + writer.collectProblemTypeData(SpringAotJavaProblemType.values()); Collections.sort(writer.problemCategories); diff --git a/vscode-extensions/vscode-spring-boot/package.json b/vscode-extensions/vscode-spring-boot/package.json index 80e6efe34..1c2a5b143 100644 --- a/vscode-extensions/vscode-spring-boot/package.json +++ b/vscode-extensions/vscode-spring-boot/package.json @@ -378,42 +378,6 @@ "ON" ] }, - "spring-boot.ls.problem.boot3.JAVA_CONCRETE_BEAN_TYPE": { - "type": "string", - "default": "WARNING", - "description": "Bean definition should have precise type for Spring 6 AOT", - "enum": [ - "IGNORE", - "INFO", - "WARNING", - "HINT", - "ERROR" - ] - }, - "spring-boot.ls.problem.boot3.JAVA_BEAN_POST_PROCESSOR_IGNORED_IN_AOT": { - "type": "string", - "default": "WARNING", - "description": "'BeanPostProcessor' behaviour is ignored in Spring 6 AOT", - "enum": [ - "IGNORE", - "INFO", - "WARNING", - "HINT", - "ERROR" - ] - }, - "spring-boot.ls.problem.boot3.JAVA_BEAN_NOT_REGISTERED_IN_AOT": { - "type": "string", - "default": "WARNING", - "description": "Not registered as Bean", - "enum": [ - "IGNORE", - "INFO", - "WARNING", - "HINT", - "ERROR" - ] - }, "spring-boot.ls.problem.boot3.JAVA_TYPE_NOT_SUPPORTED": { "type": "string", "default": "ERROR", @@ -440,10 +404,62 @@ } } }, + { + "id": "spring-aot", + "title": "Spring AOT Validation", + "order": 403, + "properties": { + "boot-java.validation.java.spring-aot": { + "type": "string", + "default": "OFF", + "description": "Enablement", + "enum": [ + "OFF", + "ON" + ] + }, + "spring-boot.ls.problem.spring-aot.JAVA_CONCRETE_BEAN_TYPE": { + "type": "string", + "default": "WARNING", + "description": "Bean definition should have precise type", + "enum": [ + "IGNORE", + "INFO", + "WARNING", + "HINT", + "ERROR" + ] + }, + "spring-boot.ls.problem.spring-aot.JAVA_BEAN_POST_PROCESSOR_IGNORED_IN_AOT": { + "type": "string", + "default": "WARNING", + "description": "'BeanPostProcessor' behaviour is ignored", + "enum": [ + "IGNORE", + "INFO", + "WARNING", + "HINT", + "ERROR" + ] + }, + "spring-boot.ls.problem.spring-aot.JAVA_BEAN_NOT_REGISTERED_IN_AOT": { + "type": "string", + "default": "WARNING", + "description": "Not registered as Bean", + "enum": [ + "IGNORE", + "INFO", + "WARNING", + "HINT", + "ERROR" + ] + } + } + }, { "id": "application-properties", "title": "Properties Validation", - "order": 403, + "order": 404, "properties": { "spring-boot.ls.problem.application-properties.PROP_INVALID_BEAN_NAVIGATION": { "type": "string", @@ -582,7 +598,7 @@ { "id": "application-yaml", "title": "YAML Properties Validation", - "order": 404, + "order": 405, "properties": { "spring-boot.ls.problem.application-yaml.YAML_SYNTAX_ERROR": { "type": "string", @@ -745,7 +761,7 @@ { "id": "spel", "title": "SPEL Validation", - "order": 405, + "order": 406, "properties": { "boot-java.validation.spel.on": { "type": "string", @@ -811,4 +827,4 @@ "extensionDependencies": [ "redhat.java" ] -} +} \ No newline at end of file From fdeb9fe73084bb138160668a8113d04bf34718db Mon Sep 17 00:00:00 2001 From: Martin Lippert Date: Mon, 7 Nov 2022 12:19:08 +0100 Subject: [PATCH 04/10] GH-862: expose all actuators via JMX for live hovers automatically when launching --- .../vscode-spring-boot/lib/debug-config-provider.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vscode-extensions/vscode-spring-boot/lib/debug-config-provider.ts b/vscode-extensions/vscode-spring-boot/lib/debug-config-provider.ts index 942b53295..4599476a6 100644 --- a/vscode-extensions/vscode-spring-boot/lib/debug-config-provider.ts +++ b/vscode-extensions/vscode-spring-boot/lib/debug-config-provider.ts @@ -6,6 +6,7 @@ import psList from 'ps-list'; import { ListenablePreferenceSetting } from "@pivotal-tools/commons-vscode/lib/launch-util"; const JMX_VM_ARG = '-Dspring.jmx.enabled=' +const ACTUATOR_JMX_EXPOSURE_ARG = '-Dmanagement.endpoints.jmx.exposure.include=' const ADMIN_VM_ARG = '-Dspring.application.admin.enabled=' const BOOT_PROJECT_ARG = '-Dspring.boot.project.name='; const RMI_HOSTNAME = '-Djava.rmi.server.hostname=localhost'; @@ -23,6 +24,9 @@ class SpringBootDebugConfigProvider implements DebugConfigurationProvider { if (debugConfiguration.vmArgs.indexOf(JMX_VM_ARG) < 0) { debugConfiguration.vmArgs += ` ${JMX_VM_ARG}true`; } + if (debugConfiguration.vmArgs.indexOf(ACTUATOR_JMX_EXPOSURE_ARG) < 0) { + debugConfiguration.vmArgs += ` ${ACTUATOR_JMX_EXPOSURE_ARG}*`; + } if (debugConfiguration.vmArgs.indexOf(ADMIN_VM_ARG) < 0) { debugConfiguration.vmArgs += ` ${ADMIN_VM_ARG}true`; } @@ -33,7 +37,7 @@ class SpringBootDebugConfigProvider implements DebugConfigurationProvider { debugConfiguration.vmArgs += ` ${RMI_HOSTNAME}`; } } else { - debugConfiguration.vmArgs = `${JMX_VM_ARG}true ${ADMIN_VM_ARG}true ${BOOT_PROJECT_ARG}${debugConfiguration.projectName} ${RMI_HOSTNAME}`; + debugConfiguration.vmArgs = `${JMX_VM_ARG}true ${ACTUATOR_JMX_EXPOSURE_ARG}* ${ADMIN_VM_ARG}true ${BOOT_PROJECT_ARG}${debugConfiguration.projectName} ${RMI_HOSTNAME}`; } } return debugConfiguration; From 8b0c149063830c645659c9c05403460d16805a4a Mon Sep 17 00:00:00 2001 From: Martin Lippert Date: Mon, 7 Nov 2022 12:23:11 +0100 Subject: [PATCH 05/10] remove maven nature, pure plugin project --- .../org.springframework.tooling.jdt.ls.extension/.project | 6 ------ 1 file changed, 6 deletions(-) diff --git a/headless-services/jdt-ls-extension/org.springframework.tooling.jdt.ls.extension/.project b/headless-services/jdt-ls-extension/org.springframework.tooling.jdt.ls.extension/.project index fa1e95bb1..1b18edcd2 100644 --- a/headless-services/jdt-ls-extension/org.springframework.tooling.jdt.ls.extension/.project +++ b/headless-services/jdt-ls-extension/org.springframework.tooling.jdt.ls.extension/.project @@ -20,14 +20,8 @@ - - org.eclipse.m2e.core.maven2Builder - - - - org.eclipse.m2e.core.maven2Nature org.eclipse.pde.PluginNature org.eclipse.jdt.core.javanature From c3f71e5db27d4ed1c6fb0434ea1702bd24629aae Mon Sep 17 00:00:00 2001 From: Martin Lippert Date: Mon, 7 Nov 2022 12:23:41 +0100 Subject: [PATCH 06/10] update gradle tooling version to something that is compatible with java 17 --- headless-services/commons/commons-gradle/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/headless-services/commons/commons-gradle/pom.xml b/headless-services/commons/commons-gradle/pom.xml index 19e72597f..397dc43df 100644 --- a/headless-services/commons/commons-gradle/pom.xml +++ b/headless-services/commons/commons-gradle/pom.xml @@ -14,7 +14,7 @@ - 6.7 + 7.3 From 1e9cb99c6426e7cc65ab081e2ae86c63eb0bde76 Mon Sep 17 00:00:00 2001 From: Martin Lippert Date: Mon, 7 Nov 2022 12:45:02 +0100 Subject: [PATCH 07/10] GH-862: expose all actuators via JMX for live hovers automatically when launching --- .../ide/eclipse/boot/dash/test/JmxSupportTest.java | 12 ++++++++---- .../eclipse/boot/launch/livebean/JmxBeanSupport.java | 9 ++++++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/eclipse-extensions/org.springframework.ide.eclipse.boot.dash.test/src/org/springframework/ide/eclipse/boot/dash/test/JmxSupportTest.java b/eclipse-extensions/org.springframework.ide.eclipse.boot.dash.test/src/org/springframework/ide/eclipse/boot/dash/test/JmxSupportTest.java index f2d2aac71..49d30a70f 100644 --- a/eclipse-extensions/org.springframework.ide.eclipse.boot.dash.test/src/org/springframework/ide/eclipse/boot/dash/test/JmxSupportTest.java +++ b/eclipse-extensions/org.springframework.ide.eclipse.boot.dash.test/src/org/springframework/ide/eclipse/boot/dash/test/JmxSupportTest.java @@ -50,7 +50,8 @@ public class JmxSupportTest { + "-Dcom.sun.management.jmxremote.rmi.port=1234 " + "-Djava.rmi.server.hostname=localhost " + "-Dcom.sun.management.jmxremote.local.only=false " - + "-Dspring.jmx.enabled=true", + + "-Dspring.jmx.enabled=true" + + "-Dmanagement.endpoints.jmx.exposure.include=*", env.get("JAVA_OPTS")); jmx.setupEnvVars(env); // should erase old and recreate @@ -61,7 +62,8 @@ public class JmxSupportTest { + "-Dcom.sun.management.jmxremote.rmi.port=1234 " + "-Djava.rmi.server.hostname=localhost " + "-Dcom.sun.management.jmxremote.local.only=false " - + "-Dspring.jmx.enabled=true", + + "-Dspring.jmx.enabled=true" + + "-Dmanagement.endpoints.jmx.exposure.include=*", env.get("JAVA_OPTS")); } @@ -84,7 +86,8 @@ public class JmxSupportTest { + "-Dcom.sun.management.jmxremote.rmi.port=1234 " + "-Djava.rmi.server.hostname=localhost " + "-Dcom.sun.management.jmxremote.local.only=false " - + "-Dspring.jmx.enabled=true", + + "-Dspring.jmx.enabled=true" + + "-Dmanagement.endpoints.jmx.exposure.include=*", env.get("JAVA_OPTS")); jmx.setupEnvVars(env); // should erase old and recreate @@ -95,7 +98,8 @@ public class JmxSupportTest { + "-Dcom.sun.management.jmxremote.rmi.port=1234 " + "-Djava.rmi.server.hostname=localhost " + "-Dcom.sun.management.jmxremote.local.only=false " - + "-Dspring.jmx.enabled=true", + + "-Dspring.jmx.enabled=true" + + "-Dmanagement.endpoints.jmx.exposure.include=*", env.get("JAVA_OPTS")); } diff --git a/eclipse-extensions/org.springframework.ide.eclipse.boot.launch/src/org/springframework/ide/eclipse/boot/launch/livebean/JmxBeanSupport.java b/eclipse-extensions/org.springframework.ide.eclipse.boot.launch/src/org/springframework/ide/eclipse/boot/launch/livebean/JmxBeanSupport.java index b1465041f..50a17d4d8 100644 --- a/eclipse-extensions/org.springframework.ide.eclipse.boot.launch/src/org/springframework/ide/eclipse/boot/launch/livebean/JmxBeanSupport.java +++ b/eclipse-extensions/org.springframework.ide.eclipse.boot.launch/src/org/springframework/ide/eclipse/boot/launch/livebean/JmxBeanSupport.java @@ -66,10 +66,17 @@ public class JmxBeanSupport { "-Dcom.sun.management.jmxremote.authenticate=false", "-Dcom.sun.management.jmxremote.ssl=false", "-Djava.rmi.server.hostname=localhost", + // // PT 164402781 - For Boot 2.2 and above, jmx is no longer enabled by default. // We explicitly enable it here. Adding this doesn't seem to affect older boot versions // and we get live information from JMX for those too. - "-Dspring.jmx.enabled=true" + // + "-Dspring.jmx.enabled=true", + // + // GH-862: Spring Boot 3 doesn't expose all actuators over JMX anymore by default + // therefore we need to set this for live hovers here + // + "-Dmanagement.endpoints.jmx.exposure.include=*" }; } From a37819368e112bc8043d76b242df38ebcc19a826 Mon Sep 17 00:00:00 2001 From: Martin Lippert Date: Mon, 7 Nov 2022 13:08:11 +0100 Subject: [PATCH 08/10] GH-862: expose all actuators via JMX for live hovers automatically when launching --- .../ide/eclipse/boot/dash/docker/jmx/JmxSupport.java | 9 +++------ .../ide/eclipse/boot/launch/livebean/JmxBeanSupport.java | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/eclipse-extensions/org.springframework.ide.eclipse.boot.dash.docker/src/org/springframework/ide/eclipse/boot/dash/docker/jmx/JmxSupport.java b/eclipse-extensions/org.springframework.ide.eclipse.boot.dash.docker/src/org/springframework/ide/eclipse/boot/dash/docker/jmx/JmxSupport.java index 193c22672..39c1fbc39 100644 --- a/eclipse-extensions/org.springframework.ide.eclipse.boot.dash.docker/src/org/springframework/ide/eclipse/boot/dash/docker/jmx/JmxSupport.java +++ b/eclipse-extensions/org.springframework.ide.eclipse.boot.dash.docker/src/org/springframework/ide/eclipse/boot/dash/docker/jmx/JmxSupport.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018,2020 Pivotal, Inc. + * Copyright (c) 2018, 2022 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 @@ -10,15 +10,11 @@ *******************************************************************************/ package org.springframework.ide.eclipse.boot.dash.docker.jmx; -import java.util.EnumSet; import java.util.Map; -import org.springframework.ide.eclipse.boot.launch.livebean.JmxBeanSupport; import org.springframework.ide.eclipse.boot.launch.util.PortFinder; import org.springsource.ide.eclipse.commons.livexp.util.Log; -import static org.springframework.ide.eclipse.boot.launch.livebean.JmxBeanSupport.Feature.*; - /** * Helper class providing functionality to connect to JMX on a remote spring boot app * running on CF, using ssh tunneling. @@ -45,7 +41,8 @@ public class JmxSupport { "-Djava.rmi.server.hostname=localhost " + "-Dcom.sun.management.jmxremote.local.only=false "+ "-Dspring.jmx.enabled=true " + - "-Dspring.application.admin.enabled=true"; + "-Dspring.application.admin.enabled=true " + + "-Dmanagement.endpoints.jmx.exposure.include=*"; } int port; diff --git a/eclipse-extensions/org.springframework.ide.eclipse.boot.launch/src/org/springframework/ide/eclipse/boot/launch/livebean/JmxBeanSupport.java b/eclipse-extensions/org.springframework.ide.eclipse.boot.launch/src/org/springframework/ide/eclipse/boot/launch/livebean/JmxBeanSupport.java index 50a17d4d8..ae3b666b1 100644 --- a/eclipse-extensions/org.springframework.ide.eclipse.boot.launch/src/org/springframework/ide/eclipse/boot/launch/livebean/JmxBeanSupport.java +++ b/eclipse-extensions/org.springframework.ide.eclipse.boot.launch/src/org/springframework/ide/eclipse/boot/launch/livebean/JmxBeanSupport.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2014, 2019 Pivotal Software, Inc. + * Copyright (c) 2014, 2022 Pivotal Software, 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 From e9c813279f15f5f48144d5d8eb13c232e62c4134 Mon Sep 17 00:00:00 2001 From: Martin Lippert Date: Mon, 7 Nov 2022 13:26:31 +0100 Subject: [PATCH 09/10] added missing copyright header --- .../livehover/v2/SpringProcessConnectorOverHttp.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/SpringProcessConnectorOverHttp.java b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/SpringProcessConnectorOverHttp.java index c06b99aa3..10ba6dc33 100644 --- a/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/SpringProcessConnectorOverHttp.java +++ b/headless-services/spring-boot-language-server/src/main/java/org/springframework/ide/vscode/boot/java/livehover/v2/SpringProcessConnectorOverHttp.java @@ -1,3 +1,13 @@ +/******************************************************************************* + * Copyright (c) 2022 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 + * https://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Pivotal, Inc. - initial API and implementation + *******************************************************************************/ package org.springframework.ide.vscode.boot.java.livehover.v2; public class SpringProcessConnectorOverHttp implements SpringProcessConnector { From fc34af4102dc6eb6c0c00a86f527b26c837a4cff Mon Sep 17 00:00:00 2001 From: Martin Lippert Date: Mon, 7 Nov 2022 14:21:01 +0100 Subject: [PATCH 10/10] remove dependencies on yedit and do not include that bundle anymore --- .../category.xml | 1 - .../category.xml | 1 - .../category.xml | 1 - .../category.xml | 1 - eclipse-distribution/pom.xml | 5 - .../META-INF/MANIFEST.MF | 1 - .../META-INF/MANIFEST.MF | 1 - .../support/yaml/AbstractYamlEditor.java | 40 --- ...AbstractYamlSourceViewerConfiguration.java | 244 ------------------ eclipse-language-servers/pom.xml | 5 - 10 files changed, 300 deletions(-) delete mode 100644 eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/AbstractYamlEditor.java delete mode 100644 eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/AbstractYamlSourceViewerConfiguration.java diff --git a/eclipse-distribution/org.springframework.boot.ide.product.e423/category.xml b/eclipse-distribution/org.springframework.boot.ide.product.e423/category.xml index d991c89e4..1e22f37ba 100644 --- a/eclipse-distribution/org.springframework.boot.ide.product.e423/category.xml +++ b/eclipse-distribution/org.springframework.boot.ide.product.e423/category.xml @@ -138,7 +138,6 @@ - diff --git a/eclipse-distribution/org.springframework.boot.ide.product.e424/category.xml b/eclipse-distribution/org.springframework.boot.ide.product.e424/category.xml index 9345bc045..b1071bf5a 100644 --- a/eclipse-distribution/org.springframework.boot.ide.product.e424/category.xml +++ b/eclipse-distribution/org.springframework.boot.ide.product.e424/category.xml @@ -138,7 +138,6 @@ - diff --git a/eclipse-distribution/org.springframework.boot.ide.product.e425/category.xml b/eclipse-distribution/org.springframework.boot.ide.product.e425/category.xml index 9345bc045..b1071bf5a 100644 --- a/eclipse-distribution/org.springframework.boot.ide.product.e425/category.xml +++ b/eclipse-distribution/org.springframework.boot.ide.product.e425/category.xml @@ -138,7 +138,6 @@ - diff --git a/eclipse-distribution/org.springframework.boot.ide.product.e426/category.xml b/eclipse-distribution/org.springframework.boot.ide.product.e426/category.xml index 9345bc045..b1071bf5a 100644 --- a/eclipse-distribution/org.springframework.boot.ide.product.e426/category.xml +++ b/eclipse-distribution/org.springframework.boot.ide.product.e426/category.xml @@ -138,7 +138,6 @@ - diff --git a/eclipse-distribution/pom.xml b/eclipse-distribution/pom.xml index 4ef92a011..edc199811 100644 --- a/eclipse-distribution/pom.xml +++ b/eclipse-distribution/pom.xml @@ -767,11 +767,6 @@ p2 ${sts4-language-servers-p2-repo} - - yedit - p2 - https://dist.springsource.com/release/TOOLS/third-party/yedit - p2-thirdparty-bundles p2 diff --git a/eclipse-extensions/org.springframework.ide.eclipse.boot.dash/META-INF/MANIFEST.MF b/eclipse-extensions/org.springframework.ide.eclipse.boot.dash/META-INF/MANIFEST.MF index b2b43fbaa..4f6863fdb 100644 --- a/eclipse-extensions/org.springframework.ide.eclipse.boot.dash/META-INF/MANIFEST.MF +++ b/eclipse-extensions/org.springframework.ide.eclipse.boot.dash/META-INF/MANIFEST.MF @@ -28,7 +28,6 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ui.views.properties.tabbed, org.eclipse.ui.editors, org.eclipse.jface.text, - org.dadacoalition.yedit, org.eclipse.ui.workbench, org.yaml.snakeyaml, org.eclipse.compare, diff --git a/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/META-INF/MANIFEST.MF b/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/META-INF/MANIFEST.MF index 2f90178cd..b42ed5fb9 100644 --- a/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/META-INF/MANIFEST.MF +++ b/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/META-INF/MANIFEST.MF @@ -15,7 +15,6 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ui.ide, org.eclipse.jdt.ui, org.eclipse.jdt.core, - org.dadacoalition.yedit, org.eclipse.ui.editors, org.springsource.ide.eclipse.commons.livexp;bundle-version="3.8.4", org.springsource.ide.eclipse.commons.frameworks.core, diff --git a/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/AbstractYamlEditor.java b/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/AbstractYamlEditor.java deleted file mode 100644 index 402707d24..000000000 --- a/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/AbstractYamlEditor.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2016 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 - * https://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.eclipse.editor.support.yaml; - -import org.dadacoalition.yedit.editor.YEdit; -import org.eclipse.core.resources.IFile; -import org.eclipse.ui.IEditorInput; - -import com.google.common.collect.ImmutableSet; - -public abstract class AbstractYamlEditor extends YEdit { - - private static final ImmutableSet YAML_EXTENSIONS = ImmutableSet.of("yml", "yaml"); - - protected ImmutableSet getSupportedFileExtensions() { - return YAML_EXTENSIONS; - } - - @Override - protected boolean canHandleMove(IEditorInput originalElement, IEditorInput movedElement) { - //See https://issuetracker.springsource.com/browse/STS-4299 - IFile file = (IFile)movedElement.getAdapter(IFile.class); - if (file!=null) { - String extension = file.getFileExtension(); - if (extension!=null) { - extension = extension.toLowerCase(); - return getSupportedFileExtensions().contains(extension); - } - } - return false; - } -} diff --git a/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/AbstractYamlSourceViewerConfiguration.java b/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/AbstractYamlSourceViewerConfiguration.java deleted file mode 100644 index fe8c6a944..000000000 --- a/eclipse-language-servers/org.springframework.ide.eclipse.editor.support/src/org/springframework/ide/eclipse/editor/support/yaml/AbstractYamlSourceViewerConfiguration.java +++ /dev/null @@ -1,244 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015, 2017 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 - * https://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Pivotal, Inc. - initial API and implementation - *******************************************************************************/ -package org.springframework.ide.eclipse.editor.support.yaml; - -import java.lang.reflect.Constructor; -import java.util.HashSet; -import java.util.Set; - -import javax.inject.Provider; - -import org.dadacoalition.yedit.editor.YEditSourceViewerConfiguration; -import org.dadacoalition.yedit.template.YEditCompletionProcessor; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.ITextHover; -import org.eclipse.jface.text.ITextViewerExtension2; -import org.eclipse.jface.text.contentassist.ContentAssistant; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.text.contentassist.IContentAssistant; -import org.eclipse.jface.text.reconciler.IReconciler; -import org.eclipse.jface.text.reconciler.IReconcilingStrategy; -import org.eclipse.jface.text.source.Annotation; -import org.eclipse.jface.text.source.DefaultAnnotationHover; -import org.eclipse.jface.text.source.IAnnotationHover; -import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Shell; -import org.springframework.ide.eclipse.editor.support.EditorSupportActivator; -import org.springframework.ide.eclipse.editor.support.ForceableReconciler; -import org.springframework.ide.eclipse.editor.support.completions.CompletionFactory; -import org.springframework.ide.eclipse.editor.support.completions.ICompletionEngine; -import org.springframework.ide.eclipse.editor.support.completions.ProposalProcessor; -import org.springframework.ide.eclipse.editor.support.hover.HoverInfoProvider; -import org.springframework.ide.eclipse.editor.support.hover.HoverInfoTextHover; -import org.springframework.ide.eclipse.editor.support.reconcile.DefaultQuickfixContext; -import org.springframework.ide.eclipse.editor.support.reconcile.QuickfixContext; -import org.springframework.ide.eclipse.editor.support.reconcile.ReconcileProblemAnnotationHover; -import org.springframework.ide.eclipse.editor.support.util.DefaultUserInteractions; -import org.springframework.ide.eclipse.editor.support.yaml.ast.YamlASTProvider; -import org.springframework.ide.eclipse.editor.support.yaml.hover.YamlHoverInfoProvider; -import org.springframework.ide.eclipse.editor.support.yaml.structure.YamlStructureProvider; -import org.yaml.snakeyaml.Yaml; -import org.yaml.snakeyaml.constructor.SafeConstructor; - -/** - * @author Kris De Volder - */ -public abstract class AbstractYamlSourceViewerConfiguration extends YEditSourceViewerConfiguration { - - private static final Set ANNOTIONS_SHOWN_IN_TEXT = new HashSet<>(); - static { - ANNOTIONS_SHOWN_IN_TEXT.add("org.eclipse.jdt.ui.warning"); - ANNOTIONS_SHOWN_IN_TEXT.add("org.eclipse.jdt.ui.error"); - } - private static final Set ANNOTIONS_SHOWN_IN_OVERVIEW_BAR = ANNOTIONS_SHOWN_IN_TEXT; - - //TODO: the ANNOTIONS_SHOWN_IN_TEXT and ANNOTIONS_SHOWN_IN_OVERVIEW_BAR should be replaced with - // properly using preferences. An example of how to set this up can be found in the code - // of the Java properties file editor. Roughly these things need to happen: - // 1) use methods like 'isShownIntext' and 'isShownInOverviewRuler' which are defined in - // our super class. - // 2) initialize the super class with a preference store (simialr to how java properties file does it) - // 3) To be able to do 2) it is necessary to add a constructor to YEditSourceViewerConfiguration which - // accepts preference store and passes it to its super class. So this requires a patch to - // YEdit source code. - - - - private Provider shellProvider; - private final String DIALOG_SETTINGS_KEY = this.getClass().getName(); - private final YamlASTProvider astProvider = new YamlASTProvider(new Yaml(new SafeConstructor())); - private YamlCompletionEngine completionEngine; - protected ForceableReconciler fReconciler; - - public AbstractYamlSourceViewerConfiguration(Provider shellProvider) { - this.shellProvider = shellProvider; - } - - protected final IDialogSettings getDialogSettings() { - IDialogSettings dialogSettings = getPluginDialogSettings(); - IDialogSettings existing = dialogSettings.getSection(DIALOG_SETTINGS_KEY); - if (existing!=null) { - return existing; - } - IDialogSettings created = dialogSettings.addNewSection(DIALOG_SETTINGS_KEY); - Point defaultPopupSize = getDefaultPopupSize(); - if (defaultPopupSize!=null) { - int suggestW = defaultPopupSize.x; - int suggestH = defaultPopupSize.y; - created.put(ContentAssistant.STORE_SIZE_X, suggestW); - created.put(ContentAssistant.STORE_SIZE_Y, suggestH); - } - return created; - } - - protected Point getDefaultPopupSize() { - return null; - } - - protected abstract IDialogSettings getPluginDialogSettings(); - - @Override - public final IContentAssistant getContentAssistant(ISourceViewer viewer) { - IContentAssistant _a = super_getContentAssistant(viewer); - - if (_a instanceof ContentAssistant) { - ContentAssistant a = (ContentAssistant)_a; - //IContentAssistProcessor processor = assistant.getContentAssistProcessor(IDocument.DEFAULT_CONTENT_TYPE); - //if (processor!=null) { - //TODO: don't overwrite existing processor but wrap it so - // we combine our proposals with existing propopals - //} - - a.setInformationControlCreator(getInformationControlCreator(viewer)); - a.enableColoredLabels(true); - a.enablePrefixCompletion(false); - a.enableAutoInsert(true); - a.enableAutoActivation(true); - a.setRestoreCompletionProposalSize(getDialogSettings()); - ProposalProcessor processor = new ProposalProcessor(getCompletionEngine(viewer)); - a.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE); - a.setSorter(CompletionFactory.SORTER); - } - return _a; - } - - private IContentAssistant super_getContentAssistant(ISourceViewer sourceViewer) { - //Copied from superclass's getContentAssistant... then modifed to make ContentAssistant - // asynchronous. - ContentAssistant ca; - try { - //Use reflection to call the constructor because it only exists in Eclipse 4.7. - Constructor constructor = ContentAssistant.class.getConstructor(boolean.class); - ca = constructor.newInstance(true); - } catch (Exception e) { - ca = new ContentAssistant(); - } - - IContentAssistProcessor cap = new YEditCompletionProcessor(); - ca.setContentAssistProcessor(cap, IDocument.DEFAULT_CONTENT_TYPE); - ca.setInformationControlCreator(getInformationControlCreator(sourceViewer)); - - ca.enableAutoInsert(true); - - return ca; - } - - @Override - public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask) { - if (contentType.equals(IDocument.DEFAULT_CONTENT_TYPE) && ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK==stateMask) { - ITextHover delegate = getTextAnnotationHover(sourceViewer); - try { - HoverInfoProvider hoverProvider = getHoverProvider(sourceViewer); - if (hoverProvider!=null) { - return new HoverInfoTextHover(sourceViewer, getHoverProvider(sourceViewer), delegate); - } - } catch (Exception e) { - EditorSupportActivator.log(e); - } - return delegate; - } else { - return super.getTextHover(sourceViewer, contentType, stateMask); - } - } - - public ICompletionEngine getCompletionEngine(ISourceViewer viewer) { - if (completionEngine==null) { - completionEngine = new YamlCompletionEngine(getStructureProvider(), getAssistContextProvider(viewer)); - } - return completionEngine; - } - - protected HoverInfoProvider getHoverProvider(ISourceViewer viewer) { - return new YamlHoverInfoProvider(getAstProvider(), getStructureProvider(), getAssistContextProvider(viewer)); - } - - protected final YamlASTProvider getAstProvider() { - return astProvider; - } - - @Override - public final IReconciler getReconciler(ISourceViewer sourceViewer) { - if (fReconciler==null) { - fReconciler = createReconciler(sourceViewer); - } - return fReconciler; - } - - @Override - public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) { - return new DefaultAnnotationHover() { - @Override - protected boolean isIncluded(Annotation annotation) { - return ANNOTIONS_SHOWN_IN_OVERVIEW_BAR.contains(annotation.getType()); - } - }; - } - - protected ITextHover getTextAnnotationHover(ISourceViewer sourceViewer) { - return new ReconcileProblemAnnotationHover(sourceViewer, getQuickfixContext(sourceViewer)); - } - - protected Shell getShell() { - return shellProvider.get(); - } - - protected final QuickfixContext getQuickfixContext(ISourceViewer sourceViewer) { - return new DefaultQuickfixContext( - getPluginId(), - getPreferencesStore(), - sourceViewer, - new DefaultUserInteractions(getShell()) - ); - } - - protected abstract String getPluginId(); - protected abstract IPreferenceStore getPreferencesStore(); - protected abstract YamlStructureProvider getStructureProvider(); - protected abstract YamlAssistContextProvider getAssistContextProvider(ISourceViewer viewer); - - protected IReconcilingStrategy createReconcilerStrategy(ISourceViewer sourceViewer) { - return null; - } - - protected ForceableReconciler createReconciler(ISourceViewer sourceViewer) { - //TODO: aplication.properties|yaml editors are overriding this. That should not be necessary. - IReconcilingStrategy strategy = createReconcilerStrategy(sourceViewer); - if (strategy!=null) { - ForceableReconciler reconciler = new ForceableReconciler(strategy); - reconciler.setDelay(500); - return reconciler; - } - return null; - } -} diff --git a/eclipse-language-servers/pom.xml b/eclipse-language-servers/pom.xml index 90c84a630..262e7d903 100644 --- a/eclipse-language-servers/pom.xml +++ b/eclipse-language-servers/pom.xml @@ -349,11 +349,6 @@ p2 https://dist.springsource.com/release/TOOLS/third-party/misc-p2-repo/${misc.p2.repo.version} - - yedit - p2 - https://dist.springsource.com/release/TOOLS/third-party/yedit -