From 060e5867fd26ce83fbc8076cd303365e83444388 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 4 May 2022 11:37:00 +0200 Subject: [PATCH] Remove ImportResolutionMode.SEMVER_LATEST This import mode does not have any generator which would use it. Remove it. JIRA: YANGTOOLS-1432 Change-Id: I060c098d97efdedd90e184912f760e0ceb8fa805 Signed-off-by: Robert Varga --- .../plugin/generator/api/FileGenerator.java | 9 +-------- .../yang2sources/spi/BasicCodeGenerator.java | 11 +---------- .../plugin/GeneratorTaskFactory.java | 17 +++-------------- 3 files changed, 5 insertions(+), 32 deletions(-) diff --git a/plugin/plugin-generator-api/src/main/java/org/opendaylight/yangtools/plugin/generator/api/FileGenerator.java b/plugin/plugin-generator-api/src/main/java/org/opendaylight/yangtools/plugin/generator/api/FileGenerator.java index f255817de9..9385c2a1c6 100644 --- a/plugin/plugin-generator-api/src/main/java/org/opendaylight/yangtools/plugin/generator/api/FileGenerator.java +++ b/plugin/plugin-generator-api/src/main/java/org/opendaylight/yangtools/plugin/generator/api/FileGenerator.java @@ -60,13 +60,6 @@ public interface FileGenerator { * Standard, RFC6020 and RFC7950 compliant mode. Imports are satisfied by exact revision match (if specified), * or by latest available revision. */ - REVISION_EXACT_OR_LATEST, - /** - * Semantic version based mode. Imports which specify a semantic version (via the OpenConfig extension) will - * be satisfied by module which exports the latest compatible revision. Imports which do not specify semantic - * version will be resolved just as they would be via {@link #REVISION_EXACT_OR_LATEST}. - */ - @Deprecated(since = "7.0.11", forRemoval = true) - SEMVER_LATEST, + REVISION_EXACT_OR_LATEST; } } diff --git a/plugin/yang-maven-plugin-spi/src/main/java/org/opendaylight/yangtools/yang2sources/spi/BasicCodeGenerator.java b/plugin/yang-maven-plugin-spi/src/main/java/org/opendaylight/yangtools/yang2sources/spi/BasicCodeGenerator.java index 81978592c8..8ecae2243b 100644 --- a/plugin/yang-maven-plugin-spi/src/main/java/org/opendaylight/yangtools/yang2sources/spi/BasicCodeGenerator.java +++ b/plugin/yang-maven-plugin-spi/src/main/java/org/opendaylight/yangtools/yang2sources/spi/BasicCodeGenerator.java @@ -29,16 +29,7 @@ public interface BasicCodeGenerator { * Standard, RFC6020 and RFC7950 compliant mode. Imports are satisfied by exact revision match (if specified), * or by latest available revision. */ - REVISION_EXACT_OR_LATEST(FileGenerator.ImportResolutionMode.REVISION_EXACT_OR_LATEST), - /** - * Semantic version based mode. Imports which specify a semantic version (via the OpenConfig extension) will - * be satisfied by module which exports the latest compatible revision. Imports which do not specify semantic - * version will be resolved just as they would be via {@link #REVISION_EXACT_OR_LATEST}. - * - * @deprecated This mode has no users and is deprecated for removal. - */ - @Deprecated(forRemoval = true, since = "8.0.4") - SEMVER_LATEST(FileGenerator.ImportResolutionMode.SEMVER_LATEST); + REVISION_EXACT_OR_LATEST(FileGenerator.ImportResolutionMode.REVISION_EXACT_OR_LATEST); private final FileGenerator.@NonNull ImportResolutionMode fileGeneratorMode; diff --git a/plugin/yang-maven-plugin/src/main/java/org/opendaylight/yangtools/yang2sources/plugin/GeneratorTaskFactory.java b/plugin/yang-maven-plugin/src/main/java/org/opendaylight/yangtools/yang2sources/plugin/GeneratorTaskFactory.java index 648b798269..802b2fcea0 100644 --- a/plugin/yang-maven-plugin/src/main/java/org/opendaylight/yangtools/yang2sources/plugin/GeneratorTaskFactory.java +++ b/plugin/yang-maven-plugin/src/main/java/org/opendaylight/yangtools/yang2sources/plugin/GeneratorTaskFactory.java @@ -16,23 +16,12 @@ import org.opendaylight.yangtools.yang.parser.api.YangParserConfiguration; @NonNullByDefault abstract class GeneratorTaskFactory extends ParserConfigAware { - private static final YangParserConfiguration SEMVER_CONFIG = YangParserConfiguration.builder() - .importResolutionMode(org.opendaylight.yangtools.yang.parser.api.ImportResolutionMode.OPENCONFIG_SEMVER) - .build(); - private final YangParserConfiguration parserConfig; GeneratorTaskFactory(final ImportResolutionMode importMode) { - switch (importMode) { - case REVISION_EXACT_OR_LATEST: - parserConfig = YangParserConfiguration.DEFAULT; - break; - case SEMVER_LATEST: - parserConfig = SEMVER_CONFIG; - break; - default: - throw new LinkageError("Unhandled import mode " + importMode); - } + parserConfig = switch (importMode) { + case REVISION_EXACT_OR_LATEST -> YangParserConfiguration.DEFAULT; + }; } @Override -- 2.36.6