Do not import java.annotation 25/76725/2
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 8 Oct 2018 05:22:10 +0000 (07:22 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 8 Oct 2018 05:38:40 +0000 (07:38 +0200)
Nullable JSR305 annotations have runtime retention scope, which is
causing javax.annotation being imported by our bundles, which is not
correct as we do not need the annotation. Reduce the use of these
and suppress javax.annotation imports.

JIRA: YANGTOOLS-907
Change-Id: I0e1f384880e148c707037f8afd4b8cb9d2e00e72
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
24 files changed:
common/concepts/pom.xml
common/util/pom.xml
yang/odlext-model-api/pom.xml
yang/odlext-parser-support/src/main/java/org/opendaylight/yangtools/odlext/parser/AnyxmlSchemaLocationEffectiveStatementImpl.java
yang/odlext-parser-support/src/main/java/org/opendaylight/yangtools/odlext/parser/YangModeledAnyxmlEffectiveStatementImpl.java
yang/openconfig-model-api/pom.xml
yang/rfc8040-parser-support/src/main/java/org/opendaylight/yangtools/rfc8040/parser/YangDataEffectiveStatementImpl.java
yang/yang-common/pom.xml
yang/yang-data-api/pom.xml
yang/yang-data-codec-gson/pom.xml
yang/yang-data-codec-xml/pom.xml
yang/yang-data-impl/pom.xml
yang/yang-data-jaxen/pom.xml
yang/yang-data-transform/pom.xml
yang/yang-data-util/pom.xml
yang/yang-model-api/pom.xml
yang/yang-model-export/pom.xml
yang/yang-model-immutable/pom.xml
yang/yang-model-util/pom.xml
yang/yang-parser-api/pom.xml
yang/yang-parser-impl/pom.xml
yang/yang-parser-reactor/pom.xml
yang/yang-parser-rfc7950/pom.xml
yang/yang-parser-spi/pom.xml

index 648dffa66b32974ac3500012de54cd6d5e744c1f..0ba50f1cc71cb6cf07e2cfd2155197cb2ab063db 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
index 3f9a2e2ea66ea657f6c3235a8956c8555b47fa36..e9bc11ef57d794238180565c10db184204285eb7 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
index 1568c2e852be639fdbc8ecfa644270625bc21f57..e99d45b4fda896b2ad735b42f4565ff6b48f0229 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
index fe6b988b3c75ea54a5bcbfc1ffcff621605478d3..24b3b3428817cb7580ce33b291c7d8af14e1c5e0 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.yangtools.odlext.parser;
 
 import com.google.common.annotations.VisibleForTesting;
 import java.util.Objects;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.odlext.model.api.AnyxmlSchemaLocationEffectiveStatement;
 import org.opendaylight.yangtools.odlext.model.api.AnyxmlSchemaLocationStatement;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -23,7 +23,7 @@ public final class AnyxmlSchemaLocationEffectiveStatementImpl
         extends UnknownEffectiveStatementBase<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement>
         implements AnyxmlSchemaLocationEffectiveStatement {
 
-    private final SchemaPath path;
+    private final @NonNull SchemaPath path;
 
     AnyxmlSchemaLocationEffectiveStatementImpl(
             final StmtContext<SchemaNodeIdentifier, AnyxmlSchemaLocationStatement, ?> ctx) {
@@ -31,15 +31,13 @@ public final class AnyxmlSchemaLocationEffectiveStatementImpl
         path = ctx.getParentContext().getSchemaPath().get().createChild(getNodeType());
     }
 
-    @Nonnull
     @Override
-    public QName getQName() {
+    public @NonNull QName getQName() {
         return getNodeType();
     }
 
-    @Nonnull
     @Override
-    public SchemaPath getPath() {
+    public @NonNull SchemaPath getPath() {
         return path;
     }
 
index f201f7c4849a2b1edcf6c436e855d094ab1bf14d..66ca9fa095c782a1580eb28ffe9f17d86c381c1c 100644 (file)
@@ -13,7 +13,7 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Objects;
 import java.util.Optional;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.odlext.model.api.YangModeledAnyXmlSchemaNode;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
@@ -30,8 +30,8 @@ import org.opendaylight.yangtools.yang.model.api.stmt.AnyxmlStatement;
 final class YangModeledAnyxmlEffectiveStatementImpl
         extends ForwardingEffectiveStatement<QName, AnyxmlStatement, AnyxmlEffectiveStatement>
         implements YangModeledAnyXmlSchemaNode, AnyxmlEffectiveStatement {
-    private final AnyxmlEffectiveStatement delegate;
-    private final ContainerSchemaNode contentSchema;
+    private final @NonNull AnyxmlEffectiveStatement delegate;
+    private final @NonNull ContainerSchemaNode contentSchema;
 
     YangModeledAnyxmlEffectiveStatementImpl(final AnyxmlEffectiveStatement delegate,
         final ContainerSchemaNode contentSchema) {
@@ -40,13 +40,12 @@ final class YangModeledAnyxmlEffectiveStatementImpl
     }
 
     @Override
-    protected AnyxmlEffectiveStatement delegate() {
+    protected @NonNull AnyxmlEffectiveStatement delegate() {
         return delegate;
     }
 
-    @Nonnull
     @Override
-    public ContainerSchemaNode getSchemaOfAnyXmlData() {
+    public @NonNull ContainerSchemaNode getSchemaOfAnyXmlData() {
         return contentSchema;
     }
 
index 712f426d61cafe99b272ab128ad0aebe1b1d6e0d..1799b760ede34ffd567a69d818d26f92d2fe2804 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
index 60efdef86e9816d194f0ed65f31522e9ec71d9ba..6a4cad48d26a2651c21b0676b170d9f30af274c1 100644 (file)
@@ -11,7 +11,6 @@ import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects;
 import com.google.common.base.Verify;
 import java.util.Objects;
-import javax.annotation.Nonnull;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.rfc8040.model.api.YangDataEffectiveStatement;
 import org.opendaylight.yangtools.rfc8040.model.api.YangDataStatement;
@@ -27,8 +26,8 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils;
 final class YangDataEffectiveStatementImpl extends UnknownEffectiveStatementBase<String, YangDataStatement>
         implements YangDataEffectiveStatement {
 
-    private final SchemaPath path;
-    private final QName maybeQNameArgument;
+    private final @NonNull SchemaPath path;
+    private final @NonNull QName maybeQNameArgument;
     private final @NonNull ContainerEffectiveStatement container;
 
     YangDataEffectiveStatementImpl(final StmtContext<String, YangDataStatement, ?> ctx) {
@@ -50,15 +49,13 @@ final class YangDataEffectiveStatementImpl extends UnknownEffectiveStatementBase
         Verify.verify(container instanceof ContainerSchemaNode);
     }
 
-    @Nonnull
     @Override
-    public QName getQName() {
+    public @NonNull QName getQName() {
         return maybeQNameArgument;
     }
 
-    @Nonnull
     @Override
-    public SchemaPath getPath() {
+    public @NonNull SchemaPath getPath() {
         return path;
     }
 
@@ -67,9 +64,8 @@ final class YangDataEffectiveStatementImpl extends UnknownEffectiveStatementBase
         return container;
     }
 
-    @Nonnull
     @Override
-    public ContainerSchemaNode getContainerSchemaNode() {
+    public @NonNull ContainerSchemaNode getContainerSchemaNode() {
         // Verified in the constructor
         return (ContainerSchemaNode) container;
     }
index 2c7ccc52ab6f47640b60744f513b68409e7775ba..b99c8a5c6c71a18d03755171f9cd4f151e557ab0 100644 (file)
@@ -59,6 +59,7 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
                         <Include-Resource>{META-INF/services=${project.build.directory}/classes/META-INF/services}</Include-Resource>
                     </instructions>
                 </configuration>
index 487ae96f2b4e32a72d753a57e980838948c39cff..7b4e9fd067beeda69f5dfd178b667f6045e1e193 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
index 878f2dfceb5460dad679ce83bef51590b8f8cf74..d03bf9fc43692a99cfe7aa099e142a217ae6e927 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
index 6a097f234421f2a6c0c391871445402edbcc5f35..7756c25d979ff16500d734af1265b628ca4bcbc1 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
index 314c2b74ed3a1e3abbef19566d8329c88c490f65..33a0988dc964cacc680972b16cf990c1a5804a6d 100644 (file)
@@ -72,6 +72,7 @@
                             org.opendaylight.yangtools.yang.data.impl.*,
                             ;-split-package:=error
                         </Export-Package>
+                        <Import-Package>!javax.annotation,*</Import-Package>
                         <Include-Resource>{META-INF/services=${project.build.directory}/classes/META-INF/services}</Include-Resource>
                         <Bundle-Activator>org.opendaylight.yangtools.yang.data.impl.osgi.Activator</Bundle-Activator>
                     </instructions>
index 12bca6a488cb7e5f104e449ffe4282426ffc2a41..e691e8c9565878938d552f9c33420fb2901fbad8 100644 (file)
@@ -93,6 +93,7 @@
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
                         <Include-Resource>{META-INF/services=${project.build.directory}/classes/META-INF/services}</Include-Resource>
                         <Bundle-Activator>org.opendaylight.yangtools.yang.data.jaxen.osgi.Activator</Bundle-Activator>
                     </instructions>
index 85c535b2bae6b21915b20b1711d861c81e526c9f..3d7fedb00f9940e326ae131c64d4ac546c445c54 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
index 7966d27c69ab4f73f20c2dd4faa89282272f2b81..fb54e93b61998aed88da5fb6c08871bb5a2966a5 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
index 2955a4eb0ef6c3b304c2d6e3470f4bb26b960ee5..da20efb93e1c2acf30431092a2000619155b4989 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
index 12433309070f11336e86a694b809da7c2e05c5f4..9ee279ee8668b1d451cad08885522cd2d1b91741 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
index d6f6ff5c9fcb62d793185d942220bfdccbedc5d4..0c762294a99efeb35cfc80b8051bcbf377073db6 100644 (file)
           <artifactId>value</artifactId>
         </dependency>
     </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
 </project>
index 507d9dec644205a8a2f2f3dacd2251be118c51e3..1904262e4121d39f36cb4e59fce7570f82746c0e 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
index e44b61798ea4131b518bb19d68ab436fb37f8b48..33f2a40f42beba7bfd380d5e429462731561bffc 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
index df596f37ad45f445e56e385a7f8ba24d480bb031..4242e2cb4802c31ef89e5457f080490748ee16dd 100644 (file)
                 <extensions>true</extensions>
                 <configuration>
                     <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
                         <Include-Resource>{META-INF/services=${project.build.directory}/classes/META-INF/services}</Include-Resource>
                         <Bundle-Activator>org.opendaylight.yangtools.yang.parser.impl.osgi.Activator</Bundle-Activator>
                     </instructions>
index d31e439369c35d0fb0b4690290f35c26f4317d89..735d727f94d165d15f65935d525cd985b79415d7 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>
index e9730df73521f095a06015aa2952ee19219efe79..2a1b61eca478660d42dbf523781a9e7e3480d3ea 100644 (file)
                     <listener>true</listener>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>build-helper-maven-plugin</artifactId>
index 94780ef6c6a223daf7806f981f076e60b3f543cd..31dfe3afba4028c417e9d06f118d4f6b869cf142 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>!javax.annotation,*</Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-checkstyle-plugin</artifactId>