From b299278d3da0bc3bc4bac686e8e56a3f9cacc802 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Tue, 16 Jul 2024 15:17:50 +0200 Subject: [PATCH 01/41] First version --- .../hilla/ApplicationContextProvider.java | 19 ++- .../vaadin/hilla/EndpointCodeGenerator.java | 62 +++++---- .../java/com/vaadin/hilla/OpenAPIUtil.java | 33 +---- .../hilla/engine/EngineConfiguration.java | 67 ++-------- .../vaadin/hilla/engine/ParserProcessor.java | 8 +- .../hilla/engine/EngineConfigurationTest.java | 29 ---- packages/java/engine-runtime/pom.xml | 10 ++ .../AbstractTaskEndpointGenerator.java | 96 -------------- .../EndpointGeneratorTaskFactoryImpl.java | 16 +++ .../internal/TaskGenerateEndpointImpl.java | 14 +- .../internal/TaskGenerateOpenAPIImpl.java | 28 ++-- .../AbstractTaskEndpointGeneratorTest.java | 2 +- .../internal/TaskGenerateOpenAPITest.java | 2 + .../com/vaadin/hilla/internal/TaskTest.java | 41 ------ .../hilla/maven/EngineConfigureMojo.java | 3 - .../hilla/maven/EngineGenerateMojo.java | 7 +- .../vaadin/hilla/maven/AbstractMojoTest.java | 20 +-- .../hilla/maven/EngineConfigureMojoTest.java | 3 +- .../hilla/maven/EngineGenerateMojoTest.java | 9 +- .../com/vaadin/hilla/parser/core/Parser.java | 124 +++++++----------- .../vaadin/hilla/parser/core/RootNode.java | 6 +- .../vaadin/hilla/parser/core/ScanResult.java | 27 ---- .../hilla/parser/core/ParserConfigTests.java | 7 +- .../hilla/parser/core/basic/AddPlugin.java | 7 +- .../hilla/parser/core/basic/BasicTests.java | 5 +- .../core/dependency/DependencyPlugin.java | 2 - .../core/dependency/DependencyTests.java | 4 +- ...pointExposedAndSecurityAnnotationTest.java | 3 +- ...xposedMethodAndSecurityAnnotationTest.java | 3 +- .../plugins/backbone/EndpointPlugin.java | 6 +- .../plugins/backbone/bare/BareTypeTest.java | 5 +- .../ComplexHierarchyTest.java | 4 +- .../backbone/complextype/ComplexTypeTest.java | 4 +- .../backbone/config/CustomConfigTest.java | 4 +- .../backbone/customname/CustomNameTest.java | 4 +- .../backbone/datetime/DateTimeTest.java | 4 +- .../backbone/enumtype/EnumTypeTest.java | 4 +- .../plugins/backbone/exposed/ExposedTest.java | 4 +- .../backbone/generics/GenericsTest.java | 8 +- .../GenericSuperClassMethodsTest.java | 5 +- .../backbone/iterable/IterableTest.java | 4 +- .../plugins/backbone/jackson/JacksonTest.java | 3 +- .../backbone/jsonvalue/JsonValueTest.java | 4 +- .../JsonValueNoJsonCreatorTest.java | 4 +- .../multiendpoints/MultiEndpointsTest.java | 6 +- .../shadowedname/ShadowedNameTest.java | 4 +- .../backbone/simpletype/SimpleTypeTest.java | 4 +- .../SuperClassMethodsTest.java | 4 +- .../backbone/transients/TransientTest.java | 4 +- .../backbone/wildcard/WildcardTypeTest.java | 4 +- .../model/annotations/AnnotationsTest.java | 3 +- .../plugins/model/javatypes/JavaTypeTest.java | 3 +- .../model/validation/ValidationTest.java | 3 +- .../plugins/nonnull/basic/BasicTest.java | 4 +- .../nonnull/extended/ExtendedTest.java | 4 +- .../nonnull/nonnullapi/NonNullApiTest.java | 4 +- .../SuperClassMethodsTest.java | 4 +- .../plugins/subtypes/SubTypesMethodsTest.java | 3 +- .../transfertypes/jsonnode/JsonNodeTest.java | 4 +- .../pageable/bare/BarePageableTest.java | 7 +- .../pageable/basic/PageableTest.java | 6 +- .../transfertypes/push/PushTypeTest.java | 4 +- .../plugins/transfertypes/uuid/UUIDTest.java | 4 +- 63 files changed, 311 insertions(+), 492 deletions(-) delete mode 100644 packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/ScanResult.java diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/ApplicationContextProvider.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/ApplicationContextProvider.java index 3e139d2b6b..ffa5cf9730 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/ApplicationContextProvider.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/ApplicationContextProvider.java @@ -1,21 +1,38 @@ package com.vaadin.hilla; +import jakarta.annotation.Nonnull; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.stereotype.Component; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Consumer; + @Component public class ApplicationContextProvider implements ApplicationContextAware { private static ApplicationContext applicationContext; + private static final List> pendingActions = new ArrayList<>(); @Override - public void setApplicationContext(ApplicationContext applicationContext) + public void setApplicationContext( + @Nonnull ApplicationContext applicationContext) throws BeansException { ApplicationContextProvider.applicationContext = applicationContext; + pendingActions.forEach(action -> action.accept(applicationContext)); + pendingActions.clear(); } public static ApplicationContext getApplicationContext() { return applicationContext; } + + public static void runOnContext(Consumer action) { + if (applicationContext == null) { + pendingActions.add(action); + } else { + action.accept(applicationContext); + } + } } diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java index 24a58e54e9..2be3dd5baf 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java @@ -18,8 +18,8 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Optional; -import java.util.Set; +import java.util.*; +import java.util.stream.Stream; import com.vaadin.hilla.engine.EngineConfiguration; import com.vaadin.hilla.engine.GeneratorProcessor; @@ -74,37 +74,47 @@ public static EndpointCodeGenerator getInstance() { /** * Re-generates the endpoint TypeScript and re-registers the endpoints in * Java. - * - * @throws IOException - * if something went wrong */ - public void update() throws IOException { + public void update() { initIfNeeded(); if (configuration.isProductionMode()) { throw new IllegalStateException( "This method is not available in production mode"); } - EngineConfiguration engineConfiguration = EngineConfiguration - .loadDirectory(buildDirectory); - ParserProcessor parser = new ParserProcessor(engineConfiguration, - getClass().getClassLoader(), false); - parser.process(); - GeneratorProcessor generator = new GeneratorProcessor( - engineConfiguration, nodeExecutable, false); - generator.process(); - - OpenAPIUtil.getCurrentOpenAPIPath(buildDirectory, false) - .ifPresent(openApiPath -> { - try { - this.endpointController - .registerEndpoints(openApiPath.toUri().toURL()); - } catch (IOException e) { - LOGGER.error( - "Endpoints could not be registered due to an exception: ", - e); - } - }); + LOGGER.info("█████████████████████████████████ Updating endpoint code generator"); + + ApplicationContextProvider.runOnContext(applicationContext -> { + List> endpoints = Stream + .of(BrowserCallable.class, Endpoint.class) + .map(applicationContext::getBeansWithAnnotation) + .map(Map::values).flatMap(Collection::stream) + .map(Object::getClass).distinct().toList(); + EngineConfiguration engineConfiguration = new EngineConfiguration(); + ParserProcessor parser = new ParserProcessor(engineConfiguration, + getClass().getClassLoader(), false); + parser.process(endpoints); + + GeneratorProcessor generator = new GeneratorProcessor( + engineConfiguration, nodeExecutable, false); + generator.process(); + + try { + OpenAPIUtil.getCurrentOpenAPIPath(buildDirectory, false) + .ifPresent(openApiPath -> { + try { + this.endpointController.registerEndpoints( + openApiPath.toUri().toURL()); + } catch (IOException e) { + LOGGER.error( + "Endpoints could not be registered due to an exception: ", + e); + } + }); + } catch (IOException e) { + throw new RuntimeException(e); + } + }); } private void initIfNeeded() { diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java index 3089d4decc..93b05113de 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java @@ -3,10 +3,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Collections; -import java.util.HashSet; -import java.util.Optional; -import java.util.Set; +import java.util.*; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -61,37 +58,11 @@ public static String getCurrentOpenAPI(Path buildDirectory, */ public static Optional getCurrentOpenAPIPath(Path buildDirectory, boolean isProductionMode) throws IOException { - EngineConfiguration engineConfiguration = EngineConfiguration - .loadDirectory(buildDirectory); - if (engineConfiguration == null) { - return Optional.empty(); - } + EngineConfiguration engineConfiguration = new EngineConfiguration(); return Optional .of(engineConfiguration.getOpenAPIFile(isProductionMode)); } - /** - * Generate a new openapi.json and return it, based on the classes in the - * build directory. - * - * @param buildDirectory - * the build directory, {@code target} if running with Maven - * @param isProductionMode - * whether to generate the openapi for production mode - * @return the contents of the generated openapi.json - * @throws IOException - * if something went wrong - */ - public static String generateOpenAPI(Path buildDirectory, - boolean isProductionMode) throws IOException { - EngineConfiguration engineConfiguration = EngineConfiguration - .loadDirectory(buildDirectory); - ParserProcessor parserProcessor = new ParserProcessor( - engineConfiguration, OpenAPIUtil.class.getClassLoader(), - isProductionMode); - return parserProcessor.createOpenAPI(); - } - /** * Parses the given open api and finds all used classes. * diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java index dee60221ed..f9da7153cc 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java @@ -1,7 +1,5 @@ package com.vaadin.hilla.engine; -import java.io.File; -import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.Collection; @@ -18,7 +16,6 @@ import com.vaadin.flow.server.frontend.FrontendUtils; public class EngineConfiguration { - public static final String DEFAULT_CONFIG_FILE_NAME = "hilla-engine-configuration.json"; public static final String OPEN_API_PATH = "hilla-openapi.json"; static final ObjectMapper MAPPER = new ObjectMapper() .setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE) @@ -33,52 +30,20 @@ public class EngineConfiguration { private Path outputDir; private ParserConfiguration parser; - private EngineConfiguration() { - } - - /** - * Reads the configuration from the given base directory. Reads only files - * with the default name. - * - * @param configDir - * a directory that contains the configuration file. - * @return the configuration, or null if the configuration file - * does not exist - * @throws IOException - * if thrown while reading the configuration file - * @throws ConfigurationException - * if the configuration file is invalid - */ - public static EngineConfiguration loadDirectory(Path configDir) - throws IOException { - return load(configDir.resolve(DEFAULT_CONFIG_FILE_NAME).toFile()); - } - - /** - * Reads the configuration from the given file path. - * - * @param configFile - * a path to a configuration file. - * @return the configuration, or null if the configuration file - * does not exist - * @throws IOException - * if thrown while reading the configuration file - * @throws ConfigurationException - * if the configuration file is invalid - */ - public static EngineConfiguration load(File configFile) throws IOException { - if (!configFile.isFile()) { - return null; - } - - try { - return MAPPER.readValue(configFile, EngineConfiguration.class); - } - // This is mainly to wrap Jackson exceptions, but declaring them - // explicitly can cause problems in tests if they are not on the - // classpath - catch (RuntimeException e) { - throw new ConfigurationException(e); + public EngineConfiguration() { + baseDir = Path.of(System.getProperty("user.dir")); + buildDir = baseDir.resolve("target"); + classesDir = buildDir.resolve("classes"); + generator = new GeneratorConfiguration(); + parser = new ParserConfiguration(); + classPath = new LinkedHashSet<>(); + + var legacyFrontendGeneratedDir = baseDir.resolve("frontend/generated"); + if (Files.exists(legacyFrontendGeneratedDir)) { + outputDir = legacyFrontendGeneratedDir; + } else { + outputDir = baseDir.resolve( + FrontendUtils.DEFAULT_PROJECT_FRONTEND_GENERATED_DIR); } } @@ -134,10 +99,6 @@ public int hashCode() { classesDir, outputDir); } - public void store(File file) throws IOException { - MAPPER.writeValue(file, this); - } - @JsonIgnore public Path getOpenAPIFile(boolean isProductionMode) { return isProductionMode ? classesDir.resolve(OPEN_API_PATH) diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java index 8d5f09c0f4..9a892c5ee9 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java @@ -44,7 +44,7 @@ public ParserProcessor(EngineConfiguration conf, ClassLoader classLoader, applyConfiguration(conf.getParser()); } - public String createOpenAPI() throws IOException { + private String createOpenAPI(List> endpoints) throws IOException { var parser = new Parser().classLoader(classLoader) .classPath(classPath.stream().map(Path::toString) .collect(Collectors.toSet())) @@ -57,17 +57,17 @@ public String createOpenAPI() throws IOException { logger.debug("Starting JVM Parser"); - var openAPI = parser.execute(); + var openAPI = parser.execute(endpoints); return new JsonPrinter().pretty().writeAsString(openAPI); } - public void process() throws ParserException { + public void process(List> endpoints) throws ParserException { String openAPIString; try { Files.createDirectories(openAPIFile.getParent()); - openAPIString = createOpenAPI(); + openAPIString = createOpenAPI(endpoints); } catch (IOException e) { throw new ParserException("Unable to prepare OpenAPI definition", e); diff --git a/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java b/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java index 66c618e34d..2cbb1ffe69 100644 --- a/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java +++ b/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java @@ -72,21 +72,6 @@ public void setUp() throws IOException { .parser(parserConfiguration).generator(generatorConfiguration); } - @Test - public void should_DeserializeFromJsonFile() - throws IOException, URISyntaxException, InvocationTargetException, - NoSuchMethodException, InstantiationException, - IllegalAccessException, NoSuchFieldException { - var config = configurationBuilder.create(); - Files.copy(Path.of(TEST_CONFIG_URL.toURI()), configFile.toPath()); - - var loadedConfig = TestEngineConfigurationPathResolver - .resolve(EngineConfiguration.load(configFile), baseDirectory); - - assertNotNull(loadedConfig); - JsonAssertions.assertEquals(config, loadedConfig); - } - @Test public void should_NotRelativizeOutputDir_WhenGivenRelative() { var config = configurationBuilder.outputDir("relative/path").create(); @@ -103,20 +88,6 @@ public void should_RelativizeOutputDir_WhenGivenAbsolutePath() { } @Test - public void should_SerializeToJsonFile() throws IOException, - InvocationTargetException, NoSuchMethodException, - InstantiationException, IllegalAccessException { - configurationBuilder.create().store(configFile); - - var storedConfig = EngineConfiguration.MAPPER.readValue(configFile, - EngineConfiguration.class); - var expectedConfig = TestEngineConfigurationPathResolver - .resolve(EngineConfiguration.MAPPER.readValue(TEST_CONFIG_URL, - EngineConfiguration.class), baseDirectory); - - JsonAssertions.assertEquals(expectedConfig, storedConfig); - } - @AfterEach public void tearDown() throws IOException { if (this.configFile.exists()) { diff --git a/packages/java/engine-runtime/pom.xml b/packages/java/engine-runtime/pom.xml index 63a13b3ca4..dc0a33d7b3 100644 --- a/packages/java/engine-runtime/pom.xml +++ b/packages/java/engine-runtime/pom.xml @@ -28,6 +28,16 @@ + + com.vaadin + hilla-endpoint + ${project.version} + + + org.springframework + spring-context + provided + com.vaadin flow-server diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/AbstractTaskEndpointGenerator.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/AbstractTaskEndpointGenerator.java index 802b953f92..70c2cee1fb 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/AbstractTaskEndpointGenerator.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/AbstractTaskEndpointGenerator.java @@ -65,100 +65,4 @@ abstract class AbstractTaskEndpointGenerator implements FallibleCommand { this.resourceFinder = Objects.requireNonNull(resourceFinder, "Class finder cannot be null"); } - - protected EngineConfiguration getEngineConfiguration() - throws ExecutionFailedException { - if (engineConfiguration == null) { - prepareEngineConfiguration(); - } - - return engineConfiguration; - } - - protected void prepareEngineConfiguration() - throws ExecutionFailedException { - var configDir = projectDirectory.toPath().resolve(buildDirectoryName); - - if (firstRun) { - logger.debug("Configure Hilla engine using build system plugin"); - - var mavenConfigure = MavenRunner.forProject(projectDirectory, "-q", - "vaadin:configure"); - var mavenConfigureVersion = getVaadinVersion() - .flatMap(version -> MavenRunner.forProject(projectDirectory, - "-q", "com.vaadin:vaadin-maven-plugin:" + version - + ":configure")); - var gradleConfigure = GradleRunner.forProject(projectDirectory, - "-q", "hillaConfigure"); - - var runners = Stream - .of(mavenConfigure, mavenConfigureVersion, gradleConfigure) - .flatMap(Optional::stream).toList(); - - if (runners.isEmpty()) { - throw new ExecutionFailedException(String.format( - "Failed to determine project directory for dev mode. " - + "Directory '%s' does not look like a Maven or " - + "Gradle project.", - projectDirectory)); - } else { - for (var runner : runners) { - try { - runner.run(null, false); - firstRun = false; - break; - } catch (CommandRunnerException e) { - logger.debug( - "Failed to configure Hilla engine using " - + runner.getClass().getSimpleName() - + " with arguments " - + Arrays.toString(runner.arguments()), - e); - } - } - } - - if (firstRun) { - throw new ExecutionFailedException( - "Failed to configure Hilla engine: no runner succeeded. " - + "Set log level to debug to see more details."); - } - } - - try { - var config = EngineConfiguration.loadDirectory(configDir); - - if (config == null) { - throw new ExecutionFailedException( - "Engine configuration is missing"); - } - - this.engineConfiguration = new EngineConfiguration.Builder(config) - .outputDir(outputDirectory.toPath()).create(); - } catch (IOException | ConfigurationException e) { - throw new ExecutionFailedException( - "Failed to read Hilla engine configuration", e); - } - - } - - private Optional getVaadinVersion() { - String vaadinVersion = null; - try (final InputStream vaadinPomProperties = resourceFinder - .apply("META-INF/maven/com.vaadin/vaadin-core/pom.properties") - .openStream()) { - if (vaadinPomProperties != null) { - final Properties properties = new Properties(); - properties.load(vaadinPomProperties); - vaadinVersion = properties.getProperty("version", ""); - } else { - LOGGER.debug("Unable to determine Vaadin version. " - + "No META-INF/maven/com.vaadin/vaadin-core/pom.properties found"); - } - } catch (Exception e) { - LOGGER.debug("Unable to determine Vaadin version", e); - } - - return Optional.ofNullable(vaadinVersion); - } } diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java index 9df5487cb2..466bddc342 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java @@ -15,6 +15,11 @@ */ package com.vaadin.hilla.internal; +import com.vaadin.hilla.BrowserCallable; +import com.vaadin.hilla.Endpoint; + +import jakarta.annotation.Nonnull; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,6 +33,17 @@ import com.vaadin.hilla.engine.ParserProcessor; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; +import java.util.stream.Stream; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; + +import com.vaadin.hilla.ApplicationContextProvider; + /** * An implementation of the EndpointGeneratorTaskFactory, which creates endpoint * generator tasks. diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java index 3bc06f820d..bcab2bbea1 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java @@ -19,13 +19,16 @@ import java.net.URL; import java.util.function.Function; +import com.vaadin.hilla.ApplicationContextProvider; import com.vaadin.hilla.engine.GeneratorException; import com.vaadin.hilla.engine.GeneratorProcessor; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.vaadin.flow.server.ExecutionFailedException; import com.vaadin.flow.server.frontend.TaskGenerateEndpoint; +import com.vaadin.hilla.engine.EngineConfiguration; /** * Starts the generation of TS files for endpoints. @@ -75,17 +78,12 @@ public class TaskGenerateEndpointImpl extends AbstractTaskEndpointGenerator */ @Override public void execute() throws ExecutionFailedException { - try { - var engineConfiguration = getEngineConfiguration(); + ApplicationContextProvider.runOnContext(applicationContext -> { + var engineConfiguration = new EngineConfiguration(); var processor = new GeneratorProcessor(engineConfiguration, nodeCommand, productionMode); processor.process(); - } catch (GeneratorException e) { - // Make sure the exception is printed in the logs - LOGGER.error("Failed to run TypeScript endpoint generator", e); - throw new ExecutionFailedException( - "Failed to run TypeScript endpoint generator"); - } + }); } } diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java index f91fdd6b7d..751c577876 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java @@ -16,11 +16,20 @@ package com.vaadin.hilla.internal; import javax.annotation.Nonnull; + import java.io.File; import java.net.URL; +import java.util.Collection; +import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.function.Function; +import java.util.function.Supplier; +import java.util.stream.Stream; +import com.vaadin.hilla.ApplicationContextProvider; +import com.vaadin.hilla.BrowserCallable; +import com.vaadin.hilla.Endpoint; import com.vaadin.hilla.engine.ParserException; import com.vaadin.hilla.engine.ParserProcessor; @@ -30,6 +39,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.vaadin.hilla.engine.EngineConfiguration; + /** * Generate OpenAPI json file for Vaadin Endpoints. */ @@ -81,15 +92,16 @@ public class TaskGenerateOpenAPIImpl extends AbstractTaskEndpointGenerator */ @Override public void execute() throws ExecutionFailedException { - try { - var engineConfiguration = getEngineConfiguration(); + ApplicationContextProvider.runOnContext(applicationContext -> { + List> endpoints = Stream + .of(BrowserCallable.class, Endpoint.class) + .map(applicationContext::getBeansWithAnnotation) + .map(Map::values).flatMap(Collection::stream) + .map(Object::getClass).distinct().toList(); + var engineConfiguration = new EngineConfiguration(); var processor = new ParserProcessor(engineConfiguration, classLoader, isProductionMode); - processor.process(); - } catch (ParserException e) { - // Make sure the exception is printed in the logs - LOGGER.error("Java code parsing failed", e); - throw new ExecutionFailedException("Java code parsing failed"); - } + processor.process(endpoints); + }); } } diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/AbstractTaskEndpointGeneratorTest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/AbstractTaskEndpointGeneratorTest.java index eb46a90419..ee84644d33 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/AbstractTaskEndpointGeneratorTest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/AbstractTaskEndpointGeneratorTest.java @@ -69,7 +69,7 @@ private class MockedTaskEndpointGenerator @Override public void execute() throws ExecutionFailedException { - getEngineConfiguration(); + } } diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateOpenAPITest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateOpenAPITest.java index 3722e65e2e..bb6e0bd956 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateOpenAPITest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateOpenAPITest.java @@ -27,6 +27,8 @@ import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.parser.OpenAPIV3Parser; +import java.util.List; + /** * This test suite is only for triggering the OpenAPI generator. For the actual * content of the generator, they are tested in other package diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java index 4ee7fc6cf8..30e202ecac 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java @@ -42,27 +42,6 @@ public void setUpTaskApplication() throws IOException, URISyntaxException, .resolve(getFrontendDirectory()); Files.createDirectories(frontendDir); - // Create hilla-engine-configuration.json from template - var configPath = buildDir - .resolve(EngineConfiguration.DEFAULT_CONFIG_FILE_NAME); - Files.copy( - Path.of(Objects - .requireNonNull(getClass().getResource( - EngineConfiguration.DEFAULT_CONFIG_FILE_NAME)) - .toURI()), - configPath); - - var config = prepareConfiguration(buildDir); - - Files.delete(configPath); - config.store(configPath.toFile()); - - // Let Hilla know that the file has been generated - var field = AbstractTaskEndpointGenerator.class - .getDeclaredField("firstRun"); - field.setAccessible(true); - field.set(null, false); - var packagesDirectory = Path .of(getClass().getClassLoader().getResource("").toURI()) .getParent() // target @@ -121,24 +100,4 @@ protected String getOutputDirectory() { protected Path getTemporaryDirectory() { return temporaryDirectory; } - - /** - * Modifies runtime settings (paths, class path) - */ - private EngineConfiguration prepareConfiguration(Path buildDir) - throws URISyntaxException, IOException, InvocationTargetException, - NoSuchMethodException, InstantiationException, - IllegalAccessException { - var classPath = new LinkedHashSet<>(List - .of(Path.of(getClass().getClassLoader().getResource("").toURI()) - .toString())); - - var config = EngineConfiguration.loadDirectory(buildDir); - - config = TestEngineConfigurationPathResolver.resolve(config, - temporaryDirectory); - - return new EngineConfiguration.Builder(config).classPath(classPath) - .create(); - } } diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineConfigureMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineConfigureMojo.java index 2ba44f6aa3..554c1890e8 100644 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineConfigureMojo.java +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineConfigureMojo.java @@ -85,9 +85,6 @@ public void execute() throws EngineConfigureMojoException { // project just to get this configuration again var configDir = project.getBasedir().toPath().resolve(buildDir); Files.createDirectories(configDir); - conf.store(configDir - .resolve(EngineConfiguration.DEFAULT_CONFIG_FILE_NAME) - .toFile()); } catch (DependencyResolutionRequiredException e) { throw new EngineConfigureMojoException("Configuration failed", e); } catch (IOException e) { diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java index 328d01dbd0..e9820716e4 100644 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java @@ -4,6 +4,7 @@ import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; +import java.util.List; import java.util.Objects; import org.apache.maven.model.Profile; @@ -27,7 +28,6 @@ * TypeScript code from it. */ @Mojo(name = "generate", defaultPhase = LifecyclePhase.PROCESS_CLASSES, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) -@Execute(goal = "configure") public final class EngineGenerateMojo extends AbstractMojo { @Parameter(defaultValue = "node") @@ -48,8 +48,7 @@ public void execute() throws EngineGenerateMojoException { try { var baseDir = project.getBasedir().toPath(); var buildDir = baseDir.resolve(project.getBuild().getDirectory()); - var conf = Objects.requireNonNull( - EngineConfiguration.loadDirectory(buildDir)); + var conf = new EngineConfiguration(); var classPath = conf.getClassPath(); var urls = new ArrayList(classPath.size()); for (var classPathItem : classPath) { @@ -64,7 +63,7 @@ public void execute() throws EngineGenerateMojoException { var generatorProcessor = new GeneratorProcessor(conf, nodeCommand, isProduction); - parserProcessor.process(); + parserProcessor.process(List.of()); generatorProcessor.process(); } catch (IOException e) { throw new EngineGenerateMojoException( diff --git a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java index 69e14cb728..1d0e8f4fdf 100644 --- a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java +++ b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java @@ -65,29 +65,11 @@ public void setUpMojoTest() throws Exception { .getOutputDirectory(); Mockito.doReturn(mockBuild).when(project).getBuild(); - var configFilePath = getBuildDirectory() - .resolve(EngineConfiguration.DEFAULT_CONFIG_FILE_NAME); - - // Load reference EngineConfiguration - Files.copy( - Path.of(Objects - .requireNonNull(getClass().getResource( - EngineConfiguration.DEFAULT_CONFIG_FILE_NAME)) - .toURI()), - configFilePath); - - var config = TestEngineConfigurationPathResolver.resolve( - EngineConfiguration.load(configFilePath.toFile()), - temporaryDirectory); - + var config = new EngineConfiguration(); assertNotNull(config, "expected reference " + "EngineConfiguration to load from json"); configurationBuilder = new EngineConfiguration.Builder(config) .baseDir(getTemporaryDirectory()); - - // Delete reference json file from temporary directory - Files.delete(getBuildDirectory() - .resolve(EngineConfiguration.DEFAULT_CONFIG_FILE_NAME)); } @AfterEach diff --git a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineConfigureMojoTest.java b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineConfigureMojoTest.java index d650208873..464a240c72 100644 --- a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineConfigureMojoTest.java +++ b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineConfigureMojoTest.java @@ -18,8 +18,7 @@ public void should_StoreConfigurationJson() throws Exception { getMavenProject()); engineConfigureMojo.execute(); - var storedEngineConfiguration = EngineConfiguration - .loadDirectory(getBuildDirectory()); + var storedEngineConfiguration = new EngineConfiguration(); assertNotNull(storedEngineConfiguration); JsonAssertions.assertEquals(getEngineConfiguration(), storedEngineConfiguration); diff --git a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineGenerateMojoTest.java b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineGenerateMojoTest.java index 9ee90cfae1..84d6972267 100644 --- a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineGenerateMojoTest.java +++ b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineGenerateMojoTest.java @@ -6,6 +6,7 @@ import java.net.URL; import java.net.URLClassLoader; +import java.util.List; import org.junit.jupiter.api.Test; import org.mockito.Answers; @@ -57,12 +58,6 @@ public void should_RunParserAndGenerator() throws Exception { var mockedStaticEngineConfiguration = Mockito .mockStatic(EngineConfiguration.class)) { - // Use reference EngineConfiguration - mockedStaticEngineConfiguration - .when(() -> EngineConfiguration - .loadDirectory(Mockito.eq(getBuildDirectory()))) - .thenReturn(getEngineConfiguration()); - // Lookup and initialize mojo var engineGenerateMojo = (EngineGenerateMojo) lookupMojo("generate", getTestConfiguration()); @@ -80,7 +75,7 @@ public void should_RunParserAndGenerator() throws Exception { .get(0); var inOrder = Mockito.inOrder(parserProcessor, generatorProcessor); - inOrder.verify(parserProcessor).process(); + inOrder.verify(parserProcessor).process(List.of()); inOrder.verify(generatorProcessor).process(); } } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java index abe5348fc1..5983f62b9f 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java @@ -16,11 +16,9 @@ import javax.annotation.Nonnull; -import io.github.classgraph.ClassInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.github.classgraph.ClassGraph; import io.swagger.v3.oas.models.OpenAPI; /** @@ -293,7 +291,7 @@ public Parser exposedPackages(@Nonnull Collection exposedPackages, * @return A result OpenAPI object. */ @Nonnull - public OpenAPI execute() { + public OpenAPI execute(List> endpoints) { Objects.requireNonNull(config.classLoader, "[JVM Parser] classLoader is not provided."); Objects.requireNonNull(config.classPathElements, @@ -305,85 +303,59 @@ public OpenAPI execute() { var storage = new SharedStorage(config); - var classGraph = new ClassGraph().enableAnnotationInfo() - .ignoreClassVisibility() - .overrideClassLoaders(config.getClassLoader()); - - Collection packages = config.exposedPackages; - - // Packages explicitly defined in pom.xml have priority - if (packages != null && !packages.isEmpty()) { - logger.debug("Search for endpoints in packages {}", packages); - classGraph.acceptPackages(packages.toArray(String[]::new)); - classGraph.overrideClasspath(config.getClassPathElements()); - } - // If no packages are defined, then scan the whole classpath except - // jars, which basically means scanning the build or target folder - else { - var buildDirectories = config.getClassPathElements().stream() - .filter(e -> !e.endsWith(".jar")) - .collect(Collectors.toList()); - logger.debug("Search for endpoints in directories {}", - buildDirectories); - classGraph.overrideClasspath(buildDirectories); - } - - try (var scanResult = classGraph.scan()) { - validateEndpointExposedClassesForAclAnnotations(scanResult); - var rootNode = new RootNode(new ScanResult(scanResult), - storage.getOpenAPI()); - var pluginManager = new PluginManager( - storage.getParserConfig().getPlugins()); - pluginManager.setStorage(storage); - var pluginExecutor = new PluginExecutor(pluginManager, rootNode); - pluginExecutor.execute(); - } + // validateEndpointExposedClassesForAclAnnotations(scanResult); + var rootNode = new RootNode(endpoints, storage.getOpenAPI()); + var pluginManager = new PluginManager( + storage.getParserConfig().getPlugins()); + pluginManager.setStorage(storage); + var pluginExecutor = new PluginExecutor(pluginManager, rootNode); + pluginExecutor.execute(); logger.debug("JVM Parser finished successfully"); return storage.getOpenAPI(); } - private void validateEndpointExposedClassesForAclAnnotations( - io.github.classgraph.ScanResult scanResult) { - - Optional.ofNullable(config.getEndpointExposedAnnotationName()) - .ifPresent(endpointExposedAnnotation -> scanResult - .getClassesWithAnnotation(endpointExposedAnnotation) - .forEach(classInfo -> { - checkClassLevelAnnotation(classInfo); - checkMethodLevelAnnotation(classInfo); - })); - } - - private void checkClassLevelAnnotation(ClassInfo classInfo) { - classInfo.getAnnotationInfo() - .forEach(annotationInfo -> throwIfAnnotationIsAclAnnotation( - annotationInfo.getName(), classInfo)); - } - - private void checkMethodLevelAnnotation(ClassInfo classInfo) { - for (Method method : classInfo.loadClass().getMethods()) { - var annotations = method.getDeclaredAnnotations(); - for (Annotation annotation : annotations) { - throwIfAnnotationIsAclAnnotation( - annotation.annotationType().getName(), classInfo); - } - } - } - - private void throwIfAnnotationIsAclAnnotation(String annotationName, - ClassInfo classInfo) { - var endpointExposedAnnotation = config - .getEndpointExposedAnnotationName(); - - if (ACL_ANNOTATIONS.contains(annotationName)) { - throw new ParserException(String.format( - ENDPOINT_EXPOSED_AND_ACL_ANNOTATIONS_ERROR_TEMPLATE, - classInfo.getName(), endpointExposedAnnotation, - annotationName, endpointExposedAnnotation)); - } - } + // private void validateEndpointExposedClassesForAclAnnotations( + // io.github.classgraph.ScanResult scanResult) { + + // Optional.ofNullable(config.getEndpointExposedAnnotationName()) + // .ifPresent(endpointExposedAnnotation -> scanResult + // .getClassesWithAnnotation(endpointExposedAnnotation) + // .forEach(classInfo -> { + // checkClassLevelAnnotation(classInfo); + // checkMethodLevelAnnotation(classInfo); + // })); + // } + + // private void checkClassLevelAnnotation(ClassInfo classInfo) { + // classInfo.getAnnotationInfo() + // .forEach(annotationInfo -> throwIfAnnotationIsAclAnnotation( + // annotationInfo.getName(), classInfo)); + // } + + // private void checkMethodLevelAnnotation(ClassInfo classInfo) { + // for (Method method : classInfo.loadClass().getMethods()) { + // var annotations = method.getDeclaredAnnotations(); + // for (Annotation annotation : annotations) { + // throwIfAnnotationIsAclAnnotation( + // annotation.annotationType().getName(), classInfo); + // } + // } + // } + + // private void throwIfAnnotationIsAclAnnotation(String annotationName, + // ClassInfo classInfo) { + // var endpointExposedAnnotation = config + // .getEndpointExposedAnnotationName(); + + // if (ACL_ANNOTATIONS.contains(annotationName)) { + // throw new ParserException(String.format( + // ENDPOINT_EXPOSED_AND_ACL_ANNOTATIONS_ERROR_TEMPLATE, + // classInfo.getName(), endpointExposedAnnotation, + // annotationName, endpointExposedAnnotation)); + // } + // } /** * Gets the internal configuration object. diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/RootNode.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/RootNode.java index 1876b6ee3d..5c4d0e726c 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/RootNode.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/RootNode.java @@ -1,11 +1,13 @@ package com.vaadin.hilla.parser.core; +import java.util.List; + import javax.annotation.Nonnull; import io.swagger.v3.oas.models.OpenAPI; -public final class RootNode extends AbstractNode { - RootNode(@Nonnull ScanResult source, @Nonnull OpenAPI target) { +public final class RootNode extends AbstractNode>, OpenAPI> { + RootNode(@Nonnull List> source, @Nonnull OpenAPI target) { super(source, target); } } diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/ScanResult.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/ScanResult.java deleted file mode 100644 index b009590471..0000000000 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/ScanResult.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.vaadin.hilla.parser.core; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import io.github.classgraph.ClassInfo; - -public class ScanResult { - private final io.github.classgraph.ScanResult result; - - public ScanResult(io.github.classgraph.ScanResult result) { - this.result = result; - } - - public io.github.classgraph.ScanResult get() { - return result; - } - - public List> getClassesWithAnnotation(String... annotations) { - Stream c = Stream.of(annotations) - .flatMap(annotation -> result - .getClassesWithAnnotation(annotation).stream()); - return c.map(ClassInfo::loadClass).toList(); - } -} diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java index 71573d7f1a..f071a15a86 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java @@ -140,7 +140,7 @@ public void should_ThrowError_When_ClassLoaderIsNotSet() { var e = assertThrows(NullPointerException.class, () -> new Parser().classPath(defaultClassPathElements) .endpointAnnotation(defaultEndpointAnnotationName) - .execute()); + .execute(List.of())); assertEquals("[JVM Parser] classLoader is not provided.", e.getMessage()); } @@ -150,7 +150,7 @@ public void should_ThrowError_When_ClassPathIsNotSet() { var e = assertThrows(NullPointerException.class, () -> new Parser().classLoader(getClass().getClassLoader()) .endpointAnnotation(defaultEndpointAnnotationName) - .execute()); + .execute(List.of())); assertEquals("[JVM Parser] classPath is not provided.", e.getMessage()); } @@ -158,7 +158,8 @@ public void should_ThrowError_When_ClassPathIsNotSet() { public void should_ThrowError_When_EndpointAnnotationNameIsNotSet() { var e = assertThrows(NullPointerException.class, () -> new Parser().classLoader(getClass().getClassLoader()) - .classPath(defaultClassPathElements).execute()); + .classPath(defaultClassPathElements) + .execute(List.of())); assertEquals("[JVM Parser] endpointAnnotationName is not provided.", e.getMessage()); } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/AddPlugin.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/AddPlugin.java index c649827b36..b9848ab020 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/AddPlugin.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/AddPlugin.java @@ -36,11 +36,8 @@ public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { var node = nodeDependencies.getNode(); if (node instanceof RootNode) { var rootNode = (RootNode) node; - var endpoints = rootNode.getSource() - .getClassesWithAnnotation(getStorage().getParserConfig() - .getEndpointAnnotationName()) - .stream().map(ClassInfoModel::of) - .collect(Collectors.toList()); + var endpoints = rootNode.getSource().stream() + .map(ClassInfoModel::of).collect(Collectors.toList()); return nodeDependencies .appendChildNodes(endpoints.stream().map(EndpointNode::of)) .appendRelatedNodes(endpoints.stream() diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java index cbe801c631..e89161b9c7 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java @@ -40,6 +40,7 @@ public class BasicTests { private final List classPath; private final ResourceLoader resourceLoader = new ResourceLoader( getClass()); + private final List> endpoints = List.of(BasicEndpoint.class); { try { @@ -54,7 +55,7 @@ public void should_TraverseInConsistentOrder() { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(classPath) .endpointAnnotation(Endpoint.class.getName()) - .addPlugin(new BasicPlugin()).execute(); + .addPlugin(new BasicPlugin()).execute(endpoints); assertEquals(String.join("\n", STEPS), openAPI.getExtensions().get(BasicPlugin.FOOTSTEPS_STORAGE_KEY)); @@ -65,7 +66,7 @@ public void should_UpdateNodesAndCollectNames() { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(classPath) .endpointAnnotation(Endpoint.class.getName()) - .addPlugin(new BasicPlugin()).execute(); + .addPlugin(new BasicPlugin()).execute(endpoints); assertEquals(String.join(", ", List.of("FieldInfoModel foo", "FieldInfoModel fieldFoo", diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyPlugin.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyPlugin.java index 5836b55ed1..400a3c59c7 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyPlugin.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyPlugin.java @@ -70,8 +70,6 @@ public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { if (node instanceof RootNode) { var rootNode = (RootNode) node; return nodeDependencies.appendChildNodes(rootNode.getSource() - .getClassesWithAnnotation(getStorage().getParserConfig() - .getEndpointAnnotationName()) .stream().map(ClassInfoModel::of).map(EndpointNode::of)); } else if ((node instanceof EndpointNode)) { var cls = (ClassInfoModel) node.getSource(); diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java index 39146ad837..6432a61ae4 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java @@ -18,6 +18,8 @@ public class DependencyTests { private static final List classPath; private static final ResourceLoader resourceLoader = new ResourceLoader( DependencyTests.class); + private static final List> endpoints = List + .of(DependencyEndpoint.class); private static OpenAPI openApi; static { @@ -34,7 +36,7 @@ public static void setUp() { .classLoader(DependencyTests.class.getClassLoader()) .classPath(classPath) .endpointAnnotation(Endpoint.class.getName()) - .addPlugin(new DependencyPlugin()).execute(); + .addPlugin(new DependencyPlugin()).execute(endpoints); } @Test diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/classlevel/EndpointExposedAndSecurityAnnotationTest.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/classlevel/EndpointExposedAndSecurityAnnotationTest.java index 8ac1e0bc11..50775318e0 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/classlevel/EndpointExposedAndSecurityAnnotationTest.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/classlevel/EndpointExposedAndSecurityAnnotationTest.java @@ -19,6 +19,7 @@ public class EndpointExposedAndSecurityAnnotationTest { private final List classPath; private final ResourceLoader resourceLoader = new ResourceLoader( getClass()); + private final List> endpoints = List.of(SomeEndpoint.class); { try { @@ -36,7 +37,7 @@ public void throws_when_parentEndpointClass_annotatedWithSecurityAnnotations() { .of("com.vaadin.hilla.parser.core.security.classlevel")) .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) - .execute()); + .execute(endpoints)); assertTrue(exception.getMessage().startsWith( "Class `com.vaadin.hilla.parser.core.security.classlevel.ParentEndpoint` is annotated with `com.vaadin.hilla.parser.core.security.EndpointExposed` and `jakarta.annotation.security.RolesAllowed` annotation.")); diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/methodlevel/EndpointExposedMethodAndSecurityAnnotationTest.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/methodlevel/EndpointExposedMethodAndSecurityAnnotationTest.java index 1b78ced2a9..ae7238bf9f 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/methodlevel/EndpointExposedMethodAndSecurityAnnotationTest.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/methodlevel/EndpointExposedMethodAndSecurityAnnotationTest.java @@ -19,6 +19,7 @@ public class EndpointExposedMethodAndSecurityAnnotationTest { private final List classPath; private final ResourceLoader resourceLoader = new ResourceLoader( getClass()); + private final List> endpoints = List.of(AnotherEndpoint.class); { try { @@ -36,7 +37,7 @@ public void throws_when_parentEndpointMethod_annotatedWithSecurityAnnotations() "com.vaadin.hilla.parser.core.security.methodlevel")) .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) - .execute()); + .execute(endpoints)); assertTrue(exception.getMessage().startsWith( "Class `com.vaadin.hilla.parser.core.security.methodlevel.ParentEndpoint` is annotated with `com.vaadin.hilla.parser.core.security.EndpointExposed` and `jakarta.annotation.security.RolesAllowed` annotation.")); diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java index f0c86d529c..7e56c7bfb5 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java @@ -67,10 +67,8 @@ public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { var rootNode = (RootNode) nodeDependencies.getNode(); var endpointAnnotationName = getStorage().getParserConfig() .getEndpointAnnotationName(); - var endpoints = rootNode.getSource() - .getClassesWithAnnotation(endpointAnnotationName, - "com.vaadin.hilla.BrowserCallable") - .stream().map(ClassInfoModel::of).toList(); + var endpoints = rootNode.getSource().stream() + .map(ClassInfoModel::of).toList(); checkIfJavaCompilerParametersFlagIsEnabled(endpoints); return nodeDependencies.appendChildNodes( endpoints.stream().filter(ClassInfoModel::isNonJDKClass) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java index 47640d98ae..8b661ad0d0 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java @@ -2,8 +2,10 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; +import com.vaadin.hilla.parser.plugins.backbone.config.CustomConfigEndpoint; import org.junit.jupiter.api.Test; import com.vaadin.hilla.parser.core.Parser; @@ -19,7 +21,8 @@ public void should_CorrectlyResolveBareTypes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(CustomConfigEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java index e8d40ff661..fb98ccbd75 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -20,7 +21,8 @@ public void should_GenerateParentModel_When_UsingChildModel() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(ComplexHierarchyEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java index cdf9b16fa7..eb1dfbf96d 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -19,7 +20,8 @@ public void should_CorrectlyHandleComplexTypes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(ComplexTypeEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java index 4c456d5b71..ceacb8d8a9 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -27,7 +28,8 @@ public void should_CorrectlyHandleComplexTypes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) - .addPlugin(backbonePlugin).execute(); + .addPlugin(backbonePlugin) + .execute(List.of(CustomConfigEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java index 57b04308a8..8440488ac2 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import com.vaadin.hilla.parser.core.Parser; @@ -18,7 +19,8 @@ public void should_UseCustomEndpointNames_WhenGivenInAnnotation() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(CustomNameTest.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java index af9edf8528..e372331ebe 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -19,7 +20,8 @@ public void should_GenerateStringType_When_ReferringToDateTimeTypes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(DateTimeEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java index 267901144f..aab6daaf29 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -19,7 +20,8 @@ public void should_GenerateStringType_When_ReferringToEnumTypes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(EnumTypeEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java index 1166521aea..6abd94c47f 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -20,7 +21,8 @@ public void should_CorrectlyHandleEndpointExposedAnnotation() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(ExposedEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java index df392e676c..efc17531d3 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -20,7 +21,12 @@ public void should_ParseGenericTypes() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(GenericsBareEndpoint.class, + GenericsExtendedEndpoint.class, + GenericsMethodsEndpoint.class, + GenericsRefEndpoint.class, + ImplementInterfaceEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java index 61109e2852..937aa9cb07 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import com.vaadin.hilla.parser.core.Parser; @@ -19,7 +20,9 @@ public void should_CorrectlyHandleSuperClassMethods() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(GenericSuperClassLong.class, + GenericSuperClassString.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java index aa28116b6d..7838486060 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -19,7 +20,8 @@ public void should_GenerateStringType_When_ReferringToEnumTypes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(IterableEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java index 858ec61cf9..3cdffd4cf4 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java @@ -28,7 +28,8 @@ public void should_CorrectlyIgnoreFieldsBasedOnJSONAnnotations() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(JacksonEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java index f7151846af..45a1ec1670 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java @@ -7,6 +7,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; public class JsonValueTest { @@ -18,7 +19,8 @@ public void should_CorrectlyMapJsonValue() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(JsonValueEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java index f66b0c801a..72418d1f83 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java @@ -6,6 +6,7 @@ import com.vaadin.hilla.parser.plugins.backbone.test.helpers.TestHelper; import org.junit.jupiter.api.Test; +import java.util.List; import java.util.Set; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -19,7 +20,8 @@ public void should_ThrowExceptionWhenOnlyJsonValueIsUsed() { new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(JsonValueNoJsonCreatorTest.class)); }); } } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java index 57553d1f53..ef8c2e2a23 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -19,7 +20,10 @@ public void should_UseAppropriateSchema_When_SimpleTypesAreUsed() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(MultiEndpointsBarEndpoint.class, + MultiEndpointsBazEndpoint.class, + MultiEndpointsFooEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java index b4112d8e38..90855967b2 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -19,7 +20,8 @@ public void should_DistinguishBetweenUserAndBuiltinTypes_When_TheyHaveSameName() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(ShadowedNameEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java index 94e8cb6d71..13ad56b052 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -19,7 +20,8 @@ public void should_UseAppropriateSchema_When_SimpleTypesAreUsed() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(SimpleTypeEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java index ae8ee5b079..c4902a41a6 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -20,7 +21,8 @@ public void should_CorrectlyHandleSuperClassMethods() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(PersonEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java index 5704f0b4fa..ad307a93ac 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -19,7 +20,8 @@ public void should_CorrectlyHandleTransients() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(TransientEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java index 2a2b2b9075..e8c1c467a0 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -19,7 +20,8 @@ public void should_CorrectlyResolveWildcardTypes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) - .addPlugin(new BackbonePlugin()).execute(); + .addPlugin(new BackbonePlugin()) + .execute(List.of(WildcardTypeEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/annotations/AnnotationsTest.java b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/annotations/AnnotationsTest.java index 08ca9d1fe1..abb3f83c96 100644 --- a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/annotations/AnnotationsTest.java +++ b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/annotations/AnnotationsTest.java @@ -10,6 +10,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; public class AnnotationsTest { @@ -25,7 +26,7 @@ public void should_GenerateAnnotations() .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) .addPlugin(new BackbonePlugin()).addPlugin(new ModelPlugin()) - .execute(); + .execute(List.of(AnnotationsEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/javatypes/JavaTypeTest.java b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/javatypes/JavaTypeTest.java index 230f4f3ebd..859f7c14ee 100644 --- a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/javatypes/JavaTypeTest.java +++ b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/javatypes/JavaTypeTest.java @@ -10,6 +10,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; public class JavaTypeTest { @@ -25,7 +26,7 @@ public void should_GenerateAnnotations() .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) .addPlugin(new BackbonePlugin()).addPlugin(new ModelPlugin()) - .execute(); + .execute(List.of(JavaTypeEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/validation/ValidationTest.java b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/validation/ValidationTest.java index 7f8eb8628d..4ee2cd641d 100644 --- a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/validation/ValidationTest.java +++ b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/validation/ValidationTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import com.vaadin.hilla.parser.plugins.model.Endpoint; @@ -26,7 +27,7 @@ public void should_GenerateValidations() .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) .addPlugin(new BackbonePlugin()).addPlugin(new ModelPlugin()) - .execute(); + .execute(List.of(ValidationEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicTest.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicTest.java index 1d936ab789..4e8e677e36 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicTest.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Assertions; @@ -29,7 +30,8 @@ public void should_ApplyNonNullAnnotation() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) - .addPlugin(new BackbonePlugin()).addPlugin(plugin).execute(); + .addPlugin(new BackbonePlugin()).addPlugin(plugin) + .execute(List.of(BasicEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/extended/ExtendedTest.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/extended/ExtendedTest.java index d2cbf19add..fa56a9f9b0 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/extended/ExtendedTest.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/extended/ExtendedTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -28,7 +29,8 @@ public void should_ApplyNonNullAnnotation() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) - .addPlugin(new BackbonePlugin()).addPlugin(plugin).execute(); + .addPlugin(new BackbonePlugin()).addPlugin(plugin) + .execute(List.of(ExtendedEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nonnullapi/NonNullApiTest.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nonnullapi/NonNullApiTest.java index be5399e54e..a3d8709cd7 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nonnullapi/NonNullApiTest.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nonnullapi/NonNullApiTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -34,7 +35,8 @@ public void should_ApplyNonNullApiAnnotation() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) - .addPlugin(new BackbonePlugin()).addPlugin(plugin).execute(); + .addPlugin(new BackbonePlugin()).addPlugin(plugin) + .execute(List.of(NonNullApiEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/superclassmethods/SuperClassMethodsTest.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/superclassmethods/SuperClassMethodsTest.java index b8c51dc5de..767372959a 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/superclassmethods/SuperClassMethodsTest.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/superclassmethods/SuperClassMethodsTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -28,7 +29,8 @@ public void should_CorrectlyHandleSuperClassMethods() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) - .addPlugin(new BackbonePlugin()).addPlugin(plugin).execute(); + .addPlugin(new BackbonePlugin()).addPlugin(plugin) + .execute(List.of(PersonEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-subtypes/src/test/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesMethodsTest.java b/packages/java/parser-jvm-plugin-subtypes/src/test/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesMethodsTest.java index ceb3d6478e..2111bc04eb 100644 --- a/packages/java/parser-jvm-plugin-subtypes/src/test/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesMethodsTest.java +++ b/packages/java/parser-jvm-plugin-subtypes/src/test/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesMethodsTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -21,7 +22,7 @@ public void should_CorrectlyHandleSuperClassMethods() .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) .addPlugin(new BackbonePlugin()).addPlugin(new SubTypesPlugin()) - .execute(); + .execute(List.of(SubTypesEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java index 48949b0f90..d5c40cb0f8 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java @@ -8,6 +8,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; public class JsonNodeTest { @@ -20,7 +21,8 @@ public void should_ReplaceJsonNodeClassWithObject() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotation(Endpoint.class.getName()) .addPlugin(new BackbonePlugin()) - .addPlugin(new TransferTypesPlugin()).execute(); + .addPlugin(new TransferTypesPlugin()) + .execute(List.of(JsonNodeEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/bare/BarePageableTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/bare/BarePageableTest.java index 19276436f8..b06e713417 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/bare/BarePageableTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/bare/BarePageableTest.java @@ -3,6 +3,7 @@ import java.io.File; import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import org.junit.jupiter.api.Test; import org.springframework.data.domain.Pageable; @@ -14,6 +15,8 @@ public class BarePageableTest { private final TestHelper helper = new TestHelper(getClass()); + private final List> endpoints = List + .of(BarePageableEndpoint.class); @Test public void should_ConsiderInternalDependenciesForReplacedEntities() @@ -25,7 +28,7 @@ public void should_ConsiderInternalDependenciesForReplacedEntities() .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) .addPlugin(new BackbonePlugin()) - .addPlugin(new TransferTypesPlugin()).execute(); + .addPlugin(new TransferTypesPlugin()).execute(endpoints); helper.executeParserWithConfig(openAPI); } @@ -40,7 +43,7 @@ public void should_CorrectlyResolveReplacedDependencies() .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) .addPlugin(new BackbonePlugin()) - .addPlugin(new TransferTypesPlugin()).execute(); + .addPlugin(new TransferTypesPlugin()).execute(endpoints); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/basic/PageableTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/basic/PageableTest.java index 11d09a3a32..4732ba1be1 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/basic/PageableTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/basic/PageableTest.java @@ -3,6 +3,7 @@ import java.io.File; import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import org.junit.jupiter.api.Test; import org.springframework.data.domain.Pageable; @@ -14,6 +15,7 @@ public class PageableTest { private final TestHelper helper = new TestHelper(getClass()); + private final List> endpoints = List.of(PageableEndpoint.class); @Test public void should_CorrectlyResolveReplacedDependencies() @@ -25,7 +27,7 @@ public void should_CorrectlyResolveReplacedDependencies() .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) .addPlugin(new BackbonePlugin()) - .addPlugin(new TransferTypesPlugin()).execute(); + .addPlugin(new TransferTypesPlugin()).execute(endpoints); helper.executeParserWithConfig(openAPI); } @@ -40,7 +42,7 @@ public void should_ReplaceSpringClassesWithSubstitutes() .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) .addPlugin(new BackbonePlugin()) - .addPlugin(new TransferTypesPlugin()).execute(); + .addPlugin(new TransferTypesPlugin()).execute(endpoints); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java index 75fa00bd14..08aae61494 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java @@ -3,6 +3,7 @@ import java.io.File; import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import org.junit.jupiter.api.Test; @@ -27,7 +28,8 @@ public void should_ReplacePushTypes() .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) .addPlugin(new BackbonePlugin()) - .addPlugin(new TransferTypesPlugin()).execute(); + .addPlugin(new TransferTypesPlugin()) + .execute(List.of(PushTypeEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/uuid/UUIDTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/uuid/UUIDTest.java index a30c815cfa..72af81a0aa 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/uuid/UUIDTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/uuid/UUIDTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.net.URISyntaxException; +import java.util.List; import java.util.Set; import org.junit.jupiter.api.Test; @@ -22,7 +23,8 @@ public void should_ReplaceUUIDClassWithString() .endpointAnnotation(Endpoint.class.getName()) .endpointExposedAnnotation(EndpointExposed.class.getName()) .addPlugin(new BackbonePlugin()) - .addPlugin(new TransferTypesPlugin()).execute(); + .addPlugin(new TransferTypesPlugin()) + .execute(List.of(UUIDEndpoint.class)); helper.executeParserWithConfig(openAPI); } From bbca209673c69679fb577e07609c6453c28fe207 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Tue, 16 Jul 2024 15:39:25 +0200 Subject: [PATCH 02/41] Check for inactive application contexts --- .../java/com/vaadin/hilla/ApplicationContextProvider.java | 6 +++++- .../main/java/com/vaadin/hilla/EndpointCodeGenerator.java | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/ApplicationContextProvider.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/ApplicationContextProvider.java index ffa5cf9730..286715c247 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/ApplicationContextProvider.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/ApplicationContextProvider.java @@ -4,6 +4,7 @@ import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; +import org.springframework.context.ConfigurableApplicationContext; import org.springframework.stereotype.Component; import java.util.ArrayList; @@ -29,7 +30,10 @@ public static ApplicationContext getApplicationContext() { } public static void runOnContext(Consumer action) { - if (applicationContext == null) { + if (applicationContext == null + || (applicationContext instanceof ConfigurableApplicationContext + && !((ConfigurableApplicationContext) applicationContext) + .isActive())) { pendingActions.add(action); } else { action.accept(applicationContext); diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java index 2be3dd5baf..1a82f1a42b 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java @@ -82,8 +82,6 @@ public void update() { "This method is not available in production mode"); } - LOGGER.info("█████████████████████████████████ Updating endpoint code generator"); - ApplicationContextProvider.runOnContext(applicationContext -> { List> endpoints = Stream .of(BrowserCallable.class, Endpoint.class) From d8f54a259936018e3f45dd7d9e1b40e9de3bad0c Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Wed, 17 Jul 2024 14:38:23 +0200 Subject: [PATCH 03/41] Remove `configure`mojo --- .../vaadin/hilla/maven/BuildFrontendMojo.java | 1 - .../hilla/maven/EngineConfigureMojo.java | 95 ------------------- .../maven/EngineConfigureMojoException.java | 30 ------ .../hilla/maven/PrepareFrontendMojo.java | 1 - .../hilla/maven/EngineConfigureMojoTest.java | 26 ----- 5 files changed, 153 deletions(-) delete mode 100644 packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineConfigureMojo.java delete mode 100644 packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineConfigureMojoException.java delete mode 100644 packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineConfigureMojoTest.java diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java index de071c4b7c..86f3356607 100644 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java @@ -31,7 +31,6 @@ * @since Flow 2.0 */ @Mojo(name = "build-frontend", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, defaultPhase = LifecyclePhase.PROCESS_CLASSES) -@Execute(goal = "configure") public class BuildFrontendMojo extends com.vaadin.flow.plugin.maven.BuildFrontendMojo { } diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineConfigureMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineConfigureMojo.java deleted file mode 100644 index 554c1890e8..0000000000 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineConfigureMojo.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.vaadin.hilla.maven; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import com.vaadin.flow.server.frontend.FrontendUtils; -import org.apache.maven.artifact.DependencyResolutionRequiredException; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.plugins.annotations.ResolutionScope; -import org.apache.maven.project.MavenProject; - -import com.vaadin.flow.plugin.maven.FlowModeAbstractMojo; -import com.vaadin.hilla.engine.EngineConfiguration; -import com.vaadin.hilla.engine.GeneratorConfiguration; -import com.vaadin.hilla.engine.ParserConfiguration; - -/** - * Maven Plugin for Hilla. Emits Hilla engine configuration file in the build - * directory. - * - * The configuration gathered from the Maven plugin is saved in a file, so that - * further runs of the parser / generator can skip running a separate Maven - * process to get this configuration again. - */ -@Mojo(name = "configure", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) -public final class EngineConfigureMojo extends AbstractMojo { - - @Parameter(readonly = true) - private final GeneratorConfiguration generator = new GeneratorConfiguration(); - - @Parameter(readonly = true) - private final ParserConfiguration parser = new ParserConfiguration(); - /** - * The folder where TypeScript endpoints are generated. - */ - @Parameter(defaultValue = "${project.basedir}/" - + FrontendUtils.DEFAULT_PROJECT_FRONTEND_GENERATED_DIR) - private File generatedTsFolder; - - private static final String LEGACY_PROJECT_FRONTEND_PATH = "./frontend"; - - @Parameter(defaultValue = "${project}", readonly = true) - private MavenProject project; - - @Override - public void execute() throws EngineConfigureMojoException { - - if (!FlowModeAbstractMojo.isHillaAvailable(project)) { - getLog().warn( - "The 'configure' goal is only meant to be used in Hilla projects with endpoints." - .stripIndent()); - return; - } - try { - var legacyFrontendFolder = project.getBasedir().toPath() - .resolve(LEGACY_PROJECT_FRONTEND_PATH).toFile(); - if (legacyFrontendFolder.exists()) { - generatedTsFolder = legacyFrontendFolder.toPath() - .resolve("generated").toFile(); - } - var buildDir = project.getBuild().getDirectory(); - var cp = Stream - .of(project.getCompileClasspathElements(), - project.getRuntimeClasspathElements(), - project.getSystemClasspathElements()) - .flatMap(Collection::stream) - .collect(Collectors.toCollection(LinkedHashSet::new)); - var conf = new EngineConfiguration.Builder( - project.getBasedir().toPath()).classPath(cp) - .outputDir(generatedTsFolder.toPath()).generator(generator) - .parser(parser).buildDir(buildDir) - .classesDir(project.getBuild().getOutputDirectory()) - .create(); - - // The configuration gathered from the Maven plugin is saved in a - // file so that further runs can skip running a separate Maven - // project just to get this configuration again - var configDir = project.getBasedir().toPath().resolve(buildDir); - Files.createDirectories(configDir); - } catch (DependencyResolutionRequiredException e) { - throw new EngineConfigureMojoException("Configuration failed", e); - } catch (IOException e) { - throw new EngineConfigureMojoException( - "Maven configuration has not been saved to file", e); - } - } -} diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineConfigureMojoException.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineConfigureMojoException.java deleted file mode 100644 index 0016ef2f9a..0000000000 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineConfigureMojoException.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.vaadin.hilla.maven; - -import org.apache.maven.plugin.MojoFailureException; - -/** - * Exception thrown when the engine configuration fails. - */ -public class EngineConfigureMojoException extends MojoFailureException { - /** - * Constructs a new exception with the specified detail message. - * - * @param message - * Message for the exception. - */ - public EngineConfigureMojoException(String message) { - super(message); - } - - /** - * Constructs a new exception with the specified detail message and cause. - * - * @param message - * Message for the exception. - * @param cause - * Cause of the exception. - */ - public EngineConfigureMojoException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/PrepareFrontendMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/PrepareFrontendMojo.java index c62fa4bd0c..dd9cdceb35 100644 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/PrepareFrontendMojo.java +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/PrepareFrontendMojo.java @@ -15,7 +15,6 @@ * @since Flow 2.0 */ @Mojo(name = "prepare-frontend", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, defaultPhase = LifecyclePhase.PROCESS_RESOURCES) -@Execute(goal = "configure") public class PrepareFrontendMojo extends com.vaadin.flow.plugin.maven.PrepareFrontendMojo { } diff --git a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineConfigureMojoTest.java b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineConfigureMojoTest.java deleted file mode 100644 index 464a240c72..0000000000 --- a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineConfigureMojoTest.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.vaadin.hilla.maven; - -import static org.junit.jupiter.api.Assertions.assertNotNull; - -import org.junit.jupiter.api.Test; - -import com.vaadin.hilla.engine.EngineConfiguration; -import com.vaadin.hilla.parser.testutils.JsonAssertions; - -public class EngineConfigureMojoTest extends AbstractMojoTest { - - @Test - public void should_StoreConfigurationJson() throws Exception { - // Lookup and initialize mojo - var engineConfigureMojo = (EngineConfigureMojo) lookupMojo("configure", - getTestConfiguration()); - setVariableValueToObject(engineConfigureMojo, "project", - getMavenProject()); - engineConfigureMojo.execute(); - - var storedEngineConfiguration = new EngineConfiguration(); - assertNotNull(storedEngineConfiguration); - JsonAssertions.assertEquals(getEngineConfiguration(), - storedEngineConfiguration); - } -} From 52ac8b37fd0ba1be3ac473df46a8e15fb1db61d8 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Wed, 17 Jul 2024 17:01:00 +0200 Subject: [PATCH 04/41] Support production mode (needs process-aot in pom.xml) --- .../internal/TaskGenerateEndpointImpl.java | 11 ++- .../internal/TaskGenerateOpenAPIImpl.java | 71 +++++++++++++++---- 2 files changed, 65 insertions(+), 17 deletions(-) diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java index bcab2bbea1..88e4c9e881 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java @@ -78,12 +78,19 @@ public class TaskGenerateEndpointImpl extends AbstractTaskEndpointGenerator */ @Override public void execute() throws ExecutionFailedException { - ApplicationContextProvider.runOnContext(applicationContext -> { + if (productionMode) { var engineConfiguration = new EngineConfiguration(); var processor = new GeneratorProcessor(engineConfiguration, nodeCommand, productionMode); processor.process(); - }); + } else { + ApplicationContextProvider.runOnContext(applicationContext -> { + var engineConfiguration = new EngineConfiguration(); + var processor = new GeneratorProcessor(engineConfiguration, + nodeCommand, productionMode); + processor.process(); + }); + } } } diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java index 751c577876..f21a417c48 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java @@ -18,19 +18,24 @@ import javax.annotation.Nonnull; import java.io.File; +import java.io.IOException; import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Function; -import java.util.function.Supplier; +import java.util.stream.Collectors; import java.util.stream.Stream; +import com.fasterxml.jackson.databind.ObjectMapper; import com.vaadin.hilla.ApplicationContextProvider; import com.vaadin.hilla.BrowserCallable; import com.vaadin.hilla.Endpoint; -import com.vaadin.hilla.engine.ParserException; +import com.vaadin.hilla.engine.EngineConfiguration; import com.vaadin.hilla.engine.ParserProcessor; import com.vaadin.flow.server.ExecutionFailedException; @@ -39,8 +44,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.vaadin.hilla.engine.EngineConfiguration; - /** * Generate OpenAPI json file for Vaadin Endpoints. */ @@ -92,16 +95,54 @@ public class TaskGenerateOpenAPIImpl extends AbstractTaskEndpointGenerator */ @Override public void execute() throws ExecutionFailedException { - ApplicationContextProvider.runOnContext(applicationContext -> { - List> endpoints = Stream - .of(BrowserCallable.class, Endpoint.class) - .map(applicationContext::getBeansWithAnnotation) - .map(Map::values).flatMap(Collection::stream) - .map(Object::getClass).distinct().toList(); - var engineConfiguration = new EngineConfiguration(); - var processor = new ParserProcessor(engineConfiguration, - classLoader, isProductionMode); - processor.process(endpoints); - }); + var json = Path.of(System.getProperty("user.dir"), + "target/spring-aot/main/resources/META-INF/native-image/com.example.application/skeleton-starter-hilla-react/reflect-config.json"); + if (isProductionMode && Files.isRegularFile(json)) { + try { + String jsonContent = Files.readString(json); + var objectMapper = new ObjectMapper(); + var rootNode = objectMapper.readTree(jsonContent); + + if (rootNode.isArray()) { + var candidates = new ArrayList(); + + for (var node : rootNode) { + String name = node.get("name").asText(); + candidates.add(name); + } + + List> endpoints = candidates.stream().map(name -> { + try { + return Class.forName(name); + } catch (Throwable t) { // must also catch + // NoClassDefFoundError + return null; + } + }).filter(Objects::nonNull).filter(cls -> cls + .isAnnotationPresent(Endpoint.class) + || cls.isAnnotationPresent(BrowserCallable.class)) + .collect(Collectors.toList()); + var engineConfiguration = new EngineConfiguration(); + var processor = new ParserProcessor(engineConfiguration, + classLoader, isProductionMode); + processor.process(endpoints); + } + } catch (IOException e) { + throw new ExecutionFailedException(e); + } + } else { + ApplicationContextProvider.runOnContext(applicationContext -> { + List> endpoints = Stream + .of(BrowserCallable.class, Endpoint.class) + .map(applicationContext::getBeansWithAnnotation) + .map(Map::values).flatMap(Collection::stream) + .map(Object::getClass).distinct() + .collect(Collectors.toList()); + var engineConfiguration = new EngineConfiguration(); + var processor = new ParserProcessor(engineConfiguration, + classLoader, isProductionMode); + processor.process(endpoints); + }); + } } } From 9bbcdbf2dc6cdc6030df891e8b5930f20e5ebf07 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Wed, 24 Jul 2024 15:17:44 +0200 Subject: [PATCH 05/41] Avoid adding new goal to pom.xml in projects --- .../hilla/engine/ParserConfiguration.java | 1 + packages/java/engine-runtime/pom.xml | 5 + .../internal/TaskGenerateOpenAPIImpl.java | 109 +++++++++++------- .../vaadin/hilla/maven/BuildFrontendMojo.java | 15 ++- 4 files changed, 89 insertions(+), 41 deletions(-) diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java index d0fd282829..263dfccf31 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java @@ -17,6 +17,7 @@ import com.vaadin.hilla.parser.utils.ConfigList; public final class ParserConfiguration { + public static List CLASSPATH; private String endpointAnnotation; private String endpointExposedAnnotation; private String openAPIBasePath; diff --git a/packages/java/engine-runtime/pom.xml b/packages/java/engine-runtime/pom.xml index dc0a33d7b3..6d246aa3d0 100644 --- a/packages/java/engine-runtime/pom.xml +++ b/packages/java/engine-runtime/pom.xml @@ -33,6 +33,11 @@ hilla-endpoint ${project.version} + + org.springframework.boot + spring-boot + provided + org.springframework spring-context diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java index f21a417c48..212de01199 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java @@ -36,6 +36,7 @@ import com.vaadin.hilla.BrowserCallable; import com.vaadin.hilla.Endpoint; import com.vaadin.hilla.engine.EngineConfiguration; +import com.vaadin.hilla.engine.ParserConfiguration; import com.vaadin.hilla.engine.ParserProcessor; import com.vaadin.flow.server.ExecutionFailedException; @@ -95,54 +96,82 @@ public class TaskGenerateOpenAPIImpl extends AbstractTaskEndpointGenerator */ @Override public void execute() throws ExecutionFailedException { - var json = Path.of(System.getProperty("user.dir"), - "target/spring-aot/main/resources/META-INF/native-image/com.example.application/skeleton-starter-hilla-react/reflect-config.json"); - if (isProductionMode && Files.isRegularFile(json)) { - try { - String jsonContent = Files.readString(json); - var objectMapper = new ObjectMapper(); - var rootNode = objectMapper.readTree(jsonContent); - - if (rootNode.isArray()) { - var candidates = new ArrayList(); - - for (var node : rootNode) { - String name = node.get("name").asText(); - candidates.add(name); - } + try { + var root = Path.of(System.getProperty("user.dir")); + var settings = List.of("org.vaadin.example.Application", + root.resolve("target/spring-aot/main/sources").toString(), + root.resolve("target/spring-aot/main/resources").toString(), + root.resolve("target/spring-aot/main/classes").toString(), + "com.example.application", "skeleton-starter-hilla-react"); + var javaExe = ProcessHandle.current().info().command() + .orElse(Path.of(System.getProperty("java.home", "bin/java")) + .toString()); + var classPath = String.join(File.pathSeparator, + ParserConfiguration.CLASSPATH); + + var processBuilder = new ProcessBuilder(); + processBuilder.inheritIO(); + processBuilder.command(javaExe, "-cp", classPath, + "org.springframework.boot.SpringApplicationAotProcessor"); + processBuilder.command().addAll(settings); + + Process process = processBuilder.start(); + process.waitFor(); + + var json = Path.of(System.getProperty("user.dir"), + "target/spring-aot/main/resources/META-INF/native-image/com.example.application/skeleton-starter-hilla-react/reflect-config.json"); + if (isProductionMode && Files.isRegularFile(json)) { + try { + String jsonContent = Files.readString(json); + var objectMapper = new ObjectMapper(); + var rootNode = objectMapper.readTree(jsonContent); + + if (rootNode.isArray()) { + var candidates = new ArrayList(); - List> endpoints = candidates.stream().map(name -> { - try { - return Class.forName(name); - } catch (Throwable t) { // must also catch - // NoClassDefFoundError - return null; + for (var node : rootNode) { + String name = node.get("name").asText(); + candidates.add(name); } - }).filter(Objects::nonNull).filter(cls -> cls - .isAnnotationPresent(Endpoint.class) - || cls.isAnnotationPresent(BrowserCallable.class)) + + List> endpoints = candidates.stream() + .map(name -> { + try { + return Class.forName(name); + } catch (Throwable t) { // must also catch + // NoClassDefFoundError + return null; + } + }).filter(Objects::nonNull) + .filter(cls -> cls + .isAnnotationPresent(Endpoint.class) + || cls.isAnnotationPresent( + BrowserCallable.class)) + .collect(Collectors.toList()); + var engineConfiguration = new EngineConfiguration(); + var processor = new ParserProcessor(engineConfiguration, + classLoader, isProductionMode); + processor.process(endpoints); + } + } catch (IOException e) { + throw new ExecutionFailedException(e); + } + } else { + ApplicationContextProvider.runOnContext(applicationContext -> { + List> endpoints = Stream + .of(BrowserCallable.class, Endpoint.class) + .map(applicationContext::getBeansWithAnnotation) + .map(Map::values).flatMap(Collection::stream) + .map(Object::getClass).distinct() .collect(Collectors.toList()); var engineConfiguration = new EngineConfiguration(); var processor = new ParserProcessor(engineConfiguration, classLoader, isProductionMode); processor.process(endpoints); - } - } catch (IOException e) { - throw new ExecutionFailedException(e); + }); } - } else { - ApplicationContextProvider.runOnContext(applicationContext -> { - List> endpoints = Stream - .of(BrowserCallable.class, Endpoint.class) - .map(applicationContext::getBeansWithAnnotation) - .map(Map::values).flatMap(Collection::stream) - .map(Object::getClass).distinct() - .collect(Collectors.toList()); - var engineConfiguration = new EngineConfiguration(); - var processor = new ParserProcessor(engineConfiguration, - classLoader, isProductionMode); - processor.process(endpoints); - }); + } catch (Exception e) { + throw new ExecutionFailedException(e); } } } diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java index 86f3356607..1041fc7970 100644 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java @@ -1,8 +1,12 @@ package com.vaadin.hilla.maven; -import org.apache.maven.plugins.annotations.Execute; +import java.util.List; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import com.vaadin.flow.component.dependency.JavaScript; @@ -11,6 +15,7 @@ import com.vaadin.flow.server.Constants; import com.vaadin.flow.server.frontend.FrontendUtils; import com.vaadin.flow.theme.Theme; +import com.vaadin.hilla.engine.ParserConfiguration; /** * Goal that builds the frontend bundle. @@ -33,4 +38,12 @@ @Mojo(name = "build-frontend", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, defaultPhase = LifecyclePhase.PROCESS_CLASSES) public class BuildFrontendMojo extends com.vaadin.flow.plugin.maven.BuildFrontendMojo { + @Parameter(defaultValue = "${project.compileClasspathElements}", readonly = true, required = true) + private List classpathElements; + + @Override + public void execute() throws MojoExecutionException, MojoFailureException { + ParserConfiguration.CLASSPATH = classpathElements; + super.execute(); + } } From 5edbd61f37be730b7792b2109a50be879b1a5a11 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Wed, 24 Jul 2024 15:28:33 +0200 Subject: [PATCH 06/41] Simplify code a bit --- .../internal/TaskGenerateOpenAPIImpl.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java index 212de01199..723e62b706 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java @@ -97,12 +97,15 @@ public class TaskGenerateOpenAPIImpl extends AbstractTaskEndpointGenerator @Override public void execute() throws ExecutionFailedException { try { - var root = Path.of(System.getProperty("user.dir")); + var aotOutput = Path.of(System.getProperty("user.dir"), + "target/spring-aot/main"); + String groupId = "com.example.application"; + String artifactId = "skeleton-starter-hilla-react"; var settings = List.of("org.vaadin.example.Application", - root.resolve("target/spring-aot/main/sources").toString(), - root.resolve("target/spring-aot/main/resources").toString(), - root.resolve("target/spring-aot/main/classes").toString(), - "com.example.application", "skeleton-starter-hilla-react"); + aotOutput.resolve("sources").toString(), + aotOutput.resolve("resources").toString(), + aotOutput.resolve("classes").toString(), groupId, + artifactId); var javaExe = ProcessHandle.current().info().command() .orElse(Path.of(System.getProperty("java.home", "bin/java")) .toString()); @@ -118,8 +121,9 @@ public void execute() throws ExecutionFailedException { Process process = processBuilder.start(); process.waitFor(); - var json = Path.of(System.getProperty("user.dir"), - "target/spring-aot/main/resources/META-INF/native-image/com.example.application/skeleton-starter-hilla-react/reflect-config.json"); + var json = aotOutput + .resolve(Path.of("resources/META-INF/native-image/", + groupId, artifactId, "/reflect-config.json")); if (isProductionMode && Files.isRegularFile(json)) { try { String jsonContent = Files.readString(json); From 7a9988341dc0cf5725c00cc9252e6c412031f88e Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Thu, 25 Jul 2024 11:16:44 +0200 Subject: [PATCH 07/41] Some code improvements --- .../vaadin/hilla/EndpointCodeGenerator.java | 6 +++++- .../java/com/vaadin/hilla/OpenAPIUtil.java | 5 +++-- .../hilla/engine/EngineConfiguration.java | 7 ------- .../hilla/engine/EngineConfigurationTest.java | 9 --------- .../AbstractTaskEndpointGenerator.java | 18 ------------------ .../EndpointGeneratorTaskFactoryImpl.java | 16 ---------------- .../internal/TaskGenerateEndpointImpl.java | 12 ++---------- .../internal/TaskGenerateOpenAPITest.java | 2 -- .../com/vaadin/hilla/internal/TaskTest.java | 4 ---- .../vaadin/hilla/maven/EngineGenerateMojo.java | 2 -- .../hilla/maven/PrepareFrontendMojo.java | 15 ++++++++++++++- .../vaadin/hilla/maven/AbstractMojoTest.java | 1 - 12 files changed, 24 insertions(+), 73 deletions(-) diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java index 1a82f1a42b..e27ad59b29 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java @@ -18,7 +18,11 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.*; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; import java.util.stream.Stream; import com.vaadin.hilla.engine.EngineConfiguration; diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java index 93b05113de..47785d7259 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java @@ -3,14 +3,15 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.*; +import java.util.HashSet; +import java.util.Optional; +import java.util.Set; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.vaadin.hilla.engine.EngineConfiguration; -import com.vaadin.hilla.engine.ParserProcessor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java index f9da7153cc..7464d04255 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java @@ -8,19 +8,12 @@ import java.util.Set; import java.util.stream.Collectors; -import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.PropertyAccessor; -import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.vaadin.flow.server.frontend.FrontendUtils; public class EngineConfiguration { public static final String OPEN_API_PATH = "hilla-openapi.json"; - static final ObjectMapper MAPPER = new ObjectMapper() - .setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE) - .setVisibility(PropertyAccessor.FIELD, - JsonAutoDetect.Visibility.ANY); private Path baseDir; private Path buildDir; @JsonDeserialize(as = LinkedHashSet.class) diff --git a/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java b/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java index 2cbb1ffe69..c3de47d7cb 100644 --- a/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java +++ b/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java @@ -1,13 +1,9 @@ package com.vaadin.hilla.engine; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.File; import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.net.URISyntaxException; -import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.util.LinkedHashSet; @@ -19,13 +15,8 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import com.vaadin.hilla.parser.testutils.JsonAssertions; -import com.vaadin.hilla.parser.testutils.TestEngineConfigurationPathResolver; - public class EngineConfigurationTest { private static final String CONFIG_FILE_NAME = "hilla-engine-configuration.json"; - private static final URL TEST_CONFIG_URL = EngineConfigurationTest.class - .getResource(CONFIG_FILE_NAME); private Path baseDirectory; private File configFile; private EngineConfiguration.Builder configurationBuilder; diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/AbstractTaskEndpointGenerator.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/AbstractTaskEndpointGenerator.java index 70c2cee1fb..54e61d15fa 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/AbstractTaskEndpointGenerator.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/AbstractTaskEndpointGenerator.java @@ -16,38 +16,20 @@ package com.vaadin.hilla.internal; import java.io.File; -import java.io.InputStream; -import java.io.IOException; import java.net.URL; -import java.util.Arrays; import java.util.Objects; -import java.util.Optional; -import java.util.Properties; import java.util.function.Function; -import java.util.stream.Stream; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.vaadin.flow.server.ExecutionFailedException; import com.vaadin.flow.server.frontend.FallibleCommand; - -import com.vaadin.hilla.engine.ConfigurationException; import com.vaadin.hilla.engine.EngineConfiguration; -import com.vaadin.hilla.engine.commandrunner.GradleRunner; -import com.vaadin.hilla.engine.commandrunner.MavenRunner; -import com.vaadin.hilla.engine.commandrunner.CommandRunnerException; /** * Abstract class for endpoint related generators. */ abstract class AbstractTaskEndpointGenerator implements FallibleCommand { - private static final Logger LOGGER = LoggerFactory - .getLogger(AbstractTaskEndpointGenerator.class); private static boolean firstRun = true; private final String buildDirectoryName; - private final Logger logger = LoggerFactory.getLogger(getClass()); protected final File outputDirectory; private final File projectDirectory; private final Function resourceFinder; diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java index 466bddc342..9df5487cb2 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java @@ -15,11 +15,6 @@ */ package com.vaadin.hilla.internal; -import com.vaadin.hilla.BrowserCallable; -import com.vaadin.hilla.Endpoint; - -import jakarta.annotation.Nonnull; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,17 +28,6 @@ import com.vaadin.hilla.engine.ParserProcessor; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; -import java.util.stream.Stream; - -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; - -import com.vaadin.hilla.ApplicationContextProvider; - /** * An implementation of the EndpointGeneratorTaskFactory, which creates endpoint * generator tasks. diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java index 88e4c9e881..50ab2d1be3 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java @@ -19,16 +19,11 @@ import java.net.URL; import java.util.function.Function; -import com.vaadin.hilla.ApplicationContextProvider; -import com.vaadin.hilla.engine.GeneratorException; -import com.vaadin.hilla.engine.GeneratorProcessor; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import com.vaadin.flow.server.ExecutionFailedException; import com.vaadin.flow.server.frontend.TaskGenerateEndpoint; +import com.vaadin.hilla.ApplicationContextProvider; import com.vaadin.hilla.engine.EngineConfiguration; +import com.vaadin.hilla.engine.GeneratorProcessor; /** * Starts the generation of TS files for endpoints. @@ -36,9 +31,6 @@ public class TaskGenerateEndpointImpl extends AbstractTaskEndpointGenerator implements TaskGenerateEndpoint { - private static final Logger LOGGER = LoggerFactory - .getLogger(TaskGenerateEndpointImpl.class); - private final String nodeCommand; private final boolean productionMode; diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateOpenAPITest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateOpenAPITest.java index bb6e0bd956..3722e65e2e 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateOpenAPITest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateOpenAPITest.java @@ -27,8 +27,6 @@ import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.parser.OpenAPIV3Parser; -import java.util.List; - /** * This test suite is only for triggering the OpenAPI generator. For the actual * content of the generator, they are tested in other package diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java index 30e202ecac..cb1b1e5729 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java @@ -7,9 +7,6 @@ import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Objects; import java.util.function.Function; import java.util.stream.Stream; @@ -18,7 +15,6 @@ import com.vaadin.flow.server.frontend.FrontendUtils; import com.vaadin.hilla.engine.EngineConfiguration; -import com.vaadin.hilla.parser.testutils.TestEngineConfigurationPathResolver; public class TaskTest { private Path temporaryDirectory; diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java index e9820716e4..535575383f 100644 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java @@ -5,11 +5,9 @@ import java.net.URLClassLoader; import java.util.ArrayList; import java.util.List; -import java.util.Objects; import org.apache.maven.model.Profile; import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/PrepareFrontendMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/PrepareFrontendMojo.java index dd9cdceb35..1adaf54a11 100644 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/PrepareFrontendMojo.java +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/PrepareFrontendMojo.java @@ -1,10 +1,15 @@ package com.vaadin.hilla.maven; -import org.apache.maven.plugins.annotations.Execute; +import com.vaadin.hilla.engine.ParserConfiguration; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; +import java.util.List; + /** * This goal checks that node and npm tools are installed and creates or updates * `package.json` and the frontend build tool configuration files. @@ -17,4 +22,12 @@ @Mojo(name = "prepare-frontend", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, defaultPhase = LifecyclePhase.PROCESS_RESOURCES) public class PrepareFrontendMojo extends com.vaadin.flow.plugin.maven.PrepareFrontendMojo { + @Parameter(defaultValue = "${project.compileClasspathElements}", readonly = true, required = true) + private List classpathElements; + + @Override + public void execute() throws MojoExecutionException, MojoFailureException { + ParserConfiguration.CLASSPATH = classpathElements; + super.execute(); + } } diff --git a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java index 1d0e8f4fdf..687188453b 100644 --- a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java +++ b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java @@ -19,7 +19,6 @@ import org.mockito.Mockito; import com.vaadin.hilla.engine.EngineConfiguration; -import com.vaadin.hilla.parser.testutils.TestEngineConfigurationPathResolver; /** * Base class for Engine Maven plugin tests. Delegates to From 7093a3a49bad60422f3762bd492c3789c8202517 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Thu, 25 Jul 2024 16:46:51 +0200 Subject: [PATCH 08/41] Make sure we use the available classpath --- .../vaadin/hilla/engine/ParserConfiguration.java | 2 +- .../hilla/internal/TaskGenerateOpenAPIImpl.java | 6 ++---- .../com/vaadin/hilla/maven/BuildFrontendMojo.java | 4 +++- .../vaadin/hilla/maven/PrepareFrontendMojo.java | 14 -------------- 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java index 263dfccf31..85e6118fb2 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java @@ -17,7 +17,7 @@ import com.vaadin.hilla.parser.utils.ConfigList; public final class ParserConfiguration { - public static List CLASSPATH; + public static String CLASSPATH = System.getProperty("java.class.path"); private String endpointAnnotation; private String endpointExposedAnnotation; private String openAPIBasePath; diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java index 723e62b706..2e410bf389 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java @@ -109,12 +109,10 @@ public void execute() throws ExecutionFailedException { var javaExe = ProcessHandle.current().info().command() .orElse(Path.of(System.getProperty("java.home", "bin/java")) .toString()); - var classPath = String.join(File.pathSeparator, - ParserConfiguration.CLASSPATH); - var processBuilder = new ProcessBuilder(); processBuilder.inheritIO(); - processBuilder.command(javaExe, "-cp", classPath, + processBuilder.command(javaExe, "-cp", + ParserConfiguration.CLASSPATH, "org.springframework.boot.SpringApplicationAotProcessor"); processBuilder.command().addAll(settings); diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java index 1041fc7970..825e5ccf23 100644 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java @@ -1,5 +1,6 @@ package com.vaadin.hilla.maven; +import java.io.File; import java.util.List; import org.apache.maven.plugin.MojoExecutionException; @@ -43,7 +44,8 @@ public class BuildFrontendMojo @Override public void execute() throws MojoExecutionException, MojoFailureException { - ParserConfiguration.CLASSPATH = classpathElements; + ParserConfiguration.CLASSPATH = String.join(File.pathSeparator, + classpathElements); super.execute(); } } diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/PrepareFrontendMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/PrepareFrontendMojo.java index 1adaf54a11..5e71a072b2 100644 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/PrepareFrontendMojo.java +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/PrepareFrontendMojo.java @@ -1,15 +1,9 @@ package com.vaadin.hilla.maven; -import com.vaadin.hilla.engine.ParserConfiguration; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; -import java.util.List; - /** * This goal checks that node and npm tools are installed and creates or updates * `package.json` and the frontend build tool configuration files. @@ -22,12 +16,4 @@ @Mojo(name = "prepare-frontend", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, defaultPhase = LifecyclePhase.PROCESS_RESOURCES) public class PrepareFrontendMojo extends com.vaadin.flow.plugin.maven.PrepareFrontendMojo { - @Parameter(defaultValue = "${project.compileClasspathElements}", readonly = true, required = true) - private List classpathElements; - - @Override - public void execute() throws MojoExecutionException, MojoFailureException { - ParserConfiguration.CLASSPATH = classpathElements; - super.execute(); - } } From 4000a32c449d2cfbef6dce99cf4126883e399703 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Fri, 26 Jul 2024 10:48:44 +0200 Subject: [PATCH 09/41] Move classpath --- .../vaadin/hilla/engine/EngineConfiguration.java | 1 + .../vaadin/hilla/engine/ParserConfiguration.java | 15 ++------------- .../hilla/internal/TaskGenerateOpenAPIImpl.java | 3 +-- .../com/vaadin/hilla/maven/BuildFrontendMojo.java | 4 ++-- 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java index 7464d04255..6bc1daa7c2 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java @@ -14,6 +14,7 @@ public class EngineConfiguration { public static final String OPEN_API_PATH = "hilla-openapi.json"; + public static String classpath = System.getProperty("java.class.path"); private Path baseDir; private Path buildDir; @JsonDeserialize(as = LinkedHashSet.class) diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java index 85e6118fb2..ec57a0f071 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java @@ -17,12 +17,10 @@ import com.vaadin.hilla.parser.utils.ConfigList; public final class ParserConfiguration { - public static String CLASSPATH = System.getProperty("java.class.path"); private String endpointAnnotation; private String endpointExposedAnnotation; private String openAPIBasePath; private Plugins plugins; - private List packages; public Optional getEndpointAnnotation() { return Optional.ofNullable(endpointAnnotation); @@ -53,18 +51,13 @@ public boolean equals(Object o) { && Objects.equals(endpointExposedAnnotation, that.endpointExposedAnnotation) && Objects.equals(openAPIBasePath, that.openAPIBasePath) - && Objects.equals(plugins, that.plugins) - && Objects.equals(packages, that.packages); + && Objects.equals(plugins, that.plugins); } @Override public int hashCode() { return Objects.hash(endpointAnnotation, endpointExposedAnnotation, - openAPIBasePath, plugins, packages); - } - - public Optional> getPackages() { - return Optional.ofNullable(packages); + openAPIBasePath, plugins); } void setEndpointAnnotation(String endpointAnnotation) { @@ -83,10 +76,6 @@ void setPlugins(Plugins plugins) { this.plugins = plugins; } - public void setPackages(List packages) { - this.packages = packages; - } - public static class Plugin { private PluginConfiguration configuration; private String name; diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java index 2e410bf389..c00b9222c9 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java @@ -36,7 +36,6 @@ import com.vaadin.hilla.BrowserCallable; import com.vaadin.hilla.Endpoint; import com.vaadin.hilla.engine.EngineConfiguration; -import com.vaadin.hilla.engine.ParserConfiguration; import com.vaadin.hilla.engine.ParserProcessor; import com.vaadin.flow.server.ExecutionFailedException; @@ -112,7 +111,7 @@ public void execute() throws ExecutionFailedException { var processBuilder = new ProcessBuilder(); processBuilder.inheritIO(); processBuilder.command(javaExe, "-cp", - ParserConfiguration.CLASSPATH, + EngineConfiguration.classpath, "org.springframework.boot.SpringApplicationAotProcessor"); processBuilder.command().addAll(settings); diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java index 825e5ccf23..d50721ccb6 100644 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java @@ -3,6 +3,7 @@ import java.io.File; import java.util.List; +import com.vaadin.hilla.engine.EngineConfiguration; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.LifecyclePhase; @@ -16,7 +17,6 @@ import com.vaadin.flow.server.Constants; import com.vaadin.flow.server.frontend.FrontendUtils; import com.vaadin.flow.theme.Theme; -import com.vaadin.hilla.engine.ParserConfiguration; /** * Goal that builds the frontend bundle. @@ -44,7 +44,7 @@ public class BuildFrontendMojo @Override public void execute() throws MojoExecutionException, MojoFailureException { - ParserConfiguration.CLASSPATH = String.join(File.pathSeparator, + EngineConfiguration.classpath = String.join(File.pathSeparator, classpathElements); super.execute(); } From 20e4cf5d4508bab1f01466e4c9208d2a43d86e38 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Mon, 29 Jul 2024 19:30:54 +0200 Subject: [PATCH 10/41] Get more config from Maven --- .../hilla/engine/EngineConfiguration.java | 3 ++ packages/java/engine-runtime/pom.xml | 5 ++ .../internal/TaskGenerateOpenAPIImpl.java | 46 +++++++++++++------ .../vaadin/hilla/maven/BuildFrontendMojo.java | 12 +++++ 4 files changed, 53 insertions(+), 13 deletions(-) diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java index 6bc1daa7c2..e77a2411dc 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java @@ -15,6 +15,9 @@ public class EngineConfiguration { public static final String OPEN_API_PATH = "hilla-openapi.json"; public static String classpath = System.getProperty("java.class.path"); + public static String groupId; + public static String artifactId; + public static String mainClass; private Path baseDir; private Path buildDir; @JsonDeserialize(as = LinkedHashSet.class) diff --git a/packages/java/engine-runtime/pom.xml b/packages/java/engine-runtime/pom.xml index 6d246aa3d0..1c09ff7c1a 100644 --- a/packages/java/engine-runtime/pom.xml +++ b/packages/java/engine-runtime/pom.xml @@ -43,6 +43,11 @@ spring-context provided + + org.springframework.boot + spring-boot-loader-tools + provided + com.vaadin flow-server diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java index c00b9222c9..e78bbd04fd 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java @@ -43,6 +43,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.boot.loader.tools.MainClassFinder; /** * Generate OpenAPI json file for Vaadin Endpoints. @@ -52,6 +53,7 @@ public class TaskGenerateOpenAPIImpl extends AbstractTaskEndpointGenerator private static final Logger LOGGER = LoggerFactory .getLogger(TaskGenerateOpenAPIImpl.class); + private static final String SPRING_BOOT_APPLICATION_CLASS_NAME = "org.springframework.boot.autoconfigure.SpringBootApplication"; private final ClassLoader classLoader; private final boolean isProductionMode; @@ -96,21 +98,24 @@ public class TaskGenerateOpenAPIImpl extends AbstractTaskEndpointGenerator @Override public void execute() throws ExecutionFailedException { try { - var aotOutput = Path.of(System.getProperty("user.dir"), - "target/spring-aot/main"); - String groupId = "com.example.application"; - String artifactId = "skeleton-starter-hilla-react"; - var settings = List.of("org.vaadin.example.Application", + var aotOutput = Path.of(System.getProperty("user.dir"), "target", + "spring-aot", "main"); + var classesDirectory = aotOutput.resolve("classes"); + var applicationClass = (EngineConfiguration.mainClass != null) + ? EngineConfiguration.mainClass + : findSingleClass(classesDirectory.toFile()); + var settings = List.of(applicationClass, aotOutput.resolve("sources").toString(), aotOutput.resolve("resources").toString(), - aotOutput.resolve("classes").toString(), groupId, - artifactId); - var javaExe = ProcessHandle.current().info().command() - .orElse(Path.of(System.getProperty("java.home", "bin/java")) + classesDirectory.toString(), EngineConfiguration.groupId, + EngineConfiguration.artifactId); + var javaExecutable = ProcessHandle.current().info().command() + .orElse(Path + .of(System.getProperty("java.home"), "bin", "java") .toString()); var processBuilder = new ProcessBuilder(); processBuilder.inheritIO(); - processBuilder.command(javaExe, "-cp", + processBuilder.command(javaExecutable, "-cp", EngineConfiguration.classpath, "org.springframework.boot.SpringApplicationAotProcessor"); processBuilder.command().addAll(settings); @@ -118,9 +123,9 @@ public void execute() throws ExecutionFailedException { Process process = processBuilder.start(); process.waitFor(); - var json = aotOutput - .resolve(Path.of("resources/META-INF/native-image/", - groupId, artifactId, "/reflect-config.json")); + var json = aotOutput.resolve(Path.of("resources", "META-INF", + "native-image", EngineConfiguration.groupId, + EngineConfiguration.artifactId, "reflect-config.json")); if (isProductionMode && Files.isRegularFile(json)) { try { String jsonContent = Files.readString(json); @@ -175,4 +180,19 @@ public void execute() throws ExecutionFailedException { throw new ExecutionFailedException(e); } } + + static String findSingleClass(File classesDirectory) + throws ExecutionFailedException { + try { + String mainClass = MainClassFinder.findSingleMainClass( + classesDirectory, SPRING_BOOT_APPLICATION_CLASS_NAME); + if (mainClass != null) { + return mainClass; + } + throw new ExecutionFailedException( + "Failed to find a single main class"); + } catch (IOException e) { + throw new ExecutionFailedException(e); + } + } } diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java index d50721ccb6..fb3dc39706 100644 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java @@ -42,10 +42,22 @@ public class BuildFrontendMojo @Parameter(defaultValue = "${project.compileClasspathElements}", readonly = true, required = true) private List classpathElements; + @Parameter(defaultValue = "${project.groupId}", readonly = true, required = true) + private String groupId; + + @Parameter(defaultValue = "${project.artifactId}", readonly = true, required = true) + private String artifactId; + + @Parameter(property = "spring-boot.aot.main-class") + private String mainClass; + @Override public void execute() throws MojoExecutionException, MojoFailureException { EngineConfiguration.classpath = String.join(File.pathSeparator, classpathElements); + EngineConfiguration.groupId = groupId; + EngineConfiguration.artifactId = artifactId; + EngineConfiguration.mainClass = mainClass; super.execute(); } } From 88d9d018f72bfaededab12fa17cb617f473b5826 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Tue, 30 Jul 2024 11:43:27 +0200 Subject: [PATCH 11/41] Refactor annotations configuration --- .../ExplicitNullableTypeCheckerTest.java | 2 +- .../hilla/engine/GeneratorConfiguration.java | 2 +- .../hilla/engine/GeneratorProcessor.java | 2 +- .../hilla/engine/ParserConfiguration.java | 33 +++++---- .../vaadin/hilla/engine/ParserProcessor.java | 40 +++++----- .../hilla/engine/EngineConfigurationTest.java | 8 +- .../internal/TaskGenerateEndpointImpl.java | 16 ++-- .../internal/TaskGenerateOpenAPIImpl.java | 2 +- .../hilla/parser/core/AbstractNode.java | 2 +- .../hilla/parser/core/NodeDependencies.java | 2 +- .../vaadin/hilla/parser/core/NodePath.java | 2 +- .../com/vaadin/hilla/parser/core/Parser.java | 73 +++++++++---------- .../hilla/parser/core/PluginExecutor.java | 2 +- .../vaadin/hilla/parser/core/RootNode.java | 2 +- .../parser/models/AnnotatedAbstractModel.java | 2 +- .../parser/models/AnnotationInfoModel.java | 2 +- .../AnnotationParameterEnumValueModel.java | 2 +- .../models/AnnotationParameterModel.java | 2 +- .../parser/models/ArraySignatureModel.java | 2 +- .../parser/models/BaseSignatureModel.java | 2 +- .../hilla/parser/models/ClassInfoModel.java | 2 +- .../ClassRefSignatureArtificialModel.java | 2 +- .../parser/models/ClassRefSignatureModel.java | 2 +- .../hilla/parser/models/FieldInfoModel.java | 2 +- .../hilla/parser/models/MethodInfoModel.java | 2 +- .../models/MethodParameterInfoModel.java | 2 +- .../hilla/parser/models/SignatureModel.java | 2 +- .../parser/models/TypeArgumentModel.java | 2 +- .../parser/models/TypeParameterModel.java | 2 +- .../models/TypeParameterSourceModel.java | 2 +- .../parser/models/TypeVariableModel.java | 2 +- .../hilla/parser/core/ParserConfigTests.java | 34 +++++---- .../hilla/parser/core/basic/AddPlugin.java | 2 +- .../hilla/parser/core/basic/BasicTests.java | 4 +- .../parser/core/basic/FinalizePlugin.java | 2 +- .../hilla/parser/core/basic/RemovePlugin.java | 2 +- .../parser/core/basic/ReplacePlugin.java | 2 +- .../dependency/DependencyEntityThree.java | 2 +- .../core/dependency/DependencyEntityTwo.java | 2 +- .../core/dependency/DependencyPlugin.java | 2 +- .../core/dependency/DependencyTests.java | 2 +- .../dependency/PluginDependencyEntity.java | 2 +- ...pointExposedAndSecurityAnnotationTest.java | 5 +- ...xposedMethodAndSecurityAnnotationTest.java | 5 +- .../hilla/parser/test/nodes/EndpointNode.java | 2 +- .../hilla/parser/test/nodes/EntityNode.java | 2 +- .../hilla/parser/test/nodes/FieldNode.java | 2 +- .../hilla/parser/test/nodes/MethodNode.java | 2 +- .../test/nodes/MethodParameterNode.java | 2 +- .../parser/test/nodes/TypeSignatureNode.java | 2 +- .../backbone/EndpointExposedPlugin.java | 4 +- .../plugins/backbone/EndpointPlugin.java | 12 ++- .../parser/plugins/backbone/EntityPlugin.java | 2 +- .../backbone/MethodParameterPlugin.java | 2 +- .../parser/plugins/backbone/MethodPlugin.java | 2 +- .../plugins/backbone/TypeSignaturePlugin.java | 2 +- .../nodes/CompositeTypeSignatureNode.java | 2 +- .../backbone/nodes/EndpointExposedNode.java | 2 +- .../plugins/backbone/nodes/EndpointNode.java | 2 +- .../nodes/EndpointNonExposedNode.java | 2 +- .../backbone/nodes/EndpointSignatureNode.java | 2 +- .../plugins/backbone/nodes/EntityNode.java | 2 +- .../plugins/backbone/nodes/MethodNode.java | 2 +- .../backbone/nodes/MethodParameterNode.java | 2 +- .../plugins/backbone/nodes/PropertyNode.java | 2 +- .../plugins/backbone/bare/BareTypeTest.java | 2 +- .../ComplexHierarchyTest.java | 5 +- .../backbone/complextype/ComplexTypeTest.java | 2 +- .../backbone/config/CustomConfigTest.java | 2 +- .../backbone/customname/CustomNameTest.java | 2 +- .../backbone/datetime/DateTimeTest.java | 2 +- .../backbone/enumtype/EnumTypeTest.java | 2 +- .../plugins/backbone/exposed/ExposedTest.java | 5 +- .../backbone/generics/GenericsTest.java | 5 +- .../GenericSuperClassMethodsTest.java | 5 +- .../backbone/iterable/IterableTest.java | 2 +- .../plugins/backbone/jackson/JacksonTest.java | 2 +- .../backbone/jsonvalue/JsonValueTest.java | 2 +- .../JsonValueNoJsonCreatorTest.java | 2 +- .../multiendpoints/MultiEndpointsTest.java | 2 +- .../shadowedname/ShadowedNameTest.java | 2 +- .../backbone/simpletype/SimpleTypeTest.java | 2 +- .../SuperClassMethodsTest.java | 5 +- .../backbone/transients/TransientTest.java | 2 +- .../backbone/wildcard/WildcardTypeTest.java | 2 +- .../parser/plugins/model/Annotation.java | 2 +- .../parser/plugins/model/ModelPlugin.java | 2 +- .../plugins/model/ValidationConstraint.java | 2 +- .../model/annotations/AnnotationsTest.java | 5 +- .../plugins/model/javatypes/JavaTypeTest.java | 5 +- .../model/validation/ValidationTest.java | 5 +- .../plugins/nonnull/AnnotationMatcher.java | 2 +- .../parser/plugins/nonnull/NonnullPlugin.java | 2 +- .../plugins/nonnull/basic/BasicTest.java | 5 +- .../nonnull/extended/ExtendedTest.java | 5 +- .../nonnull/nonnullapi/NonNullApiTest.java | 5 +- .../SuperClassMethodsTest.java | 5 +- .../plugins/subtypes/SubTypesPlugin.java | 2 +- .../plugins/subtypes/SubTypesMethodsTest.java | 5 +- .../transfertypes/TransferTypesPlugin.java | 2 +- .../transfertypes/jsonnode/JsonNodeTest.java | 2 +- .../pageable/bare/BarePageableTest.java | 10 ++- .../pageable/basic/PageableTest.java | 10 ++- .../transfertypes/push/PushTypeTest.java | 5 +- .../plugins/transfertypes/uuid/UUIDTest.java | 5 +- .../TestEngineConfigurationPathResolver.java | 2 +- 106 files changed, 252 insertions(+), 233 deletions(-) diff --git a/packages/java/endpoint/src/test/java/com/vaadin/hilla/ExplicitNullableTypeCheckerTest.java b/packages/java/endpoint/src/test/java/com/vaadin/hilla/ExplicitNullableTypeCheckerTest.java index 4e9c839ac3..0ea1cb5fa6 100644 --- a/packages/java/endpoint/src/test/java/com/vaadin/hilla/ExplicitNullableTypeCheckerTest.java +++ b/packages/java/endpoint/src/test/java/com/vaadin/hilla/ExplicitNullableTypeCheckerTest.java @@ -31,7 +31,7 @@ import java.util.Map; import java.util.Optional; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import org.junit.Assert; import org.junit.Before; diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorConfiguration.java index 85f209c98f..23f6699280 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorConfiguration.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.engine; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import java.util.ArrayList; import java.util.Collection; import java.util.List; diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorProcessor.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorProcessor.java index c05641df84..6e26228453 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorProcessor.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorProcessor.java @@ -8,7 +8,7 @@ import java.util.List; import java.util.Objects; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.engine.commandrunner.CommandNotFoundException; import com.vaadin.hilla.engine.commandrunner.CommandRunnerException; diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java index ec57a0f071..313525936e 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java @@ -6,7 +6,7 @@ import java.util.Objects; import java.util.Optional; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.PluginConfiguration; import com.vaadin.hilla.parser.plugins.backbone.BackbonePlugin; @@ -17,17 +17,19 @@ import com.vaadin.hilla.parser.utils.ConfigList; public final class ParserConfiguration { - private String endpointAnnotation; - private String endpointExposedAnnotation; + private List endpointAnnotations = List.of( + "com.vaadin.hilla.BrowserCallable", "com.vaadin.hilla.Endpoint"); + private List endpointExposedAnnotations = List + .of("com.vaadin.hilla.EndpointExposed"); private String openAPIBasePath; private Plugins plugins; - public Optional getEndpointAnnotation() { - return Optional.ofNullable(endpointAnnotation); + public List getEndpointAnnotations() { + return endpointAnnotations; } - public Optional getEndpointExposedAnnotation() { - return Optional.ofNullable(endpointExposedAnnotation); + public List getEndpointExposedAnnotations() { + return endpointExposedAnnotations; } public Optional getOpenAPIBasePath() { @@ -47,25 +49,26 @@ public boolean equals(Object o) { return false; } var that = (ParserConfiguration) o; - return Objects.equals(endpointAnnotation, that.endpointAnnotation) - && Objects.equals(endpointExposedAnnotation, - that.endpointExposedAnnotation) + return Objects.equals(endpointAnnotations, that.endpointAnnotations) + && Objects.equals(endpointExposedAnnotations, + that.endpointExposedAnnotations) && Objects.equals(openAPIBasePath, that.openAPIBasePath) && Objects.equals(plugins, that.plugins); } @Override public int hashCode() { - return Objects.hash(endpointAnnotation, endpointExposedAnnotation, + return Objects.hash(endpointAnnotations, endpointExposedAnnotations, openAPIBasePath, plugins); } - void setEndpointAnnotation(String endpointAnnotation) { - this.endpointAnnotation = endpointAnnotation; + void setEndpointAnnotations(@Nonnull List endpointAnnotations) { + this.endpointAnnotations = endpointAnnotations; } - void setEndpointExposedAnnotation(String endpointExposedAnnotation) { - this.endpointExposedAnnotation = endpointExposedAnnotation; + void setEndpointExposedAnnotations( + @Nonnull List endpointExposedAnnotations) { + this.endpointExposedAnnotations = endpointExposedAnnotations; } void setOpenAPIBasePath(String openAPIBasePath) { diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java index 9a892c5ee9..210dc18852 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java @@ -10,7 +10,7 @@ import java.util.Set; import java.util.stream.Collectors; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,8 +30,10 @@ public final class ParserProcessor { private final Set classPath; private final Path openAPIFile; private final ParserConfiguration.PluginsProcessor pluginsProcessor = new ParserConfiguration.PluginsProcessor(); - private String endpointAnnotationName = "com.vaadin.hilla.Endpoint"; - private String endpointExposedAnnotationName = "com.vaadin.hilla.EndpointExposed"; + private List endpointAnnotationNames = List + .of("com.vaadin.hilla.Endpoint"); + private List endpointExposedAnnotationNames = List + .of("com.vaadin.hilla.EndpointExposed"); private Collection exposedPackages = List.of(); private String openAPIBasePath; @@ -48,8 +50,8 @@ private String createOpenAPI(List> endpoints) throws IOException { var parser = new Parser().classLoader(classLoader) .classPath(classPath.stream().map(Path::toString) .collect(Collectors.toSet())) - .endpointAnnotation(endpointAnnotationName) - .endpointExposedAnnotation(endpointExposedAnnotationName) + .endpointAnnotations(endpointAnnotationNames) + .endpointExposedAnnotations(endpointExposedAnnotationNames) .exposedPackages(exposedPackages); preparePlugins(parser); @@ -94,30 +96,24 @@ private void applyConfiguration(ParserConfiguration parserConfiguration) { return; } - parserConfiguration.getEndpointAnnotation() - .ifPresent(this::applyEndpointAnnotation); - parserConfiguration.getEndpointExposedAnnotation() - .ifPresent(this::applyEndpointExposedAnnotation); + applyEndpointAnnotations(parserConfiguration.getEndpointAnnotations()); + applyEndpointExposedAnnotations( + parserConfiguration.getEndpointExposedAnnotations()); parserConfiguration.getOpenAPIBasePath() .ifPresent(this::applyOpenAPIBase); parserConfiguration.getPlugins().ifPresent(this::applyPlugins); - parserConfiguration.getPackages().ifPresent(this::applyExposedPackages); } - private void applyEndpointAnnotation( - @Nonnull String endpointAnnotationName) { - this.endpointAnnotationName = Objects - .requireNonNull(endpointAnnotationName); + private void applyEndpointAnnotations( + @Nonnull List endpointAnnotationNames) { + this.endpointAnnotationNames = Objects + .requireNonNull(endpointAnnotationNames); } - private void applyEndpointExposedAnnotation( - @Nonnull String endpointExposedAnnotationName) { - this.endpointExposedAnnotationName = Objects - .requireNonNull(endpointExposedAnnotationName); - } - - private void applyExposedPackages(@Nonnull List exposedPackages) { - this.exposedPackages = exposedPackages; + private void applyEndpointExposedAnnotations( + @Nonnull List endpointExposedAnnotationNames) { + this.endpointExposedAnnotationNames = Objects + .requireNonNull(endpointExposedAnnotationNames); } private void applyOpenAPIBase(@Nonnull String openAPIBasePath) { diff --git a/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java b/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java index c3de47d7cb..b5ac992501 100644 --- a/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java +++ b/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java @@ -32,10 +32,10 @@ public void setUp() throws IOException { this.baseDirectory = this.temporaryDirectory.resolve("base"); var parserConfiguration = new ParserConfiguration(); - parserConfiguration - .setEndpointAnnotation("com.vaadin.hilla.test.Endpoint"); - parserConfiguration.setEndpointExposedAnnotation( - "com.vaadin.hilla.test.EndpointExposed"); + parserConfiguration.setEndpointAnnotations( + List.of("com.vaadin.hilla.test.Endpoint")); + parserConfiguration.setEndpointExposedAnnotations( + List.of("com.vaadin.hilla.test.EndpointExposed")); parserConfiguration.setPlugins(new ParserConfiguration.Plugins(List.of( new ParserConfiguration.Plugin("parser-jvm-plugin-use"), new ParserConfiguration.Plugin("parser-jvm-plugin-nonnull", diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java index 50ab2d1be3..f986c3b62b 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java @@ -71,18 +71,18 @@ public class TaskGenerateEndpointImpl extends AbstractTaskEndpointGenerator @Override public void execute() throws ExecutionFailedException { if (productionMode) { - var engineConfiguration = new EngineConfiguration(); - var processor = new GeneratorProcessor(engineConfiguration, - nodeCommand, productionMode); - processor.process(); + runProcessor(); } else { ApplicationContextProvider.runOnContext(applicationContext -> { - var engineConfiguration = new EngineConfiguration(); - var processor = new GeneratorProcessor(engineConfiguration, - nodeCommand, productionMode); - processor.process(); + runProcessor(); }); } } + private void runProcessor() { + var engineConfiguration = new EngineConfiguration(); + var processor = new GeneratorProcessor(engineConfiguration, nodeCommand, + productionMode); + processor.process(); + } } diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java index e78bbd04fd..2a95b8530d 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java @@ -15,7 +15,7 @@ */ package com.vaadin.hilla.internal; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import java.io.File; import java.io.IOException; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/AbstractNode.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/AbstractNode.java index 21ac154f5c..a5bea35747 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/AbstractNode.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/AbstractNode.java @@ -2,7 +2,7 @@ import java.util.Objects; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.models.ClassInfoModel; import com.vaadin.hilla.parser.models.NamedModel; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/NodeDependencies.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/NodeDependencies.java index c1c867f70e..51e216e932 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/NodeDependencies.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/NodeDependencies.java @@ -4,7 +4,7 @@ import java.util.function.UnaryOperator; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; public final class NodeDependencies { private final Stream> childNodes; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/NodePath.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/NodePath.java index 9aaae6d36e..c760d09bb8 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/NodePath.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/NodePath.java @@ -4,7 +4,7 @@ import java.util.Objects; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; public final class NodePath> { private final N node; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java index 5983f62b9f..5d7b774abf 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java @@ -14,7 +14,7 @@ import java.util.function.Consumer; import java.util.stream.Collectors; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -197,14 +197,14 @@ public Parser classPath(@Nonnull Collection classPathElements, *

* If the annotation name is already set, it will be overridden. * - * @param annotationFullyQualifiedName - * The fully qualified name of the annotation + * @param annotationFullyQualifiedNames + * The fully qualified names of the annotations * @return this (for method chaining). */ @Nonnull - public Parser endpointAnnotation( - @Nonnull String annotationFullyQualifiedName) { - return endpointAnnotation(annotationFullyQualifiedName, true); + public Parser endpointAnnotations( + @Nonnull List annotationFullyQualifiedNames) { + return endpointAnnotations(annotationFullyQualifiedNames, true); } /** @@ -212,19 +212,20 @@ public Parser endpointAnnotation( * search for the endpoints. Only classes with this annotation will be * chosen. * - * @param annotationFullyQualifiedName - * The fully qualified name of the annotation + * @param annotationFullyQualifiedNames + * The fully qualified names of the annotations * @param override * specifies if the parser should override the annotation name if * it is already specified. * @return this (for method chaining). */ @Nonnull - public Parser endpointAnnotation( - @Nonnull String annotationFullyQualifiedName, boolean override) { - if (override || config.endpointAnnotationName == null) { - config.endpointAnnotationName = Objects - .requireNonNull(annotationFullyQualifiedName); + public Parser endpointAnnotations( + @Nonnull List annotationFullyQualifiedNames, + boolean override) { + if (override || config.endpointAnnotationNames == null) { + config.endpointAnnotationNames = Objects + .requireNonNull(annotationFullyQualifiedNames); } return this; } @@ -238,14 +239,14 @@ public Parser endpointAnnotation( *

* If the annotation name is already set, it will be overridden. * - * @param annotationFullyQualifiedName - * The fully qualified name of the annotation + * @param annotationFullyQualifiedNames + * The fully qualified names of the annotations * @return this (for method chaining). */ @Nonnull - public Parser endpointExposedAnnotation( - @Nonnull String annotationFullyQualifiedName) { - return endpointExposedAnnotation(annotationFullyQualifiedName, true); + public Parser endpointExposedAnnotations( + @Nonnull List annotationFullyQualifiedNames) { + return endpointExposedAnnotations(annotationFullyQualifiedNames, true); } /** @@ -254,19 +255,20 @@ public Parser endpointExposedAnnotation( * part of the endpoint. Any superclass in the endpoint's inheritance chain * will be skipped if it doesn't have this annotation. * - * @param annotationFullyQualifiedName - * The fully qualified name of the annotation + * @param annotationFullyQualifiedNames + * The fully qualified names of the annotations * @param override * specifies if the parser should override the annotation name if * it is already specified. * @return this (for method chaining). */ @Nonnull - public Parser endpointExposedAnnotation( - @Nonnull String annotationFullyQualifiedName, boolean override) { - if (override || config.endpointExposedAnnotationName == null) { - config.endpointExposedAnnotationName = Objects - .requireNonNull(annotationFullyQualifiedName); + public Parser endpointExposedAnnotations( + @Nonnull List annotationFullyQualifiedNames, + boolean override) { + if (override || config.endpointExposedAnnotationNames == null) { + config.endpointExposedAnnotationNames = Objects + .requireNonNull(annotationFullyQualifiedNames); } return this; } @@ -296,8 +298,8 @@ public OpenAPI execute(List> endpoints) { "[JVM Parser] classLoader is not provided."); Objects.requireNonNull(config.classPathElements, "[JVM Parser] classPath is not provided."); - Objects.requireNonNull(config.endpointAnnotationName, - "[JVM Parser] endpointAnnotationName is not provided."); + Objects.requireNonNull(config.endpointAnnotationNames, + "[JVM Parser] endpointAnnotationNames is not provided."); logger.debug("JVM Parser started"); @@ -437,8 +439,8 @@ public Parser plugins(@Nonnull Collection plugins) { public static final class Config { private final List plugins = new ArrayList<>(); private Set classPathElements; - private String endpointAnnotationName; - private String endpointExposedAnnotationName; + private List endpointAnnotationNames; + private List endpointExposedAnnotationNames; private Collection exposedPackages; private OpenAPI openAPI; private ClassLoader classLoader; @@ -473,8 +475,8 @@ public Set getClassPathElements() { * @return the annotation name. */ @Nonnull - public String getEndpointAnnotationName() { - return endpointAnnotationName; + public List getEndpointAnnotationNames() { + return endpointAnnotationNames; } /** @@ -483,13 +485,8 @@ public String getEndpointAnnotationName() { * @return the annotation name. */ @Nonnull - public String getEndpointExposedAnnotationName() { - return endpointExposedAnnotationName; - } - - @Nonnull - public Collection getExposedPackages() { - return exposedPackages; + public List getEndpointExposedAnnotationNames() { + return endpointExposedAnnotationNames; } /** diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/PluginExecutor.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/PluginExecutor.java index fa7440d788..cf7eca41e7 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/PluginExecutor.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/PluginExecutor.java @@ -11,7 +11,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/RootNode.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/RootNode.java index 5c4d0e726c..932a17f4fd 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/RootNode.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/RootNode.java @@ -2,7 +2,7 @@ import java.util.List; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import io.swagger.v3.oas.models.OpenAPI; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotatedAbstractModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotatedAbstractModel.java index fdd1e50463..dba3da0050 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotatedAbstractModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotatedAbstractModel.java @@ -6,7 +6,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import io.github.classgraph.AnnotationInfo; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationInfoModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationInfoModel.java index 0f505c9bdb..262f5d13da 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationInfoModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationInfoModel.java @@ -5,7 +5,7 @@ import java.util.Optional; import java.util.Set; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import io.github.classgraph.AnnotationInfo; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationParameterEnumValueModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationParameterEnumValueModel.java index 7cb2c3a965..41dea6e467 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationParameterEnumValueModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationParameterEnumValueModel.java @@ -2,7 +2,7 @@ import java.util.Objects; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import io.github.classgraph.AnnotationEnumValue; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationParameterModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationParameterModel.java index 295ba112f8..6f5adcf24e 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationParameterModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/AnnotationParameterModel.java @@ -2,7 +2,7 @@ import java.util.Objects; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import io.github.classgraph.AnnotationParameterValue; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ArraySignatureModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ArraySignatureModel.java index 7ba50abf6c..cb36fb1ae3 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ArraySignatureModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ArraySignatureModel.java @@ -3,7 +3,7 @@ import java.lang.reflect.AnnotatedArrayType; import java.util.Objects; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import io.github.classgraph.ArrayTypeSignature; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/BaseSignatureModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/BaseSignatureModel.java index f8c09c8ecb..ec75132e9f 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/BaseSignatureModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/BaseSignatureModel.java @@ -3,7 +3,7 @@ import java.lang.reflect.AnnotatedType; import java.util.Objects; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import io.github.classgraph.BaseTypeSignature; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassInfoModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassInfoModel.java index 010634729c..636211f686 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassInfoModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassInfoModel.java @@ -15,7 +15,7 @@ import java.util.Optional; import java.util.function.BiPredicate; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import io.github.classgraph.ClassInfo; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassRefSignatureArtificialModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassRefSignatureArtificialModel.java index d992e54246..25a7bca727 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassRefSignatureArtificialModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassRefSignatureArtificialModel.java @@ -4,7 +4,7 @@ import java.util.Objects; import java.util.Optional; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; /** * An artificial ClassRefSignatureModel implementation. diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassRefSignatureModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassRefSignatureModel.java index 093cc69d27..87c1bb38e4 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassRefSignatureModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/ClassRefSignatureModel.java @@ -7,7 +7,7 @@ import java.util.Objects; import java.util.Optional; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import io.github.classgraph.ClassInfo; import io.github.classgraph.ClassRefTypeSignature; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/FieldInfoModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/FieldInfoModel.java index 4234421554..5deb0a3710 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/FieldInfoModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/FieldInfoModel.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.models; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import java.lang.reflect.Field; import java.util.Objects; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/MethodInfoModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/MethodInfoModel.java index 93fb59bc0d..1b2e1cc53a 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/MethodInfoModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/MethodInfoModel.java @@ -7,7 +7,7 @@ import java.util.List; import java.util.Objects; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import io.github.classgraph.MethodInfo; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/MethodParameterInfoModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/MethodParameterInfoModel.java index 39163533d2..9ec657fcc7 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/MethodParameterInfoModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/MethodParameterInfoModel.java @@ -3,7 +3,7 @@ import java.lang.reflect.Parameter; import java.util.Objects; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import io.github.classgraph.MethodParameterInfo; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/SignatureModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/SignatureModel.java index e6459997a5..2283757526 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/SignatureModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/SignatureModel.java @@ -8,7 +8,7 @@ import java.lang.reflect.AnnotatedWildcardType; import java.lang.reflect.TypeVariable; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import io.github.classgraph.ArrayTypeSignature; import io.github.classgraph.BaseTypeSignature; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeArgumentModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeArgumentModel.java index 4dd4f78bd0..e5407eb0cd 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeArgumentModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeArgumentModel.java @@ -4,7 +4,7 @@ import java.util.List; import java.util.Objects; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import io.github.classgraph.TypeArgument; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeParameterModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeParameterModel.java index ea6bca9d29..6ef1b4cd92 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeParameterModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeParameterModel.java @@ -4,7 +4,7 @@ import java.util.List; import java.util.Objects; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import io.github.classgraph.TypeParameter; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeParameterSourceModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeParameterSourceModel.java index 46dfbfe5f7..0310a57dad 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeParameterSourceModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeParameterSourceModel.java @@ -4,7 +4,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.utils.Streams; diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeVariableModel.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeVariableModel.java index 84934d90cc..fe6b98292a 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeVariableModel.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/models/TypeVariableModel.java @@ -3,7 +3,7 @@ import java.lang.reflect.AnnotatedTypeVariable; import java.util.Objects; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import io.github.classgraph.TypeVariableSignature; diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java index f071a15a86..78165a5f7d 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java @@ -13,7 +13,7 @@ import java.util.Set; import java.util.function.Consumer; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -29,19 +29,22 @@ public class ParserConfigTests { private final ResourceLoader resourceLoader = new ResourceLoader( getClass()); private Set defaultClassPathElements; - private String defaultEndpointAnnotationName; - private String defaultEndpointExposedAnnotationName; + private List defaultEndpointAnnotationNames; + private List defaultEndpointExposedAnnotationNames; private OpenAPI defaultOpenAPI; private Parser parser; private Path targetDir; @BeforeEach public void setup() throws URISyntaxException { - defaultEndpointAnnotationName = "com.vaadin.hilla.Endpoint"; + defaultEndpointAnnotationNames = List.of( + "com.vaadin.hilla.BrowserCallable", + "com.vaadin.hilla.Endpoint"); targetDir = resourceLoader.findTargetDirPath(); defaultClassPathElements = Set.of(targetDir.toString()); - defaultEndpointExposedAnnotationName = "com.vaadin.hilla.EndpointExposed"; + defaultEndpointExposedAnnotationNames = List + .of("com.vaadin.hilla.EndpointExposed"); defaultOpenAPI = new OpenAPI() .info(new Info().title("Hilla Application").version("1.0.0")) .servers(List @@ -50,9 +53,9 @@ public void setup() throws URISyntaxException { .paths(new Paths()); parser = new Parser().classLoader(getClass().getClassLoader()) .classPath(defaultClassPathElements) - .endpointAnnotation(defaultEndpointAnnotationName) - .endpointExposedAnnotation( - defaultEndpointExposedAnnotationName); + .endpointAnnotations(defaultEndpointAnnotationNames) + .endpointExposedAnnotations( + defaultEndpointExposedAnnotationNames); } @Test @@ -105,7 +108,8 @@ public void should_AllowAdjustingOpenAPI() { @Test public void should_AllowPreservingAlreadySetProperties() { var config = parser.classPath(List.of("somepath"), false) - .endpointAnnotation("com.example.Endpoint", false).getConfig(); + .endpointAnnotations(List.of("com.example.Endpoint"), false) + .getConfig(); assertEquals(defaultClassPathElements, config.getClassPathElements()); } @@ -115,10 +119,10 @@ public void should_CreateConfigWithDefaultParameters() { var config = parser.getConfig(); assertEquals(defaultClassPathElements, config.getClassPathElements()); - assertEquals(defaultEndpointAnnotationName, - config.getEndpointAnnotationName()); - assertEquals(defaultEndpointExposedAnnotationName, - config.getEndpointExposedAnnotationName()); + assertEquals(defaultEndpointAnnotationNames, + config.getEndpointAnnotationNames()); + assertEquals(defaultEndpointExposedAnnotationNames, + config.getEndpointExposedAnnotationNames()); assertEquals(defaultOpenAPI, config.getOpenAPI()); assertEquals(List.of(), new ArrayList<>(config.getPlugins())); } @@ -139,7 +143,7 @@ public void should_ParseYAMLOpenAPISource() public void should_ThrowError_When_ClassLoaderIsNotSet() { var e = assertThrows(NullPointerException.class, () -> new Parser().classPath(defaultClassPathElements) - .endpointAnnotation(defaultEndpointAnnotationName) + .endpointAnnotations(defaultEndpointAnnotationNames) .execute(List.of())); assertEquals("[JVM Parser] classLoader is not provided.", e.getMessage()); @@ -149,7 +153,7 @@ public void should_ThrowError_When_ClassLoaderIsNotSet() { public void should_ThrowError_When_ClassPathIsNotSet() { var e = assertThrows(NullPointerException.class, () -> new Parser().classLoader(getClass().getClassLoader()) - .endpointAnnotation(defaultEndpointAnnotationName) + .endpointAnnotations(defaultEndpointAnnotationNames) .execute(List.of())); assertEquals("[JVM Parser] classPath is not provided.", e.getMessage()); } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/AddPlugin.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/AddPlugin.java index b9848ab020..36faf3655f 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/AddPlugin.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/AddPlugin.java @@ -7,7 +7,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.NodeDependencies; diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java index e89161b9c7..f2c57e563c 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java @@ -54,7 +54,7 @@ public class BasicTests { public void should_TraverseInConsistentOrder() { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(classPath) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(new BasicPlugin()).execute(endpoints); assertEquals(String.join("\n", STEPS), @@ -65,7 +65,7 @@ public void should_TraverseInConsistentOrder() { public void should_UpdateNodesAndCollectNames() { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(classPath) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(new BasicPlugin()).execute(endpoints); assertEquals(String.join(", ", diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/FinalizePlugin.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/FinalizePlugin.java index fdde4dece3..0ea9466d7f 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/FinalizePlugin.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/FinalizePlugin.java @@ -3,7 +3,7 @@ import java.util.ArrayList; import java.util.List; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.NodeDependencies; diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/RemovePlugin.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/RemovePlugin.java index a943bb893d..ac2a0a6ae0 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/RemovePlugin.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/RemovePlugin.java @@ -2,7 +2,7 @@ import java.util.stream.Stream; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.Node; diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/ReplacePlugin.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/ReplacePlugin.java index 9406c94491..88a1c62735 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/ReplacePlugin.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/ReplacePlugin.java @@ -2,7 +2,7 @@ import java.util.stream.Stream; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.Node; diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyEntityThree.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyEntityThree.java index 67db62038b..797161d6aa 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyEntityThree.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyEntityThree.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.core.dependency; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; public class DependencyEntityThree { private String foo3 = "foo3"; diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyEntityTwo.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyEntityTwo.java index 8573d29bcc..0fcae899dc 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyEntityTwo.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyEntityTwo.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.core.dependency; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; public class DependencyEntityTwo { public DependencyEntityOne foo2; diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyPlugin.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyPlugin.java index 400a3c59c7..83f5c46df3 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyPlugin.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyPlugin.java @@ -7,7 +7,7 @@ import java.util.Optional; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.NodeDependencies; diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java index 6432a61ae4..27a8530b15 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java @@ -35,7 +35,7 @@ public static void setUp() { openApi = new Parser() .classLoader(DependencyTests.class.getClassLoader()) .classPath(classPath) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(new DependencyPlugin()).execute(endpoints); } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/PluginDependencyEntity.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/PluginDependencyEntity.java index a1b047d1af..c1de713bd0 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/PluginDependencyEntity.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/PluginDependencyEntity.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.core.dependency; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; public class PluginDependencyEntity { private String pluginDependencyField = "foo"; diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/classlevel/EndpointExposedAndSecurityAnnotationTest.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/classlevel/EndpointExposedAndSecurityAnnotationTest.java index 50775318e0..3ada8fb3b4 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/classlevel/EndpointExposedAndSecurityAnnotationTest.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/classlevel/EndpointExposedAndSecurityAnnotationTest.java @@ -35,8 +35,9 @@ public void throws_when_parentEndpointClass_annotatedWithSecurityAnnotations() { .classLoader(getClass().getClassLoader()).classPath(classPath) .exposedPackages(Set .of("com.vaadin.hilla.parser.core.security.classlevel")) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .execute(endpoints)); assertTrue(exception.getMessage().startsWith( diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/methodlevel/EndpointExposedMethodAndSecurityAnnotationTest.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/methodlevel/EndpointExposedMethodAndSecurityAnnotationTest.java index ae7238bf9f..d60f91c15b 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/methodlevel/EndpointExposedMethodAndSecurityAnnotationTest.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/methodlevel/EndpointExposedMethodAndSecurityAnnotationTest.java @@ -35,8 +35,9 @@ public void throws_when_parentEndpointMethod_annotatedWithSecurityAnnotations() .classLoader(getClass().getClassLoader()).classPath(classPath) .exposedPackages(Set.of( "com.vaadin.hilla.parser.core.security.methodlevel")) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .execute(endpoints)); assertTrue(exception.getMessage().startsWith( diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/EndpointNode.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/EndpointNode.java index 8dc02a8524..b10ce6156e 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/EndpointNode.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/EndpointNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.test.nodes; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.ClassInfoModel; diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/EntityNode.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/EntityNode.java index bfc2fd8643..cd94557de2 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/EntityNode.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/EntityNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.test.nodes; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.ClassInfoModel; diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/FieldNode.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/FieldNode.java index 7749238439..d444b3e805 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/FieldNode.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/FieldNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.test.nodes; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.FieldInfoModel; diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/MethodNode.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/MethodNode.java index 57b2d67785..2b04ee5e2a 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/MethodNode.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/MethodNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.test.nodes; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.MethodInfoModel; diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/MethodParameterNode.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/MethodParameterNode.java index f38aef4203..a23550da8f 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/MethodParameterNode.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/MethodParameterNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.test.nodes; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.MethodParameterInfoModel; diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/TypeSignatureNode.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/TypeSignatureNode.java index a978428bf0..97d377f07a 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/TypeSignatureNode.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/test/nodes/TypeSignatureNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.test.nodes; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.SignatureModel; diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointExposedPlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointExposedPlugin.java index cbfdf386db..f357e4aa3f 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointExposedPlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointExposedPlugin.java @@ -2,7 +2,7 @@ import java.util.stream.Stream; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.Node; @@ -93,7 +93,7 @@ public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { private Node createEndpointHierarchyClassNode( ClassInfoModel classInfo) { var endpointExposedAnnotationName = getStorage().getParserConfig() - .getEndpointExposedAnnotationName(); + .getEndpointExposedAnnotationNames(); var exposed = classInfo.getAnnotations().stream() .map(AnnotationInfoModel::getName) .anyMatch(endpointExposedAnnotationName::equals); diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java index 7e56c7bfb5..9ac69911a1 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java @@ -5,7 +5,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.models.AnnotationInfoModel; import org.slf4j.Logger; @@ -65,8 +65,6 @@ public void exit(NodePath nodePath) { public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { if (nodeDependencies.getNode() instanceof RootNode) { var rootNode = (RootNode) nodeDependencies.getNode(); - var endpointAnnotationName = getStorage().getParserConfig() - .getEndpointAnnotationName(); var endpoints = rootNode.getSource().stream() .map(ClassInfoModel::of).toList(); checkIfJavaCompilerParametersFlagIsEnabled(endpoints); @@ -78,11 +76,11 @@ public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { } private String getEndpointName(ClassInfoModel endpointCls) { - var endpointAnnotationName = getStorage().getParserConfig() - .getEndpointAnnotationName(); + var endpointAnnotationNames = getStorage().getParserConfig() + .getEndpointAnnotationNames(); var endpointAnnotation = endpointCls.getAnnotations().stream() - .filter(annotation -> annotation.getName() - .equals(endpointAnnotationName)) + .filter(annotation -> endpointAnnotationNames + .contains(annotation.getName())) .findFirst(); return endpointAnnotation.flatMap(this::getEndpointAnnotationValue) .filter(name -> !name.isEmpty()) diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EntityPlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EntityPlugin.java index 9283f55394..785146a211 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EntityPlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EntityPlugin.java @@ -3,7 +3,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.NodeDependencies; diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/MethodParameterPlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/MethodParameterPlugin.java index ef9dbd9bf9..582ed02d10 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/MethodParameterPlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/MethodParameterPlugin.java @@ -4,7 +4,7 @@ import java.util.Optional; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.Node; diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/MethodPlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/MethodPlugin.java index 727f96f348..60533ae5d5 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/MethodPlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/MethodPlugin.java @@ -2,7 +2,7 @@ import java.util.Optional; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.Node; diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/TypeSignaturePlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/TypeSignaturePlugin.java index f510423ae0..3c180ffbce 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/TypeSignaturePlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/TypeSignaturePlugin.java @@ -9,7 +9,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.NodeDependencies; diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/CompositeTypeSignatureNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/CompositeTypeSignatureNode.java index 9e9b151ae6..8c9d2dbf32 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/CompositeTypeSignatureNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/CompositeTypeSignatureNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.plugins.backbone.nodes; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import java.util.Collection; import java.util.List; diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointExposedNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointExposedNode.java index 720168f291..b833666f10 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointExposedNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointExposedNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.plugins.backbone.nodes; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.ClassInfoModel; diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointNode.java index b1e6c7b790..14b7cd82c7 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.plugins.backbone.nodes; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.ClassInfoModel; diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointNonExposedNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointNonExposedNode.java index 573bf1cc54..c6044cf738 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointNonExposedNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointNonExposedNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.plugins.backbone.nodes; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.ClassInfoModel; diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointSignatureNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointSignatureNode.java index 0dee8be2f3..413c773ad0 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointSignatureNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EndpointSignatureNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.plugins.backbone.nodes; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.SignatureModel; diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EntityNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EntityNode.java index 893ef4467e..3021feb90f 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EntityNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/EntityNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.plugins.backbone.nodes; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.ClassInfoModel; diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/MethodNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/MethodNode.java index 44ac2dc348..85db3bbf44 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/MethodNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/MethodNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.plugins.backbone.nodes; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.MethodInfoModel; diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/MethodParameterNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/MethodParameterNode.java index fee5262856..04e64144d8 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/MethodParameterNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/MethodParameterNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.plugins.backbone.nodes; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.MethodParameterInfoModel; diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/PropertyNode.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/PropertyNode.java index fa6b0a40b1..899a16b362 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/PropertyNode.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/nodes/PropertyNode.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.plugins.backbone.nodes; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractNode; import com.vaadin.hilla.parser.models.jackson.JacksonPropertyModel; diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java index 8b661ad0d0..47190cf75a 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java @@ -20,7 +20,7 @@ public void should_CorrectlyResolveBareTypes() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(CustomConfigEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java index fb98ccbd75..79b1a655a5 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java @@ -19,8 +19,9 @@ public void should_GenerateParentModel_When_UsingChildModel() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(ComplexHierarchyEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java index eb1dfbf96d..087aa0c674 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java @@ -19,7 +19,7 @@ public void should_CorrectlyHandleComplexTypes() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(ComplexTypeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java index ceacb8d8a9..f0ceb7a805 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java @@ -27,7 +27,7 @@ public void should_CorrectlyHandleComplexTypes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(backbonePlugin) .execute(List.of(CustomConfigEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java index 8440488ac2..4b5c1530a3 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java @@ -18,7 +18,7 @@ public void should_UseCustomEndpointNames_WhenGivenInAnnotation() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(CustomNameTest.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java index e372331ebe..314d174a3c 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java @@ -19,7 +19,7 @@ public void should_GenerateStringType_When_ReferringToDateTimeTypes() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(DateTimeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java index aab6daaf29..5988409ca0 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java @@ -19,7 +19,7 @@ public void should_GenerateStringType_When_ReferringToEnumTypes() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(EnumTypeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java index 6abd94c47f..2fa29e56d9 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java @@ -19,8 +19,9 @@ public void should_CorrectlyHandleEndpointExposedAnnotation() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(ExposedEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java index efc17531d3..96233deb10 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java @@ -19,8 +19,9 @@ public void should_ParseGenericTypes() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(GenericsBareEndpoint.class, GenericsExtendedEndpoint.class, diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java index 937aa9cb07..e6c980113b 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java @@ -18,8 +18,9 @@ public void should_CorrectlyHandleSuperClassMethods() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(GenericSuperClassLong.class, GenericSuperClassString.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java index 7838486060..c25d78b21a 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java @@ -19,7 +19,7 @@ public void should_GenerateStringType_When_ReferringToEnumTypes() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(IterableEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java index 3cdffd4cf4..5b989c468d 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java @@ -27,7 +27,7 @@ public void should_CorrectlyIgnoreFieldsBasedOnJSONAnnotations() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(JacksonEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java index 45a1ec1670..08d63a1b2f 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java @@ -18,7 +18,7 @@ public void should_CorrectlyMapJsonValue() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(JsonValueEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java index 72418d1f83..575490b946 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java @@ -19,7 +19,7 @@ public void should_ThrowExceptionWhenOnlyJsonValueIsUsed() { assertThrows(MalformedValueTypeException.class, () -> { new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(JsonValueNoJsonCreatorTest.class)); }); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java index ef8c2e2a23..285b2d14ad 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java @@ -19,7 +19,7 @@ public void should_UseAppropriateSchema_When_SimpleTypesAreUsed() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(MultiEndpointsBarEndpoint.class, MultiEndpointsBazEndpoint.class, diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java index 90855967b2..6f3524249d 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java @@ -19,7 +19,7 @@ public void should_DistinguishBetweenUserAndBuiltinTypes_When_TheyHaveSameName() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(ShadowedNameEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java index 13ad56b052..6fb849d4f6 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java @@ -19,7 +19,7 @@ public void should_UseAppropriateSchema_When_SimpleTypesAreUsed() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(SimpleTypeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java index c4902a41a6..eba8512f51 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java @@ -19,8 +19,9 @@ public void should_CorrectlyHandleSuperClassMethods() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(PersonEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java index ad307a93ac..1fdea4a1a1 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java @@ -19,7 +19,7 @@ public void should_CorrectlyHandleTransients() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(TransientEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java index e8c1c467a0..089ddf5ec3 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java @@ -19,7 +19,7 @@ public void should_CorrectlyResolveWildcardTypes() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(new BackbonePlugin()) .execute(List.of(WildcardTypeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/Annotation.java b/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/Annotation.java index 677d34e5d5..1441c3294d 100644 --- a/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/Annotation.java +++ b/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/Annotation.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.plugins.model; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import java.util.Map; public final class Annotation { diff --git a/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/ModelPlugin.java b/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/ModelPlugin.java index 8716aa68c1..1688c3b966 100644 --- a/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/ModelPlugin.java +++ b/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/ModelPlugin.java @@ -7,7 +7,7 @@ import java.util.function.Predicate; import java.util.stream.Collectors; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.NodeDependencies; diff --git a/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/ValidationConstraint.java b/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/ValidationConstraint.java index d662e4561d..655d5ad34b 100644 --- a/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/ValidationConstraint.java +++ b/packages/java/parser-jvm-plugin-model/src/main/java/com/vaadin/hilla/parser/plugins/model/ValidationConstraint.java @@ -2,7 +2,7 @@ import java.util.Map; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; public final class ValidationConstraint { private final Map attributes; diff --git a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/annotations/AnnotationsTest.java b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/annotations/AnnotationsTest.java index abb3f83c96..226c600ed8 100644 --- a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/annotations/AnnotationsTest.java +++ b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/annotations/AnnotationsTest.java @@ -23,8 +23,9 @@ public void should_GenerateAnnotations() .exposedPackages(Set.of( "com.vaadin.hilla.parser.plugins.model.annotations")) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()).addPlugin(new ModelPlugin()) .execute(List.of(AnnotationsEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/javatypes/JavaTypeTest.java b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/javatypes/JavaTypeTest.java index 859f7c14ee..66e36e66f4 100644 --- a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/javatypes/JavaTypeTest.java +++ b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/javatypes/JavaTypeTest.java @@ -23,8 +23,9 @@ public void should_GenerateAnnotations() .exposedPackages(Set .of("com.vaadin.hilla.parser.plugins.model.javatypes")) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()).addPlugin(new ModelPlugin()) .execute(List.of(JavaTypeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/validation/ValidationTest.java b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/validation/ValidationTest.java index 4ee2cd641d..25994fc565 100644 --- a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/validation/ValidationTest.java +++ b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/validation/ValidationTest.java @@ -24,8 +24,9 @@ public void should_GenerateValidations() .exposedPackages(Set .of("com.vaadin.hilla.parser.plugins.model.validation")) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()).addPlugin(new ModelPlugin()) .execute(List.of(ValidationEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/AnnotationMatcher.java b/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/AnnotationMatcher.java index 16bc9f09a0..a8d1192908 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/AnnotationMatcher.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/AnnotationMatcher.java @@ -2,7 +2,7 @@ import java.util.Objects; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; /** * Describes annotations that make class members and their signatures nullable diff --git a/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/NonnullPlugin.java b/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/NonnullPlugin.java index a91061f2db..93f976c538 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/NonnullPlugin.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/main/java/com/vaadin/hilla/parser/plugins/nonnull/NonnullPlugin.java @@ -10,7 +10,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.AbstractPlugin; import com.vaadin.hilla.parser.core.NodeDependencies; diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicTest.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicTest.java index 4e8e677e36..f5d1b98532 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicTest.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicTest.java @@ -28,8 +28,9 @@ public void should_ApplyNonNullAnnotation() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()).addPlugin(plugin) .execute(List.of(BasicEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/extended/ExtendedTest.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/extended/ExtendedTest.java index fa56a9f9b0..2b33b9a55a 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/extended/ExtendedTest.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/extended/ExtendedTest.java @@ -27,8 +27,9 @@ public void should_ApplyNonNullAnnotation() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()).addPlugin(plugin) .execute(List.of(ExtendedEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nonnullapi/NonNullApiTest.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nonnullapi/NonNullApiTest.java index a3d8709cd7..c482c80326 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nonnullapi/NonNullApiTest.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nonnullapi/NonNullApiTest.java @@ -33,8 +33,9 @@ public void should_ApplyNonNullApiAnnotation() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()).addPlugin(plugin) .execute(List.of(NonNullApiEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/superclassmethods/SuperClassMethodsTest.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/superclassmethods/SuperClassMethodsTest.java index 767372959a..afeb61eaee 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/superclassmethods/SuperClassMethodsTest.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/superclassmethods/SuperClassMethodsTest.java @@ -27,8 +27,9 @@ public void should_CorrectlyHandleSuperClassMethods() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()).addPlugin(plugin) .execute(List.of(PersonEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-subtypes/src/main/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesPlugin.java b/packages/java/parser-jvm-plugin-subtypes/src/main/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesPlugin.java index f1eaf13873..f3d01229bd 100644 --- a/packages/java/parser-jvm-plugin-subtypes/src/main/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesPlugin.java +++ b/packages/java/parser-jvm-plugin-subtypes/src/main/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesPlugin.java @@ -21,7 +21,7 @@ import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.media.StringSchema; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import java.util.Arrays; import java.util.Collection; import java.util.List; diff --git a/packages/java/parser-jvm-plugin-subtypes/src/test/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesMethodsTest.java b/packages/java/parser-jvm-plugin-subtypes/src/test/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesMethodsTest.java index 2111bc04eb..aaecb4b555 100644 --- a/packages/java/parser-jvm-plugin-subtypes/src/test/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesMethodsTest.java +++ b/packages/java/parser-jvm-plugin-subtypes/src/test/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesMethodsTest.java @@ -19,8 +19,9 @@ public void should_CorrectlyHandleSuperClassMethods() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()).addPlugin(new SubTypesPlugin()) .execute(List.of(SubTypesEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/main/java/com/vaadin/hilla/parser/plugins/transfertypes/TransferTypesPlugin.java b/packages/java/parser-jvm-plugin-transfertypes/src/main/java/com/vaadin/hilla/parser/plugins/transfertypes/TransferTypesPlugin.java index 628384c86e..5b4e72bec9 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/main/java/com/vaadin/hilla/parser/plugins/transfertypes/TransferTypesPlugin.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/main/java/com/vaadin/hilla/parser/plugins/transfertypes/TransferTypesPlugin.java @@ -7,7 +7,7 @@ import java.util.UUID; import java.util.stream.Stream; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java index d5c40cb0f8..2b7b6c23f1 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java @@ -19,7 +19,7 @@ public void should_ReplaceJsonNodeClassWithObject() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) .addPlugin(new BackbonePlugin()) .addPlugin(new TransferTypesPlugin()) .execute(List.of(JsonNodeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/bare/BarePageableTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/bare/BarePageableTest.java index b06e713417..818f0ed045 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/bare/BarePageableTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/bare/BarePageableTest.java @@ -25,8 +25,9 @@ public void should_ConsiderInternalDependenciesForReplacedEntities() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(classpath.split(File.pathSeparator)) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()) .addPlugin(new TransferTypesPlugin()).execute(endpoints); @@ -40,8 +41,9 @@ public void should_CorrectlyResolveReplacedDependencies() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(classpath.split(File.pathSeparator)) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()) .addPlugin(new TransferTypesPlugin()).execute(endpoints); diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/basic/PageableTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/basic/PageableTest.java index 4732ba1be1..c33802cd1e 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/basic/PageableTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/basic/PageableTest.java @@ -24,8 +24,9 @@ public void should_CorrectlyResolveReplacedDependencies() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(classpath.split(File.pathSeparator)) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()) .addPlugin(new TransferTypesPlugin()).execute(endpoints); @@ -39,8 +40,9 @@ public void should_ReplaceSpringClassesWithSubstitutes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(classpath.split(File.pathSeparator)) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()) .addPlugin(new TransferTypesPlugin()).execute(endpoints); diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java index 08aae61494..acd7862606 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java @@ -25,8 +25,9 @@ public void should_ReplacePushTypes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(classpath.split(File.pathSeparator)) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()) .addPlugin(new TransferTypesPlugin()) .execute(List.of(PushTypeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/uuid/UUIDTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/uuid/UUIDTest.java index 72af81a0aa..e63fd582e4 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/uuid/UUIDTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/uuid/UUIDTest.java @@ -20,8 +20,9 @@ public void should_ReplaceUUIDClassWithString() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotation(Endpoint.class.getName()) - .endpointExposedAnnotation(EndpointExposed.class.getName()) + .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointExposedAnnotations( + List.of(EndpointExposed.class.getName())) .addPlugin(new BackbonePlugin()) .addPlugin(new TransferTypesPlugin()) .execute(List.of(UUIDEndpoint.class)); diff --git a/packages/java/parser-jvm-test-utils/src/main/java/com/vaadin/hilla/parser/testutils/TestEngineConfigurationPathResolver.java b/packages/java/parser-jvm-test-utils/src/main/java/com/vaadin/hilla/parser/testutils/TestEngineConfigurationPathResolver.java index 5e85e32cd8..25e9c9f539 100644 --- a/packages/java/parser-jvm-test-utils/src/main/java/com/vaadin/hilla/parser/testutils/TestEngineConfigurationPathResolver.java +++ b/packages/java/parser-jvm-test-utils/src/main/java/com/vaadin/hilla/parser/testutils/TestEngineConfigurationPathResolver.java @@ -8,7 +8,7 @@ import java.util.Objects; import java.util.stream.Collectors; -import javax.annotation.Nonnull; +import jakarta.annotation.Nonnull; /** * A converter for relative paths of From 6c702af2cf17fc609bc8c43460710dafea7f8aeb Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Tue, 30 Jul 2024 11:44:51 +0200 Subject: [PATCH 12/41] Revert import change --- .../parser/testutils/TestEngineConfigurationPathResolver.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/java/parser-jvm-test-utils/src/main/java/com/vaadin/hilla/parser/testutils/TestEngineConfigurationPathResolver.java b/packages/java/parser-jvm-test-utils/src/main/java/com/vaadin/hilla/parser/testutils/TestEngineConfigurationPathResolver.java index 25e9c9f539..5e85e32cd8 100644 --- a/packages/java/parser-jvm-test-utils/src/main/java/com/vaadin/hilla/parser/testutils/TestEngineConfigurationPathResolver.java +++ b/packages/java/parser-jvm-test-utils/src/main/java/com/vaadin/hilla/parser/testutils/TestEngineConfigurationPathResolver.java @@ -8,7 +8,7 @@ import java.util.Objects; import java.util.stream.Collectors; -import jakarta.annotation.Nonnull; +import javax.annotation.Nonnull; /** * A converter for relative paths of From 0b40ef8c53cddc7fde665a666aebf10d7e3f32b4 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Tue, 30 Jul 2024 21:32:46 +0200 Subject: [PATCH 13/41] Remove direct references to the endpoint annotations --- .../com/vaadin/hilla/EndpointCodeGenerator.java | 6 +++--- .../vaadin/hilla/engine/ParserConfiguration.java | 12 ++++++++++++ .../hilla/internal/TaskGenerateOpenAPIImpl.java | 15 +++++++-------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java index e27ad59b29..ed8bf7a401 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java @@ -87,12 +87,12 @@ public void update() { } ApplicationContextProvider.runOnContext(applicationContext -> { - List> endpoints = Stream - .of(BrowserCallable.class, Endpoint.class) + EngineConfiguration engineConfiguration = new EngineConfiguration(); + List> endpoints = engineConfiguration.getParser() + .getEndpointAnnotationClasses().stream() .map(applicationContext::getBeansWithAnnotation) .map(Map::values).flatMap(Collection::stream) .map(Object::getClass).distinct().toList(); - EngineConfiguration engineConfiguration = new EngineConfiguration(); ParserProcessor parser = new ParserProcessor(engineConfiguration, getClass().getClassLoader(), false); parser.process(endpoints); diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java index 313525936e..bc95880b6f 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java @@ -1,10 +1,12 @@ package com.vaadin.hilla.engine; +import java.lang.annotation.Annotation; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Objects; import java.util.Optional; +import java.util.stream.Collectors; import jakarta.annotation.Nonnull; @@ -28,6 +30,16 @@ public List getEndpointAnnotations() { return endpointAnnotations; } + public List> getEndpointAnnotationClasses() { + return endpointAnnotations.stream().map(name -> { + try { + return (Class) Class.forName(name); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } + }).collect(Collectors.toList()); + } + public List getEndpointExposedAnnotations() { return endpointExposedAnnotations; } diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java index 2a95b8530d..7a4b65f836 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java @@ -126,6 +126,8 @@ public void execute() throws ExecutionFailedException { var json = aotOutput.resolve(Path.of("resources", "META-INF", "native-image", EngineConfiguration.groupId, EngineConfiguration.artifactId, "reflect-config.json")); + var engineConfiguration = new EngineConfiguration(); + if (isProductionMode && Files.isRegularFile(json)) { try { String jsonContent = Files.readString(json); @@ -149,12 +151,10 @@ public void execute() throws ExecutionFailedException { return null; } }).filter(Objects::nonNull) - .filter(cls -> cls - .isAnnotationPresent(Endpoint.class) - || cls.isAnnotationPresent( - BrowserCallable.class)) + .filter(cls -> engineConfiguration.getParser() + .getEndpointAnnotationClasses().stream() + .anyMatch(cls::isAnnotationPresent)) .collect(Collectors.toList()); - var engineConfiguration = new EngineConfiguration(); var processor = new ParserProcessor(engineConfiguration, classLoader, isProductionMode); processor.process(endpoints); @@ -164,13 +164,12 @@ public void execute() throws ExecutionFailedException { } } else { ApplicationContextProvider.runOnContext(applicationContext -> { - List> endpoints = Stream - .of(BrowserCallable.class, Endpoint.class) + List> endpoints = engineConfiguration.getParser() + .getEndpointAnnotationClasses().stream() .map(applicationContext::getBeansWithAnnotation) .map(Map::values).flatMap(Collection::stream) .map(Object::getClass).distinct() .collect(Collectors.toList()); - var engineConfiguration = new EngineConfiguration(); var processor = new ParserProcessor(engineConfiguration, classLoader, isProductionMode); processor.process(endpoints); From 23814a7463f898c5afba5de59c71df291718905c Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Wed, 31 Jul 2024 19:40:16 +0200 Subject: [PATCH 14/41] support build dir --- .../hilla/engine/EngineConfiguration.java | 10 ++++------ .../hilla/internal/TaskGenerateOpenAPIImpl.java | 17 +++++++++++------ .../vaadin/hilla/maven/BuildFrontendMojo.java | 4 ++++ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java index e77a2411dc..0a03cbe0b1 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java @@ -18,8 +18,8 @@ public class EngineConfiguration { public static String groupId; public static String artifactId; public static String mainClass; + public static Path buildDir; private Path baseDir; - private Path buildDir; @JsonDeserialize(as = LinkedHashSet.class) private Set classPath; private Path classesDir; @@ -57,7 +57,6 @@ public boolean equals(Object o) { && Objects.equals(classPath, that.classPath) && Objects.equals(generator, that.generator) && Objects.equals(parser, that.parser) - && Objects.equals(buildDir, that.buildDir) && Objects.equals(classesDir, that.classesDir) && Objects.equals(outputDir, that.outputDir); } @@ -92,8 +91,8 @@ public ParserConfiguration getParser() { @Override public int hashCode() { - return Objects.hash(baseDir, classPath, generator, parser, buildDir, - classesDir, outputDir); + return Objects.hash(baseDir, classPath, generator, parser, classesDir, + outputDir); } @JsonIgnore @@ -122,7 +121,6 @@ public Builder(EngineConfiguration configuration) { this.configuration.classPath = configuration.classPath; this.configuration.generator = configuration.generator; this.configuration.parser = configuration.parser; - this.configuration.buildDir = configuration.buildDir; this.configuration.classesDir = configuration.classesDir; this.configuration.outputDir = configuration.outputDir; } @@ -137,7 +135,7 @@ public Builder buildDir(String value) { } public Builder buildDir(Path value) { - configuration.buildDir = resolve(value); + buildDir = resolve(value); return this; } diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java index 7a4b65f836..3c712a6d08 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java @@ -98,8 +98,9 @@ public class TaskGenerateOpenAPIImpl extends AbstractTaskEndpointGenerator @Override public void execute() throws ExecutionFailedException { try { - var aotOutput = Path.of(System.getProperty("user.dir"), "target", - "spring-aot", "main"); + var engineConfiguration = new EngineConfiguration(); + var aotOutput = engineConfiguration.getBuildDir() + .resolve("spring-aot/main"); var classesDirectory = aotOutput.resolve("classes"); var applicationClass = (EngineConfiguration.mainClass != null) ? EngineConfiguration.mainClass @@ -126,9 +127,13 @@ public void execute() throws ExecutionFailedException { var json = aotOutput.resolve(Path.of("resources", "META-INF", "native-image", EngineConfiguration.groupId, EngineConfiguration.artifactId, "reflect-config.json")); - var engineConfiguration = new EngineConfiguration(); - if (isProductionMode && Files.isRegularFile(json)) { + if (isProductionMode) { + if (!Files.isRegularFile(json)) { + throw new ExecutionFailedException( + "AOT file `reflect-config.json` not found"); + } + try { String jsonContent = Files.readString(json); var objectMapper = new ObjectMapper(); @@ -156,7 +161,7 @@ public void execute() throws ExecutionFailedException { .anyMatch(cls::isAnnotationPresent)) .collect(Collectors.toList()); var processor = new ParserProcessor(engineConfiguration, - classLoader, isProductionMode); + classLoader, true); processor.process(endpoints); } } catch (IOException e) { @@ -171,7 +176,7 @@ public void execute() throws ExecutionFailedException { .map(Object::getClass).distinct() .collect(Collectors.toList()); var processor = new ParserProcessor(engineConfiguration, - classLoader, isProductionMode); + classLoader, false); processor.process(endpoints); }); } diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java index fb3dc39706..3f40f47282 100644 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java @@ -48,6 +48,9 @@ public class BuildFrontendMojo @Parameter(defaultValue = "${project.artifactId}", readonly = true, required = true) private String artifactId; + @Parameter(defaultValue = "${project.build.directory}", readonly = true, required = true) + private File buildDir; + @Parameter(property = "spring-boot.aot.main-class") private String mainClass; @@ -58,6 +61,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { EngineConfiguration.groupId = groupId; EngineConfiguration.artifactId = artifactId; EngineConfiguration.mainClass = mainClass; + EngineConfiguration.buildDir = buildDir.toPath(); super.execute(); } } From d5fb53140a57f4ff94d141cf393a82a6c36e7a7f Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Wed, 31 Jul 2024 22:51:30 +0200 Subject: [PATCH 15/41] Restore check for acl annotations --- .../com/vaadin/hilla/parser/core/Parser.java | 137 +++++++++--------- 1 file changed, 67 insertions(+), 70 deletions(-) diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java index 5d7b774abf..1e96b55b1d 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java @@ -9,10 +9,8 @@ import java.util.HashSet; import java.util.List; import java.util.Objects; -import java.util.Optional; import java.util.Set; import java.util.function.Consumer; -import java.util.stream.Collectors; import jakarta.annotation.Nonnull; @@ -197,14 +195,13 @@ public Parser classPath(@Nonnull Collection classPathElements, *

* If the annotation name is already set, it will be overridden. * - * @param annotationFullyQualifiedNames + * @param annotations * The fully qualified names of the annotations * @return this (for method chaining). */ @Nonnull - public Parser endpointAnnotations( - @Nonnull List annotationFullyQualifiedNames) { - return endpointAnnotations(annotationFullyQualifiedNames, true); + public Parser endpointAnnotations(@Nonnull List> annotations) { + return endpointAnnotations(annotations, true); } /** @@ -212,7 +209,7 @@ public Parser endpointAnnotations( * search for the endpoints. Only classes with this annotation will be * chosen. * - * @param annotationFullyQualifiedNames + * @param annotations * The fully qualified names of the annotations * @param override * specifies if the parser should override the annotation name if @@ -220,12 +217,10 @@ public Parser endpointAnnotations( * @return this (for method chaining). */ @Nonnull - public Parser endpointAnnotations( - @Nonnull List annotationFullyQualifiedNames, + public Parser endpointAnnotations(@Nonnull List> annotations, boolean override) { - if (override || config.endpointAnnotationNames == null) { - config.endpointAnnotationNames = Objects - .requireNonNull(annotationFullyQualifiedNames); + if (override || config.endpointAnnotations == null) { + config.endpointAnnotations = Objects.requireNonNull(annotations); } return this; } @@ -239,14 +234,14 @@ public Parser endpointAnnotations( *

* If the annotation name is already set, it will be overridden. * - * @param annotationFullyQualifiedNames + * @param annotations * The fully qualified names of the annotations * @return this (for method chaining). */ @Nonnull public Parser endpointExposedAnnotations( - @Nonnull List annotationFullyQualifiedNames) { - return endpointExposedAnnotations(annotationFullyQualifiedNames, true); + @Nonnull List> annotations) { + return endpointExposedAnnotations(annotations, true); } /** @@ -255,7 +250,7 @@ public Parser endpointExposedAnnotations( * part of the endpoint. Any superclass in the endpoint's inheritance chain * will be skipped if it doesn't have this annotation. * - * @param annotationFullyQualifiedNames + * @param annotations * The fully qualified names of the annotations * @param override * specifies if the parser should override the annotation name if @@ -264,11 +259,10 @@ public Parser endpointExposedAnnotations( */ @Nonnull public Parser endpointExposedAnnotations( - @Nonnull List annotationFullyQualifiedNames, - boolean override) { - if (override || config.endpointExposedAnnotationNames == null) { - config.endpointExposedAnnotationNames = Objects - .requireNonNull(annotationFullyQualifiedNames); + @Nonnull List> annotations, boolean override) { + if (override || config.endpointExposedAnnotations == null) { + config.endpointExposedAnnotations = Objects + .requireNonNull(annotations); } return this; } @@ -298,14 +292,14 @@ public OpenAPI execute(List> endpoints) { "[JVM Parser] classLoader is not provided."); Objects.requireNonNull(config.classPathElements, "[JVM Parser] classPath is not provided."); - Objects.requireNonNull(config.endpointAnnotationNames, - "[JVM Parser] endpointAnnotationNames is not provided."); + Objects.requireNonNull(config.endpointAnnotations, + "[JVM Parser] endpointAnnotations is not provided."); logger.debug("JVM Parser started"); var storage = new SharedStorage(config); - // validateEndpointExposedClassesForAclAnnotations(scanResult); + validateEndpointExposedClassesForAclAnnotations(endpoints); var rootNode = new RootNode(endpoints, storage.getOpenAPI()); var pluginManager = new PluginManager( storage.getParserConfig().getPlugins()); @@ -318,46 +312,49 @@ public OpenAPI execute(List> endpoints) { return storage.getOpenAPI(); } - // private void validateEndpointExposedClassesForAclAnnotations( - // io.github.classgraph.ScanResult scanResult) { - - // Optional.ofNullable(config.getEndpointExposedAnnotationName()) - // .ifPresent(endpointExposedAnnotation -> scanResult - // .getClassesWithAnnotation(endpointExposedAnnotation) - // .forEach(classInfo -> { - // checkClassLevelAnnotation(classInfo); - // checkMethodLevelAnnotation(classInfo); - // })); - // } - - // private void checkClassLevelAnnotation(ClassInfo classInfo) { - // classInfo.getAnnotationInfo() - // .forEach(annotationInfo -> throwIfAnnotationIsAclAnnotation( - // annotationInfo.getName(), classInfo)); - // } - - // private void checkMethodLevelAnnotation(ClassInfo classInfo) { - // for (Method method : classInfo.loadClass().getMethods()) { - // var annotations = method.getDeclaredAnnotations(); - // for (Annotation annotation : annotations) { - // throwIfAnnotationIsAclAnnotation( - // annotation.annotationType().getName(), classInfo); - // } - // } - // } - - // private void throwIfAnnotationIsAclAnnotation(String annotationName, - // ClassInfo classInfo) { - // var endpointExposedAnnotation = config - // .getEndpointExposedAnnotationName(); - - // if (ACL_ANNOTATIONS.contains(annotationName)) { - // throw new ParserException(String.format( - // ENDPOINT_EXPOSED_AND_ACL_ANNOTATIONS_ERROR_TEMPLATE, - // classInfo.getName(), endpointExposedAnnotation, - // annotationName, endpointExposedAnnotation)); - // } - // } + private void validateEndpointExposedClassesForAclAnnotations( + List> endpoints) { + + endpoints.stream() + .flatMap(endpoint -> config.getEndpointExposedAnnotations() + .stream().map(ann -> List.of(endpoint, ann))) + .filter(pair -> pair.getFirst().isAnnotationPresent( + (Class) pair.getLast())) + .forEach(pair -> { + checkClassLevelAnnotation(pair.getFirst(), pair.getLast()); + checkMethodLevelAnnotation(pair.getFirst(), pair.getLast()); + }); + } + + private void checkClassLevelAnnotation(Class endpoint, + Class exposedAnnotation) { + Arrays.stream(endpoint.getAnnotations()) + .forEach(annotationInfo -> throwIfAnnotationIsAclAnnotation( + annotationInfo.annotationType().getName(), endpoint, + exposedAnnotation)); + } + + private void checkMethodLevelAnnotation(Class endpoint, + Class exposedAnnotation) { + for (Method method : endpoint.getMethods()) { + var annotations = method.getDeclaredAnnotations(); + for (Annotation annotation : annotations) { + throwIfAnnotationIsAclAnnotation( + annotation.annotationType().getName(), endpoint, + exposedAnnotation); + } + } + } + + private void throwIfAnnotationIsAclAnnotation(String annotationName, + Class endpoint, Class exposedAnnotation) { + if (ACL_ANNOTATIONS.contains(annotationName)) { + throw new ParserException(String.format( + ENDPOINT_EXPOSED_AND_ACL_ANNOTATIONS_ERROR_TEMPLATE, + endpoint.getName(), exposedAnnotation.getName(), + annotationName, exposedAnnotation.getName())); + } + } /** * Gets the internal configuration object. @@ -439,8 +436,8 @@ public Parser plugins(@Nonnull Collection plugins) { public static final class Config { private final List plugins = new ArrayList<>(); private Set classPathElements; - private List endpointAnnotationNames; - private List endpointExposedAnnotationNames; + private List> endpointAnnotations; + private List> endpointExposedAnnotations; private Collection exposedPackages; private OpenAPI openAPI; private ClassLoader classLoader; @@ -475,8 +472,8 @@ public Set getClassPathElements() { * @return the annotation name. */ @Nonnull - public List getEndpointAnnotationNames() { - return endpointAnnotationNames; + public List> getEndpointAnnotations() { + return endpointAnnotations; } /** @@ -485,8 +482,8 @@ public List getEndpointAnnotationNames() { * @return the annotation name. */ @Nonnull - public List getEndpointExposedAnnotationNames() { - return endpointExposedAnnotationNames; + public List> getEndpointExposedAnnotations() { + return endpointExposedAnnotations; } /** From ca9c6a0764380a484772cb68acb41519433a8be8 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Thu, 1 Aug 2024 10:37:45 +0200 Subject: [PATCH 16/41] Refactor annotations --- .../vaadin/hilla/EndpointCodeGenerator.java | 3 +- .../hilla/engine/ParserConfiguration.java | 27 +++------- .../vaadin/hilla/engine/ParserProcessor.java | 23 ++++----- .../hilla/engine/EngineConfigurationTest.java | 21 ++++++-- .../internal/TaskGenerateOpenAPIImpl.java | 4 +- .../com/vaadin/hilla/parser/core/Parser.java | 27 +++++----- .../hilla/parser/core/ParserConfigTests.java | 51 ++++++++++++------- .../hilla/parser/core/basic/BasicTests.java | 4 +- .../core/dependency/DependencyTests.java | 2 +- ...pointExposedAndSecurityAnnotationTest.java | 5 +- ...xposedMethodAndSecurityAnnotationTest.java | 5 +- .../backbone/EndpointExposedPlugin.java | 2 +- .../plugins/backbone/EndpointPlugin.java | 5 +- .../plugins/backbone/bare/BareTypeTest.java | 2 +- .../ComplexHierarchyTest.java | 5 +- .../backbone/complextype/ComplexTypeTest.java | 2 +- .../backbone/config/CustomConfigTest.java | 2 +- .../backbone/customname/CustomNameTest.java | 2 +- .../backbone/datetime/DateTimeTest.java | 2 +- .../backbone/enumtype/EnumTypeTest.java | 2 +- .../plugins/backbone/exposed/ExposedTest.java | 5 +- .../backbone/generics/GenericsTest.java | 5 +- .../GenericSuperClassMethodsTest.java | 5 +- .../backbone/iterable/IterableTest.java | 2 +- .../plugins/backbone/jackson/JacksonTest.java | 2 +- .../backbone/jsonvalue/JsonValueTest.java | 2 +- .../JsonValueNoJsonCreatorTest.java | 2 +- .../multiendpoints/MultiEndpointsTest.java | 2 +- .../shadowedname/ShadowedNameTest.java | 2 +- .../backbone/simpletype/SimpleTypeTest.java | 2 +- .../SuperClassMethodsTest.java | 5 +- .../backbone/transients/TransientTest.java | 2 +- .../backbone/wildcard/WildcardTypeTest.java | 2 +- .../model/annotations/AnnotationsTest.java | 5 +- .../plugins/model/javatypes/JavaTypeTest.java | 5 +- .../model/validation/ValidationTest.java | 5 +- .../plugins/nonnull/basic/BasicTest.java | 5 +- .../nonnull/extended/ExtendedTest.java | 5 +- .../nonnull/nonnullapi/NonNullApiTest.java | 5 +- .../SuperClassMethodsTest.java | 5 +- .../plugins/subtypes/SubTypesMethodsTest.java | 5 +- .../transfertypes/jsonnode/JsonNodeTest.java | 2 +- .../pageable/bare/BarePageableTest.java | 10 ++-- .../pageable/basic/PageableTest.java | 10 ++-- .../transfertypes/push/PushTypeTest.java | 5 +- .../plugins/transfertypes/uuid/UUIDTest.java | 5 +- 46 files changed, 154 insertions(+), 152 deletions(-) diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java index ed8bf7a401..0b6ca096ad 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java @@ -16,6 +16,7 @@ package com.vaadin.hilla; import java.io.IOException; +import java.lang.annotation.Annotation; import java.nio.file.Files; import java.nio.file.Path; import java.util.Collection; @@ -89,7 +90,7 @@ public void update() { ApplicationContextProvider.runOnContext(applicationContext -> { EngineConfiguration engineConfiguration = new EngineConfiguration(); List> endpoints = engineConfiguration.getParser() - .getEndpointAnnotationClasses().stream() + .getEndpointAnnotations().stream() .map(applicationContext::getBeansWithAnnotation) .map(Map::values).flatMap(Collection::stream) .map(Object::getClass).distinct().toList(); diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java index bc95880b6f..b583f3195f 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java @@ -6,7 +6,6 @@ import java.util.List; import java.util.Objects; import java.util.Optional; -import java.util.stream.Collectors; import jakarta.annotation.Nonnull; @@ -19,28 +18,17 @@ import com.vaadin.hilla.parser.utils.ConfigList; public final class ParserConfiguration { - private List endpointAnnotations = List.of( - "com.vaadin.hilla.BrowserCallable", "com.vaadin.hilla.Endpoint"); - private List endpointExposedAnnotations = List - .of("com.vaadin.hilla.EndpointExposed"); + private List> endpointAnnotations = List.of(); + private List> endpointExposedAnnotations = List + .of(); private String openAPIBasePath; private Plugins plugins; - public List getEndpointAnnotations() { + public List> getEndpointAnnotations() { return endpointAnnotations; } - public List> getEndpointAnnotationClasses() { - return endpointAnnotations.stream().map(name -> { - try { - return (Class) Class.forName(name); - } catch (ClassNotFoundException e) { - throw new RuntimeException(e); - } - }).collect(Collectors.toList()); - } - - public List getEndpointExposedAnnotations() { + public List> getEndpointExposedAnnotations() { return endpointExposedAnnotations; } @@ -74,12 +62,13 @@ public int hashCode() { openAPIBasePath, plugins); } - void setEndpointAnnotations(@Nonnull List endpointAnnotations) { + void setEndpointAnnotations( + @Nonnull List> endpointAnnotations) { this.endpointAnnotations = endpointAnnotations; } void setEndpointExposedAnnotations( - @Nonnull List endpointExposedAnnotations) { + @Nonnull List> endpointExposedAnnotations) { this.endpointExposedAnnotations = endpointExposedAnnotations; } diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java index 210dc18852..c97a467928 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java @@ -1,6 +1,7 @@ package com.vaadin.hilla.engine; import java.io.IOException; +import java.lang.annotation.Annotation; import java.nio.file.Files; import java.nio.file.Path; import java.util.Collection; @@ -30,10 +31,9 @@ public final class ParserProcessor { private final Set classPath; private final Path openAPIFile; private final ParserConfiguration.PluginsProcessor pluginsProcessor = new ParserConfiguration.PluginsProcessor(); - private List endpointAnnotationNames = List - .of("com.vaadin.hilla.Endpoint"); - private List endpointExposedAnnotationNames = List - .of("com.vaadin.hilla.EndpointExposed"); + private List> endpointAnnotations = List.of(); + private List> endpointExposedAnnotations = List + .of(); private Collection exposedPackages = List.of(); private String openAPIBasePath; @@ -50,8 +50,8 @@ private String createOpenAPI(List> endpoints) throws IOException { var parser = new Parser().classLoader(classLoader) .classPath(classPath.stream().map(Path::toString) .collect(Collectors.toSet())) - .endpointAnnotations(endpointAnnotationNames) - .endpointExposedAnnotations(endpointExposedAnnotationNames) + .endpointAnnotations(endpointAnnotations) + .endpointExposedAnnotations(endpointExposedAnnotations) .exposedPackages(exposedPackages); preparePlugins(parser); @@ -105,15 +105,14 @@ private void applyConfiguration(ParserConfiguration parserConfiguration) { } private void applyEndpointAnnotations( - @Nonnull List endpointAnnotationNames) { - this.endpointAnnotationNames = Objects - .requireNonNull(endpointAnnotationNames); + @Nonnull List> endpointAnnotations) { + this.endpointAnnotations = Objects.requireNonNull(endpointAnnotations); } private void applyEndpointExposedAnnotations( - @Nonnull List endpointExposedAnnotationNames) { - this.endpointExposedAnnotationNames = Objects - .requireNonNull(endpointExposedAnnotationNames); + @Nonnull List> endpointExposedAnnotations) { + this.endpointExposedAnnotations = Objects + .requireNonNull(endpointExposedAnnotations); } private void applyOpenAPIBase(@Nonnull String openAPIBasePath) { diff --git a/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java b/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java index b5ac992501..887a78d467 100644 --- a/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java +++ b/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java @@ -4,6 +4,10 @@ import java.io.File; import java.io.IOException; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; import java.nio.file.Files; import java.nio.file.Path; import java.util.LinkedHashSet; @@ -22,6 +26,16 @@ public class EngineConfigurationTest { private EngineConfiguration.Builder configurationBuilder; private Path temporaryDirectory; + @Target(ElementType.TYPE) + @Retention(RetentionPolicy.RUNTIME) + public @interface Endpoint { + } + + @Target(ElementType.TYPE) + @Retention(RetentionPolicy.RUNTIME) + public @interface EndpointExposed { + } + @BeforeEach public void setUp() throws IOException { this.temporaryDirectory = Files @@ -32,10 +46,9 @@ public void setUp() throws IOException { this.baseDirectory = this.temporaryDirectory.resolve("base"); var parserConfiguration = new ParserConfiguration(); - parserConfiguration.setEndpointAnnotations( - List.of("com.vaadin.hilla.test.Endpoint")); - parserConfiguration.setEndpointExposedAnnotations( - List.of("com.vaadin.hilla.test.EndpointExposed")); + parserConfiguration.setEndpointAnnotations(List.of(Endpoint.class)); + parserConfiguration + .setEndpointExposedAnnotations(List.of(EndpointExposed.class)); parserConfiguration.setPlugins(new ParserConfiguration.Plugins(List.of( new ParserConfiguration.Plugin("parser-jvm-plugin-use"), new ParserConfiguration.Plugin("parser-jvm-plugin-nonnull", diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java index 3c712a6d08..8b866fd4df 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java @@ -157,7 +157,7 @@ public void execute() throws ExecutionFailedException { } }).filter(Objects::nonNull) .filter(cls -> engineConfiguration.getParser() - .getEndpointAnnotationClasses().stream() + .getEndpointAnnotations().stream() .anyMatch(cls::isAnnotationPresent)) .collect(Collectors.toList()); var processor = new ParserProcessor(engineConfiguration, @@ -170,7 +170,7 @@ public void execute() throws ExecutionFailedException { } else { ApplicationContextProvider.runOnContext(applicationContext -> { List> endpoints = engineConfiguration.getParser() - .getEndpointAnnotationClasses().stream() + .getEndpointAnnotations().stream() .map(applicationContext::getBeansWithAnnotation) .map(Map::values).flatMap(Collection::stream) .map(Object::getClass).distinct() diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java index 1e96b55b1d..b4de31483f 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java @@ -200,7 +200,8 @@ public Parser classPath(@Nonnull Collection classPathElements, * @return this (for method chaining). */ @Nonnull - public Parser endpointAnnotations(@Nonnull List> annotations) { + public Parser endpointAnnotations( + @Nonnull List> annotations) { return endpointAnnotations(annotations, true); } @@ -217,7 +218,8 @@ public Parser endpointAnnotations(@Nonnull List> annotations) { * @return this (for method chaining). */ @Nonnull - public Parser endpointAnnotations(@Nonnull List> annotations, + public Parser endpointAnnotations( + @Nonnull List> annotations, boolean override) { if (override || config.endpointAnnotations == null) { config.endpointAnnotations = Objects.requireNonNull(annotations); @@ -240,7 +242,7 @@ public Parser endpointAnnotations(@Nonnull List> annotations, */ @Nonnull public Parser endpointExposedAnnotations( - @Nonnull List> annotations) { + @Nonnull List> annotations) { return endpointExposedAnnotations(annotations, true); } @@ -259,7 +261,8 @@ public Parser endpointExposedAnnotations( */ @Nonnull public Parser endpointExposedAnnotations( - @Nonnull List> annotations, boolean override) { + @Nonnull List> annotations, + boolean override) { if (override || config.endpointExposedAnnotations == null) { config.endpointExposedAnnotations = Objects .requireNonNull(annotations); @@ -318,11 +321,11 @@ private void validateEndpointExposedClassesForAclAnnotations( endpoints.stream() .flatMap(endpoint -> config.getEndpointExposedAnnotations() .stream().map(ann -> List.of(endpoint, ann))) - .filter(pair -> pair.getFirst().isAnnotationPresent( - (Class) pair.getLast())) + .filter(pair -> pair.get(0).isAnnotationPresent( + (Class) pair.get(1))) .forEach(pair -> { - checkClassLevelAnnotation(pair.getFirst(), pair.getLast()); - checkMethodLevelAnnotation(pair.getFirst(), pair.getLast()); + checkClassLevelAnnotation(pair.get(0), pair.get(1)); + checkMethodLevelAnnotation(pair.get(0), pair.get(1)); }); } @@ -436,8 +439,8 @@ public Parser plugins(@Nonnull Collection plugins) { public static final class Config { private final List plugins = new ArrayList<>(); private Set classPathElements; - private List> endpointAnnotations; - private List> endpointExposedAnnotations; + private List> endpointAnnotations; + private List> endpointExposedAnnotations; private Collection exposedPackages; private OpenAPI openAPI; private ClassLoader classLoader; @@ -472,7 +475,7 @@ public Set getClassPathElements() { * @return the annotation name. */ @Nonnull - public List> getEndpointAnnotations() { + public List> getEndpointAnnotations() { return endpointAnnotations; } @@ -482,7 +485,7 @@ public List> getEndpointAnnotations() { * @return the annotation name. */ @Nonnull - public List> getEndpointExposedAnnotations() { + public List> getEndpointExposedAnnotations() { return endpointExposedAnnotations; } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java index 78165a5f7d..e311d41c66 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java @@ -6,6 +6,11 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import java.io.IOException; +import java.lang.annotation.Annotation; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; import java.net.URISyntaxException; import java.nio.file.Path; import java.util.ArrayList; @@ -26,25 +31,38 @@ import io.swagger.v3.oas.models.servers.Server; public class ParserConfigTests { + @Target(ElementType.TYPE) + @Retention(RetentionPolicy.RUNTIME) + public @interface BrowserCallable { + } + + @Target(ElementType.TYPE) + @Retention(RetentionPolicy.RUNTIME) + public @interface Endpoint { + } + + @Target(ElementType.TYPE) + @Retention(RetentionPolicy.RUNTIME) + public @interface EndpointExposed { + } + private final ResourceLoader resourceLoader = new ResourceLoader( getClass()); private Set defaultClassPathElements; - private List defaultEndpointAnnotationNames; - private List defaultEndpointExposedAnnotationNames; + private List> defaultEndpointAnnotations; + private List> defaultEndpointExposedAnnotations; private OpenAPI defaultOpenAPI; private Parser parser; private Path targetDir; @BeforeEach public void setup() throws URISyntaxException { - defaultEndpointAnnotationNames = List.of( - "com.vaadin.hilla.BrowserCallable", - "com.vaadin.hilla.Endpoint"); + defaultEndpointAnnotations = List.of(BrowserCallable.class, + Endpoint.class); targetDir = resourceLoader.findTargetDirPath(); defaultClassPathElements = Set.of(targetDir.toString()); - defaultEndpointExposedAnnotationNames = List - .of("com.vaadin.hilla.EndpointExposed"); + defaultEndpointExposedAnnotations = List.of(EndpointExposed.class); defaultOpenAPI = new OpenAPI() .info(new Info().title("Hilla Application").version("1.0.0")) .servers(List @@ -53,9 +71,8 @@ public void setup() throws URISyntaxException { .paths(new Paths()); parser = new Parser().classLoader(getClass().getClassLoader()) .classPath(defaultClassPathElements) - .endpointAnnotations(defaultEndpointAnnotationNames) - .endpointExposedAnnotations( - defaultEndpointExposedAnnotationNames); + .endpointAnnotations(defaultEndpointAnnotations) + .endpointExposedAnnotations(defaultEndpointExposedAnnotations); } @Test @@ -108,7 +125,7 @@ public void should_AllowAdjustingOpenAPI() { @Test public void should_AllowPreservingAlreadySetProperties() { var config = parser.classPath(List.of("somepath"), false) - .endpointAnnotations(List.of("com.example.Endpoint"), false) + .endpointAnnotations(List.of(Endpoint.class), false) .getConfig(); assertEquals(defaultClassPathElements, config.getClassPathElements()); @@ -119,10 +136,10 @@ public void should_CreateConfigWithDefaultParameters() { var config = parser.getConfig(); assertEquals(defaultClassPathElements, config.getClassPathElements()); - assertEquals(defaultEndpointAnnotationNames, - config.getEndpointAnnotationNames()); - assertEquals(defaultEndpointExposedAnnotationNames, - config.getEndpointExposedAnnotationNames()); + assertEquals(defaultEndpointAnnotations, + config.getEndpointAnnotations()); + assertEquals(defaultEndpointExposedAnnotations, + config.getEndpointExposedAnnotations()); assertEquals(defaultOpenAPI, config.getOpenAPI()); assertEquals(List.of(), new ArrayList<>(config.getPlugins())); } @@ -143,7 +160,7 @@ public void should_ParseYAMLOpenAPISource() public void should_ThrowError_When_ClassLoaderIsNotSet() { var e = assertThrows(NullPointerException.class, () -> new Parser().classPath(defaultClassPathElements) - .endpointAnnotations(defaultEndpointAnnotationNames) + .endpointAnnotations(defaultEndpointAnnotations) .execute(List.of())); assertEquals("[JVM Parser] classLoader is not provided.", e.getMessage()); @@ -153,7 +170,7 @@ public void should_ThrowError_When_ClassLoaderIsNotSet() { public void should_ThrowError_When_ClassPathIsNotSet() { var e = assertThrows(NullPointerException.class, () -> new Parser().classLoader(getClass().getClassLoader()) - .endpointAnnotations(defaultEndpointAnnotationNames) + .endpointAnnotations(defaultEndpointAnnotations) .execute(List.of())); assertEquals("[JVM Parser] classPath is not provided.", e.getMessage()); } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java index f2c57e563c..2ca709ec11 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java @@ -54,7 +54,7 @@ public class BasicTests { public void should_TraverseInConsistentOrder() { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(classPath) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(new BasicPlugin()).execute(endpoints); assertEquals(String.join("\n", STEPS), @@ -65,7 +65,7 @@ public void should_TraverseInConsistentOrder() { public void should_UpdateNodesAndCollectNames() { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(classPath) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(new BasicPlugin()).execute(endpoints); assertEquals(String.join(", ", diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java index 27a8530b15..177e447bb4 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java @@ -35,7 +35,7 @@ public static void setUp() { openApi = new Parser() .classLoader(DependencyTests.class.getClassLoader()) .classPath(classPath) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(new DependencyPlugin()).execute(endpoints); } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/classlevel/EndpointExposedAndSecurityAnnotationTest.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/classlevel/EndpointExposedAndSecurityAnnotationTest.java index 3ada8fb3b4..c343c2f55f 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/classlevel/EndpointExposedAndSecurityAnnotationTest.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/classlevel/EndpointExposedAndSecurityAnnotationTest.java @@ -35,9 +35,8 @@ public void throws_when_parentEndpointClass_annotatedWithSecurityAnnotations() { .classLoader(getClass().getClassLoader()).classPath(classPath) .exposedPackages(Set .of("com.vaadin.hilla.parser.core.security.classlevel")) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .execute(endpoints)); assertTrue(exception.getMessage().startsWith( diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/methodlevel/EndpointExposedMethodAndSecurityAnnotationTest.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/methodlevel/EndpointExposedMethodAndSecurityAnnotationTest.java index d60f91c15b..77f8d094fc 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/methodlevel/EndpointExposedMethodAndSecurityAnnotationTest.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/methodlevel/EndpointExposedMethodAndSecurityAnnotationTest.java @@ -35,9 +35,8 @@ public void throws_when_parentEndpointMethod_annotatedWithSecurityAnnotations() .classLoader(getClass().getClassLoader()).classPath(classPath) .exposedPackages(Set.of( "com.vaadin.hilla.parser.core.security.methodlevel")) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .execute(endpoints)); assertTrue(exception.getMessage().startsWith( diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointExposedPlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointExposedPlugin.java index f357e4aa3f..84b8a6c802 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointExposedPlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointExposedPlugin.java @@ -93,7 +93,7 @@ public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { private Node createEndpointHierarchyClassNode( ClassInfoModel classInfo) { var endpointExposedAnnotationName = getStorage().getParserConfig() - .getEndpointExposedAnnotationNames(); + .getEndpointExposedAnnotations(); var exposed = classInfo.getAnnotations().stream() .map(AnnotationInfoModel::getName) .anyMatch(endpointExposedAnnotationName::equals); diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java index 9ac69911a1..61deb0a7e7 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java @@ -1,5 +1,6 @@ package com.vaadin.hilla.parser.plugins.backbone; +import java.lang.annotation.Annotation; import java.util.Collection; import java.util.Optional; import java.util.stream.Collectors; @@ -77,10 +78,10 @@ public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { private String getEndpointName(ClassInfoModel endpointCls) { var endpointAnnotationNames = getStorage().getParserConfig() - .getEndpointAnnotationNames(); + .getEndpointAnnotations(); var endpointAnnotation = endpointCls.getAnnotations().stream() .filter(annotation -> endpointAnnotationNames - .contains(annotation.getName())) + .contains(((Annotation) annotation.get()).getClass())) .findFirst(); return endpointAnnotation.flatMap(this::getEndpointAnnotationValue) .filter(name -> !name.isEmpty()) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java index 47190cf75a..799a246056 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java @@ -20,7 +20,7 @@ public void should_CorrectlyResolveBareTypes() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(CustomConfigEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java index 79b1a655a5..ac53bf8105 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java @@ -19,9 +19,8 @@ public void should_GenerateParentModel_When_UsingChildModel() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(ComplexHierarchyEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java index 087aa0c674..19eea238f1 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java @@ -19,7 +19,7 @@ public void should_CorrectlyHandleComplexTypes() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(ComplexTypeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java index f0ceb7a805..8785991009 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java @@ -27,7 +27,7 @@ public void should_CorrectlyHandleComplexTypes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(backbonePlugin) .execute(List.of(CustomConfigEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java index 4b5c1530a3..9db8a74311 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java @@ -18,7 +18,7 @@ public void should_UseCustomEndpointNames_WhenGivenInAnnotation() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(CustomNameTest.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java index 314d174a3c..73354abca3 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java @@ -19,7 +19,7 @@ public void should_GenerateStringType_When_ReferringToDateTimeTypes() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(DateTimeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java index 5988409ca0..02c9852faf 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java @@ -19,7 +19,7 @@ public void should_GenerateStringType_When_ReferringToEnumTypes() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(EnumTypeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java index 2fa29e56d9..aaa815a9c1 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java @@ -19,9 +19,8 @@ public void should_CorrectlyHandleEndpointExposedAnnotation() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(ExposedEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java index 96233deb10..8ea81db267 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java @@ -19,9 +19,8 @@ public void should_ParseGenericTypes() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(GenericsBareEndpoint.class, GenericsExtendedEndpoint.class, diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java index e6c980113b..b0e0d94877 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java @@ -18,9 +18,8 @@ public void should_CorrectlyHandleSuperClassMethods() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(GenericSuperClassLong.class, GenericSuperClassString.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java index c25d78b21a..aabc36af43 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java @@ -19,7 +19,7 @@ public void should_GenerateStringType_When_ReferringToEnumTypes() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(IterableEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java index 5b989c468d..e4bd584f5d 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java @@ -27,7 +27,7 @@ public void should_CorrectlyIgnoreFieldsBasedOnJSONAnnotations() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(JacksonEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java index 08d63a1b2f..65cf32d384 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java @@ -18,7 +18,7 @@ public void should_CorrectlyMapJsonValue() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(JsonValueEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java index 575490b946..96a907b796 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java @@ -19,7 +19,7 @@ public void should_ThrowExceptionWhenOnlyJsonValueIsUsed() { assertThrows(MalformedValueTypeException.class, () -> { new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(JsonValueNoJsonCreatorTest.class)); }); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java index 285b2d14ad..925d84695e 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java @@ -19,7 +19,7 @@ public void should_UseAppropriateSchema_When_SimpleTypesAreUsed() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(MultiEndpointsBarEndpoint.class, MultiEndpointsBazEndpoint.class, diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java index 6f3524249d..d68a28e86d 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java @@ -19,7 +19,7 @@ public void should_DistinguishBetweenUserAndBuiltinTypes_When_TheyHaveSameName() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(ShadowedNameEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java index 6fb849d4f6..d20d00f751 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java @@ -19,7 +19,7 @@ public void should_UseAppropriateSchema_When_SimpleTypesAreUsed() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(SimpleTypeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java index eba8512f51..933a82d102 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java @@ -19,9 +19,8 @@ public void should_CorrectlyHandleSuperClassMethods() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(PersonEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java index 1fdea4a1a1..07607c8af1 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java @@ -19,7 +19,7 @@ public void should_CorrectlyHandleTransients() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(TransientEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java index 089ddf5ec3..ac6ce22b47 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java @@ -19,7 +19,7 @@ public void should_CorrectlyResolveWildcardTypes() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(WildcardTypeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/annotations/AnnotationsTest.java b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/annotations/AnnotationsTest.java index 226c600ed8..6a4eccf7b6 100644 --- a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/annotations/AnnotationsTest.java +++ b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/annotations/AnnotationsTest.java @@ -23,9 +23,8 @@ public void should_GenerateAnnotations() .exposedPackages(Set.of( "com.vaadin.hilla.parser.plugins.model.annotations")) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()).addPlugin(new ModelPlugin()) .execute(List.of(AnnotationsEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/javatypes/JavaTypeTest.java b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/javatypes/JavaTypeTest.java index 66e36e66f4..bbef151fe3 100644 --- a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/javatypes/JavaTypeTest.java +++ b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/javatypes/JavaTypeTest.java @@ -23,9 +23,8 @@ public void should_GenerateAnnotations() .exposedPackages(Set .of("com.vaadin.hilla.parser.plugins.model.javatypes")) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()).addPlugin(new ModelPlugin()) .execute(List.of(JavaTypeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/validation/ValidationTest.java b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/validation/ValidationTest.java index 25994fc565..1d7b2cbff6 100644 --- a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/validation/ValidationTest.java +++ b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/validation/ValidationTest.java @@ -24,9 +24,8 @@ public void should_GenerateValidations() .exposedPackages(Set .of("com.vaadin.hilla.parser.plugins.model.validation")) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()).addPlugin(new ModelPlugin()) .execute(List.of(ValidationEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicTest.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicTest.java index f5d1b98532..438c89a57a 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicTest.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicTest.java @@ -28,9 +28,8 @@ public void should_ApplyNonNullAnnotation() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()).addPlugin(plugin) .execute(List.of(BasicEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/extended/ExtendedTest.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/extended/ExtendedTest.java index 2b33b9a55a..8c14ccecf4 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/extended/ExtendedTest.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/extended/ExtendedTest.java @@ -27,9 +27,8 @@ public void should_ApplyNonNullAnnotation() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()).addPlugin(plugin) .execute(List.of(ExtendedEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nonnullapi/NonNullApiTest.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nonnullapi/NonNullApiTest.java index c482c80326..4c4f463bad 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nonnullapi/NonNullApiTest.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nonnullapi/NonNullApiTest.java @@ -33,9 +33,8 @@ public void should_ApplyNonNullApiAnnotation() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()).addPlugin(plugin) .execute(List.of(NonNullApiEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/superclassmethods/SuperClassMethodsTest.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/superclassmethods/SuperClassMethodsTest.java index afeb61eaee..898f237f47 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/superclassmethods/SuperClassMethodsTest.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/superclassmethods/SuperClassMethodsTest.java @@ -27,9 +27,8 @@ public void should_CorrectlyHandleSuperClassMethods() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()).addPlugin(plugin) .execute(List.of(PersonEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-subtypes/src/test/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesMethodsTest.java b/packages/java/parser-jvm-plugin-subtypes/src/test/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesMethodsTest.java index aaecb4b555..fc24da7259 100644 --- a/packages/java/parser-jvm-plugin-subtypes/src/test/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesMethodsTest.java +++ b/packages/java/parser-jvm-plugin-subtypes/src/test/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesMethodsTest.java @@ -19,9 +19,8 @@ public void should_CorrectlyHandleSuperClassMethods() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()).addPlugin(new SubTypesPlugin()) .execute(List.of(SubTypesEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java index 2b7b6c23f1..ec4c926dac 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java @@ -19,7 +19,7 @@ public void should_ReplaceJsonNodeClassWithObject() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) .addPlugin(new BackbonePlugin()) .addPlugin(new TransferTypesPlugin()) .execute(List.of(JsonNodeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/bare/BarePageableTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/bare/BarePageableTest.java index 818f0ed045..5b331289a6 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/bare/BarePageableTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/bare/BarePageableTest.java @@ -25,9 +25,8 @@ public void should_ConsiderInternalDependenciesForReplacedEntities() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(classpath.split(File.pathSeparator)) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .addPlugin(new TransferTypesPlugin()).execute(endpoints); @@ -41,9 +40,8 @@ public void should_CorrectlyResolveReplacedDependencies() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(classpath.split(File.pathSeparator)) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .addPlugin(new TransferTypesPlugin()).execute(endpoints); diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/basic/PageableTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/basic/PageableTest.java index c33802cd1e..40ad040c66 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/basic/PageableTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/basic/PageableTest.java @@ -24,9 +24,8 @@ public void should_CorrectlyResolveReplacedDependencies() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(classpath.split(File.pathSeparator)) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .addPlugin(new TransferTypesPlugin()).execute(endpoints); @@ -40,9 +39,8 @@ public void should_ReplaceSpringClassesWithSubstitutes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(classpath.split(File.pathSeparator)) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .addPlugin(new TransferTypesPlugin()).execute(endpoints); diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java index acd7862606..dd9b0e8cbc 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java @@ -25,9 +25,8 @@ public void should_ReplacePushTypes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(classpath.split(File.pathSeparator)) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .addPlugin(new TransferTypesPlugin()) .execute(List.of(PushTypeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/uuid/UUIDTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/uuid/UUIDTest.java index e63fd582e4..4b17a64455 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/uuid/UUIDTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/uuid/UUIDTest.java @@ -20,9 +20,8 @@ public void should_ReplaceUUIDClassWithString() throws IOException, URISyntaxException { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) - .endpointAnnotations(List.of(Endpoint.class.getName())) - .endpointExposedAnnotations( - List.of(EndpointExposed.class.getName())) + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .addPlugin(new TransferTypesPlugin()) .execute(List.of(UUIDEndpoint.class)); From 474bd5635547e1adca06392d1a89f7fe5ac0e587 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Thu, 1 Aug 2024 14:13:29 +0200 Subject: [PATCH 17/41] Extract Aot code and use it for hotswap --- packages/java/engine-core/pom.xml | 5 + .../hilla/engine/AotEndpointFinder.java | 95 ++++++++++++++++++ packages/java/engine-runtime/pom.xml | 5 - .../internal/TaskGenerateOpenAPIImpl.java | 99 ++----------------- .../hilla/maven/EngineGenerateMojo.java | 13 ++- 5 files changed, 113 insertions(+), 104 deletions(-) create mode 100644 packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/AotEndpointFinder.java diff --git a/packages/java/engine-core/pom.xml b/packages/java/engine-core/pom.xml index 88370aee4a..3261a06c6a 100644 --- a/packages/java/engine-core/pom.xml +++ b/packages/java/engine-core/pom.xml @@ -87,6 +87,11 @@ hilla-parser-jvm-plugin-transfertypes ${project.version} + + org.springframework.boot + spring-boot-loader-tools + provided + org.mockito mockito-core diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/AotEndpointFinder.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/AotEndpointFinder.java new file mode 100644 index 0000000000..73c7168e26 --- /dev/null +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/AotEndpointFinder.java @@ -0,0 +1,95 @@ +package com.vaadin.hilla.engine; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.boot.loader.tools.MainClassFinder; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +public class AotEndpointFinder { + private static final String SPRING_BOOT_APPLICATION_CLASS_NAME = "org.springframework.boot.autoconfigure.SpringBootApplication"; + private final EngineConfiguration engineConfiguration; + + public AotEndpointFinder(EngineConfiguration engineConfiguration) { + this.engineConfiguration = engineConfiguration; + } + + public List> findEndpointClasses() + throws IOException, InterruptedException { + var aotOutput = engineConfiguration.getBuildDir() + .resolve("spring-aot/main"); + var classesDirectory = aotOutput.resolve("classes"); + var applicationClass = (EngineConfiguration.mainClass != null) + ? EngineConfiguration.mainClass + : findSingleClass(classesDirectory.toFile()); + var settings = List.of(applicationClass, + aotOutput.resolve("sources").toString(), + aotOutput.resolve("resources").toString(), + classesDirectory.toString(), EngineConfiguration.groupId, + EngineConfiguration.artifactId); + var javaExecutable = ProcessHandle.current().info().command() + .orElse(Path.of(System.getProperty("java.home"), "bin", "java") + .toString()); + var processBuilder = new ProcessBuilder(); + processBuilder.inheritIO(); + processBuilder.command(javaExecutable, "-cp", + EngineConfiguration.classpath, + "org.springframework.boot.SpringApplicationAotProcessor"); + processBuilder.command().addAll(settings); + + Process process = processBuilder.start(); + process.waitFor(); + + var json = aotOutput.resolve(Path.of("resources", "META-INF", + "native-image", EngineConfiguration.groupId, + EngineConfiguration.artifactId, "reflect-config.json")); + + if (!Files.isRegularFile(json)) { + throw new ParserException("Aot file reflect-config.json not found"); + } + + String jsonContent = Files.readString(json); + var objectMapper = new ObjectMapper(); + var rootNode = objectMapper.readTree(jsonContent); + + if (rootNode.isArray()) { + var candidates = new ArrayList(); + + for (var node : rootNode) { + String name = node.get("name").asText(); + candidates.add(name); + } + + return candidates.stream().map(name -> { + try { + return Class.forName(name); + } + // Must also catch NoClassDefFoundError + catch (Throwable t) { + return null; + } + }).filter(Objects::nonNull) + .filter(cls -> engineConfiguration.getParser() + .getEndpointAnnotations().stream() + .anyMatch(cls::isAnnotationPresent)) + .collect(Collectors.toList()); + } + + throw new ParserException("No endpoints detected"); + } + + static String findSingleClass(File classesDirectory) throws IOException { + String mainClass = MainClassFinder.findSingleMainClass(classesDirectory, + SPRING_BOOT_APPLICATION_CLASS_NAME); + if (mainClass != null) { + return mainClass; + } + throw new ParserException("Failed to find a single main class"); + } +} diff --git a/packages/java/engine-runtime/pom.xml b/packages/java/engine-runtime/pom.xml index 1c09ff7c1a..6d246aa3d0 100644 --- a/packages/java/engine-runtime/pom.xml +++ b/packages/java/engine-runtime/pom.xml @@ -43,11 +43,6 @@ spring-context provided - - org.springframework.boot - spring-boot-loader-tools - provided - com.vaadin flow-server diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java index 8b866fd4df..5c55c40329 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java @@ -15,26 +15,19 @@ */ package com.vaadin.hilla.internal; +import com.vaadin.hilla.engine.AotEndpointFinder; import jakarta.annotation.Nonnull; import java.io.File; -import java.io.IOException; import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; -import java.util.stream.Stream; -import com.fasterxml.jackson.databind.ObjectMapper; import com.vaadin.hilla.ApplicationContextProvider; -import com.vaadin.hilla.BrowserCallable; -import com.vaadin.hilla.Endpoint; import com.vaadin.hilla.engine.EngineConfiguration; import com.vaadin.hilla.engine.ParserProcessor; @@ -43,7 +36,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.boot.loader.tools.MainClassFinder; /** * Generate OpenAPI json file for Vaadin Endpoints. @@ -53,7 +45,6 @@ public class TaskGenerateOpenAPIImpl extends AbstractTaskEndpointGenerator private static final Logger LOGGER = LoggerFactory .getLogger(TaskGenerateOpenAPIImpl.class); - private static final String SPRING_BOOT_APPLICATION_CLASS_NAME = "org.springframework.boot.autoconfigure.SpringBootApplication"; private final ClassLoader classLoader; private final boolean isProductionMode; @@ -99,74 +90,12 @@ public class TaskGenerateOpenAPIImpl extends AbstractTaskEndpointGenerator public void execute() throws ExecutionFailedException { try { var engineConfiguration = new EngineConfiguration(); - var aotOutput = engineConfiguration.getBuildDir() - .resolve("spring-aot/main"); - var classesDirectory = aotOutput.resolve("classes"); - var applicationClass = (EngineConfiguration.mainClass != null) - ? EngineConfiguration.mainClass - : findSingleClass(classesDirectory.toFile()); - var settings = List.of(applicationClass, - aotOutput.resolve("sources").toString(), - aotOutput.resolve("resources").toString(), - classesDirectory.toString(), EngineConfiguration.groupId, - EngineConfiguration.artifactId); - var javaExecutable = ProcessHandle.current().info().command() - .orElse(Path - .of(System.getProperty("java.home"), "bin", "java") - .toString()); - var processBuilder = new ProcessBuilder(); - processBuilder.inheritIO(); - processBuilder.command(javaExecutable, "-cp", - EngineConfiguration.classpath, - "org.springframework.boot.SpringApplicationAotProcessor"); - processBuilder.command().addAll(settings); - - Process process = processBuilder.start(); - process.waitFor(); - - var json = aotOutput.resolve(Path.of("resources", "META-INF", - "native-image", EngineConfiguration.groupId, - EngineConfiguration.artifactId, "reflect-config.json")); - if (isProductionMode) { - if (!Files.isRegularFile(json)) { - throw new ExecutionFailedException( - "AOT file `reflect-config.json` not found"); - } - - try { - String jsonContent = Files.readString(json); - var objectMapper = new ObjectMapper(); - var rootNode = objectMapper.readTree(jsonContent); - - if (rootNode.isArray()) { - var candidates = new ArrayList(); - - for (var node : rootNode) { - String name = node.get("name").asText(); - candidates.add(name); - } - - List> endpoints = candidates.stream() - .map(name -> { - try { - return Class.forName(name); - } catch (Throwable t) { // must also catch - // NoClassDefFoundError - return null; - } - }).filter(Objects::nonNull) - .filter(cls -> engineConfiguration.getParser() - .getEndpointAnnotations().stream() - .anyMatch(cls::isAnnotationPresent)) - .collect(Collectors.toList()); - var processor = new ParserProcessor(engineConfiguration, - classLoader, true); - processor.process(endpoints); - } - } catch (IOException e) { - throw new ExecutionFailedException(e); - } + var endpoints = new AotEndpointFinder(engineConfiguration) + .findEndpointClasses(); + var processor = new ParserProcessor(engineConfiguration, + classLoader, true); + processor.process(endpoints); } else { ApplicationContextProvider.runOnContext(applicationContext -> { List> endpoints = engineConfiguration.getParser() @@ -180,22 +109,8 @@ public void execute() throws ExecutionFailedException { processor.process(endpoints); }); } - } catch (Exception e) { - throw new ExecutionFailedException(e); - } - } - static String findSingleClass(File classesDirectory) - throws ExecutionFailedException { - try { - String mainClass = MainClassFinder.findSingleMainClass( - classesDirectory, SPRING_BOOT_APPLICATION_CLASS_NAME); - if (mainClass != null) { - return mainClass; - } - throw new ExecutionFailedException( - "Failed to find a single main class"); - } catch (IOException e) { + } catch (Exception e) { throw new ExecutionFailedException(e); } } diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java index 535575383f..ec7644614a 100644 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java @@ -4,8 +4,8 @@ import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; -import java.util.List; +import com.vaadin.hilla.engine.AotEndpointFinder; import org.apache.maven.model.Profile; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugins.annotations.LifecyclePhase; @@ -44,8 +44,6 @@ public void execute() throws EngineGenerateMojoException { return; } try { - var baseDir = project.getBasedir().toPath(); - var buildDir = baseDir.resolve(project.getBuild().getDirectory()); var conf = new EngineConfiguration(); var classPath = conf.getClassPath(); var urls = new ArrayList(classPath.size()); @@ -61,11 +59,12 @@ public void execute() throws EngineGenerateMojoException { var generatorProcessor = new GeneratorProcessor(conf, nodeCommand, isProduction); - parserProcessor.process(List.of()); + var endpoints = new AotEndpointFinder(conf).findEndpointClasses(); + parserProcessor.process(endpoints); generatorProcessor.process(); - } catch (IOException e) { - throw new EngineGenerateMojoException( - "Loading saved configuration failed", e); + } catch (IOException | InterruptedException e) { + throw new EngineGenerateMojoException("Endpoint collection failed", + e); } catch (GeneratorException | ParserException e) { throw new EngineGenerateMojoException("Execution failed", e); } From d64a6cf867127a34dca7de6154f6526f9e150007 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Fri, 2 Aug 2024 08:43:36 +0200 Subject: [PATCH 18/41] Start fixing Gradle plugin --- .../hilla/gradle/plugin/SingleModuleTest.kt | 39 --------- .../gradle/plugin/EngineBuildFrontendTask.kt | 32 +++++++ .../gradle/plugin/EngineConfigureTask.kt | 86 ------------------- .../hilla/gradle/plugin/EngineGenerateTask.kt | 11 +-- .../vaadin/hilla/gradle/plugin/HillaPlugin.kt | 1 - 5 files changed, 38 insertions(+), 131 deletions(-) delete mode 100644 packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineConfigureTask.kt diff --git a/packages/java/gradle-plugin/src/functionalTest/kotlin/com/vaadin/hilla/gradle/plugin/SingleModuleTest.kt b/packages/java/gradle-plugin/src/functionalTest/kotlin/com/vaadin/hilla/gradle/plugin/SingleModuleTest.kt index b383e7c13b..4fe5957a01 100644 --- a/packages/java/gradle-plugin/src/functionalTest/kotlin/com/vaadin/hilla/gradle/plugin/SingleModuleTest.kt +++ b/packages/java/gradle-plugin/src/functionalTest/kotlin/com/vaadin/hilla/gradle/plugin/SingleModuleTest.kt @@ -32,43 +32,6 @@ import kotlin.test.expect class SingleModuleTest : AbstractGradleTest() { - @Test - fun `hillaConfigure executed HillaEngineConfigurationJson should exist`() { - createProject() - - testProject.build("hillaConfigure", checkTasksSuccessful = true) - - expect(true, "hilla-engine-configuration.json should be created after executing hillaConfigure task!") { - testProject.folder("build").find("hilla-engine-configuration.json").first().exists() - } - } - - @Test - fun `exposedPackagesToParser configured in build file hillaConfigure executed HillaEngineConfigurationJson should contain exposed packages`() { - val package1 = "com.example.app" - val package2 = "com.vaadin.hilla.foo" - - createProject(package1, package2) - - val buildResult: BuildResult = testProject.build("hillaConfigure", checkTasksSuccessful = true) - - buildResult.expectTaskSucceded("hillaConfigure") - - val hillaEngineConfigFile = testProject.folder("build").find("hilla-engine-configuration.json").first() - expect(true, "hilla-engine-configuration.json should be created after executing hillaConfigure task!") { - hillaEngineConfigFile.exists() - } - - val configuration = EngineConfiguration.load(hillaEngineConfigFile) - val packages = configuration.parser.packages.orElseThrow() - expect(true, "Configuration json should contained exposed package '$package1'") { - packages.contains(package1) - } - expect(true, "Configuration json should contained exposed package '$package2'") { - packages.contains(package2) - } - } - @Test fun `endpoints ts and openapi json are generated after hillaGenerate task executed in dev mode`() { createProject(withNpmInstall = true) @@ -77,7 +40,6 @@ class SingleModuleTest : AbstractGradleTest() { val buildResult: BuildResult = testProject.build("hillaGenerate", checkTasksSuccessful = true) - buildResult.expectTaskSucceded("hillaConfigure") buildResult.expectTaskSucceded("hillaGenerate") verifyOpenApiJsonFileGeneratedProperly(false) @@ -92,7 +54,6 @@ class SingleModuleTest : AbstractGradleTest() { val buildResult: BuildResult = testProject.build("hillaGenerate", checkTasksSuccessful = true) - buildResult.expectTaskSucceded("hillaConfigure") buildResult.expectTaskSucceded("hillaGenerate") verifyOpenApiJsonFileGeneratedProperly(true) diff --git a/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineBuildFrontendTask.kt b/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineBuildFrontendTask.kt index 91657c608a..d9588ee045 100644 --- a/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineBuildFrontendTask.kt +++ b/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineBuildFrontendTask.kt @@ -15,8 +15,40 @@ */ package com.vaadin.hilla.gradle.plugin +import org.gradle.api.tasks.Input +import org.gradle.api.tasks.InputFile +import org.gradle.api.tasks.Optional +import org.gradle.api.tasks.TaskAction +import java.io.File + /** * Extend the VaadinBuildFrontendTask so that frontend files are not cleaned after build. */ public open class EngineBuildFrontendTask : com.vaadin.gradle.VaadinBuildFrontendTask() { + @Input + val classpathElements: List = project.configurations.getByName("compileClasspath").files.map { it.absolutePath } + + @Input + val groupId: String = project.group.toString() + + @Input + val artifactId: String = project.name + + @InputFile + val buildDir: File = project.buildDir + + @Input + @Optional + var mainClass: String? = project.findProperty("spring-boot.aot.main-class") as String? + + @TaskAction + override fun exec() { + EngineConfiguration.classpath = classpathElements.joinToString(File.pathSeparator) + EngineConfiguration.groupId = groupId + EngineConfiguration.artifactId = artifactId + EngineConfiguration.mainClass = mainClass + EngineConfiguration.buildDir = buildDir.toPath() + + super.exec() + } } diff --git a/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineConfigureTask.kt b/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineConfigureTask.kt deleted file mode 100644 index edefae28f4..0000000000 --- a/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineConfigureTask.kt +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright 2000-2024 Vaadin Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.vaadin.hilla.gradle.plugin - -import com.vaadin.gradle.VaadinFlowPluginExtension -import org.gradle.api.DefaultTask -import org.gradle.api.tasks.TaskAction -import org.gradle.api.tasks.SourceSet -import org.gradle.api.tasks.SourceSetContainer -import java.nio.file.Files -import java.nio.file.Path - -import com.vaadin.hilla.engine.* - -/** - * Task that generates the configuration json which is needed - * for next task of generating the endpoints and model classes. - */ -public open class EngineConfigureTask : DefaultTask() { - - private val sourceSets: SourceSetContainer by lazy { - project.extensions.getByType(SourceSetContainer::class.java) - } - - init { - group = "Vaadin" - description = "Hilla Configure Task" - } - - private val legacyProjectFrontendPath = "./frontend" - - @TaskAction - public fun engineConfigure() { - val extension: EngineProjectExtension = EngineProjectExtension.get(project) - logger.info("Running the engineConfigure task with effective Hilla configuration $extension") - val vaadinExtension = VaadinFlowPluginExtension.get(project) - logger.info("Running the engineConfigure task with effective Vaadin configuration $extension") - - val generator = GeneratorConfiguration() - val parser = ParserConfiguration() - if (extension.exposedPackagesToParser.isNotEmpty()) { - parser.setPackages(extension.exposedPackagesToParser) - } - - val projectBuildDir = project.layout.buildDirectory.get().asFile.toPath() - val projectClassesDir = projectBuildDir.resolve("classes") - val classPathElements = (sourceSets.getByName(vaadinExtension.sourceSetName.get()) as SourceSet) - .runtimeClasspath.elements.get().stream().map { it.toString() }.toList() - - var generatedTsFolder = vaadinExtension.generatedTsFolder.get().toPath() - val legacyFrontendFolder = project.projectDir.toPath().resolve(legacyProjectFrontendPath) - if (Files.exists(legacyFrontendFolder)) { - generatedTsFolder = legacyFrontendFolder.resolve("generated") - } - - val conf = EngineConfiguration.Builder(project.projectDir.toPath()) - .classPath(classPathElements) - .outputDir(generatedTsFolder) - .generator(generator) - .parser(parser) - .buildDir(vaadinExtension.projectBuildDir.get()) - .classesDir(projectClassesDir) - .create() - - val configDir: Path = project.projectDir.toPath().resolve(projectBuildDir) - Files.createDirectories(configDir) - conf.store( - configDir - .resolve(EngineConfiguration.DEFAULT_CONFIG_FILE_NAME) - .toFile() - ) - } -} diff --git a/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineGenerateTask.kt b/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineGenerateTask.kt index 513139bf99..cbd72d0411 100644 --- a/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineGenerateTask.kt +++ b/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineGenerateTask.kt @@ -16,6 +16,7 @@ package com.vaadin.hilla.gradle.plugin import com.vaadin.gradle.VaadinFlowPluginExtension +import com.vaadin.hilla.engine.AotEndpointFinder import org.gradle.api.DefaultTask import org.gradle.api.GradleException import org.gradle.api.tasks.TaskAction @@ -36,9 +37,6 @@ public open class EngineGenerateTask : DefaultTask() { group = "Vaadin" description = "Hilla Generate Task" - // we need the build/hilla-engine-configuration.json and the compiled classes: - dependsOn("classes", "hillaConfigure") - // Make sure to run this task before the `war`/`jar` tasks, so that // generated endpoints and models will end up packaged in the war/jar archive. // The inclusion rule itself is configured in the HillaPlugin class. @@ -75,11 +73,14 @@ public open class EngineGenerateTask : DefaultTask() { val parserProcessor = ParserProcessor(conf, classLoader, isProductionMode) val generatorProcessor = GeneratorProcessor(conf, extension.nodeCommand, isProductionMode) - parserProcessor.process() + val endpoints = AotEndpointFinder(conf).findEndpointClasses() + parserProcessor.process(endpoints) generatorProcessor.process() } catch (e: IOException) { - throw GradleException("Loading saved configuration failed", e) + throw GradleException("Endpoint collection failed", e) + } catch (e: InterruptedException) { + throw GradleException("Endpoint collection failed", e) } catch (e: GeneratorException) { throw GradleException("Execution failed", e) } catch (e: ParserException) { diff --git a/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/HillaPlugin.kt b/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/HillaPlugin.kt index 54f2c492d4..6e9cb21cdb 100644 --- a/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/HillaPlugin.kt +++ b/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/HillaPlugin.kt @@ -41,7 +41,6 @@ public class HillaPlugin : Plugin { project.extensions.create(extensionName, EngineProjectExtension::class.java, project) project.tasks.apply { - register("hillaConfigure", EngineConfigureTask::class.java) register("hillaGenerate", EngineGenerateTask::class.java) } From 8403ed11b21a47a67ba5f123cab3852fd698a514 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Sat, 3 Aug 2024 22:26:18 +0200 Subject: [PATCH 19/41] Refactor configuration to not be static --- packages/java/annotations/pom.xml | 38 ++++ .../com/vaadin/hilla/BrowserCallable.java | 4 +- .../main/java/com/vaadin/hilla/Endpoint.java | 9 +- .../com/vaadin/hilla/EndpointExposed.java | 0 .../main/java/com/vaadin/hilla/Nonnull.java | 0 .../main/java/com/vaadin/hilla/Nullable.java | 0 .../vaadin/hilla/EndpointCodeGenerator.java | 2 +- .../java/com/vaadin/hilla/OpenAPIUtil.java | 2 +- .../hilla/crud/CrudRepositoryService.java | 1 - .../hilla/crud/CrudRepositoryServiceTest.java | 2 - packages/java/engine-core/pom.xml | 5 + .../hilla/engine/AotEndpointFinder.java | 15 +- .../hilla/engine/EngineConfiguration.java | 189 +++++++----------- .../hilla/engine/ParserConfiguration.java | 30 +-- .../vaadin/hilla/engine/ParserProcessor.java | 2 +- .../hilla/engine/EngineConfigurationTest.java | 102 ---------- packages/java/engine-runtime/pom.xml | 5 + .../internal/TaskGenerateEndpointImpl.java | 2 +- .../internal/TaskGenerateOpenAPIImpl.java | 2 +- .../AbstractTaskEndpointGeneratorTest.java | 47 ----- .../com/vaadin/hilla/internal/Endpoint.java | 12 -- .../hilla/internal/EndpointExposed.java | 11 - .../hilla/internal/NodeTasksEndpointTest.java | 25 ++- .../internal/fixtures/CustomEndpoint.java | 3 - .../internal/fixtures/EndpointNoValue.java | 3 - .../hilla/internal/fixtures/MyEndpoint.java | 3 - packages/java/hilla-bom/pom.xml | 2 +- packages/java/hilla-dev/pom.xml | 2 +- packages/java/hilla/pom.xml | 2 +- .../vaadin/hilla/maven/BuildFrontendMojo.java | 15 +- .../hilla/maven/EngineConfigureMojo.java | 22 ++ .../hilla/maven/EngineGenerateMojo.java | 4 +- .../vaadin/hilla/maven/AbstractMojoTest.java | 11 +- .../com/vaadin/hilla/parser/core/Parser.java | 8 +- packages/java/tests/pom.xml | 2 +- .../vaadin/flow/connect/PagedEndpoint.java | 4 - packages/java/tests/spring/pom.xml | 2 +- .../tests/spring/security-urlmapping/pom.xml | 4 + .../endpoints/BalanceEndpoint.java | 1 - pom.xml | 2 +- 40 files changed, 219 insertions(+), 376 deletions(-) create mode 100644 packages/java/annotations/pom.xml rename packages/java/{endpoint => annotations}/src/main/java/com/vaadin/hilla/BrowserCallable.java (91%) rename packages/java/{endpoint => annotations}/src/main/java/com/vaadin/hilla/Endpoint.java (88%) rename packages/java/{endpoint => annotations}/src/main/java/com/vaadin/hilla/EndpointExposed.java (100%) rename packages/java/{endpoint => annotations}/src/main/java/com/vaadin/hilla/Nonnull.java (100%) rename packages/java/{endpoint => annotations}/src/main/java/com/vaadin/hilla/Nullable.java (100%) delete mode 100644 packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java delete mode 100644 packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/Endpoint.java delete mode 100644 packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/EndpointExposed.java create mode 100644 packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineConfigureMojo.java diff --git a/packages/java/annotations/pom.xml b/packages/java/annotations/pom.xml new file mode 100644 index 0000000000..b84de792fc --- /dev/null +++ b/packages/java/annotations/pom.xml @@ -0,0 +1,38 @@ + + + 4.0.0 + + com.vaadin + hilla-project + 24.5-SNAPSHOT + ../../../pom.xml + + + hilla-annotations + jar + Hilla Annotations + + + ${project.parent.basedir} + + + + + vaadin-prereleases + + https://maven.vaadin.com/vaadin-prereleases/ + + + + + + + org.springframework + spring-context + provided + + + + diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/BrowserCallable.java b/packages/java/annotations/src/main/java/com/vaadin/hilla/BrowserCallable.java similarity index 91% rename from packages/java/endpoint/src/main/java/com/vaadin/hilla/BrowserCallable.java rename to packages/java/annotations/src/main/java/com/vaadin/hilla/BrowserCallable.java index d9d94a51b4..16926735c6 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/BrowserCallable.java +++ b/packages/java/annotations/src/main/java/com/vaadin/hilla/BrowserCallable.java @@ -26,8 +26,8 @@ * Makes the methods of the annotated class available to the browser. *

* For each class, a corresponding TypeScript class is generated in - * {@code frontend/generated} with TypeScript methods for invoking the methods - * in this class. + * {@code src/main/frontend/generated} with TypeScript methods for invoking the + * methods in this class. *

* This is an alias for {@link Endpoint}. */ diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/Endpoint.java b/packages/java/annotations/src/main/java/com/vaadin/hilla/Endpoint.java similarity index 88% rename from packages/java/endpoint/src/main/java/com/vaadin/hilla/Endpoint.java rename to packages/java/annotations/src/main/java/com/vaadin/hilla/Endpoint.java index 58c2475812..a99c293f73 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/Endpoint.java +++ b/packages/java/annotations/src/main/java/com/vaadin/hilla/Endpoint.java @@ -24,19 +24,16 @@ /** * Annotation to mark the endpoints to be processed by - * {@link EndpointController} class. Each class annotated automatically becomes + * {@code EndpointController} class. Each class annotated automatically becomes * a Spring {@link Component} bean. * * After the class is annotated and processed, it becomes available as a Vaadin * endpoint. This means that the class name and all its public methods can be * executed via the post call with the correct parameters sent in a request JSON * body. The methods' return values will be returned back as a response to the - * calls. Refer to {@link EndpointController} for more details. + * calls. Refer to {@code EndpointController} for more details. *

* This is an alias for {@link BrowserCallable}. - * - * @see EndpointController - * @see Component */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @@ -48,7 +45,7 @@ *

* Note: custom names are not allowed to be blank, be equal to any of the * ECMAScript reserved words or have whitespaces in them. See - * {@link EndpointNameChecker} for validation implementation details. + * {@code EndpointNameChecker} for validation implementation details. * * @return the name of the endpoint to use in post requests */ diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointExposed.java b/packages/java/annotations/src/main/java/com/vaadin/hilla/EndpointExposed.java similarity index 100% rename from packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointExposed.java rename to packages/java/annotations/src/main/java/com/vaadin/hilla/EndpointExposed.java diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/Nonnull.java b/packages/java/annotations/src/main/java/com/vaadin/hilla/Nonnull.java similarity index 100% rename from packages/java/endpoint/src/main/java/com/vaadin/hilla/Nonnull.java rename to packages/java/annotations/src/main/java/com/vaadin/hilla/Nonnull.java diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/Nullable.java b/packages/java/annotations/src/main/java/com/vaadin/hilla/Nullable.java similarity index 100% rename from packages/java/endpoint/src/main/java/com/vaadin/hilla/Nullable.java rename to packages/java/annotations/src/main/java/com/vaadin/hilla/Nullable.java diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java index 0b6ca096ad..33f9d8248e 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java @@ -88,7 +88,7 @@ public void update() { } ApplicationContextProvider.runOnContext(applicationContext -> { - EngineConfiguration engineConfiguration = new EngineConfiguration(); + EngineConfiguration engineConfiguration = EngineConfiguration.getDefault(); List> endpoints = engineConfiguration.getParser() .getEndpointAnnotations().stream() .map(applicationContext::getBeansWithAnnotation) diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java index 47785d7259..d95caec708 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java @@ -59,7 +59,7 @@ public static String getCurrentOpenAPI(Path buildDirectory, */ public static Optional getCurrentOpenAPIPath(Path buildDirectory, boolean isProductionMode) throws IOException { - EngineConfiguration engineConfiguration = new EngineConfiguration(); + EngineConfiguration engineConfiguration = EngineConfiguration.getDefault(); return Optional .of(engineConfiguration.getOpenAPIFile(isProductionMode)); } diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/CrudRepositoryService.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/CrudRepositoryService.java index cc9dcd8c1e..22c36de695 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/CrudRepositoryService.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/crud/CrudRepositoryService.java @@ -5,7 +5,6 @@ import com.vaadin.hilla.EndpointExposed; import com.vaadin.hilla.Nullable; -import com.vaadin.hilla.crud.filter.Filter; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.repository.CrudRepository; diff --git a/packages/java/endpoint/src/test/java/com/vaadin/hilla/crud/CrudRepositoryServiceTest.java b/packages/java/endpoint/src/test/java/com/vaadin/hilla/crud/CrudRepositoryServiceTest.java index 707768599c..ea0621e42d 100644 --- a/packages/java/endpoint/src/test/java/com/vaadin/hilla/crud/CrudRepositoryServiceTest.java +++ b/packages/java/endpoint/src/test/java/com/vaadin/hilla/crud/CrudRepositoryServiceTest.java @@ -1,8 +1,6 @@ package com.vaadin.hilla.crud; import com.vaadin.hilla.BrowserCallable; -import com.vaadin.hilla.EndpointController; -import com.vaadin.hilla.push.PushConfigurer; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/packages/java/engine-core/pom.xml b/packages/java/engine-core/pom.xml index 3261a06c6a..a269ffef13 100644 --- a/packages/java/engine-core/pom.xml +++ b/packages/java/engine-core/pom.xml @@ -67,6 +67,11 @@ hilla-parser-jvm-utils ${project.version} + + com.vaadin + hilla-annotations + ${project.version} + com.vaadin hilla-parser-jvm-plugin-nonnull diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/AotEndpointFinder.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/AotEndpointFinder.java index 73c7168e26..10bfb0df79 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/AotEndpointFinder.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/AotEndpointFinder.java @@ -25,21 +25,22 @@ public List> findEndpointClasses() var aotOutput = engineConfiguration.getBuildDir() .resolve("spring-aot/main"); var classesDirectory = aotOutput.resolve("classes"); - var applicationClass = (EngineConfiguration.mainClass != null) - ? EngineConfiguration.mainClass + var applicationClass = (engineConfiguration.getMainClass() != null) + ? engineConfiguration.getMainClass() : findSingleClass(classesDirectory.toFile()); var settings = List.of(applicationClass, aotOutput.resolve("sources").toString(), aotOutput.resolve("resources").toString(), - classesDirectory.toString(), EngineConfiguration.groupId, - EngineConfiguration.artifactId); + classesDirectory.toString(), engineConfiguration.getGroupId(), + engineConfiguration.getArtifactId()); var javaExecutable = ProcessHandle.current().info().command() .orElse(Path.of(System.getProperty("java.home"), "bin", "java") .toString()); var processBuilder = new ProcessBuilder(); processBuilder.inheritIO(); processBuilder.command(javaExecutable, "-cp", - EngineConfiguration.classpath, + engineConfiguration.getClasspath().stream().map(Path::toString) + .collect(Collectors.joining(File.pathSeparator)), "org.springframework.boot.SpringApplicationAotProcessor"); processBuilder.command().addAll(settings); @@ -47,8 +48,8 @@ public List> findEndpointClasses() process.waitFor(); var json = aotOutput.resolve(Path.of("resources", "META-INF", - "native-image", EngineConfiguration.groupId, - EngineConfiguration.artifactId, "reflect-config.json")); + "native-image", engineConfiguration.getGroupId(), + engineConfiguration.getArtifactId(), "reflect-config.json")); if (!Files.isRegularFile(json)) { throw new ParserException("Aot file reflect-config.json not found"); diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java index 0a03cbe0b1..ddc1d28786 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java @@ -1,27 +1,26 @@ package com.vaadin.hilla.engine; +import java.io.File; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.Objects; +import java.util.Arrays; import java.util.Set; import java.util.stream.Collectors; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.vaadin.flow.server.frontend.FrontendUtils; public class EngineConfiguration { + private static final EngineConfiguration INSTANCE = new EngineConfiguration(); public static final String OPEN_API_PATH = "hilla-openapi.json"; - public static String classpath = System.getProperty("java.class.path"); - public static String groupId; - public static String artifactId; - public static String mainClass; - public static Path buildDir; + private Set classpath = Arrays + .stream(System.getProperty("java.class.path") + .split(File.pathSeparator)) + .map(Path::of).collect(Collectors.toSet()); + private String groupId; + private String artifactId; + private String mainClass; + private Path buildDir; private Path baseDir; - @JsonDeserialize(as = LinkedHashSet.class) - private Set classPath; private Path classesDir; private GeneratorConfiguration generator; private Path outputDir; @@ -33,7 +32,6 @@ public EngineConfiguration() { classesDir = buildDir.resolve("classes"); generator = new GeneratorConfiguration(); parser = new ParserConfiguration(); - classPath = new LinkedHashSet<>(); var legacyFrontendGeneratedDir = baseDir.resolve("frontend/generated"); if (Files.exists(legacyFrontendGeneratedDir)) { @@ -44,143 +42,96 @@ public EngineConfiguration() { } } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - var that = (EngineConfiguration) o; - return Objects.equals(baseDir, that.baseDir) - && Objects.equals(classPath, that.classPath) - && Objects.equals(generator, that.generator) - && Objects.equals(parser, that.parser) - && Objects.equals(classesDir, that.classesDir) - && Objects.equals(outputDir, that.outputDir); + public static EngineConfiguration getDefault() { + return INSTANCE; } - public Path getBaseDir() { - return baseDir; + public Set getClasspath() { + return classpath; } - public Path getBuildDir() { - return buildDir; + public void setClasspath(Set classpath) { + this.classpath = classpath; } - public Set getClassPath() { - return classPath; + public String getGroupId() { + return groupId; } - public Path getClassesDir() { - return classesDir; + public void setGroupId(String groupId) { + this.groupId = groupId; } - public GeneratorConfiguration getGenerator() { - return generator; + public String getArtifactId() { + return artifactId; } - public Path getOutputDir() { - return outputDir; + public void setArtifactId(String artifactId) { + this.artifactId = artifactId; } - public ParserConfiguration getParser() { - return parser; + public String getMainClass() { + return mainClass; } - @Override - public int hashCode() { - return Objects.hash(baseDir, classPath, generator, parser, classesDir, - outputDir); + public void setMainClass(String mainClass) { + this.mainClass = mainClass; } - @JsonIgnore - public Path getOpenAPIFile(boolean isProductionMode) { - return isProductionMode ? classesDir.resolve(OPEN_API_PATH) - : buildDir.resolve(OPEN_API_PATH); + public Path getBuildDir() { + return buildDir; } - public static final class Builder { - private final EngineConfiguration configuration = new EngineConfiguration(); - - public Builder(Path baseDir) { - configuration.baseDir = baseDir; - var legacyFrontendGeneratedDir = baseDir - .resolve("frontend/generated"); - if (Files.exists(legacyFrontendGeneratedDir)) { - configuration.outputDir = legacyFrontendGeneratedDir; - } else { - configuration.outputDir = baseDir.resolve( - FrontendUtils.DEFAULT_PROJECT_FRONTEND_GENERATED_DIR); - } - } - - public Builder(EngineConfiguration configuration) { - this.configuration.baseDir = configuration.baseDir; - this.configuration.classPath = configuration.classPath; - this.configuration.generator = configuration.generator; - this.configuration.parser = configuration.parser; - this.configuration.classesDir = configuration.classesDir; - this.configuration.outputDir = configuration.outputDir; - } + public void setBuildDir(Path buildDir) { + this.buildDir = buildDir; + } - public Builder baseDir(Path value) { - configuration.baseDir = value; - return this; - } + public void setBuildDir(String buildDir) { + this.buildDir = baseDir.resolve(buildDir); + } - public Builder buildDir(String value) { - return buildDir(Path.of(value)); - } + public Path getBaseDir() { + return baseDir; + } - public Builder buildDir(Path value) { - buildDir = resolve(value); - return this; - } + public void setBaseDir(Path baseDir) { + this.baseDir = baseDir; + } - public Builder classPath(Collection value) { - configuration.classPath = value.stream().map(Path::of) - .map(this::resolve) - .collect(Collectors.toCollection(LinkedHashSet::new)); - return this; - } + public Path getClassesDir() { + return classesDir; + } - public Builder classesDir(Path value) { - configuration.classesDir = resolve(value); - return this; - } + public void setClassesDir(Path classesDir) { + this.classesDir = classesDir; + } - public Builder classesDir(String value) { - return classesDir(Path.of(value)); - } + public GeneratorConfiguration getGenerator() { + return generator; + } - public EngineConfiguration create() { - return configuration; - } + public void setGenerator(GeneratorConfiguration generator) { + this.generator = generator; + } - public Builder generator(GeneratorConfiguration value) { - configuration.generator = value; - return this; - } + public Path getOutputDir() { + return outputDir; + } - public Builder outputDir(String value) { - return outputDir(Path.of(value)); - } + public void setOutputDir(Path outputDir) { + this.outputDir = outputDir; + } - public Builder outputDir(Path value) { - configuration.outputDir = resolve(value); - return this; - } + public ParserConfiguration getParser() { + return parser; + } - public Builder parser(ParserConfiguration value) { - configuration.parser = value; - return this; - } + public void setParser(ParserConfiguration parser) { + this.parser = parser; + } - private Path resolve(Path path) { - return path.isAbsolute() ? path.normalize() - : configuration.baseDir.resolve(path).normalize(); - } + public Path getOpenAPIFile(boolean isProductionMode) { + return isProductionMode ? classesDir.resolve(OPEN_API_PATH) + : buildDir.resolve(OPEN_API_PATH); } } diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java index b583f3195f..746efd5dc4 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserConfiguration.java @@ -7,6 +7,9 @@ import java.util.Objects; import java.util.Optional; +import com.vaadin.hilla.BrowserCallable; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import jakarta.annotation.Nonnull; import com.vaadin.hilla.parser.core.PluginConfiguration; @@ -18,9 +21,10 @@ import com.vaadin.hilla.parser.utils.ConfigList; public final class ParserConfiguration { - private List> endpointAnnotations = List.of(); + private List> endpointAnnotations = List + .of(BrowserCallable.class, Endpoint.class); private List> endpointExposedAnnotations = List - .of(); + .of(EndpointExposed.class); private String openAPIBasePath; private Plugins plugins; @@ -40,28 +44,6 @@ public Optional getPlugins() { return Optional.ofNullable(plugins); } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - var that = (ParserConfiguration) o; - return Objects.equals(endpointAnnotations, that.endpointAnnotations) - && Objects.equals(endpointExposedAnnotations, - that.endpointExposedAnnotations) - && Objects.equals(openAPIBasePath, that.openAPIBasePath) - && Objects.equals(plugins, that.plugins); - } - - @Override - public int hashCode() { - return Objects.hash(endpointAnnotations, endpointExposedAnnotations, - openAPIBasePath, plugins); - } - void setEndpointAnnotations( @Nonnull List> endpointAnnotations) { this.endpointAnnotations = endpointAnnotations; diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java index c97a467928..56235a4552 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java @@ -42,7 +42,7 @@ public ParserProcessor(EngineConfiguration conf, ClassLoader classLoader, this.baseDir = conf.getBaseDir(); this.openAPIFile = conf.getOpenAPIFile(isProductionMode); this.classLoader = classLoader; - this.classPath = conf.getClassPath(); + this.classPath = conf.getClasspath(); applyConfiguration(conf.getParser()); } diff --git a/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java b/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java deleted file mode 100644 index 887a78d467..0000000000 --- a/packages/java/engine-core/src/test/java/com/vaadin/hilla/engine/EngineConfigurationTest.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.vaadin.hilla.engine; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.io.File; -import java.io.IOException; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.LinkedHashSet; -import java.util.List; - -import com.vaadin.hilla.parser.plugins.nonnull.AnnotationMatcher; -import com.vaadin.hilla.parser.plugins.nonnull.NonnullPluginConfig; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -public class EngineConfigurationTest { - private static final String CONFIG_FILE_NAME = "hilla-engine-configuration.json"; - private Path baseDirectory; - private File configFile; - private EngineConfiguration.Builder configurationBuilder; - private Path temporaryDirectory; - - @Target(ElementType.TYPE) - @Retention(RetentionPolicy.RUNTIME) - public @interface Endpoint { - } - - @Target(ElementType.TYPE) - @Retention(RetentionPolicy.RUNTIME) - public @interface EndpointExposed { - } - - @BeforeEach - public void setUp() throws IOException { - this.temporaryDirectory = Files - .createTempDirectory(getClass().getName()); - this.configFile = this.temporaryDirectory.resolve(CONFIG_FILE_NAME) - .toFile(); - - this.baseDirectory = this.temporaryDirectory.resolve("base"); - - var parserConfiguration = new ParserConfiguration(); - parserConfiguration.setEndpointAnnotations(List.of(Endpoint.class)); - parserConfiguration - .setEndpointExposedAnnotations(List.of(EndpointExposed.class)); - parserConfiguration.setPlugins(new ParserConfiguration.Plugins(List.of( - new ParserConfiguration.Plugin("parser-jvm-plugin-use"), - new ParserConfiguration.Plugin("parser-jvm-plugin-nonnull", - new NonnullPluginConfig(List.of(new AnnotationMatcher( - "com.example.application.annotations.NeverNull", - false, 50)), List.of()))), - List.of(new ParserConfiguration.Plugin( - "parser-jvm-plugin-disable")), - true)); - parserConfiguration.setOpenAPIBasePath("test-openapi.json"); - - var generatorConfiguration = new GeneratorConfiguration(); - generatorConfiguration.setPlugins(new GeneratorConfiguration.Plugins( - List.of(new GeneratorConfiguration.Plugin( - "generator-jvm-plugin" + "-use")), - List.of(new GeneratorConfiguration.Plugin( - "generator-jvm-plugin" + "-disable")), - true)); - - this.configurationBuilder = new EngineConfiguration.Builder( - this.baseDirectory).buildDir("build") - .outputDir("src/frontend/typescript/generated") - .classPath(new LinkedHashSet<>( - List.of("build/classes", "dependency"))) - .parser(parserConfiguration).generator(generatorConfiguration); - } - - @Test - public void should_NotRelativizeOutputDir_WhenGivenRelative() { - var config = configurationBuilder.outputDir("relative/path").create(); - assertEquals(baseDirectory.resolve("relative/path"), - config.getOutputDir()); - } - - @Test - public void should_RelativizeOutputDir_WhenGivenAbsolutePath() { - var path = temporaryDirectory.resolve("absolute/path"); - var config = configurationBuilder.outputDir(path).create(); - - assertEquals(path, config.getOutputDir()); - } - - @Test - @AfterEach - public void tearDown() throws IOException { - if (this.configFile.exists()) { - Files.delete(this.configFile.toPath()); - } - Files.delete(this.temporaryDirectory); - } -} diff --git a/packages/java/engine-runtime/pom.xml b/packages/java/engine-runtime/pom.xml index 6d246aa3d0..9baca1efc6 100644 --- a/packages/java/engine-runtime/pom.xml +++ b/packages/java/engine-runtime/pom.xml @@ -84,5 +84,10 @@ ${project.version} test + + org.springframework.boot + spring-boot-loader-tools + test + diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java index f986c3b62b..5c619e2543 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java @@ -80,7 +80,7 @@ public void execute() throws ExecutionFailedException { } private void runProcessor() { - var engineConfiguration = new EngineConfiguration(); + var engineConfiguration = EngineConfiguration.getDefault(); var processor = new GeneratorProcessor(engineConfiguration, nodeCommand, productionMode); processor.process(); diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java index 5c55c40329..b96c380817 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java @@ -89,7 +89,7 @@ public class TaskGenerateOpenAPIImpl extends AbstractTaskEndpointGenerator @Override public void execute() throws ExecutionFailedException { try { - var engineConfiguration = new EngineConfiguration(); + var engineConfiguration = EngineConfiguration.getDefault(); if (isProductionMode) { var endpoints = new AotEndpointFinder(engineConfiguration) .findEndpointClasses(); diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/AbstractTaskEndpointGeneratorTest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/AbstractTaskEndpointGeneratorTest.java index ee84644d33..cbdbe2db81 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/AbstractTaskEndpointGeneratorTest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/AbstractTaskEndpointGeneratorTest.java @@ -58,51 +58,4 @@ public void execute() throws ExecutionFailedException { // no-op } } - - private class MockedTaskEndpointGenerator - extends AbstractTaskEndpointGenerator { - MockedTaskEndpointGenerator(File projectDirectory, - String buildDirectoryName, File outputDirectory) { - super(projectDirectory, buildDirectoryName, outputDirectory, - resourceFinder); - } - - @Override - public void execute() throws ExecutionFailedException { - - } - } - - @Test - void shouldRunSpecificVersionWhenGoalIsNotFound() throws Exception { - var mockConfigureNotFound = mock(MavenRunner.class); - var rootException = new RuntimeException( - "MOCK: Could not find goal 'configure' in plugin"); - doThrow(new CommandRunnerException("MOCK: Failed to execute command", - rootException)).when(mockConfigureNotFound).run(null, false); - var mockConfigureFound = mock(MavenRunner.class); - - try (var staticMock = mockStatic(MavenRunner.class)) { - staticMock - .when(() -> MavenRunner.forProject(any(), eq("-q"), - eq("vaadin:configure"))) - .thenReturn(Optional.of(mockConfigureNotFound)); - staticMock - .when(() -> MavenRunner.forProject(any(), eq("-q"), eq( - "com.vaadin:vaadin-maven-plugin:1.0.0:configure"))) - .thenReturn(Optional.of(mockConfigureFound)); - var task = new MockedTaskEndpointGenerator( - getTemporaryDirectory().toFile(), getBuildDirectory(), - getTemporaryDirectory().resolve(getOutputDirectory()) - .toFile()); - var firstRun = AbstractTaskEndpointGenerator.class - .getDeclaredField("firstRun"); - firstRun.setAccessible(true); - firstRun.set(null, true); - Files.createFile(getTemporaryDirectory().resolve("pom.xml")); - task.execute(); - verify(mockConfigureNotFound).run(null, false); - verify(mockConfigureFound).run(null, false); - } - } } diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/Endpoint.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/Endpoint.java deleted file mode 100644 index 9166eac0ca..0000000000 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/Endpoint.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.vaadin.hilla.internal; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { - String value() default ""; -} diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/EndpointExposed.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/EndpointExposed.java deleted file mode 100644 index 803c8b93df..0000000000 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/EndpointExposed.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.internal; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface EndpointExposed { -} diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/NodeTasksEndpointTest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/NodeTasksEndpointTest.java index 8156952355..b7e58fbed1 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/NodeTasksEndpointTest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/NodeTasksEndpointTest.java @@ -5,13 +5,16 @@ import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; +import java.nio.file.Path; import java.util.Arrays; +import java.util.Map; import java.util.Set; import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; +import org.springframework.context.ApplicationContext; import com.vaadin.flow.di.Lookup; import com.vaadin.flow.server.frontend.EndpointGeneratorTaskFactory; @@ -19,15 +22,21 @@ import com.vaadin.flow.server.frontend.Options; import com.vaadin.flow.server.frontend.scanner.ClassFinder; import com.vaadin.flow.server.frontend.scanner.ClassFinder.DefaultClassFinder; +import com.vaadin.hilla.ApplicationContextProvider; +import com.vaadin.hilla.BrowserCallable; +import com.vaadin.hilla.Endpoint; import com.vaadin.hilla.EndpointController; +import com.vaadin.hilla.engine.EngineConfiguration; public class NodeTasksEndpointTest extends TaskTest { private Options options; - @Endpoint public static class ConnectEndpointsForTesting { } + public static class MyEndpoint { + } + @BeforeEach public void setUp() throws IOException { Lookup mockLookup = Mockito.mock(Lookup.class); @@ -53,6 +62,8 @@ public void setUp() throws IOException { .withJarFrontendResourcesFolder(getTemporaryDirectory() .resolve("jar-resources").toFile()); + EngineConfiguration.getDefault().setBuildDir(getBuildDirectory()); + createIndexFile(); } @@ -81,8 +92,18 @@ public void should_GenerateEndpointFilesInProductionBuildTask() @Test public void should_GenerateEndpointFilesInDevServerTask() throws Exception { - options = options.withRunNpmInstall(true); + var mockApplicationContext = Mockito.mock(ApplicationContext.class); + Mockito.doReturn(Map.of("MyEndpoint", new MyEndpoint())) + .when(mockApplicationContext) + .getBeansWithAnnotation(Endpoint.class); + Mockito.doReturn(Map.of()).when(mockApplicationContext) + .getBeansWithAnnotation(BrowserCallable.class); + var applicationContextField = ApplicationContextProvider.class + .getDeclaredField("applicationContext"); + applicationContextField.setAccessible(true); + applicationContextField.set(null, mockApplicationContext); + options = options.withRunNpmInstall(true); new NodeTasks(options).execute(); assertEndpointFiles(true); } diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/CustomEndpoint.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/CustomEndpoint.java index c8b74d0c5e..65539937c7 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/CustomEndpoint.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/CustomEndpoint.java @@ -1,11 +1,8 @@ package com.vaadin.hilla.internal.fixtures; -import com.vaadin.hilla.internal.Endpoint; - /** * A test class. */ -@Endpoint(value = "CustomEndpointName") public class CustomEndpoint { /** diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/EndpointNoValue.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/EndpointNoValue.java index d00e435d32..1b7ec0c325 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/EndpointNoValue.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/EndpointNoValue.java @@ -1,11 +1,8 @@ package com.vaadin.hilla.internal.fixtures; -import com.vaadin.hilla.internal.Endpoint; - /** * A test class. */ -@Endpoint("WithoutValueEqual") public class EndpointNoValue { /** diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/MyEndpoint.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/MyEndpoint.java index d490181627..2e1b9a284b 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/MyEndpoint.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/MyEndpoint.java @@ -1,11 +1,8 @@ package com.vaadin.hilla.internal.fixtures; -import com.vaadin.hilla.internal.Endpoint; - /** * A test class. */ -@Endpoint public class MyEndpoint { /** diff --git a/packages/java/hilla-bom/pom.xml b/packages/java/hilla-bom/pom.xml index 0809726311..d077cb0334 100644 --- a/packages/java/hilla-bom/pom.xml +++ b/packages/java/hilla-bom/pom.xml @@ -85,7 +85,7 @@ com.vaadin - hilla-endpoint + hilla-annotations ${project.version} diff --git a/packages/java/hilla-dev/pom.xml b/packages/java/hilla-dev/pom.xml index 002b13c7d9..32839e4193 100644 --- a/packages/java/hilla-dev/pom.xml +++ b/packages/java/hilla-dev/pom.xml @@ -24,7 +24,7 @@ com.vaadin - hilla-endpoint + hilla-annotations ${project.version} true diff --git a/packages/java/hilla/pom.xml b/packages/java/hilla/pom.xml index a5b9234822..7104c1cbc6 100644 --- a/packages/java/hilla/pom.xml +++ b/packages/java/hilla/pom.xml @@ -24,7 +24,7 @@ com.vaadin - hilla-endpoint + hilla-annotations ${project.version} diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java index 3f40f47282..4790762834 100644 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java @@ -1,7 +1,9 @@ package com.vaadin.hilla.maven; import java.io.File; +import java.nio.file.Path; import java.util.List; +import java.util.stream.Collectors; import com.vaadin.hilla.engine.EngineConfiguration; import org.apache.maven.plugin.MojoExecutionException; @@ -56,12 +58,13 @@ public class BuildFrontendMojo @Override public void execute() throws MojoExecutionException, MojoFailureException { - EngineConfiguration.classpath = String.join(File.pathSeparator, - classpathElements); - EngineConfiguration.groupId = groupId; - EngineConfiguration.artifactId = artifactId; - EngineConfiguration.mainClass = mainClass; - EngineConfiguration.buildDir = buildDir.toPath(); + var conf = EngineConfiguration.getDefault(); + conf.setClasspath(classpathElements.stream().map(Path::of) + .collect(Collectors.toSet())); + conf.setGroupId(groupId); + conf.setArtifactId(artifactId); + conf.setMainClass(mainClass); + conf.setBuildDir(buildDir.toPath()); super.execute(); } } diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineConfigureMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineConfigureMojo.java new file mode 100644 index 0000000000..e0bd143a43 --- /dev/null +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineConfigureMojo.java @@ -0,0 +1,22 @@ +package com.vaadin.hilla.maven; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.ResolutionScope; + +/** + * This goal is no longer used, so invoking it will only print a warning. + */ +@Mojo(name = "configure", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) +public final class EngineConfigureMojo extends AbstractMojo { + @Override + public void execute() throws MojoFailureException { + getLog().warn( + """ + The 'configure' goal is no longer used and will be removed in a future version. + """ + .stripIndent()); + } +} diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java index ec7644614a..cf908d0e17 100644 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java @@ -44,8 +44,8 @@ public void execute() throws EngineGenerateMojoException { return; } try { - var conf = new EngineConfiguration(); - var classPath = conf.getClassPath(); + var conf = EngineConfiguration.getDefault(); + var classPath = conf.getClasspath(); var urls = new ArrayList(classPath.size()); for (var classPathItem : classPath) { urls.add(classPathItem.toUri().toURL()); diff --git a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java index 687188453b..122578d471 100644 --- a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java +++ b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java @@ -28,7 +28,7 @@ public class AbstractMojoTest { private final DelegateMojoTestCase testCase = new DelegateMojoTestCase(); private Path buildDirectory; - private EngineConfiguration.Builder configurationBuilder; + private EngineConfiguration engineConfiguration; private Path outputDirectory; private MavenProject project; private Path temporaryDirectory; @@ -64,11 +64,8 @@ public void setUpMojoTest() throws Exception { .getOutputDirectory(); Mockito.doReturn(mockBuild).when(project).getBuild(); - var config = new EngineConfiguration(); - assertNotNull(config, "expected reference " - + "EngineConfiguration to load from json"); - configurationBuilder = new EngineConfiguration.Builder(config) - .baseDir(getTemporaryDirectory()); + engineConfiguration = new EngineConfiguration(); + engineConfiguration.setBaseDir(getTemporaryDirectory()); } @AfterEach @@ -88,7 +85,7 @@ protected Path getBuildDirectory() { } protected EngineConfiguration getEngineConfiguration() { - return configurationBuilder.create(); + return engineConfiguration; } protected MavenProject getMavenProject() { diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java index b4de31483f..df14d3e460 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java @@ -11,6 +11,7 @@ import java.util.Objects; import java.util.Set; import java.util.function.Consumer; +import java.util.stream.Stream; import jakarta.annotation.Nonnull; @@ -318,7 +319,7 @@ public OpenAPI execute(List> endpoints) { private void validateEndpointExposedClassesForAclAnnotations( List> endpoints) { - endpoints.stream() + endpoints.stream().flatMap(Parser::getSuperclasses) .flatMap(endpoint -> config.getEndpointExposedAnnotations() .stream().map(ann -> List.of(endpoint, ann))) .filter(pair -> pair.get(0).isAnnotationPresent( @@ -329,6 +330,11 @@ private void validateEndpointExposedClassesForAclAnnotations( }); } + private static Stream> getSuperclasses(Class clazz) { + return Stream.iterate(clazz.getSuperclass(), Objects::nonNull, + Class::getSuperclass); + } + private void checkClassLevelAnnotation(Class endpoint, Class exposedAnnotation) { Arrays.stream(endpoint.getAnnotations()) diff --git a/packages/java/tests/pom.xml b/packages/java/tests/pom.xml index 9f7ddd81ee..290332c8f5 100644 --- a/packages/java/tests/pom.xml +++ b/packages/java/tests/pom.xml @@ -60,7 +60,7 @@ com.vaadin - hilla-endpoint + hilla-annotations ${project.version} diff --git a/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/PagedEndpoint.java b/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/PagedEndpoint.java index 24b52a86b2..25ee5b6e45 100644 --- a/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/PagedEndpoint.java +++ b/packages/java/tests/spring/endpoints/src/main/java/com/vaadin/flow/connect/PagedEndpoint.java @@ -1,8 +1,5 @@ package com.vaadin.flow.connect; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Comparator; import java.util.List; import java.util.Objects; @@ -14,7 +11,6 @@ import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; -import org.springframework.data.support.PageableExecutionUtils; import com.vaadin.flow.server.auth.AnonymousAllowed; diff --git a/packages/java/tests/spring/pom.xml b/packages/java/tests/spring/pom.xml index cef81235f9..aa5d142925 100644 --- a/packages/java/tests/spring/pom.xml +++ b/packages/java/tests/spring/pom.xml @@ -67,7 +67,7 @@ com.vaadin - hilla-endpoint + hilla-annotations com.vaadin diff --git a/packages/java/tests/spring/security-urlmapping/pom.xml b/packages/java/tests/spring/security-urlmapping/pom.xml index 626c61a77f..79017db529 100644 --- a/packages/java/tests/spring/security-urlmapping/pom.xml +++ b/packages/java/tests/spring/security-urlmapping/pom.xml @@ -47,6 +47,10 @@ com.h2database h2 + + io.projectreactor + reactor-core + diff --git a/packages/java/tests/spring/security-urlmapping/src/main/java/com/vaadin/flow/spring/fusionsecurity/endpoints/BalanceEndpoint.java b/packages/java/tests/spring/security-urlmapping/src/main/java/com/vaadin/flow/spring/fusionsecurity/endpoints/BalanceEndpoint.java index b75421f034..8fa1886fd8 100644 --- a/packages/java/tests/spring/security-urlmapping/src/main/java/com/vaadin/flow/spring/fusionsecurity/endpoints/BalanceEndpoint.java +++ b/packages/java/tests/spring/security-urlmapping/src/main/java/com/vaadin/flow/spring/fusionsecurity/endpoints/BalanceEndpoint.java @@ -2,7 +2,6 @@ import jakarta.annotation.security.PermitAll; import java.math.BigDecimal; -import java.time.LocalDateTime; import java.util.stream.Stream; import org.springframework.beans.factory.annotation.Autowired; diff --git a/pom.xml b/pom.xml index 1c19eb4822..313ba42c72 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,7 @@ - packages/java/endpoint + packages/java/annotations packages/java/engine-core packages/java/engine-runtime packages/java/maven-plugin From fc64cb906b3ef1abd24e61c78ce45840b0b68118 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Tue, 6 Aug 2024 11:17:24 +0200 Subject: [PATCH 20/41] Refactorings while fixing tests --- packages/java/annotations/pom.xml | 7 ++- .../vaadin/hilla/EndpointSubscription.java | 0 .../src/main/java/module-info.java | 6 ++ .../hilla/engine/EngineConfiguration.java | 29 +++++++++ .../EndpointGeneratorTaskFactoryImpl.java | 14 +++++ .../internal/TaskGenerateOpenAPIImpl.java | 39 ++++++------ .../hilla/internal/NodeTasksEndpointTest.java | 59 +++++++++++++++---- .../hilla/parser/core/ParserConfigTests.java | 4 +- .../hilla/parser/core/basic/BasicTests.java | 44 +++++++------- .../core/dependency/DependencyTests.java | 1 + .../java/parser-jvm-plugin-backbone/pom.xml | 5 ++ .../backbone/EndpointExposedPlugin.java | 7 ++- .../plugins/backbone/EndpointPlugin.java | 4 +- .../src/main/java/module-info.java | 1 + .../backbone/bare/BareTypeEndpoint.java | 2 + .../plugins/backbone/bare/BareTypeTest.java | 6 +- .../plugins/backbone/bare/Endpoint.java | 11 ---- .../ComplexHierarchyEndpoint.java | 1 + .../ComplexHierarchyTest.java | 6 +- .../backbone/complexhierarchy/Endpoint.java | 11 ---- .../complexhierarchy/EndpointExposed.java | 11 ---- .../ComplexHierarchyGrandParentEndpoint.java | 2 +- .../complextype/ComplexTypeEndpoint.java | 2 + .../backbone/complextype/ComplexTypeTest.java | 3 + .../backbone/complextype/Endpoint.java | 11 ---- .../backbone/config/CustomConfigEndpoint.java | 2 + .../backbone/config/CustomConfigTest.java | 3 + .../plugins/backbone/config/Endpoint.java | 11 ---- .../CustomExplicitValueEndpoint.java | 2 + .../customname/CustomNameEndpoint.java | 2 + .../backbone/customname/CustomNameTest.java | 6 +- .../plugins/backbone/customname/Endpoint.java | 12 ---- .../backbone/datetime/DateTimeEndpoint.java | 2 + .../backbone/datetime/DateTimeTest.java | 3 + .../plugins/backbone/datetime/Endpoint.java | 11 ---- .../plugins/backbone/enumtype/Endpoint.java | 11 ---- .../backbone/enumtype/EnumTypeEndpoint.java | 2 + .../backbone/enumtype/EnumTypeTest.java | 3 + .../plugins/backbone/exposed/Endpoint.java | 11 ---- .../backbone/exposed/EndpointExposed.java | 11 ---- .../backbone/exposed/ExposedEndpoint.java | 2 + .../backbone/exposed/ExposedInterface.java | 2 + .../backbone/exposed/ExposedSuperclass.java | 2 + .../plugins/backbone/exposed/ExposedTest.java | 2 + .../plugins/backbone/generics/Endpoint.java | 11 ---- .../backbone/generics/EndpointExposed.java | 11 ---- .../generics/GenericsBareEndpoint.java | 2 + .../generics/GenericsExtendedEndpoint.java | 2 + .../generics/GenericsMethodsEndpoint.java | 2 + .../generics/GenericsRefEndpoint.java | 2 + .../backbone/generics/GenericsTest.java | 2 + .../generics/ImplementInterfaceEndpoint.java | 2 + .../genericsuperclassmethods/Endpoint.java | 11 ---- .../EndpointExposed.java | 11 ---- .../GenericSuperClass.java | 2 + .../GenericSuperClassLong.java | 2 + .../GenericSuperClassMethodsTest.java | 2 + .../GenericSuperClassString.java | 2 + .../plugins/backbone/iterable/Endpoint.java | 11 ---- .../backbone/iterable/IterableEndpoint.java | 2 + .../backbone/iterable/IterableTest.java | 3 + .../plugins/backbone/jackson/Endpoint.java | 11 ---- .../backbone/jackson/JacksonEndpoint.java | 1 + .../plugins/backbone/jackson/JacksonTest.java | 3 + .../plugins/backbone/jsonvalue/Endpoint.java | 11 ---- .../backbone/jsonvalue/JsonValueEndpoint.java | 1 + .../backbone/jsonvalue/JsonValueTest.java | 3 + .../jsonvaluenojsoncreator/Endpoint.java | 11 ---- .../JsonValueNoJsonCreatorEndpoint.java | 1 + .../JsonValueNoJsonCreatorTest.java | 5 +- .../backbone/multiendpoints/Endpoint.java | 11 ---- .../MultiEndpointsBarEndpoint.java | 2 + .../MultiEndpointsBazEndpoint.java | 2 + .../MultiEndpointsFooEndpoint.java | 2 + .../multiendpoints/MultiEndpointsTest.java | 3 + .../backbone/shadowedname/Endpoint.java | 11 ---- .../shadowedname/ShadowedNameEndpoint.java | 2 + .../shadowedname/ShadowedNameTest.java | 3 + .../plugins/backbone/simpletype/Endpoint.java | 11 ---- .../simpletype/SimpleTypeEndpoint.java | 2 + .../backbone/simpletype/SimpleTypeTest.java | 3 + .../superclassmethods/CrudEndpoint.java | 2 + .../backbone/superclassmethods/Endpoint.java | 11 ---- .../superclassmethods/EndpointExposed.java | 11 ---- .../backbone/superclassmethods/PagedData.java | 2 + .../superclassmethods/PersonEndpoint.java | 2 + .../superclassmethods/ReadOnlyEndpoint.java | 2 + .../SuperClassMethodsTest.java | 2 + .../plugins/backbone/transients/Endpoint.java | 11 ---- .../transients/TransientEndpoint.java | 2 + .../backbone/transients/TransientTest.java | 3 + .../plugins/backbone/wildcard/Endpoint.java | 11 ---- .../wildcard/WildcardTypeEndpoint.java | 2 + .../backbone/wildcard/WildcardTypeTest.java | 3 + .../parser-jvm-plugin-transfertypes/pom.xml | 5 ++ .../src/main/java/module-info.java | 1 + .../vaadin/hilla/EndpointSubscription.java | 5 -- .../transfertypes/push/PushTypeEndpoint.java | 3 +- 98 files changed, 290 insertions(+), 353 deletions(-) rename packages/java/{endpoint => annotations}/src/main/java/com/vaadin/hilla/EndpointSubscription.java (100%) create mode 100644 packages/java/annotations/src/main/java/module-info.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/EndpointExposed.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/EndpointExposed.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/EndpointExposed.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/EndpointExposed.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/EndpointExposed.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/Endpoint.java delete mode 100644 packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/EndpointSubscription.java diff --git a/packages/java/annotations/pom.xml b/packages/java/annotations/pom.xml index b84de792fc..aae94d6e2d 100644 --- a/packages/java/annotations/pom.xml +++ b/packages/java/annotations/pom.xml @@ -33,6 +33,9 @@ spring-context provided - - + + io.projectreactor + reactor-core + + diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointSubscription.java b/packages/java/annotations/src/main/java/com/vaadin/hilla/EndpointSubscription.java similarity index 100% rename from packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointSubscription.java rename to packages/java/annotations/src/main/java/com/vaadin/hilla/EndpointSubscription.java diff --git a/packages/java/annotations/src/main/java/module-info.java b/packages/java/annotations/src/main/java/module-info.java new file mode 100644 index 0000000000..01ec70e197 --- /dev/null +++ b/packages/java/annotations/src/main/java/module-info.java @@ -0,0 +1,6 @@ +module com.vaadin.hilla.annotations { + requires spring.context; + requires reactor.core; + + exports com.vaadin.hilla; +} diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java index ddc1d28786..7e4f3528c7 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java @@ -1,12 +1,16 @@ package com.vaadin.hilla.engine; import java.io.File; +import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.Arrays; +import java.util.List; import java.util.Set; +import java.util.function.Supplier; import java.util.stream.Collectors; +import com.vaadin.flow.server.ExecutionFailedException; import com.vaadin.flow.server.frontend.FrontendUtils; public class EngineConfiguration { @@ -25,6 +29,7 @@ public class EngineConfiguration { private GeneratorConfiguration generator; private Path outputDir; private ParserConfiguration parser; + private EndpointProvider offlineEndpointProvider; public EngineConfiguration() { baseDir = Path.of(System.getProperty("user.dir")); @@ -134,4 +139,28 @@ public Path getOpenAPIFile(boolean isProductionMode) { return isProductionMode ? classesDir.resolve(OPEN_API_PATH) : buildDir.resolve(OPEN_API_PATH); } + + public EndpointProvider getOfflineEndpointProvider() { + if (offlineEndpointProvider != null) { + return offlineEndpointProvider; + } + + return () -> { + try { + return new AotEndpointFinder(this).findEndpointClasses(); + } catch (IOException | InterruptedException e) { + throw new ExecutionFailedException(e); + } + }; + } + + public void setOfflineEndpointProvider( + EndpointProvider offlineEndpointProvider) { + this.offlineEndpointProvider = offlineEndpointProvider; + } + + @FunctionalInterface + public interface EndpointProvider { + List> findEndpoints() throws ExecutionFailedException; + } } diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java index 9df5487cb2..52434d0bc0 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java @@ -15,6 +15,7 @@ */ package com.vaadin.hilla.internal; +import com.vaadin.hilla.engine.EngineConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -28,6 +29,8 @@ import com.vaadin.hilla.engine.ParserProcessor; +import java.nio.file.Path; + /** * An implementation of the EndpointGeneratorTaskFactory, which creates endpoint * generator tasks. @@ -52,6 +55,7 @@ private static FrontendTools buildTools(Options options) { @Override public TaskGenerateEndpoint createTaskGenerateEndpoint(Options options) { + configureFromOptions(options); if (!options.isRunNpmInstall() && !options.isDevBundleBuild() && !options.isProductionMode()) { // Skip for prepare-frontend phase and in production server @@ -69,6 +73,7 @@ public TaskGenerateEndpoint createTaskGenerateEndpoint(Options options) { @Override public TaskGenerateOpenAPI createTaskGenerateOpenAPI(Options options) { + configureFromOptions(options); if (!options.isRunNpmInstall() && !options.isDevBundleBuild() && !options.isProductionMode()) { // Skip for prepare-frontend phase and in production server @@ -98,4 +103,13 @@ public void execute() { LOGGER.debug("Skipping generating OpenAPI spec"); } } + + private static void configureFromOptions(Options options) { + var conf = EngineConfiguration.getDefault(); + Path buildDir = options.getBuildDirectory().toPath(); + conf.setBaseDir(options.getNpmFolder().toPath()); + conf.setBuildDir(buildDir); + conf.setClassesDir(buildDir.resolve("classes")); + conf.setOutputDir(options.getFrontendGeneratedFolder().toPath()); + } } diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java index b96c380817..41085acdb6 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java @@ -88,30 +88,25 @@ public class TaskGenerateOpenAPIImpl extends AbstractTaskEndpointGenerator */ @Override public void execute() throws ExecutionFailedException { - try { - var engineConfiguration = EngineConfiguration.getDefault(); - if (isProductionMode) { - var endpoints = new AotEndpointFinder(engineConfiguration) - .findEndpointClasses(); + var engineConfiguration = EngineConfiguration.getDefault(); + if (isProductionMode) { + var endpoints = engineConfiguration.getOfflineEndpointProvider() + .findEndpoints(); + var processor = new ParserProcessor(engineConfiguration, + classLoader, true); + processor.process(endpoints); + } else { + ApplicationContextProvider.runOnContext(applicationContext -> { + List> endpoints = engineConfiguration.getParser() + .getEndpointAnnotations().stream() + .map(applicationContext::getBeansWithAnnotation) + .map(Map::values).flatMap(Collection::stream) + .map(Object::getClass).distinct() + .collect(Collectors.toList()); var processor = new ParserProcessor(engineConfiguration, - classLoader, true); + classLoader, false); processor.process(endpoints); - } else { - ApplicationContextProvider.runOnContext(applicationContext -> { - List> endpoints = engineConfiguration.getParser() - .getEndpointAnnotations().stream() - .map(applicationContext::getBeansWithAnnotation) - .map(Map::values).flatMap(Collection::stream) - .map(Object::getClass).distinct() - .collect(Collectors.toList()); - var processor = new ParserProcessor(engineConfiguration, - classLoader, false); - processor.process(endpoints); - }); - } - - } catch (Exception e) { - throw new ExecutionFailedException(e); + }); } } } diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/NodeTasksEndpointTest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/NodeTasksEndpointTest.java index b7e58fbed1..786d71467f 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/NodeTasksEndpointTest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/NodeTasksEndpointTest.java @@ -7,6 +7,7 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.util.Arrays; +import java.util.List; import java.util.Map; import java.util.Set; @@ -34,11 +35,39 @@ public class NodeTasksEndpointTest extends TaskTest { public static class ConnectEndpointsForTesting { } - public static class MyEndpoint { + @Endpoint + public class MyEndpoint { + public void foo(String bar) { + } + + public String bar(String baz) { + return baz; + } + } + + @Endpoint(value = "CustomEndpointName") + public class CustomEndpoint { + public void foo(String bar) { + } + + public String bar(String baz) { + return baz; + } + } + + @Endpoint("WithoutValueEqual") + public class EndpointNoValue { + public void foo(String bar) { + } + + public String bar(String baz) { + return baz; + } } @BeforeEach - public void setUp() throws IOException { + public void setUp() + throws IOException, NoSuchFieldException, IllegalAccessException { Lookup mockLookup = Mockito.mock(Lookup.class); Mockito.doReturn(new EndpointGeneratorTaskFactoryImpl()) .when(mockLookup).lookup(EndpointGeneratorTaskFactory.class); @@ -49,6 +78,18 @@ public void setUp() throws IOException { EndpointController.class, ConnectEndpointsForTesting.class))) .when(mockLookup).lookup(ClassFinder.class); + var mockApplicationContext = Mockito.mock(ApplicationContext.class); + Mockito.doReturn(Map.of("MyEndpoint", new MyEndpoint(), + "CustomEndpointName", CustomEndpoint.class, "WithoutValueEqual", + EndpointNoValue.class)).when(mockApplicationContext) + .getBeansWithAnnotation(Endpoint.class); + Mockito.doReturn(Map.of()).when(mockApplicationContext) + .getBeansWithAnnotation(BrowserCallable.class); + var applicationContextField = ApplicationContextProvider.class + .getDeclaredField("applicationContext"); + applicationContextField.setAccessible(true); + applicationContextField.set(null, mockApplicationContext); + options = new Options(mockLookup, getTemporaryDirectory().toFile()) .withFrontendDirectory(getTemporaryDirectory() .resolve(getFrontendDirectory()).toFile()) @@ -85,24 +126,16 @@ public void should_GenerateEndpointFilesInDevBuildTask() throws Exception { public void should_GenerateEndpointFilesInProductionBuildTask() throws Exception { options = options.withProductionMode(true); + EngineConfiguration.getDefault() + .setOfflineEndpointProvider(() -> List.of(MyEndpoint.class)); new NodeTasks(options).execute(); + EngineConfiguration.getDefault().setOfflineEndpointProvider(null); assertEndpointFilesInProductionMode(true); } @Test public void should_GenerateEndpointFilesInDevServerTask() throws Exception { - var mockApplicationContext = Mockito.mock(ApplicationContext.class); - Mockito.doReturn(Map.of("MyEndpoint", new MyEndpoint())) - .when(mockApplicationContext) - .getBeansWithAnnotation(Endpoint.class); - Mockito.doReturn(Map.of()).when(mockApplicationContext) - .getBeansWithAnnotation(BrowserCallable.class); - var applicationContextField = ApplicationContextProvider.class - .getDeclaredField("applicationContext"); - applicationContextField.setAccessible(true); - applicationContextField.set(null, mockApplicationContext); - options = options.withRunNpmInstall(true); new NodeTasks(options).execute(); assertEndpointFiles(true); diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java index e311d41c66..d2db28647d 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java @@ -176,12 +176,12 @@ public void should_ThrowError_When_ClassPathIsNotSet() { } @Test - public void should_ThrowError_When_EndpointAnnotationNameIsNotSet() { + public void should_ThrowError_When_EndpointAnnotationsIsNotSet() { var e = assertThrows(NullPointerException.class, () -> new Parser().classLoader(getClass().getClassLoader()) .classPath(defaultClassPathElements) .execute(List.of())); - assertEquals("[JVM Parser] endpointAnnotationName is not provided.", + assertEquals("[JVM Parser] endpointAnnotations is not provided.", e.getMessage()); } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java index 2ca709ec11..f5af54282d 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java @@ -15,26 +15,22 @@ public class BasicTests { private static final List STEPS = new LinkedList<>(); static { - STEPS.add("-> Root(ScanResult)"); - STEPS.add("-> Root(ScanResult)/Endpoint(BasicEndpoint)"); - STEPS.add("-> Root(ScanResult)/Endpoint(BasicEndpoint)/Field(foo)"); - STEPS.add("<- Root(ScanResult)/Endpoint(BasicEndpoint)/Field(foo)"); - STEPS.add( - "-> Root(ScanResult)/Endpoint(BasicEndpoint)/Field(fieldFoo)"); - STEPS.add( - "<- Root(ScanResult)/Endpoint(BasicEndpoint)/Field(fieldFoo)"); - STEPS.add( - "-> Root(ScanResult)/Endpoint(BasicEndpoint)/Field(fieldBar)"); - STEPS.add( - "<- Root(ScanResult)/Endpoint(BasicEndpoint)/Field(fieldBar)"); - STEPS.add("<- Root(ScanResult)/Endpoint(BasicEndpoint)"); - STEPS.add("-> Root(ScanResult)/Entity(Sample)"); - STEPS.add("-> Root(ScanResult)/Entity(Sample)/Method(methodFoo)"); - STEPS.add("<- Root(ScanResult)/Entity(Sample)/Method(methodFoo)"); - STEPS.add("-> Root(ScanResult)/Entity(Sample)/Method(methodBar)"); - STEPS.add("<- Root(ScanResult)/Entity(Sample)/Method(methodBar)"); - STEPS.add("<- Root(ScanResult)/Entity(Sample)"); - STEPS.add("<- Root(ScanResult)"); + STEPS.add("-> Root(List)"); + STEPS.add("-> Root(List)/Endpoint(BasicEndpoint)"); + STEPS.add("-> Root(List)/Endpoint(BasicEndpoint)/Field(foo)"); + STEPS.add("<- Root(List)/Endpoint(BasicEndpoint)/Field(foo)"); + STEPS.add("-> Root(List)/Endpoint(BasicEndpoint)/Field(fieldFoo)"); + STEPS.add("<- Root(List)/Endpoint(BasicEndpoint)/Field(fieldFoo)"); + STEPS.add("-> Root(List)/Endpoint(BasicEndpoint)/Field(fieldBar)"); + STEPS.add("<- Root(List)/Endpoint(BasicEndpoint)/Field(fieldBar)"); + STEPS.add("<- Root(List)/Endpoint(BasicEndpoint)"); + STEPS.add("-> Root(List)/Entity(Sample)"); + STEPS.add("-> Root(List)/Entity(Sample)/Method(methodFoo)"); + STEPS.add("<- Root(List)/Entity(Sample)/Method(methodFoo)"); + STEPS.add("-> Root(List)/Entity(Sample)/Method(methodBar)"); + STEPS.add("<- Root(List)/Entity(Sample)/Method(methodBar)"); + STEPS.add("<- Root(List)/Entity(Sample)"); + STEPS.add("<- Root(List)"); } private final List classPath; @@ -55,10 +51,15 @@ public void should_TraverseInConsistentOrder() { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(classPath) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BasicPlugin()).execute(endpoints); + // The list of endpoints seems to be serialized as "List12". The + // replacement tries to accommodate for similar representations. assertEquals(String.join("\n", STEPS), - openAPI.getExtensions().get(BasicPlugin.FOOTSTEPS_STORAGE_KEY)); + ((String) openAPI.getExtensions() + .get(BasicPlugin.FOOTSTEPS_STORAGE_KEY)) + .replaceAll("List\\w*", "List")); } @Test @@ -66,6 +67,7 @@ public void should_UpdateNodesAndCollectNames() { var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(classPath) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BasicPlugin()).execute(endpoints); assertEquals(String.join(", ", diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java index 177e447bb4..6acd1851a7 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java @@ -36,6 +36,7 @@ public static void setUp() { .classLoader(DependencyTests.class.getClassLoader()) .classPath(classPath) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new DependencyPlugin()).execute(endpoints); } diff --git a/packages/java/parser-jvm-plugin-backbone/pom.xml b/packages/java/parser-jvm-plugin-backbone/pom.xml index 4bf0c65736..20b8453741 100644 --- a/packages/java/parser-jvm-plugin-backbone/pom.xml +++ b/packages/java/parser-jvm-plugin-backbone/pom.xml @@ -40,6 +40,11 @@ junit-jupiter test + + com.vaadin + hilla-annotations + ${project.version} + com.vaadin hilla-parser-jvm-utils diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointExposedPlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointExposedPlugin.java index 84b8a6c802..e91be2323f 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointExposedPlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointExposedPlugin.java @@ -1,5 +1,6 @@ package com.vaadin.hilla.parser.plugins.backbone; +import java.lang.annotation.Annotation; import java.util.stream.Stream; import jakarta.annotation.Nonnull; @@ -92,11 +93,11 @@ public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { */ private Node createEndpointHierarchyClassNode( ClassInfoModel classInfo) { - var endpointExposedAnnotationName = getStorage().getParserConfig() + var endpointExposedAnnotations = getStorage().getParserConfig() .getEndpointExposedAnnotations(); var exposed = classInfo.getAnnotations().stream() - .map(AnnotationInfoModel::getName) - .anyMatch(endpointExposedAnnotationName::equals); + .map(annInfo -> ((Annotation) annInfo.get()).annotationType()) + .anyMatch(endpointExposedAnnotations::contains); var classInfoNode = exposed ? EndpointExposedNode.of(classInfo) : EndpointNonExposedNode.of(classInfo); return classInfoNode; diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java index 61deb0a7e7..41fedb6eda 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java @@ -77,10 +77,10 @@ public NodeDependencies scan(@Nonnull NodeDependencies nodeDependencies) { } private String getEndpointName(ClassInfoModel endpointCls) { - var endpointAnnotationNames = getStorage().getParserConfig() + var endpointAnnotations = getStorage().getParserConfig() .getEndpointAnnotations(); var endpointAnnotation = endpointCls.getAnnotations().stream() - .filter(annotation -> endpointAnnotationNames + .filter(annotation -> endpointAnnotations .contains(((Annotation) annotation.get()).getClass())) .findFirst(); return endpointAnnotation.flatMap(this::getEndpointAnnotationValue) diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java index 1b08aff1c1..a58b37c79e 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java @@ -4,6 +4,7 @@ requires io.github.classgraph; requires jsr305; requires com.fasterxml.jackson.databind; + requires com.vaadin.hilla.annotations; requires com.vaadin.hilla.parser.utils; requires transitive com.vaadin.hilla.parser.core; requires jakarta.annotation; diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeEndpoint.java index 91d2b70dc3..ecb3e48406 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.bare; +import com.vaadin.hilla.Endpoint; + import java.util.List; import java.util.Map; import java.util.Optional; diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java index 799a246056..5d0b0e93b2 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java @@ -5,7 +5,8 @@ import java.util.List; import java.util.Set; -import com.vaadin.hilla.parser.plugins.backbone.config.CustomConfigEndpoint; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import org.junit.jupiter.api.Test; import com.vaadin.hilla.parser.core.Parser; @@ -21,8 +22,9 @@ public void should_CorrectlyResolveBareTypes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) - .execute(List.of(CustomConfigEndpoint.class)); + .execute(List.of(BareTypeEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/Endpoint.java deleted file mode 100644 index 7e5ddf2da0..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.bare; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyEndpoint.java index 0899945b26..17b71e3cad 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyEndpoint.java @@ -15,6 +15,7 @@ */ package com.vaadin.hilla.parser.plugins.backbone.complexhierarchy; +import com.vaadin.hilla.Endpoint; import com.vaadin.hilla.parser.plugins.backbone.complexhierarchy.models.ComplexHierarchyModel; import com.vaadin.hilla.parser.plugins.backbone.complexhierarchy.models.ComplexHierarchyParentEndpoint; diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java index ac53bf8105..4ee9183b81 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java @@ -5,6 +5,9 @@ import java.util.List; import java.util.Set; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; +import com.vaadin.hilla.parser.plugins.backbone.complexhierarchy.models.ComplexHierarchyGrandParentEndpoint; import org.junit.jupiter.api.Test; import com.vaadin.hilla.parser.core.Parser; @@ -22,7 +25,8 @@ public void should_GenerateParentModel_When_UsingChildModel() .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) - .execute(List.of(ComplexHierarchyEndpoint.class)); + .execute(List.of(ComplexHierarchyEndpoint.class, + ComplexHierarchyGrandParentEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/Endpoint.java deleted file mode 100644 index c6b38d7d5c..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.complexhierarchy; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/EndpointExposed.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/EndpointExposed.java deleted file mode 100644 index 9c7db1790a..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/EndpointExposed.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.complexhierarchy; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface EndpointExposed { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/models/ComplexHierarchyGrandParentEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/models/ComplexHierarchyGrandParentEndpoint.java index 10d2067ee7..8348c31cbc 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/models/ComplexHierarchyGrandParentEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/models/ComplexHierarchyGrandParentEndpoint.java @@ -1,6 +1,6 @@ package com.vaadin.hilla.parser.plugins.backbone.complexhierarchy.models; -import com.vaadin.hilla.parser.plugins.backbone.complexhierarchy.Endpoint; +import com.vaadin.hilla.Endpoint; @Endpoint public class ComplexHierarchyGrandParentEndpoint { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeEndpoint.java index 7eb6afc61d..cb4a37f543 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.complextype; +import com.vaadin.hilla.Endpoint; + import java.util.List; import java.util.Map; diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java index 19eea238f1..8544fe82d8 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Set; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import org.junit.jupiter.api.Test; import com.vaadin.hilla.parser.core.Parser; @@ -20,6 +22,7 @@ public void should_CorrectlyHandleComplexTypes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(ComplexTypeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/Endpoint.java deleted file mode 100644 index 5045ed05c7..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.complextype; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigEndpoint.java index 40f2080c7a..0bf10c7796 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.config; +import com.vaadin.hilla.Endpoint; + @Endpoint public class CustomConfigEndpoint { public CustomConfigEntity get() { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java index 8785991009..f3018ac803 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Set; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import org.junit.jupiter.api.Test; import com.vaadin.hilla.parser.core.Parser; @@ -28,6 +30,7 @@ public void should_CorrectlyHandleComplexTypes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(backbonePlugin) .execute(List.of(CustomConfigEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/Endpoint.java deleted file mode 100644 index db0076a668..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.config; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomExplicitValueEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomExplicitValueEndpoint.java index 036783896d..97155604e3 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomExplicitValueEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomExplicitValueEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.customname; +import com.vaadin.hilla.Endpoint; + @Endpoint(value = "NameFromAnnotationExplicitValueEndpoint") public class CustomExplicitValueEndpoint { public void doSomething() { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameEndpoint.java index 7f630aab59..3c8471f28d 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.customname; +import com.vaadin.hilla.Endpoint; + @Endpoint("NameFromAnnotationEndpoint") public class CustomNameEndpoint { public void doSomething() { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java index 9db8a74311..e845c3c119 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Set; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import com.vaadin.hilla.parser.core.Parser; import com.vaadin.hilla.parser.plugins.backbone.BackbonePlugin; import com.vaadin.hilla.parser.plugins.backbone.test.helpers.TestHelper; @@ -19,8 +21,10 @@ public void should_UseCustomEndpointNames_WhenGivenInAnnotation() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) - .execute(List.of(CustomNameTest.class)); + .execute(List.of(CustomNameEndpoint.class, + CustomExplicitValueEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/Endpoint.java deleted file mode 100644 index 911daa17b9..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/Endpoint.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.customname; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { - String value() default ""; -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeEndpoint.java index 4a949b9b25..e634e6e577 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.datetime; +import com.vaadin.hilla.Endpoint; + import java.time.Instant; import java.time.LocalDate; import java.time.LocalDateTime; diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java index 73354abca3..a400add1f1 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Set; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import org.junit.jupiter.api.Test; import com.vaadin.hilla.parser.core.Parser; @@ -20,6 +22,7 @@ public void should_GenerateStringType_When_ReferringToDateTimeTypes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(DateTimeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/Endpoint.java deleted file mode 100644 index 32b46c5473..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.datetime; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/Endpoint.java deleted file mode 100644 index 4f59e24b5b..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.enumtype; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeEndpoint.java index 8520c47d6e..8bf1c49bfa 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeEndpoint.java @@ -15,6 +15,8 @@ */ package com.vaadin.hilla.parser.plugins.backbone.enumtype; +import com.vaadin.hilla.Endpoint; + import java.util.List; @Endpoint diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java index 02c9852faf..db1a28988b 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Set; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import org.junit.jupiter.api.Test; import com.vaadin.hilla.parser.core.Parser; @@ -20,6 +22,7 @@ public void should_GenerateStringType_When_ReferringToEnumTypes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(EnumTypeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/Endpoint.java deleted file mode 100644 index 736cfde230..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.exposed; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/EndpointExposed.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/EndpointExposed.java deleted file mode 100644 index dbe36dea1b..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/EndpointExposed.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.exposed; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface EndpointExposed { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedEndpoint.java index 3821b19383..2270ffbbff 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.exposed; +import com.vaadin.hilla.Endpoint; + @Endpoint public class ExposedEndpoint extends OtherSuperclass implements OtherInterface, ExposedInterface { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedInterface.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedInterface.java index 009b2d9260..5c6a9fff76 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedInterface.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedInterface.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.exposed; +import com.vaadin.hilla.EndpointExposed; + @EndpointExposed public interface ExposedInterface { default ExposedInterfaceEntity methodFromExposedInterface() { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedSuperclass.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedSuperclass.java index 93e0d84d87..d74cb64396 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedSuperclass.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedSuperclass.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.exposed; +import com.vaadin.hilla.EndpointExposed; + @EndpointExposed public class ExposedSuperclass { public ExposedSuperclassEntity methodFromExposedSuperclass() { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java index aaa815a9c1..98278cf8af 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Set; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import org.junit.jupiter.api.Test; import com.vaadin.hilla.parser.core.Parser; diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/Endpoint.java deleted file mode 100644 index 3fbd9a094b..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.generics; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/EndpointExposed.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/EndpointExposed.java deleted file mode 100644 index 15c2c6979b..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/EndpointExposed.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.generics; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface EndpointExposed { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsBareEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsBareEndpoint.java index b273367862..aa8eed6be7 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsBareEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsBareEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.generics; +import com.vaadin.hilla.Endpoint; + @Endpoint public class GenericsBareEndpoint { public T getSomething(T something) { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsExtendedEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsExtendedEndpoint.java index 6841fdefc2..d2e86ae0c7 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsExtendedEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsExtendedEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.generics; +import com.vaadin.hilla.Endpoint; + import java.util.Map; @Endpoint diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsMethodsEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsMethodsEndpoint.java index 3fac040b47..6e6e946796 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsMethodsEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsMethodsEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.generics; +import com.vaadin.hilla.Endpoint; + import java.util.List; @Endpoint diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsRefEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsRefEndpoint.java index 6b48a15ce9..8afaed26f0 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsRefEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsRefEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.generics; +import com.vaadin.hilla.Endpoint; + @Endpoint public class GenericsRefEndpoint, U extends GenericsExtendedRefEntity>> { public T getBareReference(T ref) { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java index 8ea81db267..f332a1cc90 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Set; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import org.junit.jupiter.api.Test; import com.vaadin.hilla.parser.core.Parser; diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/ImplementInterfaceEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/ImplementInterfaceEndpoint.java index 81b6acc6ed..3875ffd032 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/ImplementInterfaceEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/ImplementInterfaceEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.generics; +import com.vaadin.hilla.Endpoint; + import java.lang.reflect.Modifier; @Endpoint diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/Endpoint.java deleted file mode 100644 index af8b40938a..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.genericsuperclassmethods; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/EndpointExposed.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/EndpointExposed.java deleted file mode 100644 index a963640569..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/EndpointExposed.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.genericsuperclassmethods; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface EndpointExposed { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClass.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClass.java index 5d416f8769..cc561da3da 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClass.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClass.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.genericsuperclassmethods; +import com.vaadin.hilla.EndpointExposed; + @EndpointExposed public class GenericSuperClass { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassLong.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassLong.java index 625281e8d9..0932b61746 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassLong.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassLong.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.genericsuperclassmethods; +import com.vaadin.hilla.Endpoint; + @Endpoint public class GenericSuperClassLong extends GenericSuperClass { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java index b0e0d94877..7335639b23 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Set; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import com.vaadin.hilla.parser.core.Parser; import com.vaadin.hilla.parser.plugins.backbone.BackbonePlugin; import com.vaadin.hilla.parser.plugins.backbone.test.helpers.TestHelper; diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassString.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassString.java index f22bda74e3..1d99ff5da1 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassString.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassString.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.genericsuperclassmethods; +import com.vaadin.hilla.Endpoint; + @Endpoint public class GenericSuperClassString extends GenericSuperClass { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/Endpoint.java deleted file mode 100644 index 150e3ac076..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.iterable; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableEndpoint.java index 78ce31b0d0..100c3803c4 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.iterable; +import com.vaadin.hilla.Endpoint; + import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java index aabc36af43..a13769b2a8 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Set; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import org.junit.jupiter.api.Test; import com.vaadin.hilla.parser.core.Parser; @@ -20,6 +22,7 @@ public void should_GenerateStringType_When_ReferringToEnumTypes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(IterableEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/Endpoint.java deleted file mode 100644 index 8c45a487cd..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.jackson; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonEndpoint.java index 3ab7b6c3b9..10b8f050bb 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonEndpoint.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreType; import com.fasterxml.jackson.annotation.JsonProperty; +import com.vaadin.hilla.Endpoint; @Endpoint public class JacksonEndpoint { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java index e4bd584f5d..cceb6196a2 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java @@ -7,6 +7,8 @@ import java.util.Set; import java.util.stream.Stream; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import com.vaadin.hilla.parser.core.Parser; import com.vaadin.hilla.parser.plugins.backbone.BackbonePlugin; import com.vaadin.hilla.parser.plugins.backbone.jackson.JacksonEndpoint.Sample; @@ -28,6 +30,7 @@ public void should_CorrectlyIgnoreFieldsBasedOnJSONAnnotations() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(JacksonEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/Endpoint.java deleted file mode 100644 index 894b22a1e2..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.jsonvalue; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueEndpoint.java index 21362b3453..6af6597610 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueEndpoint.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; +import com.vaadin.hilla.Endpoint; @Endpoint public class JsonValueEndpoint { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java index 65cf32d384..7fa3b7c92d 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.jsonvalue; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import com.vaadin.hilla.parser.core.Parser; import com.vaadin.hilla.parser.plugins.backbone.BackbonePlugin; import com.vaadin.hilla.parser.plugins.backbone.test.helpers.TestHelper; @@ -19,6 +21,7 @@ public void should_CorrectlyMapJsonValue() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(JsonValueEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/Endpoint.java deleted file mode 100644 index 45cc8a95dc..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.jsonvaluenojsoncreator; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorEndpoint.java index 4b5b23932b..60ea55df58 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorEndpoint.java @@ -1,6 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.jsonvaluenojsoncreator; import com.fasterxml.jackson.annotation.JsonValue; +import com.vaadin.hilla.Endpoint; @Endpoint public class JsonValueNoJsonCreatorEndpoint { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java index 96a907b796..93d6f4a65a 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.jsonvaluenojsoncreator; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import com.vaadin.hilla.parser.core.Parser; import com.vaadin.hilla.parser.plugins.backbone.BackbonePlugin; import com.vaadin.hilla.parser.plugins.backbone.JsonValuePlugin.MalformedValueTypeException; @@ -20,8 +22,9 @@ public void should_ThrowExceptionWhenOnlyJsonValueIsUsed() { new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) - .execute(List.of(JsonValueNoJsonCreatorTest.class)); + .execute(List.of(JsonValueNoJsonCreatorEndpoint.class)); }); } } diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/Endpoint.java deleted file mode 100644 index c887dc662c..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.multiendpoints; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsBarEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsBarEndpoint.java index 1d060962ac..2526b0356f 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsBarEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsBarEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.multiendpoints; +import com.vaadin.hilla.Endpoint; + @Endpoint public class MultiEndpointsBarEndpoint { public String getBar() { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsBazEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsBazEndpoint.java index 92e6938828..0c7e825b93 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsBazEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsBazEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.multiendpoints; +import com.vaadin.hilla.Endpoint; + @Endpoint public class MultiEndpointsBazEndpoint { public String getBaz() { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsFooEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsFooEndpoint.java index cea2c8dcee..ff1a6d2f04 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsFooEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsFooEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.multiendpoints; +import com.vaadin.hilla.Endpoint; + @Endpoint public class MultiEndpointsFooEndpoint { public String getFoo() { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java index 925d84695e..cda1df3279 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Set; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import org.junit.jupiter.api.Test; import com.vaadin.hilla.parser.core.Parser; @@ -20,6 +22,7 @@ public void should_UseAppropriateSchema_When_SimpleTypesAreUsed() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(MultiEndpointsBarEndpoint.class, MultiEndpointsBazEndpoint.class, diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/Endpoint.java deleted file mode 100644 index 7631c2b847..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.shadowedname; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameEndpoint.java index 642274b206..289ecf2918 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.shadowedname; +import com.vaadin.hilla.Endpoint; + import java.util.ArrayList; @Endpoint diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java index d68a28e86d..1ba64d75ca 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Set; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import org.junit.jupiter.api.Test; import com.vaadin.hilla.parser.core.Parser; @@ -20,6 +22,7 @@ public void should_DistinguishBetweenUserAndBuiltinTypes_When_TheyHaveSameName() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(ShadowedNameEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/Endpoint.java deleted file mode 100644 index 5784f4b0f0..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.simpletype; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeEndpoint.java index 261d138c6f..aad1700342 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.simpletype; +import com.vaadin.hilla.Endpoint; + import java.math.BigDecimal; import java.math.BigInteger; diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java index d20d00f751..f07bbc7958 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Set; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import org.junit.jupiter.api.Test; import com.vaadin.hilla.parser.core.Parser; @@ -20,6 +22,7 @@ public void should_UseAppropriateSchema_When_SimpleTypesAreUsed() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(SimpleTypeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/CrudEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/CrudEndpoint.java index 2c4e973c91..0d1bcfdd85 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/CrudEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/CrudEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.superclassmethods; +import com.vaadin.hilla.EndpointExposed; + @EndpointExposed public abstract class CrudEndpoint extends ReadOnlyEndpoint { public void delete(ID id) { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/Endpoint.java deleted file mode 100644 index aa48f77d56..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.superclassmethods; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/EndpointExposed.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/EndpointExposed.java deleted file mode 100644 index e18e66d221..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/EndpointExposed.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.superclassmethods; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface EndpointExposed { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/PagedData.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/PagedData.java index 8311db6697..e98f19e7b9 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/PagedData.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/PagedData.java @@ -16,6 +16,8 @@ package com.vaadin.hilla.parser.plugins.backbone.superclassmethods; +import com.vaadin.hilla.EndpointExposed; + import java.util.Collections; import java.util.List; import java.util.Map; diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/PersonEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/PersonEndpoint.java index 0dceaf5c37..bbaea232ad 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/PersonEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/PersonEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.superclassmethods; +import com.vaadin.hilla.Endpoint; + @Endpoint public class PersonEndpoint extends CrudEndpoint implements PagedData { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/ReadOnlyEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/ReadOnlyEndpoint.java index c087f76098..0af90eca9f 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/ReadOnlyEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/ReadOnlyEndpoint.java @@ -16,6 +16,8 @@ package com.vaadin.hilla.parser.plugins.backbone.superclassmethods; +import com.vaadin.hilla.EndpointExposed; + import java.util.Optional; @EndpointExposed diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java index 933a82d102..8675935f52 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Set; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import org.junit.jupiter.api.Test; import com.vaadin.hilla.parser.core.Parser; diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/Endpoint.java deleted file mode 100644 index ff7b2d097b..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.transients; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientEndpoint.java index 3a8931cfe1..af4669c85c 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.transients; +import com.vaadin.hilla.Endpoint; + @Endpoint public class TransientEndpoint { public TransientModel getTransientModel() { diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java index 07607c8af1..79fc2f780e 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Set; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import org.junit.jupiter.api.Test; import com.vaadin.hilla.parser.core.Parser; @@ -20,6 +22,7 @@ public void should_CorrectlyHandleTransients() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(TransientEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/Endpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/Endpoint.java deleted file mode 100644 index 47d728966e..0000000000 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/Endpoint.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.vaadin.hilla.parser.plugins.backbone.wildcard; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface Endpoint { -} diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeEndpoint.java index 9be323c7bc..51683363a4 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.wildcard; +import com.vaadin.hilla.Endpoint; + import java.util.List; import java.util.Map; import java.util.Optional; diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java index ac6ce22b47..60b25da4f8 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java @@ -5,6 +5,8 @@ import java.util.List; import java.util.Set; +import com.vaadin.hilla.Endpoint; +import com.vaadin.hilla.EndpointExposed; import org.junit.jupiter.api.Test; import com.vaadin.hilla.parser.core.Parser; @@ -20,6 +22,7 @@ public void should_CorrectlyResolveWildcardTypes() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(WildcardTypeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-transfertypes/pom.xml b/packages/java/parser-jvm-plugin-transfertypes/pom.xml index 07320328a1..10aeadfe2e 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/pom.xml +++ b/packages/java/parser-jvm-plugin-transfertypes/pom.xml @@ -20,6 +20,11 @@ + + com.vaadin + hilla-annotations + ${project.version} + com.vaadin hilla-parser-jvm-core diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java b/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java index 7ba23a325c..684e1250fa 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java @@ -1,5 +1,6 @@ module com.vaadin.hilla.parser.plugins.transfertypes { requires com.fasterxml.jackson.databind; + requires com.vaadin.hilla.annotations; requires com.vaadin.hilla.parser.core; requires com.vaadin.hilla.parser.plugins.backbone; requires com.vaadin.hilla.parser.utils; diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/EndpointSubscription.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/EndpointSubscription.java deleted file mode 100644 index 1dd33ef99f..0000000000 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/EndpointSubscription.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.vaadin.hilla; - -// The real class is contained in the `endpoint` module which is not exposed as a Java module -public class EndpointSubscription { -} diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeEndpoint.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeEndpoint.java index 8f2e10eeb8..b9d5cfe04e 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeEndpoint.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeEndpoint.java @@ -11,7 +11,8 @@ public Flux getMessageFlux() { } public EndpointSubscription getSubscription() { - return new EndpointSubscription<>(); + return EndpointSubscription.of(Flux.just(), () -> { + }); } } From 4023bde8f08befe444efaaabf4d79ff200f83cc4 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Tue, 6 Aug 2024 11:23:54 +0200 Subject: [PATCH 21/41] Keep fixing tests --- .../vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java | 4 ++-- .../parser/plugins/backbone/customname/CustomNameTest.java | 4 ++-- .../parser/plugins/transfertypes/jsonnode/JsonNodeTest.java | 2 ++ .../hilla/parser/plugins/transfertypes/push/PushTypeTest.java | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java index 41fedb6eda..56ae1e5cfa 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/com/vaadin/hilla/parser/plugins/backbone/EndpointPlugin.java @@ -80,8 +80,8 @@ private String getEndpointName(ClassInfoModel endpointCls) { var endpointAnnotations = getStorage().getParserConfig() .getEndpointAnnotations(); var endpointAnnotation = endpointCls.getAnnotations().stream() - .filter(annotation -> endpointAnnotations - .contains(((Annotation) annotation.get()).getClass())) + .filter(annotation -> endpointAnnotations.contains( + ((Annotation) annotation.get()).annotationType())) .findFirst(); return endpointAnnotation.flatMap(this::getEndpointAnnotationValue) .filter(name -> !name.isEmpty()) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java index e845c3c119..046e9c634e 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java @@ -23,8 +23,8 @@ public void should_UseCustomEndpointNames_WhenGivenInAnnotation() .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) - .execute(List.of(CustomNameEndpoint.class, - CustomExplicitValueEndpoint.class)); + .execute(List.of(CustomExplicitValueEndpoint.class, + CustomNameEndpoint.class)); helper.executeParserWithConfig(openAPI); } diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java index ec4c926dac..73072f0242 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java @@ -1,5 +1,6 @@ package com.vaadin.hilla.parser.plugins.transfertypes.jsonnode; +import com.vaadin.hilla.EndpointExposed; import com.vaadin.hilla.parser.core.Parser; import com.vaadin.hilla.parser.plugins.backbone.BackbonePlugin; import com.vaadin.hilla.parser.plugins.transfertypes.TransferTypesPlugin; @@ -20,6 +21,7 @@ public void should_ReplaceJsonNodeClassWithObject() var openAPI = new Parser().classLoader(getClass().getClassLoader()) .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .addPlugin(new TransferTypesPlugin()) .execute(List.of(JsonNodeEndpoint.class)); diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java index dd9b0e8cbc..b65219a1cc 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java @@ -29,7 +29,7 @@ public void should_ReplacePushTypes() .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .addPlugin(new TransferTypesPlugin()) - .execute(List.of(PushTypeEndpoint.class)); + .execute(List.of(OtherEndpoint.class, PushTypeEndpoint.class)); helper.executeParserWithConfig(openAPI); } From cb5971c9d77309033c96589238aae9bfe5919eb3 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Thu, 8 Aug 2024 14:54:54 +0200 Subject: [PATCH 22/41] Remove moduleinfo --- packages/java/annotations/src/main/java/module-info.java | 6 ------ .../main/java/com/vaadin/hilla/EndpointCodeGenerator.java | 3 ++- .../src/main/java/com/vaadin/hilla/OpenAPIUtil.java | 3 ++- .../vaadin/hilla/internal/TaskGenerateEndpointImpl.java | 3 +++ packages/java/hilla-dev/pom.xml | 8 -------- packages/java/hilla/pom.xml | 5 ----- .../src/main/java/module-info.java | 2 +- packages/java/parser-jvm-plugin-transfertypes/pom.xml | 5 ----- .../src/main/java/module-info.java | 2 +- packages/java/tests/pom.xml | 5 ----- packages/java/tests/spring/pom.xml | 4 ---- pom.xml | 1 + 12 files changed, 10 insertions(+), 37 deletions(-) delete mode 100644 packages/java/annotations/src/main/java/module-info.java diff --git a/packages/java/annotations/src/main/java/module-info.java b/packages/java/annotations/src/main/java/module-info.java deleted file mode 100644 index 01ec70e197..0000000000 --- a/packages/java/annotations/src/main/java/module-info.java +++ /dev/null @@ -1,6 +0,0 @@ -module com.vaadin.hilla.annotations { - requires spring.context; - requires reactor.core; - - exports com.vaadin.hilla; -} diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java index 33f9d8248e..897062a86e 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java @@ -88,7 +88,8 @@ public void update() { } ApplicationContextProvider.runOnContext(applicationContext -> { - EngineConfiguration engineConfiguration = EngineConfiguration.getDefault(); + EngineConfiguration engineConfiguration = EngineConfiguration + .getDefault(); List> endpoints = engineConfiguration.getParser() .getEndpointAnnotations().stream() .map(applicationContext::getBeansWithAnnotation) diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java index d95caec708..0b77325536 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java @@ -59,7 +59,8 @@ public static String getCurrentOpenAPI(Path buildDirectory, */ public static Optional getCurrentOpenAPIPath(Path buildDirectory, boolean isProductionMode) throws IOException { - EngineConfiguration engineConfiguration = EngineConfiguration.getDefault(); + EngineConfiguration engineConfiguration = EngineConfiguration + .getDefault(); return Optional .of(engineConfiguration.getOpenAPIFile(isProductionMode)); } diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java index 5c619e2543..91656b4d77 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java @@ -73,6 +73,9 @@ public void execute() throws ExecutionFailedException { if (productionMode) { runProcessor(); } else { + // Even if we don't need the application context here, we have to + // wait for the parser to complete its job, so we add this the + // context queue. ApplicationContextProvider.runOnContext(applicationContext -> { runProcessor(); }); diff --git a/packages/java/hilla-dev/pom.xml b/packages/java/hilla-dev/pom.xml index 32839e4193..9d730ee2dd 100644 --- a/packages/java/hilla-dev/pom.xml +++ b/packages/java/hilla-dev/pom.xml @@ -21,14 +21,6 @@ ${project.parent.basedir} - - - com.vaadin - hilla-annotations - ${project.version} - true - - diff --git a/packages/java/hilla/pom.xml b/packages/java/hilla/pom.xml index 7104c1cbc6..c9e91a4060 100644 --- a/packages/java/hilla/pom.xml +++ b/packages/java/hilla/pom.xml @@ -22,11 +22,6 @@ - - com.vaadin - hilla-annotations - ${project.version} - com.vaadin hilla-engine-runtime diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java index a58b37c79e..60553fc83e 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java @@ -4,8 +4,8 @@ requires io.github.classgraph; requires jsr305; requires com.fasterxml.jackson.databind; - requires com.vaadin.hilla.annotations; requires com.vaadin.hilla.parser.utils; + requires hilla.annotations; requires transitive com.vaadin.hilla.parser.core; requires jakarta.annotation; requires org.slf4j; diff --git a/packages/java/parser-jvm-plugin-transfertypes/pom.xml b/packages/java/parser-jvm-plugin-transfertypes/pom.xml index 10aeadfe2e..07320328a1 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/pom.xml +++ b/packages/java/parser-jvm-plugin-transfertypes/pom.xml @@ -20,11 +20,6 @@ - - com.vaadin - hilla-annotations - ${project.version} - com.vaadin hilla-parser-jvm-core diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java b/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java index 684e1250fa..4488481adf 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java @@ -1,10 +1,10 @@ module com.vaadin.hilla.parser.plugins.transfertypes { requires com.fasterxml.jackson.databind; - requires com.vaadin.hilla.annotations; requires com.vaadin.hilla.parser.core; requires com.vaadin.hilla.parser.plugins.backbone; requires com.vaadin.hilla.parser.utils; requires com.vaadin.hilla.runtime.transfertypes; + requires hilla.annotations; requires jsr305; requires jakarta.annotation; requires io.swagger.v3.oas.models; diff --git a/packages/java/tests/pom.xml b/packages/java/tests/pom.xml index 290332c8f5..19ecf3deed 100644 --- a/packages/java/tests/pom.xml +++ b/packages/java/tests/pom.xml @@ -58,11 +58,6 @@ ${flow.version} test - - com.vaadin - hilla-annotations - ${project.version} - com.vaadin hilla-engine-runtime diff --git a/packages/java/tests/spring/pom.xml b/packages/java/tests/spring/pom.xml index aa5d142925..7667005054 100644 --- a/packages/java/tests/spring/pom.xml +++ b/packages/java/tests/spring/pom.xml @@ -65,10 +65,6 @@ com.vaadin hilla - - com.vaadin - hilla-annotations - com.vaadin hilla-engine-runtime diff --git a/pom.xml b/pom.xml index 313ba42c72..cb85716ea1 100644 --- a/pom.xml +++ b/pom.xml @@ -16,6 +16,7 @@ packages/java/annotations + packages/java/endpoint packages/java/engine-core packages/java/engine-runtime packages/java/maven-plugin From 91d6a307da774e15d044aa47a2e1a11d551bee5c Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Thu, 8 Aug 2024 15:08:54 +0200 Subject: [PATCH 23/41] Add some necessary comments --- .../vaadin/hilla/ApplicationContextProvider.java | 3 +++ .../com/vaadin/hilla/EndpointCodeGenerator.java | 2 ++ .../com/vaadin/hilla/engine/AotEndpointFinder.java | 14 +++++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/ApplicationContextProvider.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/ApplicationContextProvider.java index 286715c247..2bfc029401 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/ApplicationContextProvider.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/ApplicationContextProvider.java @@ -29,6 +29,9 @@ public static ApplicationContext getApplicationContext() { return applicationContext; } + // Allows to schedule actions that should be run when the application + // context is available, or to run them immediately if the context is + // already available and still active. public static void runOnContext(Consumer action) { if (applicationContext == null || (applicationContext instanceof ConfigurableApplicationContext diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java index 897062a86e..7182f26277 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java @@ -90,6 +90,8 @@ public void update() { ApplicationContextProvider.runOnContext(applicationContext -> { EngineConfiguration engineConfiguration = EngineConfiguration .getDefault(); + // TODO: extract this logic as it is also used in + // TaskGenerateOpenAPIImpl List> endpoints = engineConfiguration.getParser() .getEndpointAnnotations().stream() .map(applicationContext::getBeansWithAnnotation) diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/AotEndpointFinder.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/AotEndpointFinder.java index 10bfb0df79..df80cf827d 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/AotEndpointFinder.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/AotEndpointFinder.java @@ -12,6 +12,9 @@ import java.util.Objects; import java.util.stream.Collectors; +/** + * Utility class to find endpoints in a non-running Hilla application. + */ public class AotEndpointFinder { private static final String SPRING_BOOT_APPLICATION_CLASS_NAME = "org.springframework.boot.autoconfigure.SpringBootApplication"; private final EngineConfiguration engineConfiguration; @@ -22,6 +25,7 @@ public AotEndpointFinder(EngineConfiguration engineConfiguration) { public List> findEndpointClasses() throws IOException, InterruptedException { + // Prepares all variables based on the provided configuration var aotOutput = engineConfiguration.getBuildDir() .resolve("spring-aot/main"); var classesDirectory = aotOutput.resolve("classes"); @@ -36,6 +40,9 @@ public List> findEndpointClasses() var javaExecutable = ProcessHandle.current().info().command() .orElse(Path.of(System.getProperty("java.home"), "bin", "java") .toString()); + + // Runs the SpringApplicationAotProcessor to generate the + // reflect-config.json file. This comes from the `process-aot` goal. var processBuilder = new ProcessBuilder(); processBuilder.inheritIO(); processBuilder.command(javaExecutable, "-cp", @@ -55,6 +62,8 @@ public List> findEndpointClasses() throw new ParserException("Aot file reflect-config.json not found"); } + // The file simply contains a list of beans, we just need their names, + // which are class names. String jsonContent = Files.readString(json); var objectMapper = new ObjectMapper(); var rootNode = objectMapper.readTree(jsonContent); @@ -71,11 +80,14 @@ public List> findEndpointClasses() try { return Class.forName(name); } - // Must also catch NoClassDefFoundError + // Must also catch NoClassDefFoundError here, exceptions are not + // enough. catch (Throwable t) { return null; } }).filter(Objects::nonNull) + // Filter out classes that are not annotated with any of the + // endpoint annotations. .filter(cls -> engineConfiguration.getParser() .getEndpointAnnotations().stream() .anyMatch(cls::isAnnotationPresent)) From c2221e7ddfabeeee5042396fba14f96ed202893c Mon Sep 17 00:00:00 2001 From: Anton Platonov Date: Wed, 13 Nov 2024 16:34:20 +0200 Subject: [PATCH 24/41] chore(annotations): bump version --- packages/java/annotations/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/java/annotations/pom.xml b/packages/java/annotations/pom.xml index aae94d6e2d..844226c0b7 100644 --- a/packages/java/annotations/pom.xml +++ b/packages/java/annotations/pom.xml @@ -6,7 +6,7 @@ com.vaadin hilla-project - 24.5-SNAPSHOT + 24.6-SNAPSHOT ../../../pom.xml From a6081eefd77842c2c583a86614964332efc57fc2 Mon Sep 17 00:00:00 2001 From: Anton Platonov Date: Wed, 13 Nov 2024 16:34:44 +0200 Subject: [PATCH 25/41] text(parser-jvm-plugin-backbone): update test fixture --- .../plugins/backbone/generics/GenericsBareEntityEndpoint.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsBareEntityEndpoint.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsBareEntityEndpoint.java index fd75a2e20b..87377421dd 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsBareEntityEndpoint.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsBareEntityEndpoint.java @@ -1,5 +1,7 @@ package com.vaadin.hilla.parser.plugins.backbone.generics; +import com.vaadin.hilla.Endpoint; + import java.util.List; @Endpoint From 2d851aa79127ca49cfde5e3413ca5af3b7c97b8c Mon Sep 17 00:00:00 2001 From: Anton Platonov Date: Wed, 13 Nov 2024 16:35:09 +0200 Subject: [PATCH 26/41] fix(gradle-plugin): make it build --- .../gradle/plugin/EngineBuildFrontendTask.kt | 30 +++++++++++-------- .../hilla/gradle/plugin/EngineGenerateTask.kt | 4 +-- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineBuildFrontendTask.kt b/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineBuildFrontendTask.kt index d9588ee045..c8e0e47b6d 100644 --- a/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineBuildFrontendTask.kt +++ b/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineBuildFrontendTask.kt @@ -15,40 +15,44 @@ */ package com.vaadin.hilla.gradle.plugin +import com.vaadin.hilla.engine.EngineConfiguration + import org.gradle.api.tasks.Input import org.gradle.api.tasks.InputFile import org.gradle.api.tasks.Optional import org.gradle.api.tasks.TaskAction import java.io.File +import java.nio.file.Path /** * Extend the VaadinBuildFrontendTask so that frontend files are not cleaned after build. */ public open class EngineBuildFrontendTask : com.vaadin.gradle.VaadinBuildFrontendTask() { @Input - val classpathElements: List = project.configurations.getByName("compileClasspath").files.map { it.absolutePath } + public val classpathElements: List = project.configurations.getByName("compileClasspath").files.map { it.absolutePath } @Input - val groupId: String = project.group.toString() + public val groupId: String = project.group.toString() @Input - val artifactId: String = project.name + public val artifactId: String = project.name @InputFile - val buildDir: File = project.buildDir + public val buildDir: File = project.buildDir @Input @Optional - var mainClass: String? = project.findProperty("spring-boot.aot.main-class") as String? + public var mainClass: String? = project.findProperty("spring-boot.aot.main-class") as String? @TaskAction - override fun exec() { - EngineConfiguration.classpath = classpathElements.joinToString(File.pathSeparator) - EngineConfiguration.groupId = groupId - EngineConfiguration.artifactId = artifactId - EngineConfiguration.mainClass = mainClass - EngineConfiguration.buildDir = buildDir.toPath() - - super.exec() + public fun exec() { + var engineConfiguration = EngineConfiguration.getDefault() + engineConfiguration.classpath = classpathElements.map { Path.of(it) }.toSet() + engineConfiguration.groupId = groupId + engineConfiguration.artifactId = artifactId + engineConfiguration.mainClass = mainClass + engineConfiguration.buildDir = buildDir.toPath() + + super.vaadinBuildFrontend() } } diff --git a/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineGenerateTask.kt b/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineGenerateTask.kt index cbd72d0411..dc1aad3fc6 100644 --- a/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineGenerateTask.kt +++ b/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineGenerateTask.kt @@ -57,9 +57,9 @@ public open class EngineGenerateTask : DefaultTask() { try { val conf: EngineConfiguration = Objects.requireNonNull( - EngineConfiguration.loadDirectory(buildDir)) + EngineConfiguration.getDefault()) - val urls = conf.classPath + val urls = conf.classpath .stream().map { classPathItem: Path -> classPathItem.toUri().toURL() } From 7db7ff9c9738c7c24144e721325b3baa4d415e4a Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Mon, 18 Nov 2024 16:24:14 +0100 Subject: [PATCH 27/41] Add missing endpoint in test --- .../hilla/parser/plugins/backbone/generics/GenericsTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java index f332a1cc90..89f119d692 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java @@ -25,6 +25,7 @@ public void should_ParseGenericTypes() .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) .execute(List.of(GenericsBareEndpoint.class, + GenericsBareEntityEndpoint.class, GenericsExtendedEndpoint.class, GenericsMethodsEndpoint.class, GenericsRefEndpoint.class, From d31aadce847d64a5a3f7c8ca87eab0b17cbb8002 Mon Sep 17 00:00:00 2001 From: Anton Platonov Date: Tue, 19 Nov 2024 10:40:56 +0200 Subject: [PATCH 28/41] fix(annotations): add module declaration --- packages/java/annotations/pom.xml | 2 +- packages/java/annotations/src/main/java/module-info.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 packages/java/annotations/src/main/java/module-info.java diff --git a/packages/java/annotations/pom.xml b/packages/java/annotations/pom.xml index 844226c0b7..f4a332991a 100644 --- a/packages/java/annotations/pom.xml +++ b/packages/java/annotations/pom.xml @@ -31,7 +31,7 @@ org.springframework spring-context - provided + compile io.projectreactor diff --git a/packages/java/annotations/src/main/java/module-info.java b/packages/java/annotations/src/main/java/module-info.java new file mode 100644 index 0000000000..d1451fe146 --- /dev/null +++ b/packages/java/annotations/src/main/java/module-info.java @@ -0,0 +1,6 @@ +module com.vaadin.hilla.annotations { + requires reactor.core; + requires static spring.context; + + exports com.vaadin.hilla; +} From dac754903cb585af2701e774c5bfb6f52e508d2a Mon Sep 17 00:00:00 2001 From: Anton Platonov Date: Tue, 19 Nov 2024 10:41:45 +0200 Subject: [PATCH 29/41] test(parser-jvm-plugin-backbone): fix backbone tests --- .../parser-jvm-plugin-backbone/src/main/java/module-info.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java index 60553fc83e..764b22a3a0 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java @@ -5,7 +5,7 @@ requires jsr305; requires com.fasterxml.jackson.databind; requires com.vaadin.hilla.parser.utils; - requires hilla.annotations; + requires com.vaadin.hilla.annotations; requires transitive com.vaadin.hilla.parser.core; requires jakarta.annotation; requires org.slf4j; From 68c8e90d80296a27c4e357768285973f4a7c6db3 Mon Sep 17 00:00:00 2001 From: Anton Platonov Date: Tue, 19 Nov 2024 10:42:15 +0200 Subject: [PATCH 30/41] test(parser-jvm-plugin-transfertypes): add annotations module --- .../src/main/java/module-info.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java b/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java index 4488481adf..684e1250fa 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java @@ -1,10 +1,10 @@ module com.vaadin.hilla.parser.plugins.transfertypes { requires com.fasterxml.jackson.databind; + requires com.vaadin.hilla.annotations; requires com.vaadin.hilla.parser.core; requires com.vaadin.hilla.parser.plugins.backbone; requires com.vaadin.hilla.parser.utils; requires com.vaadin.hilla.runtime.transfertypes; - requires hilla.annotations; requires jsr305; requires jakarta.annotation; requires io.swagger.v3.oas.models; From 26c0427655812561ff74aa4f926bb62c3eda27f4 Mon Sep 17 00:00:00 2001 From: Anton Platonov Date: Tue, 19 Nov 2024 10:42:54 +0200 Subject: [PATCH 31/41] test(engine-runtime): use SpringBootTest for tasks --- packages/java/engine-runtime/pom.xml | 5 +++++ .../java/com/vaadin/hilla/internal/TaskTest.java | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/java/engine-runtime/pom.xml b/packages/java/engine-runtime/pom.xml index 7448af8482..f7c3ec669e 100644 --- a/packages/java/engine-runtime/pom.xml +++ b/packages/java/engine-runtime/pom.xml @@ -89,5 +89,10 @@ spring-boot-loader-tools test + + org.springframework.boot + spring-boot-test + test + diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java index cb1b1e5729..9cb243041f 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java @@ -10,12 +10,25 @@ import java.util.function.Function; import java.util.stream.Stream; +import com.vaadin.hilla.ApplicationContextProvider; +import com.vaadin.hilla.internal.fixtures.CustomEndpoint; +import com.vaadin.hilla.internal.fixtures.EndpointNoValue; +import com.vaadin.hilla.internal.fixtures.MyEndpoint; +import org.checkerframework.checker.units.qual.A; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import com.vaadin.flow.server.frontend.FrontendUtils; import com.vaadin.hilla.engine.EngineConfiguration; - +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.ApplicationContext; + +@SpringBootTest(classes = { + CustomEndpoint.class, + EndpointNoValue.class, + MyEndpoint.class, + ApplicationContextProvider.class +}) public class TaskTest { private Path temporaryDirectory; From 5b19b4ad8ef0ec1e04771a1da4290237db770408 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Tue, 19 Nov 2024 11:06:33 +0100 Subject: [PATCH 32/41] Revert "test(parser-jvm-plugin-transfertypes): add annotations module" This reverts commit 68c8e90d80296a27c4e357768285973f4a7c6db3. --- .../src/main/java/module-info.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java b/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java index 684e1250fa..4488481adf 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/main/java/module-info.java @@ -1,10 +1,10 @@ module com.vaadin.hilla.parser.plugins.transfertypes { requires com.fasterxml.jackson.databind; - requires com.vaadin.hilla.annotations; requires com.vaadin.hilla.parser.core; requires com.vaadin.hilla.parser.plugins.backbone; requires com.vaadin.hilla.parser.utils; requires com.vaadin.hilla.runtime.transfertypes; + requires hilla.annotations; requires jsr305; requires jakarta.annotation; requires io.swagger.v3.oas.models; From 39873fdb2ccccbf443cac591e894dfb5436f8490 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Tue, 19 Nov 2024 11:06:38 +0100 Subject: [PATCH 33/41] Revert "test(parser-jvm-plugin-backbone): fix backbone tests" This reverts commit dac754903cb585af2701e774c5bfb6f52e508d2a. --- .../parser-jvm-plugin-backbone/src/main/java/module-info.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java b/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java index 764b22a3a0..60553fc83e 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java +++ b/packages/java/parser-jvm-plugin-backbone/src/main/java/module-info.java @@ -5,7 +5,7 @@ requires jsr305; requires com.fasterxml.jackson.databind; requires com.vaadin.hilla.parser.utils; - requires com.vaadin.hilla.annotations; + requires hilla.annotations; requires transitive com.vaadin.hilla.parser.core; requires jakarta.annotation; requires org.slf4j; From b37107266e4a2f0b75951a68afa156412431fc9a Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Tue, 19 Nov 2024 11:06:39 +0100 Subject: [PATCH 34/41] Revert "fix(annotations): add module declaration" This reverts commit d31aadce847d64a5a3f7c8ca87eab0b17cbb8002. --- packages/java/annotations/pom.xml | 2 +- packages/java/annotations/src/main/java/module-info.java | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) delete mode 100644 packages/java/annotations/src/main/java/module-info.java diff --git a/packages/java/annotations/pom.xml b/packages/java/annotations/pom.xml index f4a332991a..844226c0b7 100644 --- a/packages/java/annotations/pom.xml +++ b/packages/java/annotations/pom.xml @@ -31,7 +31,7 @@ org.springframework spring-context - compile + provided io.projectreactor diff --git a/packages/java/annotations/src/main/java/module-info.java b/packages/java/annotations/src/main/java/module-info.java deleted file mode 100644 index d1451fe146..0000000000 --- a/packages/java/annotations/src/main/java/module-info.java +++ /dev/null @@ -1,6 +0,0 @@ -module com.vaadin.hilla.annotations { - requires reactor.core; - requires static spring.context; - - exports com.vaadin.hilla; -} From 34695698f379006bb5d83a07755195708aa3aca5 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Tue, 19 Nov 2024 11:08:22 +0100 Subject: [PATCH 35/41] Fix some tests --- .../com/vaadin/hilla/EndpointController.java | 50 ------------------- .../vaadin/hilla/EndpointControllerTest.java | 6 ++- .../hilla/engine/EngineConfiguration.java | 1 - .../com/vaadin/hilla/internal/TaskTest.java | 12 ++--- packages/java/maven-plugin/pom.xml | 4 ++ .../vaadin/hilla/maven/AbstractMojoTest.java | 2 +- packages/java/tests/pom.xml | 5 ++ 7 files changed, 18 insertions(+), 62 deletions(-) diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointController.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointController.java index 125e36c758..ddebfa1da9 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointController.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointController.java @@ -17,16 +17,10 @@ import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; -import java.io.IOException; import java.net.URL; -import java.util.Map; -import java.util.Optional; import java.util.TreeMap; import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -130,10 +124,6 @@ public void registerEndpoints(URL openApiResource) { endpointBeans .putAll(context.getBeansWithAnnotation(BrowserCallable.class)); - // By default, only register those endpoints included in the Hilla - // OpenAPI definition file - registerEndpointsFromApiDefinition(endpointBeans, openApiResource); - if (endpointRegistry.isEmpty() && !endpointBeans.isEmpty()) { LOGGER.debug("No endpoints found in openapi.json:" + " registering all endpoints found using the Spring context"); @@ -310,46 +300,6 @@ private ResponseEntity buildEnforcementResponseEntity( } } - /** - * Parses the openapi.json file to discover defined endpoints. - * - * @param knownEndpointBeans - * the endpoint beans found in the Spring context - */ - private void registerEndpointsFromApiDefinition( - Map knownEndpointBeans, URL openApiResource) { - - if (openApiResource == null) { - LOGGER.debug( - "Resource 'hilla-openapi.json' is not available: endpoints cannot be registered yet"); - } else { - try (var stream = openApiResource.openStream()) { - // Read the openapi.json file and extract the tags, which in - // turn define the endpoints and their implementation classes - var rootNode = new ObjectMapper().readTree(stream); - var tagsNode = (ArrayNode) rootNode.get("tags"); - - if (tagsNode != null) { - // Declared endpoints are first searched as Spring Beans. If - // not found, they are, if possible, instantiated as regular - // classes using their default constructor - tagsNode.forEach(tag -> { - Optional.ofNullable(tag.get("name")) - .map(JsonNode::asText) - .map(knownEndpointBeans::get) - .or(() -> Optional - .ofNullable(tag.get("x-class-name")) - .map(JsonNode::asText) - .map(this::instantiateEndpointByClassName)) - .ifPresent(endpointRegistry::registerEndpoint); - }); - } - } catch (IOException e) { - LOGGER.warn("Failed to read openapi.json", e); - } - } - } - /** * Instantiates an endpoint by its class name. Nothing special here, the * main purpose is to allow to instantiate in a lambda expression and log diff --git a/packages/java/endpoint/src/test/java/com/vaadin/hilla/EndpointControllerTest.java b/packages/java/endpoint/src/test/java/com/vaadin/hilla/EndpointControllerTest.java index 11c8ed3be4..9269c6a0b1 100644 --- a/packages/java/endpoint/src/test/java/com/vaadin/hilla/EndpointControllerTest.java +++ b/packages/java/endpoint/src/test/java/com/vaadin/hilla/EndpointControllerTest.java @@ -67,6 +67,7 @@ import com.vaadin.hilla.exception.EndpointValidationException; import com.vaadin.hilla.packages.application.ApplicationComponent; import com.vaadin.hilla.packages.application.ApplicationEndpoint; +import com.vaadin.hilla.packages.library.LibraryEndpoint; import com.vaadin.hilla.parser.jackson.JacksonObjectMapperFactory; import com.vaadin.hilla.testendpoint.BridgeMethodTestEndpoint; @@ -1163,8 +1164,11 @@ private URL getDefaultOpenApiResourcePathInDevMode() { private EndpointRegistry registerEndpoints(String openApiFilename) { var context = Mockito.mock(ApplicationContext.class); var applicationComponent = new ApplicationComponent(); + // Suppose that both the "regular" endpoint and the one from a library + // are Spring beans Mockito.doReturn(Map.of("regularEndpoint", - new ApplicationEndpoint(applicationComponent))).when(context) + new ApplicationEndpoint(applicationComponent), + "libraryEndpoint", new LibraryEndpoint())).when(context) .getBeansWithAnnotation(Endpoint.class); var controller = createVaadinControllerWithApplicationContext(context); controller.registerEndpoints(getClass() diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java index 7e4f3528c7..bfc4415f84 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java @@ -7,7 +7,6 @@ import java.util.Arrays; import java.util.List; import java.util.Set; -import java.util.function.Supplier; import java.util.stream.Collectors; import com.vaadin.flow.server.ExecutionFailedException; diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java index 9cb243041f..dceb299185 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java @@ -14,21 +14,15 @@ import com.vaadin.hilla.internal.fixtures.CustomEndpoint; import com.vaadin.hilla.internal.fixtures.EndpointNoValue; import com.vaadin.hilla.internal.fixtures.MyEndpoint; -import org.checkerframework.checker.units.qual.A; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import com.vaadin.flow.server.frontend.FrontendUtils; import com.vaadin.hilla.engine.EngineConfiguration; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.ApplicationContext; - -@SpringBootTest(classes = { - CustomEndpoint.class, - EndpointNoValue.class, - MyEndpoint.class, - ApplicationContextProvider.class -}) + +@SpringBootTest(classes = { CustomEndpoint.class, EndpointNoValue.class, + MyEndpoint.class, ApplicationContextProvider.class }) public class TaskTest { private Path temporaryDirectory; diff --git a/packages/java/maven-plugin/pom.xml b/packages/java/maven-plugin/pom.xml index 50df04bd36..b42968602b 100644 --- a/packages/java/maven-plugin/pom.xml +++ b/packages/java/maven-plugin/pom.xml @@ -57,6 +57,10 @@ hilla-engine-core ${project.version} + + org.springframework.boot + spring-boot-loader-tools + org.junit.jupiter junit-jupiter diff --git a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java index 122578d471..967c2944bc 100644 --- a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java +++ b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java @@ -64,7 +64,7 @@ public void setUpMojoTest() throws Exception { .getOutputDirectory(); Mockito.doReturn(mockBuild).when(project).getBuild(); - engineConfiguration = new EngineConfiguration(); + engineConfiguration = EngineConfiguration.getDefault(); engineConfiguration.setBaseDir(getTemporaryDirectory()); } diff --git a/packages/java/tests/pom.xml b/packages/java/tests/pom.xml index 768510c950..ac37eaeae6 100644 --- a/packages/java/tests/pom.xml +++ b/packages/java/tests/pom.xml @@ -68,6 +68,11 @@ hilla-dev ${project.version} + + com.vaadin + hilla-annotations + ${project.version} + com.vaadin vaadin-dev-server From 2ede348affdae4a2545b892fa8139f081aa6fc8a Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Wed, 20 Nov 2024 12:24:32 +0100 Subject: [PATCH 36/41] Remove class loader from parser --- .../vaadin/hilla/EndpointCodeGenerator.java | 2 +- .../vaadin/hilla/EndpointControllerTest.java | 5 ++-- .../hilla/engine/GeneratorProcessor.java | 2 +- .../vaadin/hilla/engine/ParserProcessor.java | 9 ++----- .../EndpointGeneratorTaskFactoryImpl.java | 1 - .../internal/TaskGenerateOpenAPIImpl.java | 15 +++-------- .../internal/TaskGenerateOpenAPITest.java | 6 ++--- .../com/vaadin/hilla/internal/TaskTest.java | 4 +-- .../hilla/maven/EngineGenerateMojo.java | 10 +------ .../com/vaadin/hilla/parser/core/Parser.java | 27 ------------------- .../hilla/parser/core/ParserConfigTests.java | 11 +++----- .../hilla/parser/core/basic/BasicTests.java | 6 ++--- .../core/dependency/DependencyTests.java | 4 +-- ...pointExposedAndSecurityAnnotationTest.java | 12 ++++----- ...xposedMethodAndSecurityAnnotationTest.java | 12 ++++----- .../plugins/backbone/bare/BareTypeTest.java | 2 +- .../ComplexHierarchyTest.java | 2 +- .../backbone/complextype/ComplexTypeTest.java | 2 +- .../backbone/config/CustomConfigTest.java | 2 +- .../backbone/customname/CustomNameTest.java | 2 +- .../backbone/datetime/DateTimeTest.java | 2 +- .../backbone/enumtype/EnumTypeTest.java | 2 +- .../plugins/backbone/exposed/ExposedTest.java | 2 +- .../backbone/generics/GenericsTest.java | 2 +- .../GenericSuperClassMethodsTest.java | 2 +- .../backbone/iterable/IterableTest.java | 2 +- .../plugins/backbone/jackson/JacksonTest.java | 2 +- .../backbone/jsonvalue/JsonValueTest.java | 2 +- .../JsonValueNoJsonCreatorTest.java | 3 +-- .../multiendpoints/MultiEndpointsTest.java | 2 +- .../shadowedname/ShadowedNameTest.java | 2 +- .../backbone/simpletype/SimpleTypeTest.java | 2 +- .../SuperClassMethodsTest.java | 2 +- .../backbone/transients/TransientTest.java | 2 +- .../backbone/wildcard/WildcardTypeTest.java | 2 +- .../model/annotations/AnnotationsTest.java | 2 +- .../plugins/model/javatypes/JavaTypeTest.java | 2 +- .../model/validation/ValidationTest.java | 2 +- .../plugins/nonnull/basic/BasicTest.java | 2 +- .../nonnull/extended/ExtendedTest.java | 2 +- .../nonnull/nonnullapi/NonNullApiTest.java | 2 +- .../SuperClassMethodsTest.java | 2 +- .../plugins/subtypes/SubTypesMethodsTest.java | 2 +- .../transfertypes/jsonnode/JsonNodeTest.java | 2 +- .../pageable/bare/BarePageableTest.java | 4 +-- .../pageable/basic/PageableTest.java | 4 +-- .../transfertypes/push/PushTypeTest.java | 2 +- .../plugins/transfertypes/uuid/UUIDTest.java | 2 +- 48 files changed, 69 insertions(+), 128 deletions(-) diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java index 7182f26277..9af3b833d6 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java @@ -98,7 +98,7 @@ public void update() { .map(Map::values).flatMap(Collection::stream) .map(Object::getClass).distinct().toList(); ParserProcessor parser = new ParserProcessor(engineConfiguration, - getClass().getClassLoader(), false); + false); parser.process(endpoints); GeneratorProcessor generator = new GeneratorProcessor( diff --git a/packages/java/endpoint/src/test/java/com/vaadin/hilla/EndpointControllerTest.java b/packages/java/endpoint/src/test/java/com/vaadin/hilla/EndpointControllerTest.java index 9269c6a0b1..c8424deb08 100644 --- a/packages/java/endpoint/src/test/java/com/vaadin/hilla/EndpointControllerTest.java +++ b/packages/java/endpoint/src/test/java/com/vaadin/hilla/EndpointControllerTest.java @@ -1144,10 +1144,9 @@ public void should_Instantiate_endpoints_correctly() throws Exception { public void should_Fallback_to_Spring_Context() throws Exception { // this also tests that an empty definition is not a problem var endpointRegistry = registerEndpoints("openapi-noendpoints.json"); - // this one is found by Spring + // as endpoints are find through Spring, the results are the same assertNotNull(endpointRegistry.get("applicationEndpoint")); - // the others are outside the Spring context - assertNull(endpointRegistry.get("libraryEndpoint")); + assertNotNull(endpointRegistry.get("libraryEndpoint")); assertNull(endpointRegistry.get("libraryEndpointWithConstructor")); } diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorProcessor.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorProcessor.java index 6e26228453..517668758c 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorProcessor.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorProcessor.java @@ -37,7 +37,7 @@ public GeneratorProcessor(EngineConfiguration conf, String nodeCommand, } public void process() throws GeneratorException { - var arguments = new ArrayList<>(); + var arguments = new ArrayList(); arguments.add(TSGEN_PATH); prepareOutputDir(arguments); preparePlugins(arguments); diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java index 56235a4552..8cb32e3dd8 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java @@ -21,13 +21,10 @@ import com.vaadin.hilla.parser.core.PluginManager; import com.vaadin.hilla.parser.utils.JsonPrinter; -import static com.vaadin.hilla.engine.EngineConfiguration.OPEN_API_PATH; - public final class ParserProcessor { private static final Logger logger = LoggerFactory .getLogger(ParserProcessor.class); private final Path baseDir; - private final ClassLoader classLoader; private final Set classPath; private final Path openAPIFile; private final ParserConfiguration.PluginsProcessor pluginsProcessor = new ParserConfiguration.PluginsProcessor(); @@ -37,17 +34,15 @@ public final class ParserProcessor { private Collection exposedPackages = List.of(); private String openAPIBasePath; - public ParserProcessor(EngineConfiguration conf, ClassLoader classLoader, - boolean isProductionMode) { + public ParserProcessor(EngineConfiguration conf, boolean isProductionMode) { this.baseDir = conf.getBaseDir(); this.openAPIFile = conf.getOpenAPIFile(isProductionMode); - this.classLoader = classLoader; this.classPath = conf.getClasspath(); applyConfiguration(conf.getParser()); } private String createOpenAPI(List> endpoints) throws IOException { - var parser = new Parser().classLoader(classLoader) + var parser = new Parser() .classPath(classPath.stream().map(Path::toString) .collect(Collectors.toSet())) .endpointAnnotations(endpointAnnotations) diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java index 52434d0bc0..baed35a18f 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java @@ -84,7 +84,6 @@ public TaskGenerateOpenAPI createTaskGenerateOpenAPI(Options options) { options.getBuildDirectoryName(), options.getFrontendGeneratedFolder(), options.getClassFinder()::getResource, - options.getClassFinder().getClassLoader(), options.isProductionMode()); } diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java index 41085acdb6..2879533eee 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java @@ -15,15 +15,11 @@ */ package com.vaadin.hilla.internal; -import com.vaadin.hilla.engine.AotEndpointFinder; -import jakarta.annotation.Nonnull; - import java.io.File; import java.net.URL; import java.util.Collection; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; @@ -46,7 +42,6 @@ public class TaskGenerateOpenAPIImpl extends AbstractTaskEndpointGenerator private static final Logger LOGGER = LoggerFactory .getLogger(TaskGenerateOpenAPIImpl.class); - private final ClassLoader classLoader; private final boolean isProductionMode; /** @@ -73,11 +68,9 @@ public class TaskGenerateOpenAPIImpl extends AbstractTaskEndpointGenerator */ TaskGenerateOpenAPIImpl(File projectDirectory, String buildDirectoryName, File outputDirectory, Function resourceFinder, - @Nonnull ClassLoader classLoader, boolean isProductionMode) { + boolean isProductionMode) { super(projectDirectory, buildDirectoryName, outputDirectory, resourceFinder); - this.classLoader = Objects.requireNonNull(classLoader, - "ClassLoader should not be null"); this.isProductionMode = isProductionMode; } @@ -92,8 +85,7 @@ public void execute() throws ExecutionFailedException { if (isProductionMode) { var endpoints = engineConfiguration.getOfflineEndpointProvider() .findEndpoints(); - var processor = new ParserProcessor(engineConfiguration, - classLoader, true); + var processor = new ParserProcessor(engineConfiguration, true); processor.process(endpoints); } else { ApplicationContextProvider.runOnContext(applicationContext -> { @@ -103,8 +95,7 @@ public void execute() throws ExecutionFailedException { .map(Map::values).flatMap(Collection::stream) .map(Object::getClass).distinct() .collect(Collectors.toList()); - var processor = new ParserProcessor(engineConfiguration, - classLoader, false); + var processor = new ParserProcessor(engineConfiguration, false); processor.process(endpoints); }); } diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateOpenAPITest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateOpenAPITest.java index 3722e65e2e..eeb37fd248 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateOpenAPITest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateOpenAPITest.java @@ -42,7 +42,7 @@ public void should_UseCustomEndpointNameWithoutValueEqual_InsteadOf_UsingClassNa taskGenerateOpenApi = new TaskGenerateOpenAPIImpl( getTemporaryDirectory().toFile(), getBuildDirectory(), getTemporaryDirectory().resolve(getOutputDirectory()).toFile(), - getClass()::getResource, getClass().getClassLoader(), false); + getClass()::getResource, false); taskGenerateOpenApi.execute(); @@ -64,7 +64,7 @@ public void should_UseCustomEndpointName_InsteadOf_UsingClassName() taskGenerateOpenApi = new TaskGenerateOpenAPIImpl( getTemporaryDirectory().toFile(), getBuildDirectory(), getTemporaryDirectory().resolve(getOutputDirectory()).toFile(), - getClass()::getResource, getClass().getClassLoader(), false); + getClass()::getResource, false); taskGenerateOpenApi.execute(); @@ -86,7 +86,7 @@ public void should_UseDefaultProperties_when_applicationPropertiesIsEmpty() taskGenerateOpenApi = new TaskGenerateOpenAPIImpl( getTemporaryDirectory().toFile(), getBuildDirectory(), getTemporaryDirectory().resolve(getOutputDirectory()).toFile(), - getClass()::getResource, getClass().getClassLoader(), false); + getClass()::getResource, false); taskGenerateOpenApi.execute(); diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java index dceb299185..a958cef42e 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java @@ -80,11 +80,11 @@ public void tearDownTaskApplication() throws IOException { } protected String getBuildDirectory() { - return "build"; + return "target"; } protected String getClassesDirectory() { - return "build/classes"; + return "target/classes"; } protected Path getOpenAPIFile() { diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java index cf908d0e17..615342e44e 100644 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java @@ -45,17 +45,9 @@ public void execute() throws EngineGenerateMojoException { } try { var conf = EngineConfiguration.getDefault(); - var classPath = conf.getClasspath(); - var urls = new ArrayList(classPath.size()); - for (var classPathItem : classPath) { - urls.add(classPathItem.toUri().toURL()); - } - var classLoader = new URLClassLoader(urls.toArray(URL[]::new), - getClass().getClassLoader()); var isProduction = project.getActiveProfiles().stream() .map(Profile::getId).anyMatch("production"::equals); - var parserProcessor = new ParserProcessor(conf, classLoader, - isProduction); + var parserProcessor = new ParserProcessor(conf, isProduction); var generatorProcessor = new GeneratorProcessor(conf, nodeCommand, isProduction); diff --git a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java index df14d3e460..b6ed64ea74 100644 --- a/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java +++ b/packages/java/parser-jvm-core/src/main/java/com/vaadin/hilla/parser/core/Parser.java @@ -102,20 +102,6 @@ public Parser adjustOpenAPI(@Nonnull Consumer action) { return this; } - /** - * Allows to change the class loader that the parser uses for reflection. - * - * @param classLoader - * a class loader instance. - * - * @return this (for method chaining). - */ - @Nonnull - public Parser classLoader(@Nonnull ClassLoader classLoader) { - config.classLoader = classLoader; - return this; - } - /** * Specifies the classpath where the parser will scan for endpoints. * Specifying the classpath is required. @@ -292,8 +278,6 @@ public Parser exposedPackages(@Nonnull Collection exposedPackages, */ @Nonnull public OpenAPI execute(List> endpoints) { - Objects.requireNonNull(config.classLoader, - "[JVM Parser] classLoader is not provided."); Objects.requireNonNull(config.classPathElements, "[JVM Parser] classPath is not provided."); Objects.requireNonNull(config.endpointAnnotations, @@ -449,22 +433,11 @@ public static final class Config { private List> endpointExposedAnnotations; private Collection exposedPackages; private OpenAPI openAPI; - private ClassLoader classLoader; private Config(OpenAPI openAPI) { this.openAPI = openAPI; } - /** - * Gets the class loader for reflection in the parser. - * - * @return the class loader - */ - @Nonnull - public ClassLoader getClassLoader() { - return classLoader; - } - /** * Gets the collection of classpath elements. * diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java index d2db28647d..c6632fa3bd 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java @@ -69,8 +69,7 @@ public void setup() throws URISyntaxException { .of(new Server().url("http://localhost:8080/connect") .description("Hilla Backend"))) .paths(new Paths()); - parser = new Parser().classLoader(getClass().getClassLoader()) - .classPath(defaultClassPathElements) + parser = new Parser().classPath(defaultClassPathElements) .endpointAnnotations(defaultEndpointAnnotations) .endpointExposedAnnotations(defaultEndpointExposedAnnotations); } @@ -169,7 +168,7 @@ public void should_ThrowError_When_ClassLoaderIsNotSet() { @Test public void should_ThrowError_When_ClassPathIsNotSet() { var e = assertThrows(NullPointerException.class, - () -> new Parser().classLoader(getClass().getClassLoader()) + () -> new Parser() .endpointAnnotations(defaultEndpointAnnotations) .execute(List.of())); assertEquals("[JVM Parser] classPath is not provided.", e.getMessage()); @@ -177,10 +176,8 @@ public void should_ThrowError_When_ClassPathIsNotSet() { @Test public void should_ThrowError_When_EndpointAnnotationsIsNotSet() { - var e = assertThrows(NullPointerException.class, - () -> new Parser().classLoader(getClass().getClassLoader()) - .classPath(defaultClassPathElements) - .execute(List.of())); + var e = assertThrows(NullPointerException.class, () -> new Parser() + .classPath(defaultClassPathElements).execute(List.of())); assertEquals("[JVM Parser] endpointAnnotations is not provided.", e.getMessage()); } diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java index f5af54282d..5275ca0694 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/basic/BasicTests.java @@ -48,8 +48,7 @@ public class BasicTests { @Test public void should_TraverseInConsistentOrder() { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) - .classPath(classPath) + var openAPI = new Parser().classPath(classPath) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BasicPlugin()).execute(endpoints); @@ -64,8 +63,7 @@ public void should_TraverseInConsistentOrder() { @Test public void should_UpdateNodesAndCollectNames() { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) - .classPath(classPath) + var openAPI = new Parser().classPath(classPath) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BasicPlugin()).execute(endpoints); diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java index 6acd1851a7..323cdb728c 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/dependency/DependencyTests.java @@ -32,9 +32,7 @@ public class DependencyTests { @BeforeAll public static void setUp() { - openApi = new Parser() - .classLoader(DependencyTests.class.getClassLoader()) - .classPath(classPath) + openApi = new Parser().classPath(classPath) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new DependencyPlugin()).execute(endpoints); diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/classlevel/EndpointExposedAndSecurityAnnotationTest.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/classlevel/EndpointExposedAndSecurityAnnotationTest.java index c343c2f55f..366e106a9f 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/classlevel/EndpointExposedAndSecurityAnnotationTest.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/classlevel/EndpointExposedAndSecurityAnnotationTest.java @@ -31,13 +31,13 @@ public class EndpointExposedAndSecurityAnnotationTest { @Test public void throws_when_parentEndpointClass_annotatedWithSecurityAnnotations() { - var exception = assertThrows(ParserException.class, () -> new Parser() - .classLoader(getClass().getClassLoader()).classPath(classPath) - .exposedPackages(Set + var exception = assertThrows(ParserException.class, + () -> new Parser().classPath(classPath).exposedPackages(Set .of("com.vaadin.hilla.parser.core.security.classlevel")) - .endpointAnnotations(List.of(Endpoint.class)) - .endpointExposedAnnotations(List.of(EndpointExposed.class)) - .execute(endpoints)); + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations( + List.of(EndpointExposed.class)) + .execute(endpoints)); assertTrue(exception.getMessage().startsWith( "Class `com.vaadin.hilla.parser.core.security.classlevel.ParentEndpoint` is annotated with `com.vaadin.hilla.parser.core.security.EndpointExposed` and `jakarta.annotation.security.RolesAllowed` annotation.")); diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/methodlevel/EndpointExposedMethodAndSecurityAnnotationTest.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/methodlevel/EndpointExposedMethodAndSecurityAnnotationTest.java index 77f8d094fc..99e7e61931 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/methodlevel/EndpointExposedMethodAndSecurityAnnotationTest.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/security/methodlevel/EndpointExposedMethodAndSecurityAnnotationTest.java @@ -31,13 +31,13 @@ public class EndpointExposedMethodAndSecurityAnnotationTest { @Test public void throws_when_parentEndpointMethod_annotatedWithSecurityAnnotations() { - var exception = assertThrows(ParserException.class, () -> new Parser() - .classLoader(getClass().getClassLoader()).classPath(classPath) - .exposedPackages(Set.of( + var exception = assertThrows(ParserException.class, + () -> new Parser().classPath(classPath).exposedPackages(Set.of( "com.vaadin.hilla.parser.core.security.methodlevel")) - .endpointAnnotations(List.of(Endpoint.class)) - .endpointExposedAnnotations(List.of(EndpointExposed.class)) - .execute(endpoints)); + .endpointAnnotations(List.of(Endpoint.class)) + .endpointExposedAnnotations( + List.of(EndpointExposed.class)) + .execute(endpoints)); assertTrue(exception.getMessage().startsWith( "Class `com.vaadin.hilla.parser.core.security.methodlevel.ParentEndpoint` is annotated with `com.vaadin.hilla.parser.core.security.EndpointExposed` and `jakarta.annotation.security.RolesAllowed` annotation.")); diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java index 5d0b0e93b2..9952770875 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/bare/BareTypeTest.java @@ -19,7 +19,7 @@ public class BareTypeTest { @Test public void should_CorrectlyResolveBareTypes() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java index 4ee9183b81..9bd738007c 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complexhierarchy/ComplexHierarchyTest.java @@ -20,7 +20,7 @@ public class ComplexHierarchyTest { @Test public void should_GenerateParentModel_When_UsingChildModel() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java index 8544fe82d8..685be18c76 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/complextype/ComplexTypeTest.java @@ -19,7 +19,7 @@ public class ComplexTypeTest { @Test public void should_CorrectlyHandleComplexTypes() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java index f3018ac803..1e63549a54 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/config/CustomConfigTest.java @@ -27,7 +27,7 @@ public void should_CorrectlyHandleComplexTypes() var backbonePlugin = new BackbonePlugin(); backbonePlugin.setConfiguration(pluginConfig); - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java index 046e9c634e..854b250f96 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/customname/CustomNameTest.java @@ -18,7 +18,7 @@ public class CustomNameTest { @Test public void should_UseCustomEndpointNames_WhenGivenInAnnotation() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java index a400add1f1..9169e59af4 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/datetime/DateTimeTest.java @@ -19,7 +19,7 @@ public class DateTimeTest { @Test public void should_GenerateStringType_When_ReferringToDateTimeTypes() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java index db1a28988b..ce0eb9c876 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/enumtype/EnumTypeTest.java @@ -19,7 +19,7 @@ public class EnumTypeTest { @Test public void should_GenerateStringType_When_ReferringToEnumTypes() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java index 98278cf8af..0900e06df1 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/exposed/ExposedTest.java @@ -19,7 +19,7 @@ public class ExposedTest { @Test public void should_CorrectlyHandleEndpointExposedAnnotation() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java index 89f119d692..52fcdd2622 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/generics/GenericsTest.java @@ -19,7 +19,7 @@ public class GenericsTest { @Test public void should_ParseGenericTypes() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java index 7335639b23..de3633767f 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/genericsuperclassmethods/GenericSuperClassMethodsTest.java @@ -18,7 +18,7 @@ public class GenericSuperClassMethodsTest { @Test public void should_CorrectlyHandleSuperClassMethods() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java index a13769b2a8..f60593dd84 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/iterable/IterableTest.java @@ -19,7 +19,7 @@ public class IterableTest { @Test public void should_GenerateStringType_When_ReferringToEnumTypes() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java index cceb6196a2..074d9321a1 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jackson/JacksonTest.java @@ -27,7 +27,7 @@ public void should_CorrectlyIgnoreFieldsBasedOnJSONAnnotations() Assumptions.assumeTrue(fieldsReturnedInDefinedOrder(), "This test is skipped on JDKs that do not return declared methods in the file order"); - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java index 7fa3b7c92d..4db4fe8706 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvalue/JsonValueTest.java @@ -18,7 +18,7 @@ public class JsonValueTest { @Test public void should_CorrectlyMapJsonValue() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java index 93d6f4a65a..4ba801d636 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/jsonvaluenojsoncreator/JsonValueNoJsonCreatorTest.java @@ -19,8 +19,7 @@ public class JsonValueNoJsonCreatorTest { @Test public void should_ThrowExceptionWhenOnlyJsonValueIsUsed() { assertThrows(MalformedValueTypeException.class, () -> { - new Parser().classLoader(getClass().getClassLoader()) - .classPath(Set.of(helper.getTargetDir().toString())) + new Parser().classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) .addPlugin(new BackbonePlugin()) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java index cda1df3279..4918de5ce7 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/multiendpoints/MultiEndpointsTest.java @@ -19,7 +19,7 @@ public class MultiEndpointsTest { @Test public void should_UseAppropriateSchema_When_SimpleTypesAreUsed() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java index 1ba64d75ca..d83c5bc3fb 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/shadowedname/ShadowedNameTest.java @@ -19,7 +19,7 @@ public class ShadowedNameTest { @Test public void should_DistinguishBetweenUserAndBuiltinTypes_When_TheyHaveSameName() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java index f07bbc7958..5a0fa07f45 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/simpletype/SimpleTypeTest.java @@ -19,7 +19,7 @@ public class SimpleTypeTest { @Test public void should_UseAppropriateSchema_When_SimpleTypesAreUsed() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java index 8675935f52..2888a71929 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/superclassmethods/SuperClassMethodsTest.java @@ -19,7 +19,7 @@ public class SuperClassMethodsTest { @Test public void should_CorrectlyHandleSuperClassMethods() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java index 79fc2f780e..a06c5024f8 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/transients/TransientTest.java @@ -19,7 +19,7 @@ public class TransientTest { @Test public void should_CorrectlyHandleTransients() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java index 60b25da4f8..5a10189de9 100644 --- a/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java +++ b/packages/java/parser-jvm-plugin-backbone/src/test/java/com/vaadin/hilla/parser/plugins/backbone/wildcard/WildcardTypeTest.java @@ -19,7 +19,7 @@ public class WildcardTypeTest { @Test public void should_CorrectlyResolveWildcardTypes() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/annotations/AnnotationsTest.java b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/annotations/AnnotationsTest.java index 6a4eccf7b6..3b72ba6a96 100644 --- a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/annotations/AnnotationsTest.java +++ b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/annotations/AnnotationsTest.java @@ -19,7 +19,7 @@ public class AnnotationsTest { @Test public void should_GenerateAnnotations() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .exposedPackages(Set.of( "com.vaadin.hilla.parser.plugins.model.annotations")) .classPath(Set.of(helper.getTargetDir().toString())) diff --git a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/javatypes/JavaTypeTest.java b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/javatypes/JavaTypeTest.java index bbef151fe3..819abee45b 100644 --- a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/javatypes/JavaTypeTest.java +++ b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/javatypes/JavaTypeTest.java @@ -19,7 +19,7 @@ public class JavaTypeTest { @Test public void should_GenerateAnnotations() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .exposedPackages(Set .of("com.vaadin.hilla.parser.plugins.model.javatypes")) .classPath(Set.of(helper.getTargetDir().toString())) diff --git a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/validation/ValidationTest.java b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/validation/ValidationTest.java index 1d7b2cbff6..871af885a3 100644 --- a/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/validation/ValidationTest.java +++ b/packages/java/parser-jvm-plugin-model/src/test/java/com/vaadin/hilla/parser/plugins/model/validation/ValidationTest.java @@ -20,7 +20,7 @@ public class ValidationTest { @Test public void should_GenerateValidations() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .exposedPackages(Set .of("com.vaadin.hilla.parser.plugins.model.validation")) .classPath(Set.of(helper.getTargetDir().toString())) diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicTest.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicTest.java index 438c89a57a..6686c3abf9 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicTest.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/basic/BasicTest.java @@ -26,7 +26,7 @@ public void should_ApplyNonNullAnnotation() .of(new AnnotationMatcher(Nonnull.class.getName(), false, 0)), null)); - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/extended/ExtendedTest.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/extended/ExtendedTest.java index 8c14ccecf4..dff84d2764 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/extended/ExtendedTest.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/extended/ExtendedTest.java @@ -25,7 +25,7 @@ public void should_ApplyNonNullAnnotation() .of(new AnnotationMatcher(Nonnull.class.getName(), false, 0)), null)); - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nonnullapi/NonNullApiTest.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nonnullapi/NonNullApiTest.java index 4c4f463bad..282c45248a 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nonnullapi/NonNullApiTest.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nonnullapi/NonNullApiTest.java @@ -31,7 +31,7 @@ public void should_ApplyNonNullApiAnnotation() 20)), null)); - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/superclassmethods/SuperClassMethodsTest.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/superclassmethods/SuperClassMethodsTest.java index 898f237f47..c6a6c43dd7 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/superclassmethods/SuperClassMethodsTest.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/superclassmethods/SuperClassMethodsTest.java @@ -25,7 +25,7 @@ public void should_CorrectlyHandleSuperClassMethods() .of(new AnnotationMatcher(Nonnull.class.getName(), false, 0)), null)); - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-subtypes/src/test/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesMethodsTest.java b/packages/java/parser-jvm-plugin-subtypes/src/test/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesMethodsTest.java index fc24da7259..2d0bd6e7c1 100644 --- a/packages/java/parser-jvm-plugin-subtypes/src/test/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesMethodsTest.java +++ b/packages/java/parser-jvm-plugin-subtypes/src/test/java/com/vaadin/hilla/parser/plugins/subtypes/SubTypesMethodsTest.java @@ -17,7 +17,7 @@ public class SubTypesMethodsTest { @Test public void should_CorrectlyHandleSuperClassMethods() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java index 73072f0242..f4017889cc 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/jsonnode/JsonNodeTest.java @@ -18,7 +18,7 @@ public class JsonNodeTest { @Test public void should_ReplaceJsonNodeClassWithObject() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/bare/BarePageableTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/bare/BarePageableTest.java index 5b331289a6..c034a54c8c 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/bare/BarePageableTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/bare/BarePageableTest.java @@ -23,7 +23,7 @@ public void should_ConsiderInternalDependenciesForReplacedEntities() throws IOException, URISyntaxException { var classpath = helper.getExtendedClassPath(Pageable.class); - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(classpath.split(File.pathSeparator)) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) @@ -38,7 +38,7 @@ public void should_CorrectlyResolveReplacedDependencies() throws IOException, URISyntaxException { var classpath = helper.getExtendedClassPath(Pageable.class); - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(classpath.split(File.pathSeparator)) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/basic/PageableTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/basic/PageableTest.java index 40ad040c66..422acd3547 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/basic/PageableTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/pageable/basic/PageableTest.java @@ -22,7 +22,7 @@ public void should_CorrectlyResolveReplacedDependencies() throws IOException, URISyntaxException { var classpath = helper.getExtendedClassPath(Pageable.class); - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(classpath.split(File.pathSeparator)) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) @@ -37,7 +37,7 @@ public void should_ReplaceSpringClassesWithSubstitutes() throws IOException, URISyntaxException { var classpath = helper.getExtendedClassPath(Pageable.class); - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(classpath.split(File.pathSeparator)) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java index b65219a1cc..911c6323ee 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/push/PushTypeTest.java @@ -23,7 +23,7 @@ public void should_ReplacePushTypes() var classpath = helper.getExtendedClassPath(Flux.class, EndpointSubscription.class); - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(classpath.split(File.pathSeparator)) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) diff --git a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/uuid/UUIDTest.java b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/uuid/UUIDTest.java index 4b17a64455..76f2601aa9 100644 --- a/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/uuid/UUIDTest.java +++ b/packages/java/parser-jvm-plugin-transfertypes/src/test/java/com/vaadin/hilla/parser/plugins/transfertypes/uuid/UUIDTest.java @@ -18,7 +18,7 @@ public class UUIDTest { @Test public void should_ReplaceUUIDClassWithString() throws IOException, URISyntaxException { - var openAPI = new Parser().classLoader(getClass().getClassLoader()) + var openAPI = new Parser() .classPath(Set.of(helper.getTargetDir().toString())) .endpointAnnotations(List.of(Endpoint.class)) .endpointExposedAnnotations(List.of(EndpointExposed.class)) From 1e1cd0894d66a90515b597245f0db0803003bfae Mon Sep 17 00:00:00 2001 From: Anton Platonov Date: Wed, 20 Nov 2024 14:11:55 +0200 Subject: [PATCH 37/41] fix(gradle-plugin): remove classLoader --- .../com/vaadin/hilla/gradle/plugin/EngineGenerateTask.kt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineGenerateTask.kt b/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineGenerateTask.kt index dc1aad3fc6..9a879554ad 100644 --- a/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineGenerateTask.kt +++ b/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineGenerateTask.kt @@ -65,12 +65,8 @@ public open class EngineGenerateTask : DefaultTask() { } .toList() - val classLoader = URLClassLoader( - urls.toTypedArray(), - javaClass.classLoader - ) val isProductionMode = vaadinExtension.productionMode.getOrElse(false); - val parserProcessor = ParserProcessor(conf, classLoader, isProductionMode) + val parserProcessor = ParserProcessor(conf, isProductionMode) val generatorProcessor = GeneratorProcessor(conf, extension.nodeCommand, isProductionMode) val endpoints = AotEndpointFinder(conf).findEndpointClasses() From 8cb42b8712286179c81a08436a0dade557b2c6be Mon Sep 17 00:00:00 2001 From: Anton Platonov Date: Wed, 20 Nov 2024 14:12:15 +0200 Subject: [PATCH 38/41] fix(maven-plugin): dependencyConvergence issue --- packages/java/maven-plugin/pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/java/maven-plugin/pom.xml b/packages/java/maven-plugin/pom.xml index b42968602b..3db895888c 100644 --- a/packages/java/maven-plugin/pom.xml +++ b/packages/java/maven-plugin/pom.xml @@ -60,6 +60,13 @@ org.springframework.boot spring-boot-loader-tools + + + + org.apache.commons + commons-compress + + org.junit.jupiter From c8cf885f66380bc5efca4bebd77a1a78c6523a30 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Wed, 20 Nov 2024 13:57:48 +0100 Subject: [PATCH 39/41] Fix number of expected params --- .../java/com/vaadin/hilla/maven/EngineGenerateMojoTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineGenerateMojoTest.java b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineGenerateMojoTest.java index 4deb643176..87b4dfc0c3 100644 --- a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineGenerateMojoTest.java +++ b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineGenerateMojoTest.java @@ -25,8 +25,8 @@ public void should_RunParserAndGenerator() throws Exception { Mockito.withSettings().defaultAnswer(Answers.RETURNS_SELF), (mock, context) -> { // Verify ParserProcessor constructor arguments - assertEquals(3, context.arguments().size(), - "expected 3 ParserProcessor arguments"); + assertEquals(2, context.arguments().size(), + "expected 2 ParserProcessor arguments"); // Verify configuration argument var conf = (EngineConfiguration) context.arguments().get(0); From 64132722607b9eceaa5d78b7f46d1ee5b00f0688 Mon Sep 17 00:00:00 2001 From: Luciano Vernaschi Date: Thu, 21 Nov 2024 08:16:54 +0100 Subject: [PATCH 40/41] Fix some tests --- .../vaadin/hilla/internal/NodeTasksEndpointTest.java | 4 ++-- .../vaadin/hilla/parser/core/ParserConfigTests.java | 10 ---------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/NodeTasksEndpointTest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/NodeTasksEndpointTest.java index 786d71467f..d41c4685a6 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/NodeTasksEndpointTest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/NodeTasksEndpointTest.java @@ -142,7 +142,7 @@ public void should_GenerateEndpointFilesInDevServerTask() throws Exception { } private void assertEndpointFiles(boolean shouldExist) { - Arrays.asList("build/hilla-openapi.json", + Arrays.asList("target/hilla-openapi.json", "api/connect-client.default.ts", "api/MyEndpoint.ts") .forEach(name -> assertEquals(shouldExist, new File(getTemporaryDirectory().toFile(), name) @@ -152,7 +152,7 @@ private void assertEndpointFiles(boolean shouldExist) { } private void assertEndpointFilesInProductionMode(boolean shouldExist) { - Arrays.asList("build/classes/hilla-openapi.json", + Arrays.asList("target/classes/hilla-openapi.json", "api/connect-client.default.ts", "api/MyEndpoint.ts") .forEach(name -> assertEquals(shouldExist, new File(getTemporaryDirectory().toFile(), name) diff --git a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java index c6632fa3bd..1575102a15 100644 --- a/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java +++ b/packages/java/parser-jvm-core/src/test/java/com/vaadin/hilla/parser/core/ParserConfigTests.java @@ -155,16 +155,6 @@ public void should_ParseYAMLOpenAPISource() testOpenAPISourceFile("openapi-base.yml", OpenAPIFileType.YAML); } - @Test - public void should_ThrowError_When_ClassLoaderIsNotSet() { - var e = assertThrows(NullPointerException.class, - () -> new Parser().classPath(defaultClassPathElements) - .endpointAnnotations(defaultEndpointAnnotations) - .execute(List.of())); - assertEquals("[JVM Parser] classLoader is not provided.", - e.getMessage()); - } - @Test public void should_ThrowError_When_ClassPathIsNotSet() { var e = assertThrows(NullPointerException.class, From df20ab7223ea63eb915f789fe1ba402f322e9e23 Mon Sep 17 00:00:00 2001 From: Anton Platonov Date: Fri, 22 Nov 2024 18:14:45 +0200 Subject: [PATCH 41/41] refactor!: make EngineConfiguration read-only, simplify parser/generator tasks --- .../vaadin/hilla/EndpointCodeGenerator.java | 68 ++- .../java/com/vaadin/hilla/OpenAPIUtil.java | 9 +- .../hilla/engine/EngineConfiguration.java | 187 +++++--- .../hilla/engine/GeneratorProcessor.java | 7 +- .../vaadin/hilla/engine/ParserProcessor.java | 4 +- .../AbstractTaskEndpointGenerator.java | 22 +- .../EndpointGeneratorTaskFactoryImpl.java | 34 +- .../internal/TaskGenerateEndpointImpl.java | 40 +- .../internal/TaskGenerateOpenAPIImpl.java | 41 +- .../AbstractTaskEndpointGeneratorTest.java | 32 +- .../hilla/internal/NodeTasksEndpointTest.java | 62 +-- .../internal/TaskGenerateEndpointTest.java | 12 +- .../internal/TaskGenerateOpenAPITest.java | 52 +- .../com/vaadin/hilla/internal/TaskTest.java | 16 +- .../internal/fixtures/CustomEndpoint.java | 3 + .../internal/fixtures/EndpointNoValue.java | 3 + .../hilla/internal/fixtures/MyEndpoint.java | 3 + .../gradle/plugin/EngineBuildFrontendTask.kt | 15 +- .../hilla/gradle/plugin/EngineGenerateTask.kt | 39 +- .../vaadin/hilla/maven/BuildFrontendMojo.java | 42 +- .../hilla/maven/EngineGenerateMojo.java | 48 +- .../vaadin/hilla/maven/AbstractMojoTest.java | 6 +- .../hilla/maven/EngineGenerateMojoTest.java | 36 +- .../endpoints discovery/package-lock.json | 452 +++++++++--------- .../spring/endpoints discovery/package.json | 26 +- .../tests/spring/endpoints discovery/pom.xml | 14 +- 26 files changed, 615 insertions(+), 658 deletions(-) diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java index 9af3b833d6..f2bde080d3 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/EndpointCodeGenerator.java @@ -16,7 +16,6 @@ package com.vaadin.hilla; import java.io.IOException; -import java.lang.annotation.Annotation; import java.nio.file.Files; import java.nio.file.Path; import java.util.Collection; @@ -24,8 +23,8 @@ import java.util.Map; import java.util.Optional; import java.util.Set; -import java.util.stream.Stream; +import com.vaadin.flow.server.frontend.FrontendUtils; import com.vaadin.hilla.engine.EngineConfiguration; import com.vaadin.hilla.engine.GeneratorProcessor; import com.vaadin.hilla.engine.ParserProcessor; @@ -51,8 +50,8 @@ public class EndpointCodeGenerator { private Path buildDirectory; private ApplicationConfiguration configuration; - private String nodeExecutable; private Set classesUsedInOpenApi = null; + private EngineConfiguration engineConfiguration; /** * Creates the singleton. @@ -88,35 +87,24 @@ public void update() { } ApplicationContextProvider.runOnContext(applicationContext -> { - EngineConfiguration engineConfiguration = EngineConfiguration - .getDefault(); // TODO: extract this logic as it is also used in // TaskGenerateOpenAPIImpl List> endpoints = engineConfiguration.getParser() .getEndpointAnnotations().stream() .map(applicationContext::getBeansWithAnnotation) .map(Map::values).flatMap(Collection::stream) - .map(Object::getClass).distinct().toList(); - ParserProcessor parser = new ParserProcessor(engineConfiguration, - false); + .> map(Object::getClass).distinct().toList(); + ParserProcessor parser = new ParserProcessor(engineConfiguration); parser.process(endpoints); GeneratorProcessor generator = new GeneratorProcessor( - engineConfiguration, nodeExecutable, false); + engineConfiguration); generator.process(); try { - OpenAPIUtil.getCurrentOpenAPIPath(buildDirectory, false) - .ifPresent(openApiPath -> { - try { - this.endpointController.registerEndpoints( - openApiPath.toUri().toURL()); - } catch (IOException e) { - LOGGER.error( - "Endpoints could not be registered due to an exception: ", - e); - } - }); + var openApiPath = engineConfiguration.getOpenAPIFile(); + this.endpointController + .registerEndpoints(openApiPath.toUri().toURL()); } catch (IOException e) { throw new RuntimeException(e); } @@ -131,30 +119,36 @@ private void initIfNeeded() { buildDirectory = projectFolder .resolve(configuration.getBuildFolder()); - FrontendTools tools = new FrontendTools(configuration, + var frontendTools = new FrontendTools(configuration, configuration.getProjectFolder()); - nodeExecutable = tools.getNodeBinary(); + engineConfiguration = new EngineConfiguration.Builder() + .baseDir(configuration.getProjectFolder().toPath()) + .buildDir(configuration.getBuildFolder()) + .outputDir( + FrontendUtils + .getFrontendGeneratedFolder( + configuration.getFrontendFolder()) + .toPath()) + .productionMode(false) + .nodeCommand(frontendTools.getNodeBinary()).create(); } } public Optional> getClassesUsedInOpenApi() throws IOException { if (classesUsedInOpenApi == null) { initIfNeeded(); - OpenAPIUtil.getCurrentOpenAPIPath(buildDirectory, false) - .ifPresent(openApiPath -> { - if (openApiPath.toFile().exists()) { - try { - classesUsedInOpenApi = OpenAPIUtil - .findOpenApiClasses( - Files.readString(openApiPath)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } else { - LOGGER.debug( - "No OpenAPI file is available yet ..."); - } - }); + var conf = EngineConfiguration.getDefault(); + var openApiPath = conf.getOpenAPIFile(); + if (openApiPath != null && openApiPath.toFile().exists()) { + try { + classesUsedInOpenApi = OpenAPIUtil + .findOpenApiClasses(Files.readString(openApiPath)); + } catch (IOException e) { + throw new RuntimeException(e); + } + } else { + LOGGER.debug("No OpenAPI file is available yet ..."); + } } return Optional.ofNullable(classesUsedInOpenApi); } diff --git a/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java b/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java index 0b77325536..99c55e34b9 100644 --- a/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java +++ b/packages/java/endpoint/src/main/java/com/vaadin/hilla/OpenAPIUtil.java @@ -59,10 +59,11 @@ public static String getCurrentOpenAPI(Path buildDirectory, */ public static Optional getCurrentOpenAPIPath(Path buildDirectory, boolean isProductionMode) throws IOException { - EngineConfiguration engineConfiguration = EngineConfiguration - .getDefault(); - return Optional - .of(engineConfiguration.getOpenAPIFile(isProductionMode)); + var engineConfiguration = new EngineConfiguration.Builder() + .buildDir(buildDirectory) + .productionMode(isProductionMode) + .create(); + return Optional.of(engineConfiguration.getOpenAPIFile()); } /** diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java index bfc4415f84..7136a367b6 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/EngineConfiguration.java @@ -5,7 +5,9 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.Arrays; +import java.util.Collection; import java.util.List; +import java.util.LinkedHashSet; import java.util.Set; import java.util.stream.Collectors; @@ -13,7 +15,8 @@ import com.vaadin.flow.server.frontend.FrontendUtils; public class EngineConfiguration { - private static final EngineConfiguration INSTANCE = new EngineConfiguration(); + private static EngineConfiguration INSTANCE; + public static final String OPEN_API_PATH = "hilla-openapi.json"; private Set classpath = Arrays .stream(System.getProperty("java.class.path") @@ -24,16 +27,16 @@ public class EngineConfiguration { private String mainClass; private Path buildDir; private Path baseDir; - private Path classesDir; private GeneratorConfiguration generator; private Path outputDir; private ParserConfiguration parser; private EndpointProvider offlineEndpointProvider; + private boolean productionMode = false; + private String nodeCommand = "node"; - public EngineConfiguration() { + private EngineConfiguration() { baseDir = Path.of(System.getProperty("user.dir")); buildDir = baseDir.resolve("target"); - classesDir = buildDir.resolve("classes"); generator = new GeneratorConfiguration(); parser = new ParserConfiguration(); @@ -46,96 +49,53 @@ public EngineConfiguration() { } } - public static EngineConfiguration getDefault() { - return INSTANCE; - } - public Set getClasspath() { return classpath; } - public void setClasspath(Set classpath) { - this.classpath = classpath; - } - public String getGroupId() { return groupId; } - public void setGroupId(String groupId) { - this.groupId = groupId; - } - public String getArtifactId() { return artifactId; } - public void setArtifactId(String artifactId) { - this.artifactId = artifactId; - } - public String getMainClass() { return mainClass; } - public void setMainClass(String mainClass) { - this.mainClass = mainClass; - } - public Path getBuildDir() { return buildDir; } - public void setBuildDir(Path buildDir) { - this.buildDir = buildDir; - } - - public void setBuildDir(String buildDir) { - this.buildDir = baseDir.resolve(buildDir); - } - public Path getBaseDir() { return baseDir; } - public void setBaseDir(Path baseDir) { - this.baseDir = baseDir; - } - - public Path getClassesDir() { - return classesDir; - } - - public void setClassesDir(Path classesDir) { - this.classesDir = classesDir; - } - public GeneratorConfiguration getGenerator() { return generator; } - public void setGenerator(GeneratorConfiguration generator) { - this.generator = generator; - } - public Path getOutputDir() { return outputDir; } - public void setOutputDir(Path outputDir) { - this.outputDir = outputDir; - } - public ParserConfiguration getParser() { return parser; } - public void setParser(ParserConfiguration parser) { - this.parser = parser; + public boolean isProductionMode() { + return productionMode; + } + + public String getNodeCommand() { + return nodeCommand; } - public Path getOpenAPIFile(boolean isProductionMode) { - return isProductionMode ? classesDir.resolve(OPEN_API_PATH) + public Path getOpenAPIFile() { + return productionMode + ? buildDir.resolve("classes").resolve(OPEN_API_PATH) : buildDir.resolve(OPEN_API_PATH); } @@ -153,9 +113,118 @@ public EndpointProvider getOfflineEndpointProvider() { }; } - public void setOfflineEndpointProvider( - EndpointProvider offlineEndpointProvider) { - this.offlineEndpointProvider = offlineEndpointProvider; + public static EngineConfiguration getDefault() { + if (INSTANCE == null) { + INSTANCE = new EngineConfiguration(); + } + + return INSTANCE; + } + + public static void setDefault(EngineConfiguration config) { + INSTANCE = config; + } + + public static final class Builder { + private final EngineConfiguration configuration = new EngineConfiguration(); + + public Builder() { + this(getDefault()); + } + + public Builder(EngineConfiguration configuration) { + this.configuration.baseDir = configuration.baseDir; + this.configuration.buildDir = configuration.buildDir; + this.configuration.classpath = configuration.classpath; + this.configuration.generator = configuration.generator; + this.configuration.parser = configuration.parser; + this.configuration.outputDir = configuration.outputDir; + this.configuration.groupId = configuration.groupId; + this.configuration.artifactId = configuration.artifactId; + this.configuration.mainClass = configuration.mainClass; + this.configuration.offlineEndpointProvider = configuration.offlineEndpointProvider; + this.configuration.productionMode = configuration.productionMode; + this.configuration.nodeCommand = configuration.nodeCommand; + } + + public Builder baseDir(Path value) { + configuration.baseDir = value; + return this; + } + + public Builder buildDir(String value) { + return buildDir(Path.of(value)); + } + + public Builder buildDir(Path value) { + configuration.buildDir = resolve(value); + return this; + } + + public Builder classpath(Collection value) { + configuration.classpath = value.stream().map(Path::of) + .map(this::resolve) + .collect(Collectors.toCollection(LinkedHashSet::new)); + return this; + } + + public EngineConfiguration create() { + return configuration; + } + + public Builder generator(GeneratorConfiguration value) { + configuration.generator = value; + return this; + } + + public Builder outputDir(String value) { + return outputDir(Path.of(value)); + } + + public Builder outputDir(Path value) { + configuration.outputDir = resolve(value); + return this; + } + + public Builder parser(ParserConfiguration value) { + configuration.parser = value; + return this; + } + + public Builder groupId(String value) { + configuration.groupId = value; + return this; + } + + public Builder artifactId(String value) { + configuration.artifactId = value; + return this; + } + + public Builder mainClass(String value) { + configuration.mainClass = value; + return this; + } + + public Builder offlineEndpointProvider(EndpointProvider value) { + configuration.offlineEndpointProvider = value; + return this; + } + + public Builder productionMode(boolean value) { + configuration.productionMode = value; + return this; + } + + public Builder nodeCommand(String value) { + configuration.nodeCommand = value; + return this; + } + + private Path resolve(Path path) { + return path.isAbsolute() ? path.normalize() + : configuration.baseDir.resolve(path).normalize(); + } } @FunctionalInterface diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorProcessor.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorProcessor.java index 517668758c..78deaa8389 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorProcessor.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/GeneratorProcessor.java @@ -27,12 +27,11 @@ public final class GeneratorProcessor { private final Path outputDirectory; private final GeneratorConfiguration.PluginsProcessor pluginsProcessor = new GeneratorConfiguration.PluginsProcessor(); - public GeneratorProcessor(EngineConfiguration conf, String nodeCommand, - boolean isProductionMode) { + public GeneratorProcessor(EngineConfiguration conf) { this.baseDir = conf.getBaseDir(); - this.openAPIFile = conf.getOpenAPIFile(isProductionMode); + this.openAPIFile = conf.getOpenAPIFile(); this.outputDirectory = conf.getOutputDir(); - this.nodeCommand = nodeCommand; + this.nodeCommand = conf.getNodeCommand(); applyConfiguration(conf.getGenerator()); } diff --git a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java index 8cb32e3dd8..06c4d1ac65 100644 --- a/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java +++ b/packages/java/engine-core/src/main/java/com/vaadin/hilla/engine/ParserProcessor.java @@ -34,9 +34,9 @@ public final class ParserProcessor { private Collection exposedPackages = List.of(); private String openAPIBasePath; - public ParserProcessor(EngineConfiguration conf, boolean isProductionMode) { + public ParserProcessor(EngineConfiguration conf) { this.baseDir = conf.getBaseDir(); - this.openAPIFile = conf.getOpenAPIFile(isProductionMode); + this.openAPIFile = conf.getOpenAPIFile(); this.classPath = conf.getClasspath(); applyConfiguration(conf.getParser()); } diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/AbstractTaskEndpointGenerator.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/AbstractTaskEndpointGenerator.java index 54e61d15fa..79ee9755d8 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/AbstractTaskEndpointGenerator.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/AbstractTaskEndpointGenerator.java @@ -29,22 +29,14 @@ abstract class AbstractTaskEndpointGenerator implements FallibleCommand { private static boolean firstRun = true; - private final String buildDirectoryName; - protected final File outputDirectory; - private final File projectDirectory; - private final Function resourceFinder; private EngineConfiguration engineConfiguration; - AbstractTaskEndpointGenerator(File projectDirectory, - String buildDirectoryName, File outputDirectory, - Function resourceFinder) { - this.projectDirectory = Objects.requireNonNull(projectDirectory, - "Project directory cannot be null"); - this.buildDirectoryName = Objects.requireNonNull(buildDirectoryName, - "Build directory name cannot be null"); - this.outputDirectory = Objects.requireNonNull(outputDirectory, - "Output directory name cannot be null"); - this.resourceFinder = Objects.requireNonNull(resourceFinder, - "Class finder cannot be null"); + AbstractTaskEndpointGenerator(EngineConfiguration engineConfiguration) { + this.engineConfiguration = Objects.requireNonNull(engineConfiguration, + "Engine configuration cannot be null"); + } + + protected EngineConfiguration getEngineConfiguration() { + return engineConfiguration; } } diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java index baed35a18f..1953ff7515 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/EndpointGeneratorTaskFactoryImpl.java @@ -29,8 +29,6 @@ import com.vaadin.hilla.engine.ParserProcessor; -import java.nio.file.Path; - /** * An implementation of the EndpointGeneratorTaskFactory, which creates endpoint * generator tasks. @@ -55,36 +53,26 @@ private static FrontendTools buildTools(Options options) { @Override public TaskGenerateEndpoint createTaskGenerateEndpoint(Options options) { - configureFromOptions(options); if (!options.isRunNpmInstall() && !options.isDevBundleBuild() && !options.isProductionMode()) { // Skip for prepare-frontend phase and in production server return new SkipTaskGenerateEndpoint(); } - var nodeExecutable = buildTools(options).getNodeExecutable(); - - return new TaskGenerateEndpointImpl(options.getNpmFolder(), - options.getBuildDirectoryName(), - options.getFrontendGeneratedFolder(), - options.getClassFinder()::getResource, - options.isProductionMode(), nodeExecutable); + var engineConfiguration = configureFromOptions(options); + return new TaskGenerateEndpointImpl(engineConfiguration); } @Override public TaskGenerateOpenAPI createTaskGenerateOpenAPI(Options options) { - configureFromOptions(options); if (!options.isRunNpmInstall() && !options.isDevBundleBuild() && !options.isProductionMode()) { // Skip for prepare-frontend phase and in production server return new SkipTaskGenerateOpenAPI(); } - return new TaskGenerateOpenAPIImpl(options.getNpmFolder(), - options.getBuildDirectoryName(), - options.getFrontendGeneratedFolder(), - options.getClassFinder()::getResource, - options.isProductionMode()); + var engineConfiguration = configureFromOptions(options); + return new TaskGenerateOpenAPIImpl(engineConfiguration); } private static class SkipTaskGenerateEndpoint @@ -103,12 +91,12 @@ public void execute() { } } - private static void configureFromOptions(Options options) { - var conf = EngineConfiguration.getDefault(); - Path buildDir = options.getBuildDirectory().toPath(); - conf.setBaseDir(options.getNpmFolder().toPath()); - conf.setBuildDir(buildDir); - conf.setClassesDir(buildDir.resolve("classes")); - conf.setOutputDir(options.getFrontendGeneratedFolder().toPath()); + private static EngineConfiguration configureFromOptions(Options options) { + return new EngineConfiguration.Builder() + .baseDir(options.getNpmFolder().toPath()) + .buildDir(options.getBuildDirectoryName()) + .outputDir(options.getFrontendGeneratedFolder().toPath()) + .nodeCommand(buildTools(options).getNodeExecutable()) + .productionMode(options.isProductionMode()).create(); } } diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java index 91656b4d77..6067a958a1 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateEndpointImpl.java @@ -15,10 +15,6 @@ */ package com.vaadin.hilla.internal; -import java.io.File; -import java.net.URL; -import java.util.function.Function; - import com.vaadin.flow.server.ExecutionFailedException; import com.vaadin.flow.server.frontend.TaskGenerateEndpoint; import com.vaadin.hilla.ApplicationContextProvider; @@ -31,36 +27,14 @@ public class TaskGenerateEndpointImpl extends AbstractTaskEndpointGenerator implements TaskGenerateEndpoint { - private final String nodeCommand; - private final boolean productionMode; - /** * Create a task for generating OpenAPI spec. * - * @param projectDirectory - * the base directory of the project. - * - * @param buildDirectoryName - * Java build directory name (relative to the {@code - * projectDirectory}). - * - * @param outputDirectory - * the output directory for generated TypeScript code. - * @param resourceFinder - * used internally to find resources - * @param productionMode - * {@code true} if building for production - * @param nodeCommand - * a command to run NodeJS, either absolute path to the - * executable or PATH-related command + * @param engineConfiguration + * Hilla engine configuration instance */ - TaskGenerateEndpointImpl(File projectDirectory, String buildDirectoryName, - File outputDirectory, Function resourceFinder, - boolean productionMode, String nodeCommand) { - super(projectDirectory, buildDirectoryName, outputDirectory, - resourceFinder); - this.productionMode = productionMode; - this.nodeCommand = nodeCommand; + TaskGenerateEndpointImpl(EngineConfiguration engineConfiguration) { + super(engineConfiguration); } /** @@ -70,7 +44,7 @@ public class TaskGenerateEndpointImpl extends AbstractTaskEndpointGenerator */ @Override public void execute() throws ExecutionFailedException { - if (productionMode) { + if (getEngineConfiguration().isProductionMode()) { runProcessor(); } else { // Even if we don't need the application context here, we have to @@ -83,9 +57,7 @@ public void execute() throws ExecutionFailedException { } private void runProcessor() { - var engineConfiguration = EngineConfiguration.getDefault(); - var processor = new GeneratorProcessor(engineConfiguration, nodeCommand, - productionMode); + var processor = new GeneratorProcessor(getEngineConfiguration()); processor.process(); } } diff --git a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java index 2879533eee..9e0f3a6e2c 100644 --- a/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java +++ b/packages/java/engine-runtime/src/main/java/com/vaadin/hilla/internal/TaskGenerateOpenAPIImpl.java @@ -15,12 +15,9 @@ */ package com.vaadin.hilla.internal; -import java.io.File; -import java.net.URL; import java.util.Collection; import java.util.List; import java.util.Map; -import java.util.function.Function; import java.util.stream.Collectors; import com.vaadin.hilla.ApplicationContextProvider; @@ -42,36 +39,14 @@ public class TaskGenerateOpenAPIImpl extends AbstractTaskEndpointGenerator private static final Logger LOGGER = LoggerFactory .getLogger(TaskGenerateOpenAPIImpl.class); - private final boolean isProductionMode; - /** * Create a task for generating OpenAPI spec. * - * @param projectDirectory - * the base directory of the project. - * - * @param buildDirectoryName - * Java build directory name (relative to the {@code - * projectDirectory}). - * - * @param outputDirectory - * the output directory for generated TypeScript code. - * - * @param resourceFinder - * used internally to find resources. - * - * @param classLoader - * the Java Class Loader for the parser. - * - * @param isProductionMode - * {@code true} if building for production. + * @param engineConfiguration + * Hilla engine configuration instance */ - TaskGenerateOpenAPIImpl(File projectDirectory, String buildDirectoryName, - File outputDirectory, Function resourceFinder, - boolean isProductionMode) { - super(projectDirectory, buildDirectoryName, outputDirectory, - resourceFinder); - this.isProductionMode = isProductionMode; + TaskGenerateOpenAPIImpl(EngineConfiguration engineConfiguration) { + super(engineConfiguration); } /** @@ -81,11 +56,11 @@ public class TaskGenerateOpenAPIImpl extends AbstractTaskEndpointGenerator */ @Override public void execute() throws ExecutionFailedException { - var engineConfiguration = EngineConfiguration.getDefault(); - if (isProductionMode) { + var engineConfiguration = getEngineConfiguration(); + if (getEngineConfiguration().isProductionMode()) { var endpoints = engineConfiguration.getOfflineEndpointProvider() .findEndpoints(); - var processor = new ParserProcessor(engineConfiguration, true); + var processor = new ParserProcessor(engineConfiguration); processor.process(endpoints); } else { ApplicationContextProvider.runOnContext(applicationContext -> { @@ -95,7 +70,7 @@ public void execute() throws ExecutionFailedException { .map(Map::values).flatMap(Collection::stream) .map(Object::getClass).distinct() .collect(Collectors.toList()); - var processor = new ParserProcessor(engineConfiguration, false); + var processor = new ParserProcessor(engineConfiguration); processor.process(endpoints); }); } diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/AbstractTaskEndpointGeneratorTest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/AbstractTaskEndpointGeneratorTest.java index cbdbe2db81..e146bf5339 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/AbstractTaskEndpointGeneratorTest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/AbstractTaskEndpointGeneratorTest.java @@ -6,6 +6,7 @@ import java.util.Optional; import java.util.function.Function; +import com.vaadin.hilla.engine.EngineConfiguration; import com.vaadin.hilla.engine.commandrunner.CommandRunnerException; import com.vaadin.hilla.engine.commandrunner.MavenRunner; import org.junit.jupiter.api.Test; @@ -17,29 +18,10 @@ class AbstractTaskEndpointGeneratorTest extends TaskTest { @Test - void shouldThrowIfProjectDirectoryIsNull() { + void shouldThrowIfEngineConfigurationIsNull() { assertThrowsExactly(NullPointerException.class, () -> { - new TestTaskEndpointGenerator(null, getBuildDirectory(), - getTemporaryDirectory().resolve(getOutputDirectory()) - .toFile()); - }, "Project directory cannot be null"); - } - - @Test - void shouldThrowIfBuildDirectoryNameIsNull() { - assertThrowsExactly(NullPointerException.class, () -> { - new TestTaskEndpointGenerator(getTemporaryDirectory().toFile(), - null, getTemporaryDirectory().resolve(getOutputDirectory()) - .toFile()); - }, "Build directory name cannot be null"); - } - - @Test - void shouldThrowIfOutputDirectoryIsNull() { - assertThrowsExactly(NullPointerException.class, () -> { - new TestTaskEndpointGenerator(getTemporaryDirectory().toFile(), - getBuildDirectory(), null); - }, "Output directory cannot be null"); + new TestTaskEndpointGenerator(null); + }, "Engine configuration cannot be null"); } private final Function resourceFinder = Thread.currentThread() @@ -47,10 +29,8 @@ void shouldThrowIfOutputDirectoryIsNull() { private class TestTaskEndpointGenerator extends AbstractTaskEndpointGenerator { - TestTaskEndpointGenerator(File projectDirectory, - String buildDirectoryName, File outputDirectory) { - super(projectDirectory, buildDirectoryName, outputDirectory, - resourceFinder); + TestTaskEndpointGenerator(EngineConfiguration engineConfiguration) { + super(engineConfiguration); } @Override diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/NodeTasksEndpointTest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/NodeTasksEndpointTest.java index d41c4685a6..df1a072505 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/NodeTasksEndpointTest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/NodeTasksEndpointTest.java @@ -5,17 +5,15 @@ import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; -import java.nio.file.Path; import java.util.Arrays; import java.util.List; -import java.util.Map; import java.util.Set; +import com.vaadin.hilla.internal.fixtures.MyEndpoint; import org.apache.commons.io.FileUtils; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -import org.springframework.context.ApplicationContext; import com.vaadin.flow.di.Lookup; import com.vaadin.flow.server.frontend.EndpointGeneratorTaskFactory; @@ -23,9 +21,6 @@ import com.vaadin.flow.server.frontend.Options; import com.vaadin.flow.server.frontend.scanner.ClassFinder; import com.vaadin.flow.server.frontend.scanner.ClassFinder.DefaultClassFinder; -import com.vaadin.hilla.ApplicationContextProvider; -import com.vaadin.hilla.BrowserCallable; -import com.vaadin.hilla.Endpoint; import com.vaadin.hilla.EndpointController; import com.vaadin.hilla.engine.EngineConfiguration; @@ -35,36 +30,6 @@ public class NodeTasksEndpointTest extends TaskTest { public static class ConnectEndpointsForTesting { } - @Endpoint - public class MyEndpoint { - public void foo(String bar) { - } - - public String bar(String baz) { - return baz; - } - } - - @Endpoint(value = "CustomEndpointName") - public class CustomEndpoint { - public void foo(String bar) { - } - - public String bar(String baz) { - return baz; - } - } - - @Endpoint("WithoutValueEqual") - public class EndpointNoValue { - public void foo(String bar) { - } - - public String bar(String baz) { - return baz; - } - } - @BeforeEach public void setUp() throws IOException, NoSuchFieldException, IllegalAccessException { @@ -78,18 +43,6 @@ public void setUp() EndpointController.class, ConnectEndpointsForTesting.class))) .when(mockLookup).lookup(ClassFinder.class); - var mockApplicationContext = Mockito.mock(ApplicationContext.class); - Mockito.doReturn(Map.of("MyEndpoint", new MyEndpoint(), - "CustomEndpointName", CustomEndpoint.class, "WithoutValueEqual", - EndpointNoValue.class)).when(mockApplicationContext) - .getBeansWithAnnotation(Endpoint.class); - Mockito.doReturn(Map.of()).when(mockApplicationContext) - .getBeansWithAnnotation(BrowserCallable.class); - var applicationContextField = ApplicationContextProvider.class - .getDeclaredField("applicationContext"); - applicationContextField.setAccessible(true); - applicationContextField.set(null, mockApplicationContext); - options = new Options(mockLookup, getTemporaryDirectory().toFile()) .withFrontendDirectory(getTemporaryDirectory() .resolve(getFrontendDirectory()).toFile()) @@ -103,8 +56,6 @@ public void setUp() .withJarFrontendResourcesFolder(getTemporaryDirectory() .resolve("jar-resources").toFile()); - EngineConfiguration.getDefault().setBuildDir(getBuildDirectory()); - createIndexFile(); } @@ -126,11 +77,12 @@ public void should_GenerateEndpointFilesInDevBuildTask() throws Exception { public void should_GenerateEndpointFilesInProductionBuildTask() throws Exception { options = options.withProductionMode(true); - EngineConfiguration.getDefault() - .setOfflineEndpointProvider(() -> List.of(MyEndpoint.class)); + var engineConfiguration = new EngineConfiguration.Builder() + .offlineEndpointProvider(() -> List.of(MyEndpoint.class)) + .create(); + EngineConfiguration.setDefault(engineConfiguration); new NodeTasks(options).execute(); - EngineConfiguration.getDefault().setOfflineEndpointProvider(null); assertEndpointFilesInProductionMode(true); } @@ -142,7 +94,7 @@ public void should_GenerateEndpointFilesInDevServerTask() throws Exception { } private void assertEndpointFiles(boolean shouldExist) { - Arrays.asList("target/hilla-openapi.json", + Arrays.asList("build/hilla-openapi.json", "api/connect-client.default.ts", "api/MyEndpoint.ts") .forEach(name -> assertEquals(shouldExist, new File(getTemporaryDirectory().toFile(), name) @@ -152,7 +104,7 @@ private void assertEndpointFiles(boolean shouldExist) { } private void assertEndpointFilesInProductionMode(boolean shouldExist) { - Arrays.asList("target/classes/hilla-openapi.json", + Arrays.asList("build/classes/hilla-openapi.json", "api/connect-client.default.ts", "api/MyEndpoint.ts") .forEach(name -> assertEquals(shouldExist, new File(getTemporaryDirectory().toFile(), name) diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateEndpointTest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateEndpointTest.java index d0cd4e47e4..e8193b3e4f 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateEndpointTest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateEndpointTest.java @@ -31,8 +31,8 @@ public void setUp() throws IOException, URISyntaxException { .toURI()); Files.createDirectories(getOpenAPIFile().getParent()); Files.copy(referenceOpenAPIJsonFile, getOpenAPIFile()); - outputDirectory = Files - .createDirectory(getTemporaryDirectory().resolve("output")); + outputDirectory = Files.createDirectory( + getTemporaryDirectory().resolve(getOutputDirectory())); } @Test @@ -47,9 +47,7 @@ public void should_generate_Two_TypeScriptFiles() throws Exception { assertFalse(client.exists()); taskGenerateEndpoint = new TaskGenerateEndpointImpl( - getTemporaryDirectory().toFile(), getBuildDirectory(), - outputDirectory.toFile(), getClass()::getResource, false, - "node"); + getEngineConfiguration()); taskGenerateEndpoint.execute(); assertTrue(ts1.exists()); @@ -82,9 +80,7 @@ public void should_use_custom_endpoint_name_when_connect_client_exists() assertTrue(customConnectClient.exists()); taskGenerateEndpoint = new TaskGenerateEndpointImpl( - getTemporaryDirectory().toFile(), getBuildDirectory(), - outputDirectory.toFile(), getClass()::getResource, false, - "node"); + getEngineConfiguration()); taskGenerateEndpoint.execute(); assertTrue(ts1.exists()); diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateOpenAPITest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateOpenAPITest.java index eeb37fd248..5fed4bd0a3 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateOpenAPITest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskGenerateOpenAPITest.java @@ -16,16 +16,20 @@ package com.vaadin.hilla.internal; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.hasKey; -import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.*; import static org.junit.jupiter.api.Assertions.assertEquals; +import com.vaadin.hilla.ApplicationContextProvider; +import com.vaadin.hilla.internal.fixtures.CustomEndpoint; +import com.vaadin.hilla.internal.fixtures.EndpointNoValue; +import com.vaadin.hilla.internal.fixtures.MyEndpoint; import org.junit.jupiter.api.Test; import com.vaadin.flow.server.frontend.TaskGenerateOpenAPI; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.parser.OpenAPIV3Parser; +import org.springframework.boot.test.context.SpringBootTest; /** * This test suite is only for triggering the OpenAPI generator. For the actual @@ -40,53 +44,47 @@ public class TaskGenerateOpenAPITest extends TaskTest { public void should_UseCustomEndpointNameWithoutValueEqual_InsteadOf_UsingClassName() throws Exception { taskGenerateOpenApi = new TaskGenerateOpenAPIImpl( - getTemporaryDirectory().toFile(), getBuildDirectory(), - getTemporaryDirectory().resolve(getOutputDirectory()).toFile(), - getClass()::getResource, false); + getEngineConfiguration()); taskGenerateOpenApi.execute(); var generatedOpenAPI = getGeneratedOpenAPI(); - assertThat(generatedOpenAPI.getPaths(), - hasKey("/WithoutValueEqual/bar")); - assertThat(generatedOpenAPI.getPaths(), - not(hasKey("/EndpointNoValue/bar"))); - assertThat(generatedOpenAPI.getPaths(), - hasKey("/WithoutValueEqual/foo")); - assertThat(generatedOpenAPI.getPaths(), - not(hasKey("/EndpointNoValue/foo"))); + assertThat(generatedOpenAPI.getPaths().keySet(), + hasItem("/WithoutValueEqual/bar")); + assertThat(generatedOpenAPI.getPaths().keySet(), + not(hasItem("/EndpointNoValue/bar"))); + assertThat(generatedOpenAPI.getPaths().keySet(), + hasItem("/WithoutValueEqual/foo")); + assertThat(generatedOpenAPI.getPaths().keySet(), + not(hasItem("/EndpointNoValue/foo"))); } @Test public void should_UseCustomEndpointName_InsteadOf_UsingClassName() throws Exception { taskGenerateOpenApi = new TaskGenerateOpenAPIImpl( - getTemporaryDirectory().toFile(), getBuildDirectory(), - getTemporaryDirectory().resolve(getOutputDirectory()).toFile(), - getClass()::getResource, false); + getEngineConfiguration()); taskGenerateOpenApi.execute(); var generatedOpenAPI = getGeneratedOpenAPI(); - assertThat(generatedOpenAPI.getPaths(), - hasKey("/CustomEndpointName/bar")); - assertThat(generatedOpenAPI.getPaths(), - not(hasKey("/CustomEndpoint/bar"))); - assertThat(generatedOpenAPI.getPaths(), - hasKey("/CustomEndpointName/foo")); - assertThat(generatedOpenAPI.getPaths(), - not(hasKey("/CustomEndpoint/foo"))); + assertThat(generatedOpenAPI.getPaths().keySet(), + hasItem("/CustomEndpointName/bar")); + assertThat(generatedOpenAPI.getPaths().keySet(), + not(hasItem("/CustomEndpoint/bar"))); + assertThat(generatedOpenAPI.getPaths().keySet(), + hasItem("/CustomEndpointName/foo")); + assertThat(generatedOpenAPI.getPaths().keySet(), + not(hasItem("/CustomEndpoint/foo"))); } @Test public void should_UseDefaultProperties_when_applicationPropertiesIsEmpty() throws Exception { taskGenerateOpenApi = new TaskGenerateOpenAPIImpl( - getTemporaryDirectory().toFile(), getBuildDirectory(), - getTemporaryDirectory().resolve(getOutputDirectory()).toFile(), - getClass()::getResource, false); + getEngineConfiguration()); taskGenerateOpenApi.execute(); diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java index a958cef42e..68b36cd50b 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/TaskTest.java @@ -3,7 +3,6 @@ import static com.vaadin.flow.server.frontend.FrontendUtils.PARAM_FRONTEND_DIR; import java.io.IOException; -import java.lang.reflect.InvocationTargetException; import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; @@ -28,10 +27,7 @@ public class TaskTest { @BeforeEach public void setUpTaskApplication() throws IOException, URISyntaxException, - FrontendUtils.CommandExecutionException, InterruptedException, - InvocationTargetException, NoSuchMethodException, - InstantiationException, IllegalAccessException, - NoSuchFieldException { + FrontendUtils.CommandExecutionException, InterruptedException { temporaryDirectory = Files.createTempDirectory(getClass().getName()); temporaryDirectory.toFile().deleteOnExit(); var userDir = temporaryDirectory.toAbsolutePath().toString(); @@ -80,11 +76,11 @@ public void tearDownTaskApplication() throws IOException { } protected String getBuildDirectory() { - return "target"; + return "build"; } protected String getClassesDirectory() { - return "target/classes"; + return "build/classes"; } protected Path getOpenAPIFile() { @@ -103,4 +99,10 @@ protected String getOutputDirectory() { protected Path getTemporaryDirectory() { return temporaryDirectory; } + + protected EngineConfiguration getEngineConfiguration() { + return new EngineConfiguration.Builder() + .baseDir(getTemporaryDirectory()).buildDir(getBuildDirectory()) + .outputDir(getOutputDirectory()).create(); + } } diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/CustomEndpoint.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/CustomEndpoint.java index 65539937c7..c172517e24 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/CustomEndpoint.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/CustomEndpoint.java @@ -1,8 +1,11 @@ package com.vaadin.hilla.internal.fixtures; +import com.vaadin.hilla.Endpoint; + /** * A test class. */ +@Endpoint(value = "CustomEndpointName") public class CustomEndpoint { /** diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/EndpointNoValue.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/EndpointNoValue.java index 1b7ec0c325..7d79a7c9d5 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/EndpointNoValue.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/EndpointNoValue.java @@ -1,8 +1,11 @@ package com.vaadin.hilla.internal.fixtures; +import com.vaadin.hilla.Endpoint; + /** * A test class. */ +@Endpoint("WithoutValueEqual") public class EndpointNoValue { /** diff --git a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/MyEndpoint.java b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/MyEndpoint.java index 2e1b9a284b..47f245bb4e 100644 --- a/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/MyEndpoint.java +++ b/packages/java/engine-runtime/src/test/java/com/vaadin/hilla/internal/fixtures/MyEndpoint.java @@ -1,8 +1,11 @@ package com.vaadin.hilla.internal.fixtures; +import com.vaadin.hilla.BrowserCallable; + /** * A test class. */ +@BrowserCallable public class MyEndpoint { /** diff --git a/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineBuildFrontendTask.kt b/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineBuildFrontendTask.kt index c8e0e47b6d..627db6ff0d 100644 --- a/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineBuildFrontendTask.kt +++ b/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineBuildFrontendTask.kt @@ -46,12 +46,15 @@ public open class EngineBuildFrontendTask : com.vaadin.gradle.VaadinBuildFronten @TaskAction public fun exec() { - var engineConfiguration = EngineConfiguration.getDefault() - engineConfiguration.classpath = classpathElements.map { Path.of(it) }.toSet() - engineConfiguration.groupId = groupId - engineConfiguration.artifactId = artifactId - engineConfiguration.mainClass = mainClass - engineConfiguration.buildDir = buildDir.toPath() + var engineConfiguration = EngineConfiguration.Builder() + .classpath(classpathElements) + .groupId(groupId) + .artifactId(artifactId) + .mainClass(mainClass) + .buildDir(buildDir.toPath()) + .create() + + EngineConfiguration.setDefault(engineConfiguration) super.vaadinBuildFrontend() } diff --git a/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineGenerateTask.kt b/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineGenerateTask.kt index 9a879554ad..757d9298ff 100644 --- a/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineGenerateTask.kt +++ b/packages/java/gradle-plugin/src/main/kotlin/com/vaadin/hilla/gradle/plugin/EngineGenerateTask.kt @@ -22,12 +22,12 @@ import org.gradle.api.GradleException import org.gradle.api.tasks.TaskAction import org.gradle.api.tasks.bundling.Jar import java.io.IOException -import java.net.URL -import java.net.URLClassLoader import java.nio.file.Path -import java.util.* import com.vaadin.hilla.engine.* +import org.gradle.api.tasks.Input +import org.gradle.api.tasks.Optional + /** * Task that generates the endpoints.ts and model TS classes * needed for calling the backend in a typesafe manner. @@ -45,6 +45,16 @@ public open class EngineGenerateTask : DefaultTask() { } } + @Input + public val groupId: String = project.group.toString() + + @Input + public val artifactId: String = project.name + + @Input + @Optional + public var mainClass: String? = project.findProperty("spring-boot.aot.main-class") as String? + @TaskAction public fun engineGenerate() { val extension: EngineProjectExtension = EngineProjectExtension.get(project) @@ -56,18 +66,19 @@ public open class EngineGenerateTask : DefaultTask() { val buildDir: Path = baseDir.resolve(vaadinExtension.projectBuildDir.get()) try { - val conf: EngineConfiguration = Objects.requireNonNull( - EngineConfiguration.getDefault()) - - val urls = conf.classpath - .stream().map { classPathItem: Path -> - classPathItem.toUri().toURL() - } - .toList() - val isProductionMode = vaadinExtension.productionMode.getOrElse(false); - val parserProcessor = ParserProcessor(conf, isProductionMode) - val generatorProcessor = GeneratorProcessor(conf, extension.nodeCommand, isProductionMode) + val conf: EngineConfiguration = EngineConfiguration.Builder() + .baseDir(baseDir) + .buildDir(buildDir) + .outputDir(vaadinExtension.generatedTsFolder.get().toPath()) + .groupId(groupId) + .artifactId(artifactId) + .mainClass(mainClass) + .productionMode(isProductionMode) + .create() + + val parserProcessor = ParserProcessor(conf) + val generatorProcessor = GeneratorProcessor(conf) val endpoints = AotEndpointFinder(conf).findEndpointClasses() parserProcessor.process(endpoints) diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java index 4790762834..788bb8672b 100644 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/BuildFrontendMojo.java @@ -1,16 +1,10 @@ package com.vaadin.hilla.maven; -import java.io.File; -import java.nio.file.Path; -import java.util.List; -import java.util.stream.Collectors; - import com.vaadin.hilla.engine.EngineConfiguration; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import com.vaadin.flow.component.dependency.JavaScript; @@ -19,6 +13,7 @@ import com.vaadin.flow.server.Constants; import com.vaadin.flow.server.frontend.FrontendUtils; import com.vaadin.flow.theme.Theme; +import org.apache.maven.project.MavenProject; /** * Goal that builds the frontend bundle. @@ -41,30 +36,23 @@ @Mojo(name = "build-frontend", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, defaultPhase = LifecyclePhase.PROCESS_CLASSES) public class BuildFrontendMojo extends com.vaadin.flow.plugin.maven.BuildFrontendMojo { - @Parameter(defaultValue = "${project.compileClasspathElements}", readonly = true, required = true) - private List classpathElements; - - @Parameter(defaultValue = "${project.groupId}", readonly = true, required = true) - private String groupId; - - @Parameter(defaultValue = "${project.artifactId}", readonly = true, required = true) - private String artifactId; - - @Parameter(defaultValue = "${project.build.directory}", readonly = true, required = true) - private File buildDir; - - @Parameter(property = "spring-boot.aot.main-class") - private String mainClass; + // FIXME(platosha): Maven only supports parameters on a single class. + // @Parameter(property = "spring-boot.aot.main-class") + // private String mainClass; @Override public void execute() throws MojoExecutionException, MojoFailureException { - var conf = EngineConfiguration.getDefault(); - conf.setClasspath(classpathElements.stream().map(Path::of) - .collect(Collectors.toSet())); - conf.setGroupId(groupId); - conf.setArtifactId(artifactId); - conf.setMainClass(mainClass); - conf.setBuildDir(buildDir.toPath()); + var project = (MavenProject) getPluginContext().get("project"); + if (project == null) { + throw new MojoExecutionException("No project found"); + } + EngineConfiguration.setDefault(new EngineConfiguration.Builder() + .baseDir(npmFolder().toPath()).buildDir(buildFolder()) + .outputDir(generatedTsFolder().toPath()) + .groupId(project.getGroupId()) + .artifactId(project.getArtifactId()) + // .mainClass(mainClass) + .create()); super.execute(); } } diff --git a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java index 615342e44e..13ff19550c 100644 --- a/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java +++ b/packages/java/maven-plugin/src/main/java/com/vaadin/hilla/maven/EngineGenerateMojo.java @@ -1,11 +1,8 @@ package com.vaadin.hilla.maven; -import java.io.IOException; -import java.net.URL; -import java.net.URLClassLoader; -import java.util.ArrayList; +import java.io.File; -import com.vaadin.hilla.engine.AotEndpointFinder; +import com.vaadin.flow.server.ExecutionFailedException; import org.apache.maven.model.Profile; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugins.annotations.LifecyclePhase; @@ -21,18 +18,33 @@ import com.vaadin.hilla.engine.ParserException; import com.vaadin.hilla.engine.ParserProcessor; +import static com.vaadin.flow.server.frontend.FrontendUtils.FRONTEND; +import static com.vaadin.flow.server.frontend.FrontendUtils.GENERATED; + /** * Maven Plugin for Hilla. Handles parsing Java bytecode and generating * TypeScript code from it. */ @Mojo(name = "generate", defaultPhase = LifecyclePhase.PROCESS_CLASSES, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) public final class EngineGenerateMojo extends AbstractMojo { + /** + * A directory with project's frontend source files. + */ + @Parameter(defaultValue = "${project.basedir}/src/main/" + FRONTEND) + private File frontendDirectory; + + @Parameter(defaultValue = "${null}") + private File generatedTsFolder; @Parameter(defaultValue = "node") private String nodeCommand; - @Parameter(defaultValue = "${project}", readonly = true) + + @Parameter(defaultValue = "${project}", readonly = true, required = true) private MavenProject project; + @Parameter(property = "spring-boot.aot.main-class") + private String mainClass; + @Override public void execute() throws EngineGenerateMojoException { if (!FlowModeAbstractMojo.isHillaAvailable(project)) { @@ -44,21 +56,33 @@ public void execute() throws EngineGenerateMojoException { return; } try { - var conf = EngineConfiguration.getDefault(); var isProduction = project.getActiveProfiles().stream() .map(Profile::getId).anyMatch("production"::equals); - var parserProcessor = new ParserProcessor(conf, isProduction); - var generatorProcessor = new GeneratorProcessor(conf, nodeCommand, - isProduction); + var conf = new EngineConfiguration.Builder() + .baseDir(project.getBasedir().toPath()) + .buildDir(project.getBuild().getDirectory()) + .outputDir(generatedTsFolder().toPath()) + .groupId(project.getGroupId()) + .artifactId(project.getArtifactId()).mainClass(mainClass) + .productionMode(isProduction).create(); + var parserProcessor = new ParserProcessor(conf); + var generatorProcessor = new GeneratorProcessor(conf); - var endpoints = new AotEndpointFinder(conf).findEndpointClasses(); + var endpoints = conf.getOfflineEndpointProvider().findEndpoints(); parserProcessor.process(endpoints); generatorProcessor.process(); - } catch (IOException | InterruptedException e) { + } catch (ExecutionFailedException e) { throw new EngineGenerateMojoException("Endpoint collection failed", e); } catch (GeneratorException | ParserException e) { throw new EngineGenerateMojoException("Execution failed", e); } } + + private File generatedTsFolder() { + if (generatedTsFolder != null) { + return generatedTsFolder; + } + return new File(frontendDirectory, GENERATED); + } } diff --git a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java index b872e1e13c..bb164eb754 100644 --- a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java +++ b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/AbstractMojoTest.java @@ -5,6 +5,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.Comparator; +import java.util.List; import java.util.Objects; import java.util.Set; @@ -50,8 +51,9 @@ public void setUpMojoTest() throws Exception { // Maven project is not initialized on the mojo, setup a mock manually project = createMavenProject(); - engineConfiguration = EngineConfiguration.getDefault(); - engineConfiguration.setBaseDir(getTemporaryDirectory()); + engineConfiguration = new EngineConfiguration.Builder() + .offlineEndpointProvider(() -> List.of()).create(); + EngineConfiguration.setDefault(engineConfiguration); } @AfterEach diff --git a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineGenerateMojoTest.java b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineGenerateMojoTest.java index 87b4dfc0c3..924ec6e545 100644 --- a/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineGenerateMojoTest.java +++ b/packages/java/maven-plugin/src/test/java/com/vaadin/hilla/maven/EngineGenerateMojoTest.java @@ -25,42 +25,26 @@ public void should_RunParserAndGenerator() throws Exception { Mockito.withSettings().defaultAnswer(Answers.RETURNS_SELF), (mock, context) -> { // Verify ParserProcessor constructor arguments - assertEquals(2, context.arguments().size(), - "expected 2 ParserProcessor arguments"); + assertEquals(1, context.arguments().size(), + "expected 1 ParserProcessor argument"); // Verify configuration argument var conf = (EngineConfiguration) context.arguments().get(0); - assertEquals(conf, getEngineConfiguration()); - - // Verify class loader argument - var classLoader = (ClassLoader) context.arguments().get(1); - assertInstanceOf(URLClassLoader.class, classLoader); - assertEquals(classLoader.getParent(), - EngineGenerateMojo.class.getClassLoader()); - assertArrayEquals( - new URL[] { getTemporaryDirectory() - .resolve("build/classes").toUri().toURL(), - getTemporaryDirectory() - .resolve("build/test-classes") - .toUri().toURL() }, - ((URLClassLoader) classLoader).getURLs()); + verifyConfiguration(conf); }); var mockedConstructionGenerator = Mockito.mockConstruction( GeneratorProcessor.class, Mockito.withSettings() .defaultAnswer(Answers.RETURNS_SELF), ((mock, context) -> { // Verify GeneratorProcessor arguments - assertEquals(3, context.arguments().size(), - "expected 3 GeneratorProcessor arguments"); + assertEquals(1, context.arguments().size(), + "expected 1 GeneratorProcessor argument"); // Verify configuration argument var conf = (EngineConfiguration) context.arguments() .get(0); - assertEquals(conf, getEngineConfiguration()); - })); - - var mockedStaticEngineConfiguration = Mockito - .mockStatic(EngineConfiguration.class)) { + verifyConfiguration(conf); + }));) { // Lookup and initialize mojo var engineGenerateMojo = (EngineGenerateMojo) lookupMojo("generate", @@ -83,4 +67,10 @@ public void should_RunParserAndGenerator() throws Exception { inOrder.verify(generatorProcessor).process(); } } + + private void verifyConfiguration(EngineConfiguration conf) { + assertEquals(conf.getBaseDir(), getTemporaryDirectory()); + assertEquals(conf.getOpenAPIFile(), getTemporaryDirectory() + .resolve("build").resolve("hilla-openapi.json")); + } } diff --git a/packages/java/tests/spring/endpoints discovery/package-lock.json b/packages/java/tests/spring/endpoints discovery/package-lock.json index c514b981f7..e73c979f5d 100644 --- a/packages/java/tests/spring/endpoints discovery/package-lock.json +++ b/packages/java/tests/spring/endpoints discovery/package-lock.json @@ -10,13 +10,13 @@ "@vaadin/common-frontend": "0.0.19", "@vaadin/hilla-frontend": "file:../../../../ts/frontend", "@vaadin/hilla-lit-form": "file:../../../../ts/lit-form", - "@vaadin/icon": "24.6.0-alpha8", - "@vaadin/icons": "24.6.0-alpha8", - "@vaadin/polymer-legacy-adapter": "24.6.0-alpha8", + "@vaadin/icon": "24.6.0-beta1", + "@vaadin/icons": "24.6.0-beta1", + "@vaadin/polymer-legacy-adapter": "24.6.0-beta1", "@vaadin/router": "2.0.0", - "@vaadin/tooltip": "24.6.0-alpha8", - "@vaadin/vaadin-lumo-styles": "24.6.0-alpha8", - "@vaadin/vaadin-themable-mixin": "24.6.0-alpha8", + "@vaadin/tooltip": "24.6.0-beta1", + "@vaadin/vaadin-lumo-styles": "24.6.0-beta1", + "@vaadin/vaadin-themable-mixin": "24.6.0-beta1", "construct-style-sheets-polyfill": "3.1.0", "lit": "3.2.1" }, @@ -52,7 +52,7 @@ }, "../../../../ts/frontend": { "name": "@vaadin/hilla-frontend", - "version": "24.6.0-alpha4", + "version": "24.6.0-alpha5", "license": "Apache-2.0", "dependencies": { "@vaadin/common-frontend": "^0.0.19", @@ -83,12 +83,12 @@ }, "../../../../ts/generator-cli": { "name": "@vaadin/hilla-generator-cli", - "version": "24.6.0-alpha4", + "version": "24.6.0-alpha5", "dev": true, "license": "Apache 2.0", "dependencies": { - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-utils": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-utils": "24.6.0-alpha5", "get-stdin": "^9.0.0", "meow": "^12.1.1" }, @@ -102,7 +102,7 @@ "@types/node": "^20.7.1", "@types/sinon": "^10.0.17", "@types/sinon-chai": "^3.2.10", - "@vaadin/hilla-generator-core": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", "c8": "^10.1.2", "chai": "^4.3.10", "chai-as-promised": "^7.1.1", @@ -121,12 +121,12 @@ }, "../../../../ts/generator-core": { "name": "@vaadin/hilla-generator-core", - "version": "24.6.0-alpha4", + "version": "24.6.0-alpha5", "dev": true, "license": "Apache 2.0", "dependencies": { "@apidevtools/swagger-parser": "^10.1.0", - "@vaadin/hilla-generator-utils": "24.6.0-alpha4", + "@vaadin/hilla-generator-utils": "24.6.0-alpha5", "meow": "^12.1.1", "openapi-types": "^12.1.3", "typescript": "5.6.2" @@ -153,13 +153,13 @@ }, "../../../../ts/generator-plugin-backbone": { "name": "@vaadin/hilla-generator-plugin-backbone", - "version": "24.6.0-alpha4", + "version": "24.6.0-alpha5", "dev": true, "license": "Apache 2.0", "dependencies": { - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha4", - "@vaadin/hilla-generator-utils": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha5", + "@vaadin/hilla-generator-utils": "24.6.0-alpha5", "fast-deep-equal": "^3.1.3", "openapi-types": "^12.1.3", "typescript": "5.6.2" @@ -170,8 +170,8 @@ "@types/node": "^20.7.1", "@types/sinon": "^10.0.17", "@types/sinon-chai": "^3.2.10", - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha5", "c8": "^10.1.2", "chai": "^4.3.10", "concurrently": "^8.2.1", @@ -189,13 +189,13 @@ }, "../../../../ts/generator-plugin-barrel": { "name": "@vaadin/hilla-generator-plugin-barrel", - "version": "24.6.0-alpha4", + "version": "24.6.0-alpha5", "dev": true, "license": "Apache 2.0", "dependencies": { - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-backbone": "24.6.0-alpha4", - "@vaadin/hilla-generator-utils": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-backbone": "24.6.0-alpha5", + "@vaadin/hilla-generator-utils": "24.6.0-alpha5", "typescript": "5.6.2" }, "devDependencies": { @@ -204,8 +204,8 @@ "@types/node": "^20.7.1", "@types/sinon": "^10.0.17", "@types/sinon-chai": "^3.2.10", - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-backbone": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-backbone": "24.6.0-alpha5", "c8": "^10.1.2", "chai": "^4.3.10", "concurrently": "^8.2.1", @@ -223,12 +223,12 @@ }, "../../../../ts/generator-plugin-client": { "name": "@vaadin/hilla-generator-plugin-client", - "version": "24.6.0-alpha4", + "version": "24.6.0-alpha5", "dev": true, "license": "Apache 2.0", "dependencies": { - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-utils": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-utils": "24.6.0-alpha5", "typescript": "5.6.2" }, "devDependencies": { @@ -237,7 +237,7 @@ "@types/node": "^20.7.1", "@types/sinon": "^10.0.17", "@types/sinon-chai": "^3.2.10", - "@vaadin/hilla-generator-core": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", "c8": "^10.1.2", "chai": "^4.3.10", "concurrently": "^8.2.1", @@ -255,14 +255,14 @@ }, "../../../../ts/generator-plugin-model": { "name": "@vaadin/hilla-generator-plugin-model", - "version": "24.6.0-alpha4", + "version": "24.6.0-alpha5", "dev": true, "license": "Apache 2.0", "dependencies": { - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-backbone": "24.6.0-alpha4", - "@vaadin/hilla-generator-utils": "24.6.0-alpha4", - "@vaadin/hilla-lit-form": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-backbone": "24.6.0-alpha5", + "@vaadin/hilla-generator-utils": "24.6.0-alpha5", + "@vaadin/hilla-lit-form": "24.6.0-alpha5", "fast-deep-equal": "^3.1.3", "openapi-types": "^12.1.3", "typescript": "5.6.2" @@ -273,8 +273,8 @@ "@types/node": "^20.7.1", "@types/sinon": "^10.0.17", "@types/sinon-chai": "^3.2.10", - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha5", "c8": "^10.1.2", "chai": "^4.3.10", "concurrently": "^8.2.1", @@ -292,13 +292,13 @@ }, "../../../../ts/generator-plugin-push": { "name": "@vaadin/hilla-generator-plugin-push", - "version": "24.6.0-alpha4", + "version": "24.6.0-alpha5", "dev": true, "license": "Apache 2.0", "dependencies": { - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha4", - "@vaadin/hilla-generator-utils": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha5", + "@vaadin/hilla-generator-utils": "24.6.0-alpha5", "fast-deep-equal": "^3.1.3", "openapi-types": "^12.1.3", "typescript": "5.6.2" @@ -309,8 +309,8 @@ "@types/node": "^20.7.1", "@types/sinon": "^10.0.17", "@types/sinon-chai": "^3.2.10", - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha5", "c8": "^10.1.2", "chai": "^4.3.10", "concurrently": "^8.2.1", @@ -328,14 +328,14 @@ }, "../../../../ts/generator-plugin-signals": { "name": "@vaadin/hilla-generator-plugin-signals", - "version": "24.6.0-alpha4", + "version": "24.6.0-alpha5", "dev": true, "license": "Apache 2.0", "dependencies": { - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-backbone": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha4", - "@vaadin/hilla-generator-utils": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-backbone": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha5", + "@vaadin/hilla-generator-utils": "24.6.0-alpha5", "fast-deep-equal": "^3.1.3", "iterator-helpers-polyfill": "^3.0.1", "openapi-types": "^12.1.3", @@ -347,8 +347,8 @@ "@types/node": "^20.7.1", "@types/sinon": "^10.0.17", "@types/sinon-chai": "^3.2.10", - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha5", "c8": "^8.0.1", "chai": "^4.3.10", "concurrently": "^8.2.1", @@ -365,14 +365,14 @@ }, "../../../../ts/generator-plugin-subtypes": { "name": "@vaadin/hilla-generator-plugin-subtypes", - "version": "24.6.0-alpha4", + "version": "24.6.0-alpha5", "dev": true, "license": "Apache 2.0", "dependencies": { - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-model": "24.6.0-alpha4", - "@vaadin/hilla-generator-utils": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-model": "24.6.0-alpha5", + "@vaadin/hilla-generator-utils": "24.6.0-alpha5", "fast-deep-equal": "^3.1.3", "openapi-types": "^12.1.3", "typescript": "5.6.2" @@ -383,9 +383,9 @@ "@types/node": "^20.7.1", "@types/sinon": "^10.0.17", "@types/sinon-chai": "^3.2.10", - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-model": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-model": "24.6.0-alpha5", "c8": "^10.1.2", "chai": "^4.3.10", "concurrently": "^8.2.1", @@ -403,7 +403,7 @@ }, "../../../../ts/generator-utils": { "name": "@vaadin/hilla-generator-utils", - "version": "24.6.0-alpha4", + "version": "24.6.0-alpha5", "dev": true, "license": "Apache 2.0", "dependencies": { @@ -460,10 +460,10 @@ }, "../../../../ts/lit-form": { "name": "@vaadin/hilla-lit-form", - "version": "24.6.0-alpha4", + "version": "24.6.0-alpha5", "license": "Apache-2.0", "dependencies": { - "@vaadin/hilla-frontend": "24.6.0-alpha4", + "@vaadin/hilla-frontend": "24.6.0-alpha5", "validator": "^13.11.0" }, "devDependencies": { @@ -3554,13 +3554,14 @@ "integrity": "sha512-IDaobHimLQhjwsQ/NMwRVfa/yL7L/wriQPMhw1ZJall0KX6E1oxk29XMDeilW5qTIg5aoiqf5Udy8U/51aNoQQ==" }, "node_modules/@vaadin/a11y-base": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/a11y-base/-/a11y-base-24.6.0-alpha8.tgz", - "integrity": "sha512-dCVgfB06VzTXlAstWcrnPeL+LolwhP1/HKLblTm13U/qvaAQ1IogI8jJFkyA+HeDBKmVYX1C2oYheU62491W9w==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/a11y-base/-/a11y-base-24.6.0-beta1.tgz", + "integrity": "sha512-gDi+sUvPM3XAYkg6O9Sai51T7M6KvBTkCg5WSvkTZOVoLJcbV7PgKv5Ah8njoJ3UmFweEWmxhjB1aGDv68dNiw==", + "license": "Apache-2.0", "dependencies": { "@open-wc/dedupe-mixin": "^1.3.0", "@polymer/polymer": "^3.0.0", - "@vaadin/component-base": "24.6.0-alpha8", + "@vaadin/component-base": "24.6.0-beta1", "lit": "^3.0.0" } }, @@ -3576,9 +3577,10 @@ } }, "node_modules/@vaadin/component-base": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/component-base/-/component-base-24.6.0-alpha8.tgz", - "integrity": "sha512-vRFjnBUq8VQ2elNUbTwl9+LFxb6wvdwzHWFEd2AK/Xhi25IoaFM+B0+zlZM4O7FunqOvYIiOMzfz5vPrk8vG8w==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/component-base/-/component-base-24.6.0-beta1.tgz", + "integrity": "sha512-69qMnRU49CnN1Zbf6SaCpSlZgySY4h8frkOvtW24GkMKprXBoSuWcKsUBXgR/xCMnwYM3KpJbbTVpqLqN6TCpw==", + "license": "Apache-2.0", "dependencies": { "@open-wc/dedupe-mixin": "^1.3.0", "@polymer/polymer": "^3.0.0", @@ -3636,73 +3638,79 @@ "link": true }, "node_modules/@vaadin/icon": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/icon/-/icon-24.6.0-alpha8.tgz", - "integrity": "sha512-K+SPEL5FaS/KXtCN//6R4lpKFFuq8INoPksJPv6053slgSsDOicjZC9ip2Sg8Bc4ifaxhqBhI153m5WVJ5yRuQ==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/icon/-/icon-24.6.0-beta1.tgz", + "integrity": "sha512-p2MS1shPHDPK3TITvkb28o1+l4fbDrhSDjdMlk8krTm7daHoDp4QMpXpmR2CfRs8WE8ZgF4XW5jihoudAEfV1Q==", + "license": "Apache-2.0", "dependencies": { "@open-wc/dedupe-mixin": "^1.3.0", "@polymer/polymer": "^3.0.0", - "@vaadin/component-base": "24.6.0-alpha8", - "@vaadin/vaadin-lumo-styles": "24.6.0-alpha8", - "@vaadin/vaadin-themable-mixin": "24.6.0-alpha8", + "@vaadin/component-base": "24.6.0-beta1", + "@vaadin/vaadin-lumo-styles": "24.6.0-beta1", + "@vaadin/vaadin-themable-mixin": "24.6.0-beta1", "lit": "^3.0.0" } }, "node_modules/@vaadin/icons": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/icons/-/icons-24.6.0-alpha8.tgz", - "integrity": "sha512-MROcW+sRCkYSmHfxL91z9gB6q1EruAKu6crmBQaAlIOYEUtsR4egi/lvoK6QJlIJzPA7nyqjYDcwxWruf4nc7w==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/icons/-/icons-24.6.0-beta1.tgz", + "integrity": "sha512-Za/wfpcE3VUGoBlFVN2JyNdnjCq8QIzCNqLi2tc6LclnawaO+q1LwJiJkMXJ28DwIncLZnw6i1fFB8yxUlYSjg==", + "license": "Apache-2.0", "dependencies": { "@polymer/polymer": "^3.0.0", - "@vaadin/icon": "24.6.0-alpha8" + "@vaadin/icon": "24.6.0-beta1" } }, "node_modules/@vaadin/lit-renderer": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/lit-renderer/-/lit-renderer-24.6.0-alpha8.tgz", - "integrity": "sha512-qhucr9v4B6Kuz26YD5tmr2J7Ol286FXIopeVuReU+m67RN8dEe45g+ptz7bqxqYYhUR3wBZrZSoG3wwTX5zcoA==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/lit-renderer/-/lit-renderer-24.6.0-beta1.tgz", + "integrity": "sha512-GKFwglatwKne1j52HVF6kFZLUnnaJO+EhH8M9Ge4IIWMTlJRJljt6iWJaip9fnQ0KsEVaQL76WhI1PodW+NoZw==", + "license": "Apache-2.0", "dependencies": { "lit": "^3.0.0" } }, "node_modules/@vaadin/overlay": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/overlay/-/overlay-24.6.0-alpha8.tgz", - "integrity": "sha512-Pq2KeYFS4wCFzV1KvTsyD3Rbv6v0nuY9BVUBpWmBZIK2D4BlU/6KggEHpA835t6PJF4YK5GMQryCiABs6SUqKw==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/overlay/-/overlay-24.6.0-beta1.tgz", + "integrity": "sha512-ILnufqxXlAPWWSr/cz2XI0wvmTNTmC1qmBCIHDnRPT079GXxdH+u49mhfZYvqBKwOkpDwdihvcLvOU0BRcwkKg==", + "license": "Apache-2.0", "dependencies": { "@open-wc/dedupe-mixin": "^1.3.0", "@polymer/polymer": "^3.0.0", - "@vaadin/a11y-base": "24.6.0-alpha8", - "@vaadin/component-base": "24.6.0-alpha8", - "@vaadin/vaadin-lumo-styles": "24.6.0-alpha8", - "@vaadin/vaadin-material-styles": "24.6.0-alpha8", - "@vaadin/vaadin-themable-mixin": "24.6.0-alpha8", + "@vaadin/a11y-base": "24.6.0-beta1", + "@vaadin/component-base": "24.6.0-beta1", + "@vaadin/vaadin-lumo-styles": "24.6.0-beta1", + "@vaadin/vaadin-material-styles": "24.6.0-beta1", + "@vaadin/vaadin-themable-mixin": "24.6.0-beta1", "lit": "^3.0.0" } }, "node_modules/@vaadin/polymer-legacy-adapter": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/polymer-legacy-adapter/-/polymer-legacy-adapter-24.6.0-alpha8.tgz", - "integrity": "sha512-OSE9WBuVQ3M7XP2Zd1gpyGTSi6pUXVSvPffuMLNck3iLe2O9hd4t98A+SQB6QfQjcJjmEk+4F2jgyxw62SYFyA==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/polymer-legacy-adapter/-/polymer-legacy-adapter-24.6.0-beta1.tgz", + "integrity": "sha512-rn8kiRXl838X+N12l7LmlgohGCz698G2TkAfYoJjcBpfcbJtzxDmHwBuUgg+2yVTg0NGBICRFBITRaBR5Z6JGg==", + "license": "Apache-2.0", "dependencies": { "@polymer/polymer": "^3.0.0", - "@vaadin/vaadin-themable-mixin": "24.6.0-alpha8", + "@vaadin/vaadin-themable-mixin": "24.6.0-beta1", "lit": "^3.0.0" } }, "node_modules/@vaadin/popover": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/popover/-/popover-24.6.0-alpha8.tgz", - "integrity": "sha512-tKXvoodN67CZFKJgOwZKcJNXa41H55qDi76g+cdOYaRZ+KrfsSKjDFs1ZsBkymLYqVVOuyFaOFh7U/WtdyKf7g==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/popover/-/popover-24.6.0-beta1.tgz", + "integrity": "sha512-ZuwtLejdrqfGNAa6ViF4UxdLq4Vx80SkO5DreEDAcFRO5EjQQiQPiH0BK6lm8i5qhZQr7QWrDXm2hMVpwx6ADg==", + "license": "Apache-2.0", "dependencies": { "@open-wc/dedupe-mixin": "^1.3.0", - "@vaadin/a11y-base": "24.6.0-alpha8", - "@vaadin/component-base": "24.6.0-alpha8", - "@vaadin/lit-renderer": "24.6.0-alpha8", - "@vaadin/overlay": "24.6.0-alpha8", - "@vaadin/vaadin-lumo-styles": "24.6.0-alpha8", - "@vaadin/vaadin-material-styles": "24.6.0-alpha8", - "@vaadin/vaadin-themable-mixin": "24.6.0-alpha8", + "@vaadin/a11y-base": "24.6.0-beta1", + "@vaadin/component-base": "24.6.0-beta1", + "@vaadin/lit-renderer": "24.6.0-beta1", + "@vaadin/overlay": "24.6.0-beta1", + "@vaadin/vaadin-lumo-styles": "24.6.0-beta1", + "@vaadin/vaadin-material-styles": "24.6.0-beta1", + "@vaadin/vaadin-themable-mixin": "24.6.0-beta1", "lit": "^3.0.0" } }, @@ -3728,19 +3736,20 @@ } }, "node_modules/@vaadin/tooltip": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/tooltip/-/tooltip-24.6.0-alpha8.tgz", - "integrity": "sha512-5ZJu4bue9dMdp+R0xIaLEh2zyNwdJGyQ4a4osL1kZPiSE8gbhfAMuyOIzQmZ3Enhup0YVpMGqUI0+px/YpxnDg==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/tooltip/-/tooltip-24.6.0-beta1.tgz", + "integrity": "sha512-QS9mq/I2pVpsK++Wfitl0n9WQ/mz3ac1mH7DSpmKKzah7pIqCOmO1ap/XQ92ofST7GYxa65iQ4tSwAk2tLTBUg==", + "license": "Apache-2.0", "dependencies": { "@open-wc/dedupe-mixin": "^1.3.0", "@polymer/polymer": "^3.0.0", - "@vaadin/a11y-base": "24.6.0-alpha8", - "@vaadin/component-base": "24.6.0-alpha8", - "@vaadin/overlay": "24.6.0-alpha8", - "@vaadin/popover": "24.6.0-alpha8", - "@vaadin/vaadin-lumo-styles": "24.6.0-alpha8", - "@vaadin/vaadin-material-styles": "24.6.0-alpha8", - "@vaadin/vaadin-themable-mixin": "24.6.0-alpha8", + "@vaadin/a11y-base": "24.6.0-beta1", + "@vaadin/component-base": "24.6.0-beta1", + "@vaadin/overlay": "24.6.0-beta1", + "@vaadin/popover": "24.6.0-beta1", + "@vaadin/vaadin-lumo-styles": "24.6.0-beta1", + "@vaadin/vaadin-material-styles": "24.6.0-beta1", + "@vaadin/vaadin-themable-mixin": "24.6.0-beta1", "lit": "^3.0.0" } }, @@ -3750,30 +3759,33 @@ "integrity": "sha512-N6a5nLT/ytEUlpPo+nvdCKIGoyNjPsj3rzPGvGYK8x9Ceg76OTe1xI/GtN71mRW9e2HUScR0kCNOkl1Z63YDjw==" }, "node_modules/@vaadin/vaadin-lumo-styles": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/vaadin-lumo-styles/-/vaadin-lumo-styles-24.6.0-alpha8.tgz", - "integrity": "sha512-/XNt5Ago7TpZcYbxyIRVlX+3KhG7quV6ssOJ7oWHJelrWYEjLWy0ZTHaS5iTamvAq6lOapytuFbO5/sy+z/mUA==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/vaadin-lumo-styles/-/vaadin-lumo-styles-24.6.0-beta1.tgz", + "integrity": "sha512-0o0lqHy9jP6ZakC4NXcw/fnsqVo56GSJsysIaQalb4KDThHl1XSUT+QeIgUvfqvVLnLzjF1CjoEK+K7NM0luuQ==", + "license": "Apache-2.0", "dependencies": { "@polymer/polymer": "^3.0.0", - "@vaadin/component-base": "24.6.0-alpha8", - "@vaadin/icon": "24.6.0-alpha8", - "@vaadin/vaadin-themable-mixin": "24.6.0-alpha8" + "@vaadin/component-base": "24.6.0-beta1", + "@vaadin/icon": "24.6.0-beta1", + "@vaadin/vaadin-themable-mixin": "24.6.0-beta1" } }, "node_modules/@vaadin/vaadin-material-styles": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/vaadin-material-styles/-/vaadin-material-styles-24.6.0-alpha8.tgz", - "integrity": "sha512-ERNeJzZU4h2OjQg/nyU55jHfdMhdst0Sjcl+QTRLf/gNns0pdd7oCWoTZ9o5yNVwo5NAWa7UI3Ry+rOrl8hZ1g==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/vaadin-material-styles/-/vaadin-material-styles-24.6.0-beta1.tgz", + "integrity": "sha512-+TZ7AIKv6zT5FqKtcwoqjrvUk5Pfnt26wgVAFswUQf/sr0Ww+n+WVlPyE62lkRfWpXKPDTgsxOMlRAQcaROlog==", + "license": "Apache-2.0", "dependencies": { "@polymer/polymer": "^3.0.0", - "@vaadin/component-base": "24.6.0-alpha8", - "@vaadin/vaadin-themable-mixin": "24.6.0-alpha8" + "@vaadin/component-base": "24.6.0-beta1", + "@vaadin/vaadin-themable-mixin": "24.6.0-beta1" } }, "node_modules/@vaadin/vaadin-themable-mixin": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/vaadin-themable-mixin/-/vaadin-themable-mixin-24.6.0-alpha8.tgz", - "integrity": "sha512-qKtIYeeukUR5m3h1ASFhmFWHScLHjERPUmDPc66XTX7GWW5vYHv06yzKEzL7xEJx5AghUCQRHwWbE2Xo3EvqzA==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/vaadin-themable-mixin/-/vaadin-themable-mixin-24.6.0-beta1.tgz", + "integrity": "sha512-C/aGG+uA/esAFpswKM7yKIiNXn4Z65vJqV59XIHI1TANjhvmjjtIx9IdlmgV8FsqsgsnIYUPCJGhe4/QN5VPEw==", + "license": "Apache-2.0", "dependencies": { "@open-wc/dedupe-mixin": "^1.3.0", "lit": "^3.0.0" @@ -10253,13 +10265,13 @@ "integrity": "sha512-IDaobHimLQhjwsQ/NMwRVfa/yL7L/wriQPMhw1ZJall0KX6E1oxk29XMDeilW5qTIg5aoiqf5Udy8U/51aNoQQ==" }, "@vaadin/a11y-base": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/a11y-base/-/a11y-base-24.6.0-alpha8.tgz", - "integrity": "sha512-dCVgfB06VzTXlAstWcrnPeL+LolwhP1/HKLblTm13U/qvaAQ1IogI8jJFkyA+HeDBKmVYX1C2oYheU62491W9w==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/a11y-base/-/a11y-base-24.6.0-beta1.tgz", + "integrity": "sha512-gDi+sUvPM3XAYkg6O9Sai51T7M6KvBTkCg5WSvkTZOVoLJcbV7PgKv5Ah8njoJ3UmFweEWmxhjB1aGDv68dNiw==", "requires": { "@open-wc/dedupe-mixin": "^1.3.0", "@polymer/polymer": "3.5.2", - "@vaadin/component-base": "24.6.0-alpha8", + "@vaadin/component-base": "24.6.0-beta1", "lit": "3.2.1" } }, @@ -10272,9 +10284,9 @@ } }, "@vaadin/component-base": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/component-base/-/component-base-24.6.0-alpha8.tgz", - "integrity": "sha512-vRFjnBUq8VQ2elNUbTwl9+LFxb6wvdwzHWFEd2AK/Xhi25IoaFM+B0+zlZM4O7FunqOvYIiOMzfz5vPrk8vG8w==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/component-base/-/component-base-24.6.0-beta1.tgz", + "integrity": "sha512-69qMnRU49CnN1Zbf6SaCpSlZgySY4h8frkOvtW24GkMKprXBoSuWcKsUBXgR/xCMnwYM3KpJbbTVpqLqN6TCpw==", "requires": { "@open-wc/dedupe-mixin": "^1.3.0", "@polymer/polymer": "3.5.2", @@ -10316,8 +10328,8 @@ "@types/node": "^20.7.1", "@types/sinon": "^10.0.17", "@types/sinon-chai": "^3.2.10", - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-utils": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-utils": "24.6.0-alpha5", "c8": "^10.1.2", "chai": "^4.3.10", "chai-as-promised": "^7.1.1", @@ -10342,7 +10354,7 @@ "@types/node": "^20.7.1", "@types/sinon": "^10.0.17", "@types/sinon-chai": "^3.2.10", - "@vaadin/hilla-generator-utils": "24.6.0-alpha4", + "@vaadin/hilla-generator-utils": "24.6.0-alpha5", "c8": "^10.1.2", "chai": "^4.3.10", "concurrently": "^8.2.1", @@ -10365,9 +10377,9 @@ "@types/node": "^20.7.1", "@types/sinon": "^10.0.17", "@types/sinon-chai": "^3.2.10", - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha4", - "@vaadin/hilla-generator-utils": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha5", + "@vaadin/hilla-generator-utils": "24.6.0-alpha5", "c8": "^10.1.2", "chai": "^4.3.10", "concurrently": "^8.2.1", @@ -10391,9 +10403,9 @@ "@types/node": "^20.7.1", "@types/sinon": "^10.0.17", "@types/sinon-chai": "^3.2.10", - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-backbone": "24.6.0-alpha4", - "@vaadin/hilla-generator-utils": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-backbone": "24.6.0-alpha5", + "@vaadin/hilla-generator-utils": "24.6.0-alpha5", "c8": "^10.1.2", "chai": "^4.3.10", "concurrently": "^8.2.1", @@ -10415,8 +10427,8 @@ "@types/node": "^20.7.1", "@types/sinon": "^10.0.17", "@types/sinon-chai": "^3.2.10", - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-utils": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-utils": "24.6.0-alpha5", "c8": "^10.1.2", "chai": "^4.3.10", "concurrently": "^8.2.1", @@ -10438,11 +10450,11 @@ "@types/node": "^20.7.1", "@types/sinon": "^10.0.17", "@types/sinon-chai": "^3.2.10", - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-backbone": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha4", - "@vaadin/hilla-generator-utils": "24.6.0-alpha4", - "@vaadin/hilla-lit-form": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-backbone": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha5", + "@vaadin/hilla-generator-utils": "24.6.0-alpha5", + "@vaadin/hilla-lit-form": "24.6.0-alpha5", "c8": "^10.1.2", "chai": "^4.3.10", "concurrently": "^8.2.1", @@ -10466,9 +10478,9 @@ "@types/node": "^20.7.1", "@types/sinon": "^10.0.17", "@types/sinon-chai": "^3.2.10", - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha4", - "@vaadin/hilla-generator-utils": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha5", + "@vaadin/hilla-generator-utils": "24.6.0-alpha5", "c8": "^10.1.2", "chai": "^4.3.10", "concurrently": "^8.2.1", @@ -10492,10 +10504,10 @@ "@types/node": "^20.7.1", "@types/sinon": "^10.0.17", "@types/sinon-chai": "^3.2.10", - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-backbone": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha4", - "@vaadin/hilla-generator-utils": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-backbone": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha5", + "@vaadin/hilla-generator-utils": "24.6.0-alpha5", "c8": "^8.0.1", "chai": "^4.3.10", "concurrently": "^8.2.1", @@ -10519,10 +10531,10 @@ "@types/node": "^20.7.1", "@types/sinon": "^10.0.17", "@types/sinon-chai": "^3.2.10", - "@vaadin/hilla-generator-core": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha4", - "@vaadin/hilla-generator-plugin-model": "24.6.0-alpha4", - "@vaadin/hilla-generator-utils": "24.6.0-alpha4", + "@vaadin/hilla-generator-core": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-client": "24.6.0-alpha5", + "@vaadin/hilla-generator-plugin-model": "24.6.0-alpha5", + "@vaadin/hilla-generator-utils": "24.6.0-alpha5", "c8": "^10.1.2", "chai": "^4.3.10", "concurrently": "^8.2.1", @@ -10571,7 +10583,7 @@ "@types/sinon": "^10.0.17", "@types/sinon-chai": "^3.2.10", "@types/validator": "^13.11.2", - "@vaadin/hilla-frontend": "24.6.0-alpha4", + "@vaadin/hilla-frontend": "24.6.0-alpha5", "chai-dom": "^1.11.0", "sinon": "^16.0.0", "sinon-chai": "^3.7.0", @@ -10580,73 +10592,73 @@ } }, "@vaadin/icon": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/icon/-/icon-24.6.0-alpha8.tgz", - "integrity": "sha512-K+SPEL5FaS/KXtCN//6R4lpKFFuq8INoPksJPv6053slgSsDOicjZC9ip2Sg8Bc4ifaxhqBhI153m5WVJ5yRuQ==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/icon/-/icon-24.6.0-beta1.tgz", + "integrity": "sha512-p2MS1shPHDPK3TITvkb28o1+l4fbDrhSDjdMlk8krTm7daHoDp4QMpXpmR2CfRs8WE8ZgF4XW5jihoudAEfV1Q==", "requires": { "@open-wc/dedupe-mixin": "^1.3.0", "@polymer/polymer": "3.5.2", - "@vaadin/component-base": "24.6.0-alpha8", - "@vaadin/vaadin-lumo-styles": "24.6.0-alpha8", - "@vaadin/vaadin-themable-mixin": "24.6.0-alpha8", + "@vaadin/component-base": "24.6.0-beta1", + "@vaadin/vaadin-lumo-styles": "24.6.0-beta1", + "@vaadin/vaadin-themable-mixin": "24.6.0-beta1", "lit": "3.2.1" } }, "@vaadin/icons": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/icons/-/icons-24.6.0-alpha8.tgz", - "integrity": "sha512-MROcW+sRCkYSmHfxL91z9gB6q1EruAKu6crmBQaAlIOYEUtsR4egi/lvoK6QJlIJzPA7nyqjYDcwxWruf4nc7w==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/icons/-/icons-24.6.0-beta1.tgz", + "integrity": "sha512-Za/wfpcE3VUGoBlFVN2JyNdnjCq8QIzCNqLi2tc6LclnawaO+q1LwJiJkMXJ28DwIncLZnw6i1fFB8yxUlYSjg==", "requires": { "@polymer/polymer": "3.5.2", - "@vaadin/icon": "24.6.0-alpha8" + "@vaadin/icon": "24.6.0-beta1" } }, "@vaadin/lit-renderer": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/lit-renderer/-/lit-renderer-24.6.0-alpha8.tgz", - "integrity": "sha512-qhucr9v4B6Kuz26YD5tmr2J7Ol286FXIopeVuReU+m67RN8dEe45g+ptz7bqxqYYhUR3wBZrZSoG3wwTX5zcoA==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/lit-renderer/-/lit-renderer-24.6.0-beta1.tgz", + "integrity": "sha512-GKFwglatwKne1j52HVF6kFZLUnnaJO+EhH8M9Ge4IIWMTlJRJljt6iWJaip9fnQ0KsEVaQL76WhI1PodW+NoZw==", "requires": { "lit": "3.2.1" } }, "@vaadin/overlay": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/overlay/-/overlay-24.6.0-alpha8.tgz", - "integrity": "sha512-Pq2KeYFS4wCFzV1KvTsyD3Rbv6v0nuY9BVUBpWmBZIK2D4BlU/6KggEHpA835t6PJF4YK5GMQryCiABs6SUqKw==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/overlay/-/overlay-24.6.0-beta1.tgz", + "integrity": "sha512-ILnufqxXlAPWWSr/cz2XI0wvmTNTmC1qmBCIHDnRPT079GXxdH+u49mhfZYvqBKwOkpDwdihvcLvOU0BRcwkKg==", "requires": { "@open-wc/dedupe-mixin": "^1.3.0", "@polymer/polymer": "3.5.2", - "@vaadin/a11y-base": "24.6.0-alpha8", - "@vaadin/component-base": "24.6.0-alpha8", - "@vaadin/vaadin-lumo-styles": "24.6.0-alpha8", - "@vaadin/vaadin-material-styles": "24.6.0-alpha8", - "@vaadin/vaadin-themable-mixin": "24.6.0-alpha8", + "@vaadin/a11y-base": "24.6.0-beta1", + "@vaadin/component-base": "24.6.0-beta1", + "@vaadin/vaadin-lumo-styles": "24.6.0-beta1", + "@vaadin/vaadin-material-styles": "24.6.0-beta1", + "@vaadin/vaadin-themable-mixin": "24.6.0-beta1", "lit": "3.2.1" } }, "@vaadin/polymer-legacy-adapter": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/polymer-legacy-adapter/-/polymer-legacy-adapter-24.6.0-alpha8.tgz", - "integrity": "sha512-OSE9WBuVQ3M7XP2Zd1gpyGTSi6pUXVSvPffuMLNck3iLe2O9hd4t98A+SQB6QfQjcJjmEk+4F2jgyxw62SYFyA==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/polymer-legacy-adapter/-/polymer-legacy-adapter-24.6.0-beta1.tgz", + "integrity": "sha512-rn8kiRXl838X+N12l7LmlgohGCz698G2TkAfYoJjcBpfcbJtzxDmHwBuUgg+2yVTg0NGBICRFBITRaBR5Z6JGg==", "requires": { "@polymer/polymer": "3.5.2", - "@vaadin/vaadin-themable-mixin": "24.6.0-alpha8", + "@vaadin/vaadin-themable-mixin": "24.6.0-beta1", "lit": "3.2.1" } }, "@vaadin/popover": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/popover/-/popover-24.6.0-alpha8.tgz", - "integrity": "sha512-tKXvoodN67CZFKJgOwZKcJNXa41H55qDi76g+cdOYaRZ+KrfsSKjDFs1ZsBkymLYqVVOuyFaOFh7U/WtdyKf7g==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/popover/-/popover-24.6.0-beta1.tgz", + "integrity": "sha512-ZuwtLejdrqfGNAa6ViF4UxdLq4Vx80SkO5DreEDAcFRO5EjQQiQPiH0BK6lm8i5qhZQr7QWrDXm2hMVpwx6ADg==", "requires": { "@open-wc/dedupe-mixin": "^1.3.0", - "@vaadin/a11y-base": "24.6.0-alpha8", - "@vaadin/component-base": "24.6.0-alpha8", - "@vaadin/lit-renderer": "24.6.0-alpha8", - "@vaadin/overlay": "24.6.0-alpha8", - "@vaadin/vaadin-lumo-styles": "24.6.0-alpha8", - "@vaadin/vaadin-material-styles": "24.6.0-alpha8", - "@vaadin/vaadin-themable-mixin": "24.6.0-alpha8", + "@vaadin/a11y-base": "24.6.0-beta1", + "@vaadin/component-base": "24.6.0-beta1", + "@vaadin/lit-renderer": "24.6.0-beta1", + "@vaadin/overlay": "24.6.0-beta1", + "@vaadin/vaadin-lumo-styles": "24.6.0-beta1", + "@vaadin/vaadin-material-styles": "24.6.0-beta1", + "@vaadin/vaadin-themable-mixin": "24.6.0-beta1", "lit": "3.2.1" } }, @@ -10668,19 +10680,19 @@ } }, "@vaadin/tooltip": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/tooltip/-/tooltip-24.6.0-alpha8.tgz", - "integrity": "sha512-5ZJu4bue9dMdp+R0xIaLEh2zyNwdJGyQ4a4osL1kZPiSE8gbhfAMuyOIzQmZ3Enhup0YVpMGqUI0+px/YpxnDg==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/tooltip/-/tooltip-24.6.0-beta1.tgz", + "integrity": "sha512-QS9mq/I2pVpsK++Wfitl0n9WQ/mz3ac1mH7DSpmKKzah7pIqCOmO1ap/XQ92ofST7GYxa65iQ4tSwAk2tLTBUg==", "requires": { "@open-wc/dedupe-mixin": "^1.3.0", "@polymer/polymer": "3.5.2", - "@vaadin/a11y-base": "24.6.0-alpha8", - "@vaadin/component-base": "24.6.0-alpha8", - "@vaadin/overlay": "24.6.0-alpha8", - "@vaadin/popover": "24.6.0-alpha8", - "@vaadin/vaadin-lumo-styles": "24.6.0-alpha8", - "@vaadin/vaadin-material-styles": "24.6.0-alpha8", - "@vaadin/vaadin-themable-mixin": "24.6.0-alpha8", + "@vaadin/a11y-base": "24.6.0-beta1", + "@vaadin/component-base": "24.6.0-beta1", + "@vaadin/overlay": "24.6.0-beta1", + "@vaadin/popover": "24.6.0-beta1", + "@vaadin/vaadin-lumo-styles": "24.6.0-beta1", + "@vaadin/vaadin-material-styles": "24.6.0-beta1", + "@vaadin/vaadin-themable-mixin": "24.6.0-beta1", "lit": "3.2.1" } }, @@ -10690,30 +10702,30 @@ "integrity": "sha512-N6a5nLT/ytEUlpPo+nvdCKIGoyNjPsj3rzPGvGYK8x9Ceg76OTe1xI/GtN71mRW9e2HUScR0kCNOkl1Z63YDjw==" }, "@vaadin/vaadin-lumo-styles": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/vaadin-lumo-styles/-/vaadin-lumo-styles-24.6.0-alpha8.tgz", - "integrity": "sha512-/XNt5Ago7TpZcYbxyIRVlX+3KhG7quV6ssOJ7oWHJelrWYEjLWy0ZTHaS5iTamvAq6lOapytuFbO5/sy+z/mUA==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/vaadin-lumo-styles/-/vaadin-lumo-styles-24.6.0-beta1.tgz", + "integrity": "sha512-0o0lqHy9jP6ZakC4NXcw/fnsqVo56GSJsysIaQalb4KDThHl1XSUT+QeIgUvfqvVLnLzjF1CjoEK+K7NM0luuQ==", "requires": { "@polymer/polymer": "3.5.2", - "@vaadin/component-base": "24.6.0-alpha8", - "@vaadin/icon": "24.6.0-alpha8", - "@vaadin/vaadin-themable-mixin": "24.6.0-alpha8" + "@vaadin/component-base": "24.6.0-beta1", + "@vaadin/icon": "24.6.0-beta1", + "@vaadin/vaadin-themable-mixin": "24.6.0-beta1" } }, "@vaadin/vaadin-material-styles": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/vaadin-material-styles/-/vaadin-material-styles-24.6.0-alpha8.tgz", - "integrity": "sha512-ERNeJzZU4h2OjQg/nyU55jHfdMhdst0Sjcl+QTRLf/gNns0pdd7oCWoTZ9o5yNVwo5NAWa7UI3Ry+rOrl8hZ1g==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/vaadin-material-styles/-/vaadin-material-styles-24.6.0-beta1.tgz", + "integrity": "sha512-+TZ7AIKv6zT5FqKtcwoqjrvUk5Pfnt26wgVAFswUQf/sr0Ww+n+WVlPyE62lkRfWpXKPDTgsxOMlRAQcaROlog==", "requires": { "@polymer/polymer": "3.5.2", - "@vaadin/component-base": "24.6.0-alpha8", - "@vaadin/vaadin-themable-mixin": "24.6.0-alpha8" + "@vaadin/component-base": "24.6.0-beta1", + "@vaadin/vaadin-themable-mixin": "24.6.0-beta1" } }, "@vaadin/vaadin-themable-mixin": { - "version": "24.6.0-alpha8", - "resolved": "https://registry.npmjs.org/@vaadin/vaadin-themable-mixin/-/vaadin-themable-mixin-24.6.0-alpha8.tgz", - "integrity": "sha512-qKtIYeeukUR5m3h1ASFhmFWHScLHjERPUmDPc66XTX7GWW5vYHv06yzKEzL7xEJx5AghUCQRHwWbE2Xo3EvqzA==", + "version": "24.6.0-beta1", + "resolved": "https://registry.npmjs.org/@vaadin/vaadin-themable-mixin/-/vaadin-themable-mixin-24.6.0-beta1.tgz", + "integrity": "sha512-C/aGG+uA/esAFpswKM7yKIiNXn4Z65vJqV59XIHI1TANjhvmjjtIx9IdlmgV8FsqsgsnIYUPCJGhe4/QN5VPEw==", "requires": { "@open-wc/dedupe-mixin": "^1.3.0", "lit": "3.2.1" diff --git a/packages/java/tests/spring/endpoints discovery/package.json b/packages/java/tests/spring/endpoints discovery/package.json index d9631e71c1..754fe97320 100644 --- a/packages/java/tests/spring/endpoints discovery/package.json +++ b/packages/java/tests/spring/endpoints discovery/package.json @@ -7,13 +7,13 @@ "@vaadin/common-frontend": "0.0.19", "@vaadin/hilla-frontend": "file:../../../../ts/frontend", "@vaadin/hilla-lit-form": "file:../../../../ts/lit-form", - "@vaadin/icon": "24.6.0-alpha8", - "@vaadin/icons": "24.6.0-alpha8", - "@vaadin/polymer-legacy-adapter": "24.6.0-alpha8", + "@vaadin/icon": "24.6.0-beta1", + "@vaadin/icons": "24.6.0-beta1", + "@vaadin/polymer-legacy-adapter": "24.6.0-beta1", "@vaadin/router": "2.0.0", - "@vaadin/tooltip": "24.6.0-alpha8", - "@vaadin/vaadin-lumo-styles": "24.6.0-alpha8", - "@vaadin/vaadin-themable-mixin": "24.6.0-alpha8", + "@vaadin/tooltip": "24.6.0-beta1", + "@vaadin/vaadin-lumo-styles": "24.6.0-beta1", + "@vaadin/vaadin-themable-mixin": "24.6.0-beta1", "construct-style-sheets-polyfill": "3.1.0", "lit": "3.2.1" }, @@ -52,13 +52,13 @@ "@vaadin/common-frontend": "0.0.19", "@vaadin/hilla-frontend": "24.6.0-alpha4", "@vaadin/hilla-lit-form": "24.6.0-alpha4", - "@vaadin/icon": "24.6.0-alpha8", - "@vaadin/icons": "24.6.0-alpha8", - "@vaadin/polymer-legacy-adapter": "24.6.0-alpha8", + "@vaadin/icon": "24.6.0-beta1", + "@vaadin/icons": "24.6.0-beta1", + "@vaadin/polymer-legacy-adapter": "24.6.0-beta1", "@vaadin/router": "2.0.0", - "@vaadin/tooltip": "24.6.0-alpha8", - "@vaadin/vaadin-lumo-styles": "24.6.0-alpha8", - "@vaadin/vaadin-themable-mixin": "24.6.0-alpha8", + "@vaadin/tooltip": "24.6.0-beta1", + "@vaadin/vaadin-lumo-styles": "24.6.0-beta1", + "@vaadin/vaadin-themable-mixin": "24.6.0-beta1", "construct-style-sheets-polyfill": "3.1.0", "lit": "3.2.1" }, @@ -91,7 +91,7 @@ "workbox-core": "7.3.0", "workbox-precaching": "7.3.0" }, - "hash": "bd667a5268f220bc586d8433e421ec5d7a075ee64a0988359dfe04d6fbc53be9" + "hash": "c2376a64930ba43ae3a818ee81208f6bcdb436844218a09ad707633d20a14f25" }, "overrides": { "@vaadin/common-frontend": "$@vaadin/common-frontend", diff --git a/packages/java/tests/spring/endpoints discovery/pom.xml b/packages/java/tests/spring/endpoints discovery/pom.xml index b413d0edfe..384da8a540 100644 --- a/packages/java/tests/spring/endpoints discovery/pom.xml +++ b/packages/java/tests/spring/endpoints discovery/pom.xml @@ -46,13 +46,13 @@ com.vaadin hilla-maven-plugin - - - com.example.application - com.invalid - com.example.library.unpublished - - + + + + + + +