Update boot version validation
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user