[java-shib-shared] branch main updated: Add some nullability annotation in the yesy classes

Rod Widdowson rdw at steadingsoftware.com
Thu Nov 24 15:17:26 UTC 2022


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch main
in repository java-shib-shared.

View the commit online:
http://git.shibboleth.net/view/?p=java-shib-shared.git;a=commit;h=416160839795d342cccd3d5fce8f6274db939996

The following commit(s) were added to refs/heads/main by this push:
     new 41616083 Add some  nullability annotation in the yesy classes
41616083 is described below

commit 416160839795d342cccd3d5fce8f6274db939996
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Nov 24 15:16:49 2022 +0000

    Add some  nullability annotation in the yesy classes
---
 .../shared/scripting/EvaluableScriptTest.java      | 12 ++--
 .../shared/xml/TestResourceConverter.java          | 10 ++--
 .../shared/testing/MockApplicationContext.java     | 67 +++++++++++-----------
 .../shared/testing/MockReloadableService.java      |  2 +-
 4 files changed, 47 insertions(+), 44 deletions(-)

diff --git a/shib-support/src/test/java/net/shibboleth/shared/scripting/EvaluableScriptTest.java b/shib-support/src/test/java/net/shibboleth/shared/scripting/EvaluableScriptTest.java
index b205bf87..aee47c10 100644
--- a/shib-support/src/test/java/net/shibboleth/shared/scripting/EvaluableScriptTest.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/scripting/EvaluableScriptTest.java
@@ -166,15 +166,15 @@ public class EvaluableScriptTest {
                 return false;
             }
 
-            public URL getURL() throws IOException {
+            public @Nonnull URL getURL() throws IOException {
                 throw new IOException();
             }
 
-            public URI getURI() throws IOException {
+            public @Nonnull URI getURI() throws IOException {
                 throw new IOException();
             }
 
-            public InputStream getInputStream() throws IOException {
+            public @Nonnull InputStream getInputStream() throws IOException {
                 return is;
             }
 
@@ -182,11 +182,11 @@ public class EvaluableScriptTest {
                 return null;
             }
 
-            public File getFile() throws IOException {
+            public @Nonnull File getFile() throws IOException {
                 throw new IOException();
             }
 
-            public String getDescription() {
+            public @Nonnull String getDescription() {
                 return "";
             }
 
@@ -194,7 +194,7 @@ public class EvaluableScriptTest {
                 return true;
             }
 
-            public Resource createRelativeResource(String relativePath) throws IOException {
+            public @Nonnull Resource createRelativeResource(String relativePath) throws IOException {
                 throw new IOException();
             }
 
diff --git a/shib-support/src/test/java/net/shibboleth/shared/xml/TestResourceConverter.java b/shib-support/src/test/java/net/shibboleth/shared/xml/TestResourceConverter.java
index 1ad762a9..00371465 100644
--- a/shib-support/src/test/java/net/shibboleth/shared/xml/TestResourceConverter.java
+++ b/shib-support/src/test/java/net/shibboleth/shared/xml/TestResourceConverter.java
@@ -86,17 +86,17 @@ public final class TestResourceConverter implements net.shibboleth.shared.resour
     }
 
     /** {@inheritDoc} */
-    @Override public URL getURL() throws IOException {
+    @Override public @Nonnull URL getURL() throws IOException {
         return springResource.getURL();
     }
 
     /** {@inheritDoc} */
-    @Override public URI getURI() throws IOException {
+    @Override public @Nonnull URI getURI() throws IOException {
         return springResource.getURI();
     }
 
     /** {@inheritDoc} */
-    @Override public File getFile() throws IOException {
+    @Override public @Nonnull File getFile() throws IOException {
         return springResource.getFile();
     }
 
@@ -111,7 +111,7 @@ public final class TestResourceConverter implements net.shibboleth.shared.resour
     }
 
     /** {@inheritDoc} */
-    @Override public net.shibboleth.shared.resource.Resource createRelativeResource(
+    @Override public @Nonnull net.shibboleth.shared.resource.Resource createRelativeResource(
             String relativePath) throws IOException {
 
         return of(springResource.createRelative(relativePath));
@@ -123,7 +123,7 @@ public final class TestResourceConverter implements net.shibboleth.shared.resour
     }
 
     /** {@inheritDoc} */
-    @Override public String getDescription() {
+    @Override public @Nonnull String getDescription() {
         return springResource.getDescription();
     }
 
diff --git a/shib-testing/src/main/java/net/shibboleth/shared/testing/MockApplicationContext.java b/shib-testing/src/main/java/net/shibboleth/shared/testing/MockApplicationContext.java
index b392a53a..ce5b08fe 100644
--- a/shib-testing/src/main/java/net/shibboleth/shared/testing/MockApplicationContext.java
+++ b/shib-testing/src/main/java/net/shibboleth/shared/testing/MockApplicationContext.java
@@ -23,6 +23,9 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.BeanFactory;
 import org.springframework.beans.factory.NoSuchBeanDefinitionException;
@@ -52,12 +55,12 @@ public class MockApplicationContext implements ConfigurableApplicationContext {
     }
 
     /** {@inheritDoc} */
-    public String getApplicationName() {
+    public @Nonnull String getApplicationName() {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public String getDisplayName() {
+    public @Nonnull String getDisplayName() {
         throw new IllegalStateException();
     }
 
@@ -72,7 +75,7 @@ public class MockApplicationContext implements ConfigurableApplicationContext {
     }
 
     /** {@inheritDoc} */
-    public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException {
+    public @Nonnull AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException {
         throw new IllegalStateException();
     }
 
@@ -87,48 +90,48 @@ public class MockApplicationContext implements ConfigurableApplicationContext {
     }
 
     /** {@inheritDoc} */
-    public String[] getBeanDefinitionNames() {
+    public @Nonnull String[] getBeanDefinitionNames() {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public String[] getBeanNamesForType(ResolvableType type) {
+    public @Nonnull String[] getBeanNamesForType(ResolvableType type) {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public String[] getBeanNamesForType(ResolvableType type, boolean includeNonSingletons, boolean allowEagerInit) {
+    public @Nonnull String[] getBeanNamesForType(ResolvableType type, boolean includeNonSingletons, boolean allowEagerInit) {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public String[] getBeanNamesForType(Class<?> type) {
+    public @Nonnull String[] getBeanNamesForType(@Nullable Class<?> type) {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public String[] getBeanNamesForType(Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) {
+    public @Nonnull String[] getBeanNamesForType(@Nullable Class<?> type, boolean includeNonSingletons, boolean allowEagerInit) {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public <T> Map<String, T> getBeansOfType(Class<T> type) throws BeansException {
+    @Nonnull public <T> Map<String, T> getBeansOfType(@Nullable Class<T> type) throws BeansException {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public <T> Map<String, T> getBeansOfType(Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)
+    @Nonnull public <T> Map<String, T> getBeansOfType(@Nullable Class<T> type, boolean includeNonSingletons, boolean allowEagerInit)
             throws BeansException {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public String[] getBeanNamesForAnnotation(Class<? extends Annotation> annotationType) {
+    public @Nonnull String[] getBeanNamesForAnnotation(Class<? extends Annotation> annotationType) {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType)
+    public @Nonnull Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> annotationType)
             throws BeansException {
         throw new IllegalStateException();
     }
@@ -140,37 +143,37 @@ public class MockApplicationContext implements ConfigurableApplicationContext {
     }
 
     /** {@inheritDoc} */
-    public Object getBean(String name) throws BeansException {
+    public @Nonnull Object getBean(String name) throws BeansException {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public <T> T getBean(String name, Class<T> requiredType) throws BeansException {
+    public @Nonnull <T> T getBean(String name, Class<T> requiredType) throws BeansException {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public Object getBean(String name, Object... args) throws BeansException {
+    public @Nonnull Object getBean(String name, Object... args) throws BeansException {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public <T> T getBean(Class<T> requiredType) throws BeansException {
+    public @Nonnull <T> T getBean(Class<T> requiredType) throws BeansException {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public <T> T getBean(Class<T> requiredType, Object... args) throws BeansException {
+    public @Nonnull <T> T getBean(Class<T> requiredType, Object... args) throws BeansException {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public <T> ObjectProvider<T> getBeanProvider(Class<T> requiredType) {
+    public @Nonnull <T> ObjectProvider<T> getBeanProvider(Class<T> requiredType) {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public <T> ObjectProvider<T> getBeanProvider(ResolvableType requiredType) {
+    public @Nonnull <T> ObjectProvider<T> getBeanProvider(ResolvableType requiredType) {
         throw new IllegalStateException();
     }
 
@@ -210,7 +213,7 @@ public class MockApplicationContext implements ConfigurableApplicationContext {
     }
 
     /** {@inheritDoc} */
-    public String[] getAliases(String name) {
+    public @Nonnull String[] getAliases(String name) {
         throw new IllegalStateException();
     }
 
@@ -225,17 +228,17 @@ public class MockApplicationContext implements ConfigurableApplicationContext {
     }
 
     /** {@inheritDoc} */
-    public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
+    public String getMessage(String code, @Nullable Object[] args, @Nullable String defaultMessage, Locale locale) {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException {
+    public @Nonnull String getMessage(String code , at Nullable Object[] args, Locale locale) throws NoSuchMessageException {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException {
+    public @Nonnull String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException {
         throw new IllegalStateException();
     }
 
@@ -245,12 +248,12 @@ public class MockApplicationContext implements ConfigurableApplicationContext {
     }
 
     /** {@inheritDoc} */
-    public Resource[] getResources(String locationPattern) throws IOException {
+    public @Nonnull Resource[] getResources(String locationPattern) throws IOException {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public Resource getResource(String location) {
+    public @Nonnull Resource getResource(String location) {
         throw new IllegalStateException();
     }
 
@@ -280,7 +283,7 @@ public class MockApplicationContext implements ConfigurableApplicationContext {
     }
 
     /** {@inheritDoc} */
-    public void setParent(ApplicationContext parent) {
+    public void setParent(@Nullable ApplicationContext parent) {
         throw new IllegalStateException();
     }
 
@@ -290,7 +293,7 @@ public class MockApplicationContext implements ConfigurableApplicationContext {
     }
 
     /** {@inheritDoc} */
-    public ConfigurableEnvironment getEnvironment() {
+    public @Nonnull ConfigurableEnvironment getEnvironment() {
         throw new IllegalStateException();
     }
 
@@ -329,7 +332,7 @@ public class MockApplicationContext implements ConfigurableApplicationContext {
     }
 
     /** {@inheritDoc} */
-    public ConfigurableListableBeanFactory getBeanFactory() throws IllegalStateException {
+    public @Nonnull ConfigurableListableBeanFactory getBeanFactory() throws IllegalStateException {
         throw new IllegalStateException();
     }
 
@@ -339,12 +342,12 @@ public class MockApplicationContext implements ConfigurableApplicationContext {
     }
 
     /** {@inheritDoc} */
-    public <T> ObjectProvider<T> getBeanProvider(Class<T> requiredType, boolean allowEagerInit) {
+    public @Nonnull <T> ObjectProvider<T> getBeanProvider(Class<T> requiredType, boolean allowEagerInit) {
         throw new IllegalStateException();
     }
 
     /** {@inheritDoc} */
-    public <T> ObjectProvider<T> getBeanProvider(ResolvableType requiredType, boolean allowEagerInit) {
+    public @Nonnull <T> ObjectProvider<T> getBeanProvider(ResolvableType requiredType, boolean allowEagerInit) {
         throw new IllegalStateException();
     }
 
@@ -354,7 +357,7 @@ public class MockApplicationContext implements ConfigurableApplicationContext {
     }
 
     /** {@inheritDoc} */
-    public ApplicationStartup getApplicationStartup() {
+    public @Nonnull ApplicationStartup getApplicationStartup() {
         throw new IllegalStateException();
     }
 
@@ -371,7 +374,7 @@ public class MockApplicationContext implements ConfigurableApplicationContext {
 
     /** {@inheritDoc} */
     @Override
-    public <A extends Annotation> Set<A> findAllAnnotationsOnBean(String beanName, Class<A> annotationType,
+    public @Nonnull <A extends Annotation> Set<A> findAllAnnotationsOnBean(String beanName, Class<A> annotationType,
             boolean allowFactoryBeanInit) throws NoSuchBeanDefinitionException {
         throw new IllegalStateException();
     }
diff --git a/shib-testing/src/main/java/net/shibboleth/shared/testing/MockReloadableService.java b/shib-testing/src/main/java/net/shibboleth/shared/testing/MockReloadableService.java
index 9c46a44a..c4a05a5d 100644
--- a/shib-testing/src/main/java/net/shibboleth/shared/testing/MockReloadableService.java
+++ b/shib-testing/src/main/java/net/shibboleth/shared/testing/MockReloadableService.java
@@ -39,7 +39,7 @@ public class MockReloadableService<T> extends AbstractReloadableService<T> {
      *
      * @param what component
      */
-    public MockReloadableService(@Nullable final AbstractServiceableComponent<T> what) {
+    public MockReloadableService(final @Nonnull AbstractServiceableComponent<T> what) {
         component = what;
     }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list