From b8efe51011a13308e205a165e9a3cd71f32eaf4b Mon Sep 17 00:00:00 2001 From: David Waltermire Date: Tue, 29 Oct 2024 21:45:37 -0400 Subject: [PATCH] Removed use of auto service. Reformatted code. --- core/pom.xml | 9 +++------ .../datatype/adapter/MetaschemaDataTypeProvider.java | 4 ---- .../core/datatype/markup/MarkupDataTypeProvider.java | 4 ---- .../function/library/DefaultFunctionLibrary.java | 4 ---- .../metaschema/core/model/xml/XmlConstraintLoader.java | 1 + .../core/model/xml/impl/ConstraintXmlSupport.java | 2 ++ .../core/model/xml/impl/XmlGlobalFieldDefinition.java | 1 - .../core/model/xml/impl/XmlGlobalFlagDefinition.java | 1 - core/src/main/java/module-info.java | 1 - ...st.secauto.metaschema.core.datatype.IDataTypeProvider | 2 ++ ...to.metaschema.core.metapath.function.IFunctionLibrary | 1 + databind/pom.xml | 6 ------ .../databind/AbstractModuleLoaderStrategy.java | 4 +--- .../metapath/function/DatabindFunctionLibrary.java | 4 ---- databind/src/main/java/module-info.java | 1 - ...to.metaschema.core.metapath.function.IFunctionLibrary | 1 + .../metaschema/databind/io/DefaultBoundLoaderTest.java | 3 +-- 17 files changed, 12 insertions(+), 37 deletions(-) create mode 100644 core/src/main/resources/META-INF/services/gov.nist.secauto.metaschema.core.datatype.IDataTypeProvider create mode 100644 core/src/main/resources/META-INF/services/gov.nist.secauto.metaschema.core.metapath.function.IFunctionLibrary create mode 100644 databind/src/main/resources/META-INF/services/gov.nist.secauto.metaschema.core.metapath.function.IFunctionLibrary diff --git a/core/pom.xml b/core/pom.xml index 876449181..d1a399d09 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -27,12 +27,6 @@ - - com.google.auto.service - auto-service-annotations - true - - com.github.spotbugs spotbugs-annotations @@ -151,6 +145,9 @@ + + src/main/resources + ${project.build.directory}/generated-resources/xmlbeans diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/MetaschemaDataTypeProvider.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/MetaschemaDataTypeProvider.java index b0b80a707..6969a6cd7 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/MetaschemaDataTypeProvider.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/adapter/MetaschemaDataTypeProvider.java @@ -5,10 +5,7 @@ package gov.nist.secauto.metaschema.core.datatype.adapter; -import com.google.auto.service.AutoService; - import gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeProvider; -import gov.nist.secauto.metaschema.core.datatype.IDataTypeProvider; import edu.umd.cs.findbugs.annotations.NonNull; @@ -17,7 +14,6 @@ * data types. */ @SuppressWarnings("PMD.CouplingBetweenObjects") -@AutoService(IDataTypeProvider.class) public final class MetaschemaDataTypeProvider // NOPMD - Used for service initialization extends AbstractDataTypeProvider { @NonNull diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/markup/MarkupDataTypeProvider.java b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/markup/MarkupDataTypeProvider.java index b8a32752a..e2836d3ba 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/markup/MarkupDataTypeProvider.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/datatype/markup/MarkupDataTypeProvider.java @@ -5,10 +5,7 @@ package gov.nist.secauto.metaschema.core.datatype.markup; -import com.google.auto.service.AutoService; - import gov.nist.secauto.metaschema.core.datatype.AbstractDataTypeProvider; -import gov.nist.secauto.metaschema.core.datatype.IDataTypeProvider; import edu.umd.cs.findbugs.annotations.NonNull; @@ -16,7 +13,6 @@ * Provides for runtime discovery of built-in implementations of the markup * Metaschema data types. */ -@AutoService(IDataTypeProvider.class) public final class MarkupDataTypeProvider extends AbstractDataTypeProvider { @NonNull diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/library/DefaultFunctionLibrary.java b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/library/DefaultFunctionLibrary.java index f5870c8bd..c4eab2db9 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/library/DefaultFunctionLibrary.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/metapath/function/library/DefaultFunctionLibrary.java @@ -5,11 +5,8 @@ package gov.nist.secauto.metaschema.core.metapath.function.library; -import com.google.auto.service.AutoService; - import gov.nist.secauto.metaschema.core.metapath.MetapathConstants; import gov.nist.secauto.metaschema.core.metapath.function.FunctionLibrary; -import gov.nist.secauto.metaschema.core.metapath.function.IFunctionLibrary; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IBooleanItem; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IDateItem; import gov.nist.secauto.metaschema.core.metapath.item.atomic.IDateTimeItem; @@ -31,7 +28,6 @@ */ @SuppressWarnings({ "removal" }) @SuppressFBWarnings("UWF_UNWRITTEN_FIELD") -@AutoService(IFunctionLibrary.class) public class DefaultFunctionLibrary extends FunctionLibrary { diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/XmlConstraintLoader.java b/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/XmlConstraintLoader.java index 80c5cda79..eb1cff2bb 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/XmlConstraintLoader.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/XmlConstraintLoader.java @@ -9,6 +9,7 @@ import gov.nist.secauto.metaschema.core.metapath.StaticContext; import gov.nist.secauto.metaschema.core.model.AbstractLoader; import gov.nist.secauto.metaschema.core.model.IConstraintLoader; +import gov.nist.secauto.metaschema.core.model.ISource; import gov.nist.secauto.metaschema.core.model.MetaschemaException; import gov.nist.secauto.metaschema.core.model.constraint.AssemblyConstraintSet; import gov.nist.secauto.metaschema.core.model.constraint.AssemblyTargetedConstraints; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/impl/ConstraintXmlSupport.java b/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/impl/ConstraintXmlSupport.java index 5b6aea754..bfbdcd72e 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/impl/ConstraintXmlSupport.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/impl/ConstraintXmlSupport.java @@ -11,6 +11,7 @@ import gov.nist.secauto.metaschema.core.datatype.markup.MarkupMultiline; import gov.nist.secauto.metaschema.core.metapath.MetapathException; import gov.nist.secauto.metaschema.core.model.IAttributable; +import gov.nist.secauto.metaschema.core.model.ISource; import gov.nist.secauto.metaschema.core.model.constraint.IAllowedValue; import gov.nist.secauto.metaschema.core.model.constraint.IAllowedValuesConstraint; import gov.nist.secauto.metaschema.core.model.constraint.ICardinalityConstraint; @@ -374,6 +375,7 @@ private ConstraintXmlSupport() { // disable construction } + @SuppressWarnings("unused") private static final class XmlbeanGeneratingVisitor implements IConstraintVisitor { diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/impl/XmlGlobalFieldDefinition.java b/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/impl/XmlGlobalFieldDefinition.java index 15c24a807..e26ca33fe 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/impl/XmlGlobalFieldDefinition.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/impl/XmlGlobalFieldDefinition.java @@ -14,7 +14,6 @@ import gov.nist.secauto.metaschema.core.model.IContainerFlagSupport; import gov.nist.secauto.metaschema.core.model.IFieldInstance; import gov.nist.secauto.metaschema.core.model.IFlagInstance; -import gov.nist.secauto.metaschema.core.model.ModuleScopeEnum; import gov.nist.secauto.metaschema.core.model.constraint.IValueConstrained; import gov.nist.secauto.metaschema.core.model.constraint.ValueConstraintSet; import gov.nist.secauto.metaschema.core.model.xml.xmlbeans.GlobalFieldDefinitionType; diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/impl/XmlGlobalFlagDefinition.java b/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/impl/XmlGlobalFlagDefinition.java index cb67e4548..ed3d011ad 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/impl/XmlGlobalFlagDefinition.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/model/xml/impl/XmlGlobalFlagDefinition.java @@ -12,7 +12,6 @@ import gov.nist.secauto.metaschema.core.model.AbstractGlobalFlagDefinition; import gov.nist.secauto.metaschema.core.model.IAttributable; import gov.nist.secauto.metaschema.core.model.IFlagInstance; -import gov.nist.secauto.metaschema.core.model.constraint.ISource; import gov.nist.secauto.metaschema.core.model.constraint.IValueConstrained; import gov.nist.secauto.metaschema.core.model.constraint.ValueConstraintSet; import gov.nist.secauto.metaschema.core.model.xml.xmlbeans.GlobalFlagDefinitionType; diff --git a/core/src/main/java/module-info.java b/core/src/main/java/module-info.java index 25679c29f..61b0705e8 100644 --- a/core/src/main/java/module-info.java +++ b/core/src/main/java/module-info.java @@ -25,7 +25,6 @@ requires static org.eclipse.jdt.annotation; requires static biz.aQute.bnd.util; - requires static com.google.auto.service; requires static com.github.spotbugs.annotations; requires com.ctc.wstx; diff --git a/core/src/main/resources/META-INF/services/gov.nist.secauto.metaschema.core.datatype.IDataTypeProvider b/core/src/main/resources/META-INF/services/gov.nist.secauto.metaschema.core.datatype.IDataTypeProvider new file mode 100644 index 000000000..e85626b94 --- /dev/null +++ b/core/src/main/resources/META-INF/services/gov.nist.secauto.metaschema.core.datatype.IDataTypeProvider @@ -0,0 +1,2 @@ +gov.nist.secauto.metaschema.core.datatype.adapter.MetaschemaDataTypeProvider +gov.nist.secauto.metaschema.core.datatype.markup.MarkupDataTypeProvider diff --git a/core/src/main/resources/META-INF/services/gov.nist.secauto.metaschema.core.metapath.function.IFunctionLibrary b/core/src/main/resources/META-INF/services/gov.nist.secauto.metaschema.core.metapath.function.IFunctionLibrary new file mode 100644 index 000000000..9d5c17a7e --- /dev/null +++ b/core/src/main/resources/META-INF/services/gov.nist.secauto.metaschema.core.metapath.function.IFunctionLibrary @@ -0,0 +1 @@ +gov.nist.secauto.metaschema.core.metapath.function.library.DefaultFunctionLibrary diff --git a/databind/pom.xml b/databind/pom.xml index b3751e915..6db75327b 100644 --- a/databind/pom.xml +++ b/databind/pom.xml @@ -33,12 +33,6 @@ metaschema-core - - com.google.auto.service - auto-service-annotations - true - - org.apache.commons commons-lang3 diff --git a/databind/src/main/java/gov/nist/secauto/metaschema/databind/AbstractModuleLoaderStrategy.java b/databind/src/main/java/gov/nist/secauto/metaschema/databind/AbstractModuleLoaderStrategy.java index 7239d8b92..fe5ba18d2 100644 --- a/databind/src/main/java/gov/nist/secauto/metaschema/databind/AbstractModuleLoaderStrategy.java +++ b/databind/src/main/java/gov/nist/secauto/metaschema/databind/AbstractModuleLoaderStrategy.java @@ -72,12 +72,10 @@ public IBoundModule registerModule( assert key != null; IBoundModule boundModule; - Class moduleClass; if (key instanceof IBoundModule) { boundModule = (IBoundModule) key; - moduleClass = boundModule.getClass(); } else { - moduleClass = handleUnboundModule(key); + Class moduleClass = handleUnboundModule(key); boundModule = lookupInstance(moduleClass, bindingContext); } diff --git a/databind/src/main/java/gov/nist/secauto/metaschema/databind/metapath/function/DatabindFunctionLibrary.java b/databind/src/main/java/gov/nist/secauto/metaschema/databind/metapath/function/DatabindFunctionLibrary.java index b0dff1b67..45dd6ed93 100644 --- a/databind/src/main/java/gov/nist/secauto/metaschema/databind/metapath/function/DatabindFunctionLibrary.java +++ b/databind/src/main/java/gov/nist/secauto/metaschema/databind/metapath/function/DatabindFunctionLibrary.java @@ -5,12 +5,8 @@ package gov.nist.secauto.metaschema.databind.metapath.function; -import com.google.auto.service.AutoService; - import gov.nist.secauto.metaschema.core.metapath.function.FunctionLibrary; -import gov.nist.secauto.metaschema.core.metapath.function.IFunctionLibrary; -@AutoService(IFunctionLibrary.class) public class DatabindFunctionLibrary extends FunctionLibrary { diff --git a/databind/src/main/java/module-info.java b/databind/src/main/java/module-info.java index 3f5a9f77b..89ef4bea5 100644 --- a/databind/src/main/java/module-info.java +++ b/databind/src/main/java/module-info.java @@ -19,7 +19,6 @@ requires com.ctc.wstx; requires com.fasterxml.jackson.dataformat.yaml; requires com.fasterxml.jackson.dataformat.xml; - requires transitive com.google.auto.service; requires transitive com.squareup.javapoet; requires nl.talsmasoftware.lazy4j; requires transitive org.apache.commons.lang3; diff --git a/databind/src/main/resources/META-INF/services/gov.nist.secauto.metaschema.core.metapath.function.IFunctionLibrary b/databind/src/main/resources/META-INF/services/gov.nist.secauto.metaschema.core.metapath.function.IFunctionLibrary new file mode 100644 index 000000000..05b03ef7e --- /dev/null +++ b/databind/src/main/resources/META-INF/services/gov.nist.secauto.metaschema.core.metapath.function.IFunctionLibrary @@ -0,0 +1 @@ +gov.nist.secauto.metaschema.databind.metapath.function.DatabindFunctionLibrary diff --git a/databind/src/test/java/gov/nist/secauto/metaschema/databind/io/DefaultBoundLoaderTest.java b/databind/src/test/java/gov/nist/secauto/metaschema/databind/io/DefaultBoundLoaderTest.java index 3d8053331..96477217d 100644 --- a/databind/src/test/java/gov/nist/secauto/metaschema/databind/io/DefaultBoundLoaderTest.java +++ b/databind/src/test/java/gov/nist/secauto/metaschema/databind/io/DefaultBoundLoaderTest.java @@ -13,7 +13,6 @@ import gov.nist.secauto.metaschema.core.model.MetaschemaException; import gov.nist.secauto.metaschema.core.util.ObjectUtils; import gov.nist.secauto.metaschema.databind.IBindingContext; -import gov.nist.secauto.metaschema.databind.model.metaschema.IBindingMetaschemaModule; import org.junit.jupiter.api.Test; @@ -30,7 +29,7 @@ void testIssue187() throws IOException, MetaschemaException { .compilePath(ObjectUtils.notNull(Files.createTempDirectory(Paths.get("target"), "modules-"))) .build(); - IBindingMetaschemaModule module = bindingContext.loadMetaschema(ObjectUtils.notNull( + bindingContext.loadMetaschema(ObjectUtils.notNull( Paths.get("src/test/resources/content/issue187-metaschema.xml"))); IBoundLoader loader = new DefaultBoundLoader(bindingContext);