From 16c9e607607e55c8ea928cbe8cfa02d224de8dcb Mon Sep 17 00:00:00 2001 From: Johan Stuyts Date: Thu, 30 Jan 2025 17:43:11 +0100 Subject: [PATCH] Added `@Nonnull` to parameters. Fixed some bugs in `null` checks. --- wicket-auth-roles/pom.xml | 4 ++ .../src/main/java/module-info.java | 1 + .../AbstractRoleAuthorizationStrategy.java | 4 +- .../authorization/strategies/role/Roles.java | 8 ++-- wicket-bean-validation/pom.xml | 4 ++ .../src/main/java/module-info.java | 1 + .../BeanValidationConfiguration.java | 13 +++--- .../validation/BeanValidationContext.java | 3 +- .../wicket/bean/validation/Property.java | 4 +- .../bean/validation/PropertyValidator.java | 3 +- .../validation/SessionLocaleInterpolator.java | 3 +- .../wicket/cdi/ConversationPropagator.java | 3 +- wicket-core-tests/pom.xml | 5 +++ .../BasicResourceReferenceMapperTest.java | 12 ++--- .../core/util/tester/WicketTesterTest.java | 2 +- wicket-core/pom.xml | 4 ++ wicket-core/src/main/java/module-info.java | 1 + .../java/org/apache/wicket/Application.java | 13 +++--- .../org/apache/wicket/AttributeModifier.java | 18 ++++---- .../java/org/apache/wicket/Behaviors.java | 8 ++-- .../java/org/apache/wicket/Component.java | 12 ++--- .../apache/wicket/ComponentEventSender.java | 6 ++- .../org/apache/wicket/ConverterLocator.java | 4 +- .../wicket/DefaultPageManagerProvider.java | 6 ++- .../org/apache/wicket/MarkupContainer.java | 14 +++--- .../org/apache/wicket/ResourceBundles.java | 4 +- .../main/java/org/apache/wicket/Session.java | 6 ++- .../org/apache/wicket/SharedResources.java | 4 +- .../ajax/AbstractAjaxTimerBehavior.java | 5 ++- .../org/apache/wicket/ajax/AjaxChannel.java | 4 +- .../wicket/ajax/AjaxClientInfoBehavior.java | 5 ++- .../apache/wicket/ajax/AjaxEventBehavior.java | 6 ++- .../ajax/AjaxNewWindowNotifyingBehavior.java | 4 +- .../AjaxOnDomReadyClientInfoBehavior.java | 4 +- .../wicket/ajax/AjaxRequestHandler.java | 4 +- .../apache/wicket/ajax/AjaxRequestTarget.java | 4 +- .../ajax/AjaxSelfUpdatingTimerBehavior.java | 4 +- .../ajax/attributes/AjaxAttributeName.java | 4 +- .../attributes/AjaxRequestAttributes.java | 10 +++-- .../ajax/attributes/ThrottlingSettings.java | 8 ++-- ...axFormChoiceComponentUpdatingBehavior.java | 4 +- .../AjaxFormComponentUpdatingBehavior.java | 4 +- .../ajax/form/AjaxFormSubmitBehavior.java | 4 +- .../ajax/form/AjaxFormValidatingBehavior.java | 5 ++- .../ajax/form/OnChangeAjaxBehavior.java | 4 +- .../apache/wicket/ajax/json/JSONFunction.java | 4 +- .../application/AbstractClassResolver.java | 4 +- .../application/CompoundClassResolver.java | 8 ++-- .../wicket/application/IClassResolver.java | 6 ++- .../DefaultAuthenticationStrategy.java | 4 +- .../wicket/behavior/AbstractAjaxBehavior.java | 4 +- .../org/apache/wicket/behavior/Behavior.java | 10 +++-- ...rossOriginEmbedderPolicyConfiguration.java | 6 ++- ...ginEmbedderPolicyRequestCycleListener.java | 3 +- .../CrossOriginOpenerPolicyConfiguration.java | 6 ++- ...riginOpenerPolicyRequestCycleListener.java | 3 +- .../AbstractPartialPageRequestHandler.java | 6 ++- .../BookmarkableListenerRequestHandler.java | 4 +- .../BookmarkablePageRequestHandler.java | 4 +- .../handler/IPartialPageRequestHandler.java | 4 +- .../handler/ListenerRequestHandler.java | 4 +- .../handler/PageAndComponentProvider.java | 8 ++-- .../core/request/handler/PageProvider.java | 6 ++- .../handler/RenderPageRequestHandler.java | 4 +- .../handler/RequestSettingRequestHandler.java | 4 +- .../mapper/AbstractBookmarkableMapper.java | 8 ++-- .../mapper/AbstractComponentMapper.java | 6 ++- .../mapper/BasicResourceReferenceMapper.java | 4 +- .../core/request/mapper/CryptoMapper.java | 4 +- .../core/request/mapper/MapperUtils.java | 6 ++- .../core/request/mapper/MountedMapper.java | 4 +- .../core/request/mapper/PackageMapper.java | 4 +- .../core/request/mapper/ResourceMapper.java | 3 +- .../wicket/core/util/crypt/AESCrypt.java | 8 ++-- .../crypt/KeyInSessionSunJceCryptFactory.java | 4 +- .../core/util/file/WebApplicationPath.java | 3 +- .../checker/AbstractObjectChecker.java | 4 +- .../resource/ClassPathResourceFinder.java | 4 +- .../core/util/resource/UrlResourceStream.java | 5 ++- .../caching/CachingResourceStreamLocator.java | 4 +- .../org/apache/wicket/csp/ClonedCSPValue.java | 4 +- .../csp/ContentSecurityPolicySettings.java | 8 ++-- .../wicket/csp/RelativeURICSPValue.java | 4 +- .../org/apache/wicket/event/IEventSource.java | 4 +- .../ContainerFeedbackMessageFilter.java | 4 +- .../feedback/FeedbackMessagesModel.java | 4 +- .../apache/wicket/markup/ComponentTag.java | 4 +- .../apache/wicket/markup/IMarkupCache.java | 4 +- .../java/org/apache/wicket/markup/Markup.java | 6 ++- .../org/apache/wicket/markup/MarkupCache.java | 4 +- .../apache/wicket/markup/MarkupFactory.java | 12 ++--- .../apache/wicket/markup/MarkupFragment.java | 4 +- .../wicket/markup/MarkupResourceStream.java | 5 ++- .../apache/wicket/markup/MarkupStream.java | 4 +- .../org/apache/wicket/markup/TagUtils.java | 4 +- .../head/AbstractCssReferenceHeaderItem.java | 4 +- ...AbstractJavaScriptReferenceHeaderItem.java | 4 +- .../head/JavaScriptReferenceHeaderItem.java | 4 +- .../markup/head/JavaScriptReferenceType.java | 4 +- .../markup/head/MetaDataHeaderItem.java | 8 ++-- .../wicket/markup/head/OnEventHeaderItem.java | 4 +- .../wicket/markup/head/StringHeaderItem.java | 4 +- .../markup/head/http2/PushHeaderItem.java | 3 +- .../markup/html/HeaderPartContainer.java | 6 ++- .../HeaderResponseDecoratorCollection.java | 10 +++-- .../apache/wicket/markup/html/MarkupUtil.java | 4 +- .../markup/html/basic/EnclosureContainer.java | 4 +- .../wicket/markup/html/border/Body.java | 4 +- .../wicket/markup/html/border/Border.java | 10 +++-- .../html/form/CheckBoxMultipleChoice.java | 4 +- .../apache/wicket/markup/html/form/Form.java | 7 +-- .../markup/html/form/FormComponent.java | 12 ++--- .../markup/html/form/FormComponentLabel.java | 4 +- .../form/FormComponentUpdatingBehavior.java | 4 +- .../html/form/JavaScriptReservedNames.java | 4 +- .../wicket/markup/html/form/RadioChoice.java | 4 +- .../html/form/ValidationErrorFeedback.java | 4 +- .../markup/html/form/upload/FileUpload.java | 6 ++- .../form/upload/FilesSelectedBehavior.java | 5 ++- .../resource/FileUploadResourceReference.java | 5 ++- .../resource/FolderUploadsFileManager.java | 5 ++- .../validation/AbstractFormValidator.java | 6 ++- .../form/validation/EqualInputValidator.java | 4 +- .../wicket/markup/html/include/Include.java | 3 +- .../wicket/markup/html/link/DownloadLink.java | 6 ++- .../AssociatedMarkupSourcingStrategy.java | 4 +- .../wicket/markup/html/panel/Fragment.java | 4 +- .../panel/FragmentMarkupSourcingStrategy.java | 4 +- .../wicket/markup/parser/IXmlPullParser.java | 5 ++- .../wicket/markup/parser/XmlPullParser.java | 6 ++- .../filter/StyleAndScriptIdentifier.java | 4 +- .../AbstractHeaderRenderStrategy.java | 12 ++--- .../ChildFirstHeaderRenderStrategy.java | 10 +++-- .../renderStrategy/DeepChildFirstVisitor.java | 4 +- .../renderStrategy/IHeaderRenderStrategy.java | 6 ++- .../ParentFirstHeaderRenderStrategy.java | 6 ++- .../markup/repeater/data/DataViewBase.java | 4 +- .../wicket/markup/repeater/data/GridView.java | 6 ++- .../repeater/util/ModelIteratorAdapter.java | 4 +- .../transformer/XsltTransformerBehavior.java | 4 +- .../apache/wicket/mock/MockWebResponse.java | 4 +- .../java/org/apache/wicket/model/IModel.java | 16 ++++--- .../org/apache/wicket/model/LambdaModel.java | 8 ++-- .../wicket/model/StringResourceModel.java | 4 +- .../wicket/page/DefaultPageLockManager.java | 4 +- .../wicket/page/PageAccessSynchronizer.java | 4 +- .../org/apache/wicket/page/PageManager.java | 4 +- .../apache/wicket/page/PartialPageUpdate.java | 10 +++-- .../AbstractPersistentPageStore.java | 5 ++- .../pageStore/AsynchronousPageStore.java | 4 +- .../wicket/pageStore/CryptingPageStore.java | 6 ++- .../wicket/pageStore/DelegatingPageStore.java | 4 +- .../wicket/pageStore/DiskPageStore.java | 4 +- .../wicket/pageStore/FilePageStore.java | 4 +- .../wicket/pageStore/InMemoryPageStore.java | 4 +- .../wicket/pageStore/InSessionPageStore.java | 5 ++- .../wicket/pageStore/SerializedPage.java | 4 +- .../pageStore/SerializingPageStore.java | 4 +- .../wicket/pageStore/disk/NestedFolders.java | 4 +- .../protocol/http/AbstractRequestLogger.java | 5 ++- .../protocol/http/BufferedWebResponse.java | 6 ++- .../http/HeaderBufferingWebResponse.java | 4 +- .../http/OriginResourceIsolationPolicy.java | 5 ++- .../wicket/protocol/http/WebApplication.java | 9 ++-- .../wicket/protocol/http/WicketFilter.java | 3 +- .../wicket/protocol/http/mock/Cookies.java | 5 ++- .../http/servlet/ErrorAttributes.java | 3 +- .../http/servlet/ForwardAttributes.java | 3 +- .../servlet/MultipartServletWebRequest.java | 3 +- .../MultipartServletWebRequestImpl.java | 11 ++--- .../http/servlet/ServletPartFileItem.java | 3 +- .../http/servlet/ServletWebRequest.java | 4 +- .../http/servlet/ServletWebResponse.java | 10 +++-- .../wicket/protocol/https/HttpsMapper.java | 5 ++- .../wicket/request/cycle/RequestCycle.java | 6 ++- .../ResourceReferenceRequestHandler.java | 4 +- .../resource/ResourceRequestHandler.java | 4 +- .../ResourceStreamRequestHandler.java | 5 ++- .../request/resource/AbstractResource.java | 11 ++--- .../resource/ContextRelativeResource.java | 4 +- .../ContextRelativeResourceReference.java | 4 +- .../resource/DynamicImageResource.java | 4 +- .../wicket/request/resource/IResource.java | 4 +- .../request/resource/PartWriterCallback.java | 4 +- .../request/resource/ResourceReference.java | 12 ++--- .../resource/ResourceReferenceRegistry.java | 8 ++-- .../resource/UrlResourceReference.java | 4 +- ...ameWithVersionResourceCachingStrategy.java | 6 ++- ...ingWithVersionResourceCachingStrategy.java | 6 ++- .../version/CachingResourceVersion.java | 6 ++- .../version/MessageDigestResourceVersion.java | 4 +- .../RequestCycleCachedResourceVersion.java | 4 +- .../version/StaticResourceVersion.java | 4 +- .../apache/wicket/resource/ResourceUtil.java | 6 ++- .../bundles/ConcatBundleResource.java | 3 +- .../ConcatResourceBundleReference.java | 4 +- .../loader/ClassStringResourceLoader.java | 4 +- .../loader/ComponentStringResourceLoader.java | 4 +- .../InitializerStringResourceLoader.java | 4 +- .../loader/NestedStringResourceLoader.java | 4 +- .../wicket/settings/ApplicationSettings.java | 8 ++-- .../apache/wicket/settings/DebugSettings.java | 4 +- .../wicket/settings/ExceptionSettings.java | 4 +- .../wicket/settings/FrameworkSettings.java | 6 ++- .../settings/JavaScriptLibrarySettings.java | 8 ++-- .../wicket/settings/MarkupSettings.java | 6 ++- .../wicket/settings/RequestCycleSettings.java | 7 ++- .../wicket/settings/ResourceSettings.java | 8 ++-- .../wicket/settings/SecuritySettings.java | 8 ++-- .../apache/wicket/settings/StoreSettings.java | 6 ++- .../wicket/util/cookies/CookieUtils.java | 3 +- .../util/template/TextTemplateDecorator.java | 5 ++- .../wicket/validation/CompoundValidator.java | 6 ++- .../wicket/validation/RawValidationError.java | 4 +- .../wicket/validation/ValidationError.java | 14 +++--- .../wicket/validation/ValidatorAdapter.java | 4 +- wicket-devutils/pom.xml | 4 ++ .../src/main/java/module-info.java | 1 + .../wicket/devutils/debugbar/DebugBar.java | 6 ++- .../examples/upload/UploadToResourcePage.java | 5 ++- .../wicket/examples/wizard/WizardPage.java | 4 +- wicket-extensions/pom.xml | 4 ++ .../src/main/java/module-info.java | 1 + .../extensions/ajax/AjaxDownloadBehavior.java | 16 ++++--- .../extensions/ajax/AjaxFileDropBehavior.java | 4 +- .../markup/html/AjaxIndicatorAppender.java | 4 +- .../markup/html/IndicatingAjaxButton.java | 6 ++- .../ajax/markup/html/IndicatingAjaxLink.java | 4 +- .../autocomplete/AutoCompleteBehavior.java | 4 +- .../html/form/upload/UploadProgressBar.java | 4 +- .../BreadCrumbModelListenerSupport.java | 4 +- .../panel/BreadCrumbPanelFactory.java | 4 +- .../breadcrumb/panel/BreadCrumbPanelLink.java | 6 ++- .../datetime/ZonedToLocalDateTimeModel.java | 6 ++- .../markup/html/form/select/Select.java | 4 +- .../resource/ThumbnailImageResource.java | 5 ++- .../html/repeater/data/sort/ISortState.java | 6 ++- .../html/repeater/data/sort/OrderByLink.java | 6 ++- .../html/repeater/data/table/DataTable.java | 6 ++- .../repeater/data/table/LambdaColumn.java | 4 +- .../data/table/export/CSVDataExporter.java | 4 +- .../data/table/export/ExportToolbar.java | 9 ++-- .../data/table/filter/FilterForm.java | 4 +- .../data/table/filter/FilterToolbar.java | 4 +- .../html/repeater/util/SingleSortState.java | 6 ++- .../markup/html/repeater/util/SortParam.java | 4 +- .../markup/html/tabs/TabbedPanel.java | 4 +- wicket-guice/pom.xml | 5 +++ .../guice/JakartaInjectTestBehavior.java | 9 ++-- .../org/apache/wicket/guice/TestBehavior.java | 2 +- wicket-ioc/pom.xml | 4 ++ wicket-ioc/src/main/java/module-info.java | 1 + .../injection/CompoundFieldValueFactory.java | 10 +++-- .../wicket-native-websocket-core/pom.xml | 4 ++ .../src/main/java/module-info.java | 1 + .../wicket/protocol/ws/WebSocketSettings.java | 26 ++++++----- .../ws/api/AbstractWebSocketConnection.java | 4 +- .../ws/api/AbstractWebSocketProcessor.java | 3 +- .../ws/api/BaseWebSocketBehavior.java | 3 +- .../ws/api/IWebSocketRequestHandler.java | 12 ++--- .../api/WebSocketConnectionOriginFilter.java | 3 +- .../api/WebSocketMessageBroadcastHandler.java | 4 +- .../ws/api/WebSocketPushBroadcaster.java | 12 ++--- .../ws/api/WebSocketRequestHandler.java | 14 +++--- .../protocol/ws/api/WebSocketResponse.java | 8 ++-- .../ws/api/event/WebSocketBinaryPayload.java | 4 +- .../ws/api/event/WebSocketPayload.java | 4 +- .../ws/api/event/WebSocketPushPayload.java | 4 +- .../ws/api/event/WebSocketTextPayload.java | 4 +- .../ws/api/message/AbstractClientMessage.java | 4 +- .../protocol/ws/api/message/TextMessage.java | 4 +- .../IWebSocketConnectionRegistry.java | 12 ++--- .../protocol/ws/api/registry/PageIdKey.java | 4 +- .../ws/api/registry/ResourceNameKey.java | 4 +- .../ws/api/registry/ResourceNameTokenKey.java | 4 +- .../SimpleWebSocketConnectionRegistry.java | 12 ++--- .../src/main/java/module-info.java | 1 + .../ws/javax/JavaxWebSocketConnection.java | 3 +- .../wicket-native-websocket-tester/pom.xml | 4 ++ .../src/main/java/module-info.java | 1 + .../ws/tester/TestWebSocketProcessor.java | 5 ++- .../protocol/ws/tester/WebSocketTester.java | 6 ++- wicket-request/pom.xml | 4 ++ wicket-request/src/main/java/module-info.java | 1 + .../wicket/request/HttpHeaderCollection.java | 7 ++- .../org/apache/wicket/request/Response.java | 4 +- .../java/org/apache/wicket/request/Url.java | 16 ++++--- .../apache/wicket/request/UrlRenderer.java | 8 ++-- .../request/handler/TextRequestHandler.java | 4 +- .../wicket/request/http/WebResponse.java | 6 ++- .../http/handler/RedirectRequestHandler.java | 3 +- .../wicket/request/mapper/AbstractMapper.java | 10 +++-- .../mapper/ParentPathReferenceRewriter.java | 6 ++- .../request/mapper/info/ComponentInfo.java | 4 +- .../mapper/info/PageComponentInfo.java | 4 +- .../mapper/parameter/INamedParameters.java | 12 ++--- .../mapper/parameter/PageParameters.java | 12 ++--- .../UrlPathPageParametersEncoder.java | 4 +- .../CombinedRequestParametersAdapter.java | 4 +- .../UrlRequestParametersAdapter.java | 4 +- wicket-spring/pom.xml | 4 ++ wicket-spring/src/main/java/module-info.java | 1 + .../wicket/spring/SpringBeanLocator.java | 6 ++- .../annot/AnnotProxyFieldValueFactory.java | 3 +- .../annot/SpringComponentInjector.java | 5 ++- wicket-tester/pom.xml | 4 ++ wicket-tester/src/main/java/module-info.java | 7 +-- .../wicket/util/tester/BaseWicketTester.java | 45 ++++++++++--------- .../apache/wicket/util/tester/DiffUtil.java | 4 +- .../apache/wicket/util/tester/FormTester.java | 8 ++-- .../apache/wicket/util/tester/TagTester.java | 8 ++-- .../wicket/util/tester/WicketTester.java | 5 ++- .../util/tester/WicketTesterHelper.java | 4 +- wicket-util/pom.xml | 4 ++ wicket-util/src/main/java/module-info.java | 1 + .../util/convert/ConversionException.java | 6 ++- .../wicket/util/convert/MaskConverter.java | 4 +- .../convert/converter/CalendarConverter.java | 4 +- .../crypt/CryptFactoryCachingDecorator.java | 4 +- .../apache/wicket/util/crypt/SunJceCrypt.java | 4 +- .../wicket/util/encoding/UrlDecoder.java | 6 ++- .../wicket/util/encoding/UrlEncoder.java | 6 ++- .../util/file/FileCleanerTrackerAdapter.java | 4 +- .../org/apache/wicket/util/file/Files.java | 11 +++-- .../wicket/util/file/IResourceFinder.java | 4 +- .../org/apache/wicket/util/file/Path.java | 4 +- .../util/io/DeferredFileOutputStream.java | 6 ++- .../org/apache/wicket/util/io/Streams.java | 4 +- .../org/apache/wicket/util/io/XmlReader.java | 4 +- .../org/apache/wicket/util/lang/Args.java | 6 ++- .../org/apache/wicket/util/lang/Checks.java | 10 +++-- .../org/apache/wicket/util/lang/Threads.java | 6 ++- .../util/resource/FileResourceStream.java | 5 ++- .../resource/FileSystemResourceStream.java | 9 ++-- .../util/resource/ResourceStreamWrapper.java | 5 ++- .../util/resource/ZipResourceStream.java | 7 ++- .../wicket/util/string/StringValue.java | 4 +- .../apache/wicket/util/string/Strings.java | 8 ++-- .../apache/wicket/util/value/LongValue.java | 6 ++- .../wicket/util/visit/ClassVisitFilter.java | 4 +- .../org/apache/wicket/util/visit/Visits.java | 6 ++- .../wicket/util/xml/CustomEntityResolver.java | 5 ++- wicket-velocity/pom.xml | 4 ++ .../src/main/java/module-info.java | 1 + .../wicket/velocity/VelocityContributor.java | 4 +- 345 files changed, 1291 insertions(+), 605 deletions(-) diff --git a/wicket-auth-roles/pom.xml b/wicket-auth-roles/pom.xml index eb2e59726f3..cdb26b3f4db 100644 --- a/wicket-auth-roles/pom.xml +++ b/wicket-auth-roles/pom.xml @@ -35,6 +35,10 @@ !java*,!kotlin*,!sun.nio.ch,org.slf4j*;version="[1.7,3)",* + + jakarta.annotation + jakarta.annotation-api + org.apache.wicket wicket-core diff --git a/wicket-auth-roles/src/main/java/module-info.java b/wicket-auth-roles/src/main/java/module-info.java index 5bd0a08e116..71148fbc0f5 100644 --- a/wicket-auth-roles/src/main/java/module-info.java +++ b/wicket-auth-roles/src/main/java/module-info.java @@ -20,6 +20,7 @@ requires org.apache.wicket.util; requires org.apache.wicket.request; requires org.apache.wicket.core; + requires jakarta.annotation; exports org.apache.wicket.authroles.authentication; exports org.apache.wicket.authroles.authentication.pages; diff --git a/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authorization/strategies/role/AbstractRoleAuthorizationStrategy.java b/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authorization/strategies/role/AbstractRoleAuthorizationStrategy.java index ec592a3b52c..350f7e182ad 100644 --- a/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authorization/strategies/role/AbstractRoleAuthorizationStrategy.java +++ b/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authorization/strategies/role/AbstractRoleAuthorizationStrategy.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.authroles.authorization.strategies.role; +import jakarta.annotation.Nonnull; + import org.apache.wicket.authorization.IAuthorizationStrategy; import org.apache.wicket.util.lang.Args; @@ -36,7 +38,7 @@ public abstract class AbstractRoleAuthorizationStrategy extends IAuthorizationSt * @param roleCheckingStrategy * the authorizer delegate */ - public AbstractRoleAuthorizationStrategy(IRoleCheckingStrategy roleCheckingStrategy) + public AbstractRoleAuthorizationStrategy(@Nonnull IRoleCheckingStrategy roleCheckingStrategy) { Args.notNull(roleCheckingStrategy, "roleCheckingStrategy"); this.roleCheckingStrategy = roleCheckingStrategy; diff --git a/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authorization/strategies/role/Roles.java b/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authorization/strategies/role/Roles.java index fa5251d7d7d..ced21ad7691 100644 --- a/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authorization/strategies/role/Roles.java +++ b/wicket-auth-roles/src/main/java/org/apache/wicket/authroles/authorization/strategies/role/Roles.java @@ -19,6 +19,8 @@ import java.util.Collection; import java.util.HashSet; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.io.IClusterable; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.string.StringList; @@ -53,7 +55,7 @@ public Roles() * @param roles * Roles as a comma separated list, like "ADMIN, USER" */ - public Roles(final String roles) + public Roles(@Nonnull final String roles) { Args.notNull(roles, "roles"); for (final String role : roles.split("\\s*,\\s*")) @@ -68,7 +70,7 @@ public Roles(final String roles) * @param roles * Roles */ - public Roles(final String[] roles) + public Roles(@Nonnull final String[] roles) { Args.notNull(roles, "roles"); for (final String role : roles) @@ -77,7 +79,7 @@ public Roles(final String[] roles) } } - public Roles(final Collection roles) { + public Roles(@Nonnull final Collection roles) { Args.notNull(roles, "roles"); addAll(roles); } diff --git a/wicket-bean-validation/pom.xml b/wicket-bean-validation/pom.xml index 1d191a450f4..4f89d756a7c 100644 --- a/wicket-bean-validation/pom.xml +++ b/wicket-bean-validation/pom.xml @@ -42,6 +42,10 @@ + + jakarta.annotation + jakarta.annotation-api + jakarta.el jakarta.el-api diff --git a/wicket-bean-validation/src/main/java/module-info.java b/wicket-bean-validation/src/main/java/module-info.java index bf3ec4b49d2..dda401a2b13 100644 --- a/wicket-bean-validation/src/main/java/module-info.java +++ b/wicket-bean-validation/src/main/java/module-info.java @@ -19,6 +19,7 @@ requires org.apache.wicket.util; requires org.apache.wicket.core; requires jakarta.validation; + requires jakarta.annotation; exports org.apache.wicket.bean.validation; } diff --git a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationConfiguration.java b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationConfiguration.java index d019b753026..a96a1647f4e 100644 --- a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationConfiguration.java +++ b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationConfiguration.java @@ -25,6 +25,7 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.function.Supplier; +import jakarta.annotation.Nonnull; import jakarta.validation.Validator; import jakarta.validation.constraints.NotEmpty; import jakarta.validation.constraints.NotNull; @@ -99,8 +100,8 @@ public BeanValidationConfiguration() * tag modifier to use * @return {@code this} */ - public BeanValidationConfiguration register(Class annotationType, - ITagModifier modifier) + public BeanValidationConfiguration register(@Nonnull Class annotationType, + @Nonnull ITagModifier modifier) { Args.notNull(annotationType, "annotationType"); Args.notNull(modifier, "modifier"); @@ -117,7 +118,7 @@ public BeanValidationConfiguration register(Class anno */ @Override @SuppressWarnings("unchecked") - public ITagModifier getTagModifier(Class annotationType) + public ITagModifier getTagModifier(@Nonnull Class annotationType) { Args.notNull(annotationType, "annotationType"); @@ -131,7 +132,7 @@ public ITagModifier getTagModifier(Class annotation * @param resolver * @return {@code this} */ - public BeanValidationConfiguration add(IPropertyResolver resolver) + public BeanValidationConfiguration add(@Nonnull IPropertyResolver resolver) { Args.notNull(resolver, "resolver"); @@ -156,7 +157,7 @@ public Validator getValidator() * * @param validatorProvider */ - public void setValidatorProvider(Supplier validatorProvider) + public void setValidatorProvider(@Nonnull Supplier validatorProvider) { Args.notNull(validatorProvider, "validatorProvider"); @@ -187,7 +188,7 @@ public IViolationTranslator getViolationTranslator() * A violation translator that will convert {@link jakarta.validation.ConstraintViolation}s into Wicket's * {@link org.apache.wicket.validation.ValidationError}s */ - public void setViolationTranslator(IViolationTranslator violationTranslator) + public void setViolationTranslator(@Nonnull IViolationTranslator violationTranslator) { Args.notNull(violationTranslator, "violationTranslator"); diff --git a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationContext.java b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationContext.java index f3293c5833a..216a23ff7b0 100644 --- a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationContext.java +++ b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/BeanValidationContext.java @@ -18,6 +18,7 @@ import java.lang.annotation.Annotation; +import jakarta.annotation.Nonnull; import jakarta.validation.Validator; import jakarta.validation.metadata.ConstraintDescriptor; @@ -41,7 +42,7 @@ public interface BeanValidationContext extends IPropertyResolver * @param annotationType * @return tag modifier or {@code null} if none */ - ITagModifier getTagModifier(Class annotationType); + ITagModifier getTagModifier(@Nonnull Class annotationType); /** * @return the validator diff --git a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/Property.java b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/Property.java index b411f17915d..307dd15d872 100644 --- a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/Property.java +++ b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/Property.java @@ -18,6 +18,8 @@ import java.io.Serializable; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.reference.ClassReference; @@ -31,7 +33,7 @@ public final class Property implements Serializable private final ClassReference owner; private final String name; - public Property(ClassReference owner, String name) + public Property(@Nonnull ClassReference owner, @Nonnull String name) { Args.notNull(owner, "owner"); Args.notEmpty(name, "name"); diff --git a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java index c696c7dca66..c2faf53c21f 100644 --- a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java +++ b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/PropertyValidator.java @@ -21,6 +21,7 @@ import java.util.Iterator; import java.util.Set; +import jakarta.annotation.Nonnull; import jakarta.validation.ConstraintViolation; import jakarta.validation.Validator; import jakarta.validation.groups.Default; @@ -150,7 +151,7 @@ private Class[] getGroups() @SuppressWarnings("unchecked") @Override - public void bind(Component component) + public void bind(@Nonnull Component component) { if (this.component != null) { diff --git a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/SessionLocaleInterpolator.java b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/SessionLocaleInterpolator.java index 58d74734825..f822b0d008d 100644 --- a/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/SessionLocaleInterpolator.java +++ b/wicket-bean-validation/src/main/java/org/apache/wicket/bean/validation/SessionLocaleInterpolator.java @@ -18,6 +18,7 @@ import java.util.Locale; +import jakarta.annotation.Nonnull; import jakarta.validation.MessageInterpolator; import org.apache.wicket.Session; @@ -38,7 +39,7 @@ public class SessionLocaleInterpolator implements MessageInterpolator * @param delegate * the MessageInterpolator to delegate to */ - public SessionLocaleInterpolator(MessageInterpolator delegate) + public SessionLocaleInterpolator(@Nonnull MessageInterpolator delegate) { Args.notNull(delegate, "delegate"); this.delegate = delegate; diff --git a/wicket-cdi/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java b/wicket-cdi/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java index b28c6b5f784..fbcdf7affd5 100644 --- a/wicket-cdi/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java +++ b/wicket-cdi/src/main/java/org/apache/wicket/cdi/ConversationPropagator.java @@ -16,6 +16,7 @@ */ package org.apache.wicket.cdi; +import jakarta.annotation.Nonnull; import jakarta.enterprise.context.ContextNotActiveException; import jakarta.enterprise.context.Conversation; import jakarta.enterprise.context.ConversationScoped; @@ -77,7 +78,7 @@ public class ConversationPropagator implements IRequestCycleListener * @param application * @param propagation */ - public ConversationPropagator(Application application, IConversationPropagation propagation) + public ConversationPropagator(@Nonnull Application application, @Nonnull IConversationPropagation propagation) { Args.notNull(application, "application"); Args.notNull(propagation, "propagation"); diff --git a/wicket-core-tests/pom.xml b/wicket-core-tests/pom.xml index dc0e8b1e395..26fd1361002 100644 --- a/wicket-core-tests/pom.xml +++ b/wicket-core-tests/pom.xml @@ -36,6 +36,11 @@ true + + jakarta.annotation + jakarta.annotation-api + test + jakarta.servlet jakarta.servlet-api diff --git a/wicket-core-tests/src/test/java/org/apache/wicket/core/request/mapper/BasicResourceReferenceMapperTest.java b/wicket-core-tests/src/test/java/org/apache/wicket/core/request/mapper/BasicResourceReferenceMapperTest.java index 550424ecfcc..446332f1404 100644 --- a/wicket-core-tests/src/test/java/org/apache/wicket/core/request/mapper/BasicResourceReferenceMapperTest.java +++ b/wicket-core-tests/src/test/java/org/apache/wicket/core/request/mapper/BasicResourceReferenceMapperTest.java @@ -16,15 +16,13 @@ */ package org.apache.wicket.core.request.mapper; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNull; - import java.io.Serializable; import java.util.Locale; import java.util.function.Supplier; import java.util.regex.Pattern; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.IRequestHandler; import org.apache.wicket.request.Url; import org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler; @@ -47,6 +45,10 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + /** * @author Matej Knopp */ @@ -584,7 +586,7 @@ private static class AlphaDigitResourceVersion implements IResourceVersion * @param version * static version string to deliver for all queries resources */ - AlphaDigitResourceVersion(String version) + AlphaDigitResourceVersion(@Nonnull String version) { this.version = Args.notNull(version, "version"); } diff --git a/wicket-core-tests/src/test/java/org/apache/wicket/core/util/tester/WicketTesterTest.java b/wicket-core-tests/src/test/java/org/apache/wicket/core/util/tester/WicketTesterTest.java index e00ad3f05bf..b5423bee874 100644 --- a/wicket-core-tests/src/test/java/org/apache/wicket/core/util/tester/WicketTesterTest.java +++ b/wicket-core-tests/src/test/java/org/apache/wicket/core/util/tester/WicketTesterTest.java @@ -692,7 +692,7 @@ void executeAjaxEvent_ajaxFormSubmitLink() // executeAjaxEvent weren't submitting the form the name would have been // reset to null, because the form would have been updated but there // wouldn't be any data to update it with. - assertNotNull("executeAjaxEvent() did not properly submit the form", pojo.getName()); + assertNotNull(pojo.getName(), "executeAjaxEvent() did not properly submit the form"); assertEquals("Mock name", pojo.getName()); } diff --git a/wicket-core/pom.xml b/wicket-core/pom.xml index a1e0e8b7dbe..ed1dfbf1090 100644 --- a/wicket-core/pom.xml +++ b/wicket-core/pom.xml @@ -148,6 +148,10 @@ org.apache.wicket.validation.validator;-noimport:=true !java*,!kotlin*,!sun.nio.ch,!com.sun.crypto.provider,org.slf4j*;version="[1.7,3)",jakarta.servlet,jakarta.servlet.http,* + + jakarta.annotation + jakarta.annotation-api + com.github.openjson openjson diff --git a/wicket-core/src/main/java/module-info.java b/wicket-core/src/main/java/module-info.java index e7bd7b3a4b0..1b67ac80702 100644 --- a/wicket-core/src/main/java/module-info.java +++ b/wicket-core/src/main/java/module-info.java @@ -30,6 +30,7 @@ requires org.danekja.jdk.serializable.functional; requires com.github.openjson; requires static org.bouncycastle.provider; + requires jakarta.annotation; provides org.apache.wicket.IInitializer with org.apache.wicket.Initializer; provides org.apache.wicket.resource.FileSystemPathService with org.apache.wicket.resource.FileSystemJarPathService; diff --git a/wicket-core/src/main/java/org/apache/wicket/Application.java b/wicket-core/src/main/java/org/apache/wicket/Application.java index 0c48666ee93..2fbb7771ff2 100644 --- a/wicket-core/src/main/java/org/apache/wicket/Application.java +++ b/wicket-core/src/main/java/org/apache/wicket/Application.java @@ -25,6 +25,9 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Supplier; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.application.ComponentInitializationListenerCollection; import org.apache.wicket.application.ComponentInstantiationListenerCollection; import org.apache.wicket.application.ComponentOnAfterRenderListenerCollection; @@ -673,7 +676,7 @@ public Supplier getExceptionMapperProvider() return exceptionMapperProvider; } - public void setExceptionMapperProvider(Supplier exceptionMapperProvider) { + public void setExceptionMapperProvider(@Nonnull Supplier exceptionMapperProvider) { this.exceptionMapperProvider = Args.notNull(exceptionMapperProvider, "exceptionMapperProvider"); } @@ -690,7 +693,7 @@ public final Supplier getSessionStoreProvider() * * @param sessionStoreProvider */ - public final Application setSessionStoreProvider(final Supplier sessionStoreProvider) + public final Application setSessionStoreProvider(@Nonnull final Supplier sessionStoreProvider) { this.sessionStoreProvider = Args.notNull(sessionStoreProvider, "sessionStoreProvider"); this.sessionStore = null; @@ -800,7 +803,7 @@ protected void validateInit() * @param name * unique application name */ - public final void setName(final String name) + public final void setName(@Nonnull final String name) { Args.notEmpty(name, "name"); @@ -1392,7 +1395,7 @@ public final IPageRendererProvider getPageRendererProvider() * * @param pageRendererProvider */ - public final Application setPageRendererProvider(final IPageRendererProvider pageRendererProvider) + public final Application setPageRendererProvider(@Nonnull final IPageRendererProvider pageRendererProvider) { Args.notNull(pageRendererProvider, "pageRendererProvider"); this.pageRendererProvider = pageRendererProvider; @@ -1519,7 +1522,7 @@ protected IMapperContext newMapperContext() * @param requestCycle * @return Session */ - public Session fetchCreateAndSetSession(final RequestCycle requestCycle) + public Session fetchCreateAndSetSession(@Nonnull final RequestCycle requestCycle) { Args.notNull(requestCycle, "requestCycle"); diff --git a/wicket-core/src/main/java/org/apache/wicket/AttributeModifier.java b/wicket-core/src/main/java/org/apache/wicket/AttributeModifier.java index 37607a602f6..175c79ec315 100644 --- a/wicket-core/src/main/java/org/apache/wicket/AttributeModifier.java +++ b/wicket-core/src/main/java/org/apache/wicket/AttributeModifier.java @@ -18,6 +18,8 @@ import java.io.Serializable; +import jakarta.annotation.Nonnull; + import org.apache.wicket.behavior.AttributeAppender; import org.apache.wicket.behavior.Behavior; import org.apache.wicket.markup.ComponentTag; @@ -102,7 +104,7 @@ public enum MarkerValue { * @param replaceModel * The model to replace the value with */ - public AttributeModifier(final String attribute, final IModel replaceModel) + public AttributeModifier(@Nonnull final String attribute, final IModel replaceModel) { Args.notNull(attribute, "attribute"); @@ -264,7 +266,7 @@ protected Serializable newValue(final String currentValue, final String replacem * @return the attribute modifier * @since 1.5 */ - public static AttributeModifier replace(String attributeName, IModel value) + public static AttributeModifier replace(@Nonnull String attributeName, IModel value) { Args.notEmpty(attributeName, "attributeName"); @@ -279,7 +281,7 @@ public static AttributeModifier replace(String attributeName, IModel value) * @return the attribute modifier * @since 1.5 */ - public static AttributeModifier replace(String attributeName, Serializable value) + public static AttributeModifier replace(@Nonnull String attributeName, Serializable value) { Args.notEmpty(attributeName, "attributeName"); @@ -296,7 +298,7 @@ public static AttributeModifier replace(String attributeName, Serializable value * @since 1.5 * @see AttributeAppender */ - public static AttributeAppender append(String attributeName, IModel value) + public static AttributeAppender append(@Nonnull String attributeName, IModel value) { Args.notEmpty(attributeName, "attributeName"); @@ -313,7 +315,7 @@ public static AttributeAppender append(String attributeName, IModel value) * @since 1.5 * @see AttributeAppender */ - public static AttributeAppender append(String attributeName, Serializable value) + public static AttributeAppender append(@Nonnull String attributeName, Serializable value) { Args.notEmpty(attributeName, "attributeName"); @@ -330,7 +332,7 @@ public static AttributeAppender append(String attributeName, Serializable value) * @since 1.5 * @see AttributeAppender */ - public static AttributeAppender prepend(String attributeName, IModel value) + public static AttributeAppender prepend(@Nonnull String attributeName, IModel value) { Args.notEmpty(attributeName, "attributeName"); @@ -357,7 +359,7 @@ protected Serializable newValue(String currentValue, String replacementValue) * @since 1.5 * @see AttributeAppender */ - public static AttributeAppender prepend(String attributeName, Serializable value) + public static AttributeAppender prepend(@Nonnull String attributeName, Serializable value) { Args.notEmpty(attributeName, "attributeName"); @@ -372,7 +374,7 @@ public static AttributeAppender prepend(String attributeName, Serializable value * @return the attribute modifier * @since 1.5 */ - public static AttributeModifier remove(String attributeName) + public static AttributeModifier remove(@Nonnull String attributeName) { Args.notEmpty(attributeName, "attributeName"); diff --git a/wicket-core/src/main/java/org/apache/wicket/Behaviors.java b/wicket-core/src/main/java/org/apache/wicket/Behaviors.java index ed0298be07c..c4c71cd256c 100644 --- a/wicket-core/src/main/java/org/apache/wicket/Behaviors.java +++ b/wicket-core/src/main/java/org/apache/wicket/Behaviors.java @@ -20,6 +20,8 @@ import java.util.Collections; import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.behavior.Behavior; import org.apache.wicket.behavior.InvalidBehaviorIdException; import org.apache.wicket.util.lang.Args; @@ -37,7 +39,7 @@ private Behaviors() // utility class } - public static void add(Component component, Behavior... behaviors) + public static void add(Component component, @Nonnull Behavior... behaviors) { Args.notNull(behaviors, "behaviors"); @@ -107,7 +109,7 @@ public static List getBehaviors(Component component, Cla } - public static void remove(Component component, Behavior behavior) + public static void remove(Component component, @Nonnull Behavior behavior) { Args.notNull(behavior, "behavior"); @@ -294,7 +296,7 @@ public BehaviorIdList() } } - public static int getBehaviorId(Component component, Behavior behavior) + public static int getBehaviorId(Component component, @Nonnull Behavior behavior) { Args.notNull(behavior, "behavior"); diff --git a/wicket-core/src/main/java/org/apache/wicket/Component.java b/wicket-core/src/main/java/org/apache/wicket/Component.java index 371fbc9a703..be2790a39b8 100644 --- a/wicket-core/src/main/java/org/apache/wicket/Component.java +++ b/wicket-core/src/main/java/org/apache/wicket/Component.java @@ -23,6 +23,8 @@ import java.util.Locale; import java.util.Optional; +import jakarta.annotation.Nonnull; + import org.apache.wicket.ajax.IAjaxRegionMarkupIdProvider; import org.apache.wicket.application.IComponentInstantiationListener; import org.apache.wicket.authorization.Action; @@ -2701,7 +2703,7 @@ public void internalRenderHead(final HtmlHeaderContainer container) * component to replace this one * @return the component which replaced this one */ - public Component replaceWith(Component replacement) + public Component replaceWith(@Nonnull Component replacement) { Args.notNull(replacement, "replacement"); @@ -2835,7 +2837,7 @@ public final void setMarkupIdImpl(Object markupId) * * @param comp */ - final void setMarkupId(Component comp) + final void setMarkupId(@Nonnull Component comp) { Args.notNull(comp, "comp"); @@ -2863,7 +2865,7 @@ final void setMarkupId(Component comp) * markup id value or null to clear any previous user defined value * @return this for chaining */ - public Component setMarkupId(String markupId) + public Component setMarkupId(@Nonnull String markupId) { Args.notEmpty(markupId, "markupId"); @@ -3411,7 +3413,7 @@ public final R visitParents(final Class parent */ @SuppressWarnings("unchecked") public final R visitParents(final Class parentClass, - final IVisitor visitor, IVisitFilter filter) + final IVisitor visitor, @Nonnull IVisitFilter filter) { Args.notNull(filter, "filter"); @@ -4446,7 +4448,7 @@ public void onEvent(IEvent event) /** {@inheritDoc} */ @Override - public final void send(IEventSink sink, Broadcast type, T payload) + public final void send(IEventSink sink, @Nonnull Broadcast type, T payload) { // if there are no event dispatchers then don't even try to send event if (getApplication().getFrameworkSettings().hasAnyEventDispatchers()) diff --git a/wicket-core/src/main/java/org/apache/wicket/ComponentEventSender.java b/wicket-core/src/main/java/org/apache/wicket/ComponentEventSender.java index 399a21fe870..80b35c469e4 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ComponentEventSender.java +++ b/wicket-core/src/main/java/org/apache/wicket/ComponentEventSender.java @@ -18,6 +18,8 @@ import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.behavior.Behavior; import org.apache.wicket.event.Broadcast; import org.apache.wicket.event.IEventSink; @@ -45,7 +47,7 @@ final class ComponentEventSender implements IEventSource * component that originated the event * @param dispatcher */ - public ComponentEventSender(Component source, IEventDispatcher dispatcher) + public ComponentEventSender(@Nonnull Component source, @Nonnull IEventDispatcher dispatcher) { Args.notNull(source, "source"); Args.notNull(dispatcher, "dispatcher"); @@ -55,7 +57,7 @@ public ComponentEventSender(Component source, IEventDispatcher dispatcher) /** {@inheritDoc} */ @Override - public void send(IEventSink sink, Broadcast type, T payload) + public void send(IEventSink sink, @Nonnull Broadcast type, T payload) { ComponentEvent event = new ComponentEvent(sink, source, type, payload); Args.notNull(type, "type"); diff --git a/wicket-core/src/main/java/org/apache/wicket/ConverterLocator.java b/wicket-core/src/main/java/org/apache/wicket/ConverterLocator.java index 9b8def9651d..8c3d86f9e45 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ConverterLocator.java +++ b/wicket-core/src/main/java/org/apache/wicket/ConverterLocator.java @@ -29,6 +29,8 @@ import java.util.Locale; import java.util.Map; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.convert.ConversionException; import org.apache.wicket.util.convert.IConverter; import org.apache.wicket.util.convert.converter.BigDecimalConverter; @@ -257,7 +259,7 @@ public final IConverter remove(Class c) * @return The previous registered converter for class c or null if none was registered yet for * class c */ - public final IConverter set(final Class c, final IConverter converter) + public final IConverter set(@Nonnull final Class c, @Nonnull final IConverter converter) { Args.notNull(c, "Class"); Args.notNull(converter, "converter"); diff --git a/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java b/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java index 11eeff1309a..8768ddbf2a5 100644 --- a/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java +++ b/wicket-core/src/main/java/org/apache/wicket/DefaultPageManagerProvider.java @@ -18,6 +18,8 @@ import java.io.File; +import jakarta.annotation.Nonnull; + import org.apache.wicket.page.IPageManager; import org.apache.wicket.page.PageManager; import org.apache.wicket.pageStore.AsynchronousPageStore; @@ -90,7 +92,7 @@ public class DefaultPageManagerProvider implements IPageManagerProvider * @param application * The application instance */ - public DefaultPageManagerProvider(Application application) + public DefaultPageManagerProvider(@Nonnull Application application) { this.application = Args.notNull(application, "application"); } @@ -233,4 +235,4 @@ protected MetaDataKey getKey() return KEY; } } -} \ No newline at end of file +} diff --git a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java index ad876b36e66..ebe46da1f8e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java +++ b/wicket-core/src/main/java/org/apache/wicket/MarkupContainer.java @@ -31,6 +31,8 @@ import java.util.stream.Stream; import java.util.stream.StreamSupport; +import jakarta.annotation.Nonnull; + import org.apache.commons.collections4.map.LinkedMap; import org.apache.wicket.behavior.OutputMarkupContainerClassNameBehavior; import org.apache.wicket.core.util.string.ComponentStrings; @@ -293,7 +295,7 @@ public MarkupContainer addOrReplace(final Component... children) * stream to be used to render the component. * @return True, if component has been added */ - public final boolean autoAdd(final Component component, MarkupStream markupStream) + public final boolean autoAdd(@Nonnull final Component component, MarkupStream markupStream) { Args.notNull(component, "component"); @@ -324,7 +326,7 @@ public final boolean autoAdd(final Component component, MarkupStream markupStrea * True if all descendents should be considered * @return True if the component is contained in this container */ - public boolean contains(final Component component, final boolean recurse) + public boolean contains(@Nonnull final Component component, final boolean recurse) { Args.notNull(component, "component"); @@ -689,7 +691,7 @@ public final Iterator iterator(Comparator comparator) * Component to remove from this container * @return {@code this} for chaining */ - public MarkupContainer remove(final Component component) + public MarkupContainer remove(@Nonnull final Component component) { checkHierarchyChange(component); @@ -708,7 +710,7 @@ public MarkupContainer remove(final Component component) * The id of the component to remove * @return {@code this} for chaining */ - public MarkupContainer remove(final String id) + public MarkupContainer remove(@Nonnull final String id) { Args.notNull(id, "id"); @@ -833,7 +835,7 @@ public final void renderAssociatedMarkup(final String openTagName) * Thrown if there was no child with the same id. * @return This */ - public MarkupContainer replace(final Component child) + public MarkupContainer replace(@Nonnull final Component child) { Args.notNull(child, "child"); @@ -992,7 +994,7 @@ public final R visitChildren(final IVisitor visitor) * @param child * Component being added */ - private void addedComponent(final Component child) + private void addedComponent(@Nonnull final Component child) { // Check for degenerate case Args.notNull(child, "child"); diff --git a/wicket-core/src/main/java/org/apache/wicket/ResourceBundles.java b/wicket-core/src/main/java/org/apache/wicket/ResourceBundles.java index 3b4375ec505..198ab9e8a43 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ResourceBundles.java +++ b/wicket-core/src/main/java/org/apache/wicket/ResourceBundles.java @@ -21,6 +21,8 @@ import java.util.List; import java.util.Map; +import jakarta.annotation.Nonnull; + import org.apache.wicket.css.ICssCompressor; import org.apache.wicket.javascript.IJavaScriptCompressor; import org.apache.wicket.markup.head.CssHeaderItem; @@ -58,7 +60,7 @@ public class ResourceBundles * @param registry * the registry that keeps all referenced resources */ - public ResourceBundles(final ResourceReferenceRegistry registry) + public ResourceBundles(@Nonnull final ResourceReferenceRegistry registry) { this.registry = Args.notNull(registry, "registry"); this.providedResourcesToBundles = new HashMap(); diff --git a/wicket-core/src/main/java/org/apache/wicket/Session.java b/wicket-core/src/main/java/org/apache/wicket/Session.java index b131ea8b0cb..cde3297ce3d 100644 --- a/wicket-core/src/main/java/org/apache/wicket/Session.java +++ b/wicket-core/src/main/java/org/apache/wicket/Session.java @@ -29,6 +29,8 @@ import java.util.function.Supplier; import java.util.regex.Pattern; +import jakarta.annotation.Nonnull; + import org.apache.wicket.application.IClassResolver; import org.apache.wicket.authorization.IAuthorizationStrategy; import org.apache.wicket.core.request.ClientInfo; @@ -220,7 +222,7 @@ public static Session get() * @param locale - locale to check * @return true in case passed locale is right-to-left */ - public static boolean isRtlLanguage(final Locale locale) { + public static boolean isRtlLanguage(@Nonnull final Locale locale) { Args.notNull(locale, "locale"); return RTL_LOCALE_RE.matcher(locale.toLanguageTag()).find(); } @@ -644,7 +646,7 @@ public final Session setClientInfo(ClientInfo clientInfo) * @param locale * New locale */ - public Session setLocale(final Locale locale) + public Session setLocale(@Nonnull final Locale locale) { Args.notNull(locale, "locale"); diff --git a/wicket-core/src/main/java/org/apache/wicket/SharedResources.java b/wicket-core/src/main/java/org/apache/wicket/SharedResources.java index 68fe47092b7..8830f15e424 100644 --- a/wicket-core/src/main/java/org/apache/wicket/SharedResources.java +++ b/wicket-core/src/main/java/org/apache/wicket/SharedResources.java @@ -18,6 +18,8 @@ import java.util.Locale; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.resource.IResource; import org.apache.wicket.request.resource.ResourceReference; import org.apache.wicket.request.resource.ResourceReference.Key; @@ -43,7 +45,7 @@ public class SharedResources * * @param registry */ - public SharedResources(ResourceReferenceRegistry registry) + public SharedResources(@Nonnull ResourceReferenceRegistry registry) { this.registry = Args.notNull(registry, "registry"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java index a4291a3f68e..fb0cd194950 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AbstractAjaxTimerBehavior.java @@ -17,6 +17,9 @@ package org.apache.wicket.ajax; import java.time.Duration; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.Page; import org.apache.wicket.core.request.handler.IPartialPageRequestHandler; @@ -253,7 +256,7 @@ protected void onUnbind() * the consumer which accepts the {@link AjaxRequestTarget} * @return the {@link AbstractAjaxTimerBehavior} */ - public static AbstractAjaxTimerBehavior onTimer(Duration interval, SerializableConsumer onTimer) + public static AbstractAjaxTimerBehavior onTimer(Duration interval, @Nonnull SerializableConsumer onTimer) { Args.notNull(onTimer, "onTimer"); diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxChannel.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxChannel.java index e2adcf1b112..d7515d53f67 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxChannel.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxChannel.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.ajax; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.io.IClusterable; import org.apache.wicket.util.lang.Args; @@ -104,7 +106,7 @@ public AjaxChannel(final String name) * @param type * the behavior type of this channel */ - public AjaxChannel(final String name, final Type type) + public AjaxChannel(@Nonnull final String name, @Nonnull final Type type) { this.name = Args.notNull(name, "name"); this.type = Args.notNull(type, "type"); diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxClientInfoBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxClientInfoBehavior.java index 9429d729876..74190aa2a37 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxClientInfoBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxClientInfoBehavior.java @@ -17,6 +17,9 @@ package org.apache.wicket.ajax; import java.time.Duration; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.Session; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; @@ -115,7 +118,7 @@ public void renderHead(Component component, IHeaderResponse response) * {@link WebClientInfo} * @return the {@link AjaxClientInfoBehavior} */ - public static AjaxClientInfoBehavior onClientInfo(SerializableBiConsumer onClientInfo) + public static AjaxClientInfoBehavior onClientInfo(@Nonnull SerializableBiConsumer onClientInfo) { Args.notNull(onClientInfo, "onClientInfo"); diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxEventBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxEventBehavior.java index 31f5e6b48bf..f4ac34bb633 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxEventBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxEventBehavior.java @@ -19,6 +19,8 @@ import java.util.ArrayList; import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; import org.apache.wicket.markup.head.IHeaderResponse; @@ -79,7 +81,7 @@ public abstract class AjaxEventBehavior extends AbstractDefaultAjaxBehavior * @param event * the event this behavior will be attached to */ - public AjaxEventBehavior(String event) + public AjaxEventBehavior(@Nonnull String event) { Args.notEmpty(event, "event"); @@ -164,7 +166,7 @@ protected final void respond(final AjaxRequestTarget target) * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AjaxEventBehavior} */ - public static AjaxEventBehavior onEvent(String eventName, SerializableConsumer onEvent) + public static AjaxEventBehavior onEvent(String eventName, @Nonnull SerializableConsumer onEvent) { Args.notNull(onEvent, "onEvent"); diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxNewWindowNotifyingBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxNewWindowNotifyingBehavior.java index f7e982d1ada..90ebfc24203 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxNewWindowNotifyingBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxNewWindowNotifyingBehavior.java @@ -18,6 +18,8 @@ import java.util.UUID; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.Page; import org.apache.wicket.ajax.attributes.AjaxCallListener; @@ -154,7 +156,7 @@ protected void onNewWindow(AjaxRequestTarget target) * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AjaxNewWindowNotifyingBehavior} */ - public static AjaxNewWindowNotifyingBehavior onNewWindow(SerializableConsumer onNewWindow) + public static AjaxNewWindowNotifyingBehavior onNewWindow(@Nonnull SerializableConsumer onNewWindow) { Args.notNull(onNewWindow, "onNewWindow"); diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxOnDomReadyClientInfoBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxOnDomReadyClientInfoBehavior.java index 84eaa08aaa0..b3318759b14 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxOnDomReadyClientInfoBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxOnDomReadyClientInfoBehavior.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.ajax; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.Session; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; @@ -96,7 +98,7 @@ public void renderHead(Component component, IHeaderResponse response) * {@link WebClientInfo} * @return the {@link AjaxOnDomReadyClientInfoBehavior} */ - public static AjaxOnDomReadyClientInfoBehavior onClientInfo(SerializableBiConsumer onClientInfo) + public static AjaxOnDomReadyClientInfoBehavior onClientInfo(@Nonnull SerializableBiConsumer onClientInfo) { Args.notNull(onClientInfo, "onClientInfo"); diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java index d9a1d386ad4..0a115891ce0 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestHandler.java @@ -24,6 +24,8 @@ import java.util.Map; import java.util.Set; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.Component; import org.apache.wicket.Page; @@ -155,7 +157,7 @@ protected void onAfterRespond(final Response response) } @Override - public void addListener(AjaxRequestTarget.IListener listener) throws IllegalStateException + public void addListener(@Nonnull AjaxRequestTarget.IListener listener) throws IllegalStateException { Args.notNull(listener, "listener"); assertListenersNotFrozen(); diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java index 6cb35afba6b..877405c98e5 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxRequestTarget.java @@ -18,6 +18,8 @@ import java.util.Map; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.Page; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; @@ -105,7 +107,7 @@ interface ITargetRespondListener * if {@link AjaxRequestTarget.IListener}'s events are currently being fired or have both been fired * already */ - void addListener(AjaxRequestTarget.IListener listener); + void addListener(@Nonnull AjaxRequestTarget.IListener listener); /** * Register the given respond listener. The listener's diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxSelfUpdatingTimerBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxSelfUpdatingTimerBehavior.java index 0f336a5c5c0..fcfd5199fb1 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxSelfUpdatingTimerBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/AjaxSelfUpdatingTimerBehavior.java @@ -18,6 +18,8 @@ import java.time.Duration; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; import org.danekja.java.util.function.serializable.SerializableConsumer; @@ -72,7 +74,7 @@ protected void onPostProcessTarget(final AjaxRequestTarget target) * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link AbstractAjaxTimerBehavior} */ - public static AjaxSelfUpdatingTimerBehavior onSelfUpdate(Duration interval, SerializableConsumer onTimer) + public static AjaxSelfUpdatingTimerBehavior onSelfUpdate(Duration interval, @Nonnull SerializableConsumer onTimer) { Args.notNull(onTimer, "onTimer"); diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxAttributeName.java b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxAttributeName.java index c0409e8326c..0bfbd00a28e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxAttributeName.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxAttributeName.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.ajax.attributes; +import jakarta.annotation.Nonnull; + import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; import org.apache.wicket.util.lang.Args; @@ -246,7 +248,7 @@ public enum AjaxAttributeName { private final String jsonName; - AjaxAttributeName(String jsonName) + AjaxAttributeName(@Nonnull String jsonName) { this.jsonName = Args.notNull(jsonName, "jsonName"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java index 222554d8b9f..b3aef1be228 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/AjaxRequestAttributes.java @@ -25,6 +25,8 @@ import org.apache.wicket.util.lang.Args; import java.time.Duration; +import jakarta.annotation.Nonnull; + /** * Attributes of an Ajax Request. * @@ -219,7 +221,7 @@ public Method getMethod() * the type of the Ajax request * @return {@code this} object for chaining */ - public AjaxRequestAttributes setMethod(final Method method) + public AjaxRequestAttributes setMethod(@Nonnull final Method method) { this.method = Args.notNull(method, "method"); return this; @@ -370,7 +372,7 @@ public EventPropagation getEventPropagation() * the type of the stop * @return {@code this} object, for chaining */ - public AjaxRequestAttributes setEventPropagation(EventPropagation eventPropagation) + public AjaxRequestAttributes setEventPropagation(@Nonnull EventPropagation eventPropagation) { this.eventPropagation = Args.notNull(eventPropagation, "eventPropagation"); return this; @@ -428,7 +430,7 @@ public String[] getEventNames() * the names of the events which will trigger the Ajax call * @return {@code this} object for chaining */ - public AjaxRequestAttributes setEventNames(String... eventNames) + public AjaxRequestAttributes setEventNames(@Nonnull String... eventNames) { Args.notNull(eventNames, "eventNames"); this.eventNames = eventNames; @@ -510,7 +512,7 @@ public String getDataType() * the type of the data in the Ajax response. * @return {@code this} object for chaining */ - public AjaxRequestAttributes setDataType(final String dataType) + public AjaxRequestAttributes setDataType(@Nonnull final String dataType) { this.dataType = Args.notEmpty(dataType, "dataType"); return this; diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java index efdf5421ab0..e6ee8d954e3 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/attributes/ThrottlingSettings.java @@ -21,6 +21,8 @@ import org.apache.wicket.util.lang.Args; import java.time.Duration; +import jakarta.annotation.Nonnull; + /** * Class to keep track of throttling settings. * @@ -80,7 +82,7 @@ public ThrottlingSettings(final String id, final Duration delay) * @param delay * the amount of time the action should be postponed */ - public ThrottlingSettings(final String id, final Duration delay, + public ThrottlingSettings(final String id, @Nonnull final Duration delay, final boolean postponeTimerOnUpdate) { this.id = id; @@ -96,7 +98,7 @@ public Duration getDelay() return delay; } - public void setDelay(Duration delay) + public void setDelay(@Nonnull Duration delay) { this.delay = Args.notNull(delay, "delay"); } @@ -131,4 +133,4 @@ public void setPostponeTimerOnUpdate(boolean postponeTimerOnUpdate) this.postponeTimerOnUpdate = postponeTimerOnUpdate; } -} \ No newline at end of file +} diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java index 522c703e4be..e1364352ef8 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.ajax.form; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.ajax.AjaxRequestTarget; @@ -124,7 +126,7 @@ static boolean appliesTo(Component component) * @return the {@link AjaxFormChoiceComponentUpdatingBehavior} */ public static AjaxFormChoiceComponentUpdatingBehavior onUpdateChoice( - SerializableConsumer onUpdateChoice) + @Nonnull SerializableConsumer onUpdateChoice) { Args.notNull(onUpdateChoice, "onUpdateChoice"); return new AjaxFormChoiceComponentUpdatingBehavior() diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java index 27308271751..d39ff8eb8ac 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormComponentUpdatingBehavior.java @@ -18,6 +18,8 @@ import java.util.Locale; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.Component; import org.apache.wicket.WicketRuntimeException; @@ -226,7 +228,7 @@ protected void onError(AjaxRequestTarget target, RuntimeException e) * @return the {@link AjaxFormComponentUpdatingBehavior} */ public static AjaxFormComponentUpdatingBehavior onUpdate(String eventName, - SerializableConsumer onUpdate) + @Nonnull SerializableConsumer onUpdate) { Args.notNull(onUpdate, "onUpdate"); diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java index 23137b1e66a..506376a959b 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormSubmitBehavior.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.ajax.form; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxEventBehavior; import org.apache.wicket.ajax.AjaxRequestTarget; @@ -313,7 +315,7 @@ public void setDefaultProcessing(boolean defaultProcessing) * @return the {@link AjaxFormSubmitBehavior} */ public static AjaxFormSubmitBehavior onSubmit(String eventName, - SerializableConsumer onSubmit) + @Nonnull SerializableConsumer onSubmit) { Args.notNull(onSubmit, "onSubmit"); diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormValidatingBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormValidatingBehavior.java index fc6022ffd5c..a5187b68e8f 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormValidatingBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/form/AjaxFormValidatingBehavior.java @@ -27,6 +27,9 @@ import org.apache.wicket.markup.html.form.FormComponent; import org.apache.wicket.util.io.IClusterable; import java.time.Duration; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.visit.IVisit; import org.apache.wicket.util.visit.IVisitor; @@ -86,7 +89,7 @@ public AjaxFormValidatingBehavior(String event, Duration throttleDelay) } @Override - public void bind(Component component) + public void bind(@Nonnull Component component) { super.bind(component); diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/form/OnChangeAjaxBehavior.java b/wicket-core/src/main/java/org/apache/wicket/ajax/form/OnChangeAjaxBehavior.java index 198e3364e3f..4fc99c1f0df 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/form/OnChangeAjaxBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/form/OnChangeAjaxBehavior.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.ajax.form; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.attributes.AjaxRequestAttributes; @@ -88,7 +90,7 @@ protected void updateAjaxAttributes(AjaxRequestAttributes attributes) * the {@code SerializableConsumer} which accepts the {@link AjaxRequestTarget} * @return the {@link OnChangeAjaxBehavior} */ - public static OnChangeAjaxBehavior onChange(SerializableConsumer onChange) + public static OnChangeAjaxBehavior onChange(@Nonnull SerializableConsumer onChange) { Args.notNull(onChange, "onChange"); diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/json/JSONFunction.java b/wicket-core/src/main/java/org/apache/wicket/ajax/json/JSONFunction.java index 7cc7acdb4da..c663efabed7 100644 --- a/wicket-core/src/main/java/org/apache/wicket/ajax/json/JSONFunction.java +++ b/wicket-core/src/main/java/org/apache/wicket/ajax/json/JSONFunction.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.ajax.json; +import jakarta.annotation.Nonnull; + import com.github.openjson.JSONString; import org.apache.wicket.util.io.IClusterable; import org.apache.wicket.util.lang.Args; @@ -33,7 +35,7 @@ public class JSONFunction implements JSONString, CharSequence, IClusterable * Function to be used to output the json value without quotes * @param value the value */ - public JSONFunction(CharSequence value) + public JSONFunction(@Nonnull CharSequence value) { this.value = Args.notNull(value, "value"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/application/AbstractClassResolver.java b/wicket-core/src/main/java/org/apache/wicket/application/AbstractClassResolver.java index de8a9b3b149..7668fc40b12 100644 --- a/wicket-core/src/main/java/org/apache/wicket/application/AbstractClassResolver.java +++ b/wicket-core/src/main/java/org/apache/wicket/application/AbstractClassResolver.java @@ -25,6 +25,8 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.util.collections.UrlExternalFormComparator; @@ -112,7 +114,7 @@ public final Class resolveClass(final String className) throws ClassNotFoundE } @Override - public Iterator getResources(final String name) + public Iterator getResources(@Nonnull final String name) { Set resultSet = new TreeSet<>(new UrlExternalFormComparator()); diff --git a/wicket-core/src/main/java/org/apache/wicket/application/CompoundClassResolver.java b/wicket-core/src/main/java/org/apache/wicket/application/CompoundClassResolver.java index f73bae3949e..1b1d8d57f9b 100644 --- a/wicket-core/src/main/java/org/apache/wicket/application/CompoundClassResolver.java +++ b/wicket-core/src/main/java/org/apache/wicket/application/CompoundClassResolver.java @@ -23,6 +23,8 @@ import java.util.TreeSet; import java.util.concurrent.CopyOnWriteArrayList; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.collections.UrlExternalFormComparator; import org.apache.wicket.util.lang.Args; import org.slf4j.Logger; @@ -89,7 +91,7 @@ public Class resolveClass(final String className) throws ClassNotFoundExcepti * @return An {@link Iterator} of all the {@link URL}s matching the resource name. */ @Override - public Iterator getResources(final String name) + public Iterator getResources(@Nonnull final String name) { Args.notNull(name, "name"); @@ -134,7 +136,7 @@ public ClassLoader getClassLoader() * The resolver to add * @return {@code this} for chaining */ - public CompoundClassResolver add(final IClassResolver resolver) + public CompoundClassResolver add(@Nonnull final IClassResolver resolver) { Args.notNull(resolver, "resolver"); resolvers.add(resolver); @@ -153,4 +155,4 @@ public CompoundClassResolver remove(final IClassResolver resolver) resolvers.remove(resolver); return this; } -} \ No newline at end of file +} diff --git a/wicket-core/src/main/java/org/apache/wicket/application/IClassResolver.java b/wicket-core/src/main/java/org/apache/wicket/application/IClassResolver.java index 6fcfe04e17b..d42e3d25a19 100644 --- a/wicket-core/src/main/java/org/apache/wicket/application/IClassResolver.java +++ b/wicket-core/src/main/java/org/apache/wicket/application/IClassResolver.java @@ -19,6 +19,8 @@ import java.net.URL; import java.util.Iterator; +import jakarta.annotation.Nonnull; + /** * An interface to code which finds classes and resources * @@ -45,7 +47,7 @@ public interface IClassResolver * @param name * @return iterator over matching resources */ - Iterator getResources(String name); + Iterator getResources(@Nonnull String name); /** * Returns the {@link ClassLoader} to be used for resolving classes @@ -53,4 +55,4 @@ public interface IClassResolver * @return the {@link ClassLoader} to be used for resolving classes */ ClassLoader getClassLoader(); -} \ No newline at end of file +} diff --git a/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/DefaultAuthenticationStrategy.java b/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/DefaultAuthenticationStrategy.java index b905858f644..dfd513dc415 100644 --- a/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/DefaultAuthenticationStrategy.java +++ b/wicket-core/src/main/java/org/apache/wicket/authentication/strategy/DefaultAuthenticationStrategy.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.authentication.strategy; +import jakarta.annotation.Nonnull; + import org.apache.wicket.authentication.IAuthenticationStrategy; import org.apache.wicket.util.cookies.CookieDefaults; import org.apache.wicket.util.cookies.CookieUtils; @@ -59,7 +61,7 @@ public class DefaultAuthenticationStrategy implements IAuthenticationStrategy * @param crypt * the crypt */ - public DefaultAuthenticationStrategy(final String cookieKey, ICrypt crypt) + public DefaultAuthenticationStrategy(@Nonnull final String cookieKey, @Nonnull ICrypt crypt) { this.cookieKey = Args.notEmpty(cookieKey, "cookieKey"); this.crypt = Args.notNull(crypt, "crypt"); diff --git a/wicket-core/src/main/java/org/apache/wicket/behavior/AbstractAjaxBehavior.java b/wicket-core/src/main/java/org/apache/wicket/behavior/AbstractAjaxBehavior.java index fa19179355a..61162873222 100644 --- a/wicket-core/src/main/java/org/apache/wicket/behavior/AbstractAjaxBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/behavior/AbstractAjaxBehavior.java @@ -25,6 +25,8 @@ import java.util.List; +import jakarta.annotation.Nonnull; + /** * Abstract class for handling Ajax roundtrips. This class serves as a base for javascript specific * implementations, like ones based on Dojo or Scriptaculous, or Wicket's default. @@ -54,7 +56,7 @@ public AbstractAjaxBehavior() * the component to bind to */ @Override - public final void bind(final Component hostComponent) + public final void bind(@Nonnull final Component hostComponent) { Args.notNull(hostComponent, "hostComponent"); diff --git a/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java b/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java index c4eae58caea..606f33b6a5e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/behavior/Behavior.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.behavior; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.Component; import org.apache.wicket.IComponentAwareEventSink; @@ -100,7 +102,7 @@ public void afterRender(Component component) * @param component * the component to bind to */ - public void bind(Component component) + public void bind(@Nonnull Component component) { } @@ -277,7 +279,7 @@ public void onRemove(Component component) * the {@code SerializableConsumer} that accepts the {@link ComponentTag} * @return The created behavior */ - public static Behavior onTag(SerializableBiConsumer onTagConsumer) + public static Behavior onTag(@Nonnull SerializableBiConsumer onTagConsumer) { Args.notNull(onTagConsumer, "onTagConsumer"); @@ -308,8 +310,8 @@ public void onComponentTag(Component component, ComponentTag tag) * returns a new value * @return The created behavior */ - public static Behavior onAttribute(String name, - SerializableFunction onAttribute) + public static Behavior onAttribute(@Nonnull String name, + @Nonnull SerializableFunction onAttribute) { Args.notEmpty(name, "name"); Args.notNull(onAttribute, "onAttribute"); diff --git a/wicket-core/src/main/java/org/apache/wicket/coep/CrossOriginEmbedderPolicyConfiguration.java b/wicket-core/src/main/java/org/apache/wicket/coep/CrossOriginEmbedderPolicyConfiguration.java index 4094b7454e5..2a7397d910d 100644 --- a/wicket-core/src/main/java/org/apache/wicket/coep/CrossOriginEmbedderPolicyConfiguration.java +++ b/wicket-core/src/main/java/org/apache/wicket/coep/CrossOriginEmbedderPolicyConfiguration.java @@ -24,6 +24,8 @@ import java.util.HashSet; import java.util.Set; +import jakarta.annotation.Nonnull; + /** * Specifies the configuration for Cross-Origin Embedder Policy to be used for * {@link CrossOriginEmbedderPolicyRequestCycleListener}. Users can specify the paths that should be exempt from COEP and @@ -70,13 +72,13 @@ public enum CoepMode private final Set exemptions = new HashSet<>(); private final CoepMode mode; - public CrossOriginEmbedderPolicyConfiguration(CoepMode mode, String... exemptions) + public CrossOriginEmbedderPolicyConfiguration(@Nonnull CoepMode mode, String... exemptions) { this.exemptions.addAll(Arrays.asList(exemptions)); this.mode = Args.notNull(mode, "mode"); } - public CrossOriginEmbedderPolicyConfiguration(CoepMode mode) + public CrossOriginEmbedderPolicyConfiguration(@Nonnull CoepMode mode) { this.mode = Args.notNull(mode, "mode"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/coep/CrossOriginEmbedderPolicyRequestCycleListener.java b/wicket-core/src/main/java/org/apache/wicket/coep/CrossOriginEmbedderPolicyRequestCycleListener.java index d2077879619..a58608fd134 100644 --- a/wicket-core/src/main/java/org/apache/wicket/coep/CrossOriginEmbedderPolicyRequestCycleListener.java +++ b/wicket-core/src/main/java/org/apache/wicket/coep/CrossOriginEmbedderPolicyRequestCycleListener.java @@ -25,6 +25,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.annotation.Nonnull; import jakarta.servlet.http.HttpServletRequest; /** @@ -60,7 +61,7 @@ public class CrossOriginEmbedderPolicyRequestCycleListener implements IRequestCy private final CrossOriginEmbedderPolicyConfiguration coepConfig; - public CrossOriginEmbedderPolicyRequestCycleListener(CrossOriginEmbedderPolicyConfiguration coepConfig) + public CrossOriginEmbedderPolicyRequestCycleListener(@Nonnull CrossOriginEmbedderPolicyConfiguration coepConfig) { this.coepConfig = Args.notNull(coepConfig, "coepConfig"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/coop/CrossOriginOpenerPolicyConfiguration.java b/wicket-core/src/main/java/org/apache/wicket/coop/CrossOriginOpenerPolicyConfiguration.java index ff363bdd823..9098e8d4d4a 100644 --- a/wicket-core/src/main/java/org/apache/wicket/coop/CrossOriginOpenerPolicyConfiguration.java +++ b/wicket-core/src/main/java/org/apache/wicket/coop/CrossOriginOpenerPolicyConfiguration.java @@ -24,6 +24,8 @@ import java.util.HashSet; import java.util.Set; +import jakarta.annotation.Nonnull; + /** * Specifies the configuration for Cross-Origin Opener Policy to be used by * {@link CrossOriginOpenerPolicyRequestCycleListener} when adding COOP headers. Users can specify the paths that @@ -74,13 +76,13 @@ public enum CoopMode private final Set exemptions = new HashSet<>(); private final CoopMode mode; - public CrossOriginOpenerPolicyConfiguration(CoopMode mode, String... exemptions) + public CrossOriginOpenerPolicyConfiguration(@Nonnull CoopMode mode, String... exemptions) { this.exemptions.addAll(Arrays.asList(exemptions)); this.mode = Args.notNull(mode, "mode"); } - public CrossOriginOpenerPolicyConfiguration(CoopMode mode) + public CrossOriginOpenerPolicyConfiguration(@Nonnull CoopMode mode) { this.mode = Args.notNull(mode, "mode"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/coop/CrossOriginOpenerPolicyRequestCycleListener.java b/wicket-core/src/main/java/org/apache/wicket/coop/CrossOriginOpenerPolicyRequestCycleListener.java index 4842360b98a..a26b814f1fb 100644 --- a/wicket-core/src/main/java/org/apache/wicket/coop/CrossOriginOpenerPolicyRequestCycleListener.java +++ b/wicket-core/src/main/java/org/apache/wicket/coop/CrossOriginOpenerPolicyRequestCycleListener.java @@ -25,6 +25,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.annotation.Nonnull; import jakarta.servlet.http.HttpServletRequest; /** @@ -57,7 +58,7 @@ public class CrossOriginOpenerPolicyRequestCycleListener implements IRequestCycl private final CrossOriginOpenerPolicyConfiguration coopConfig; - public CrossOriginOpenerPolicyRequestCycleListener(CrossOriginOpenerPolicyConfiguration coopConfig) + public CrossOriginOpenerPolicyRequestCycleListener(@Nonnull CrossOriginOpenerPolicyConfiguration coopConfig) { this.coopConfig = Args.notNull(coopConfig, "coopConfig"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/AbstractPartialPageRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/AbstractPartialPageRequestHandler.java index accada33ff9..2a415c3edbd 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/AbstractPartialPageRequestHandler.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/AbstractPartialPageRequestHandler.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.core.request.handler; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.MarkupContainer; import org.apache.wicket.Page; @@ -36,12 +38,12 @@ public abstract class AbstractPartialPageRequestHandler implements IPartialPageR /** The associated Page */ private final Page page; - protected AbstractPartialPageRequestHandler(Page page) { + protected AbstractPartialPageRequestHandler(@Nonnull Page page) { this.page = Args.notNull(page, "page"); } @Override - public final void addChildren(MarkupContainer parent, Class childCriteria) + public final void addChildren(@Nonnull MarkupContainer parent, @Nonnull Class childCriteria) { Args.notNull(parent, "parent"); Args.notNull(childCriteria, "childCriteria"); diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/BookmarkableListenerRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/BookmarkableListenerRequestHandler.java index 159b8130c6d..4b7d335a4fc 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/BookmarkableListenerRequestHandler.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/BookmarkableListenerRequestHandler.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.core.request.handler; +import jakarta.annotation.Nonnull; + import org.apache.wicket.IRequestListener; import org.apache.wicket.request.IRequestCycle; import org.apache.wicket.request.component.IRequestableComponent; @@ -45,7 +47,7 @@ public class BookmarkableListenerRequestHandler * @param behaviorIndex */ public BookmarkableListenerRequestHandler( - IPageAndComponentProvider pageComponentProvider, + @Nonnull IPageAndComponentProvider pageComponentProvider, Integer behaviorIndex) { Args.notNull(pageComponentProvider, "pageComponentProvider"); diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/BookmarkablePageRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/BookmarkablePageRequestHandler.java index a7a94508ff4..eabc6e12a55 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/BookmarkablePageRequestHandler.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/BookmarkablePageRequestHandler.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.core.request.handler; +import jakarta.annotation.Nonnull; + import org.apache.wicket.core.request.handler.logger.PageLogData; import org.apache.wicket.request.ILoggableRequestHandler; import org.apache.wicket.request.IRequestCycle; @@ -43,7 +45,7 @@ public class BookmarkablePageRequestHandler * * @param pageProvider */ - public BookmarkablePageRequestHandler(IPageProvider pageProvider) + public BookmarkablePageRequestHandler(@Nonnull IPageProvider pageProvider) { Args.notNull(pageProvider, "pageProvider"); diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/IPartialPageRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/IPartialPageRequestHandler.java index 4db9e986b19..d28b717aa8a 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/IPartialPageRequestHandler.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/IPartialPageRequestHandler.java @@ -18,6 +18,8 @@ import java.util.Collection; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.MarkupContainer; import org.apache.wicket.markup.head.IHeaderResponse; @@ -61,7 +63,7 @@ public interface IPartialPageRequestHandler extends IPageRequestHandler * Must not be null. If you want to traverse all components use ` Component.class as * the value for this argument. */ - void addChildren(MarkupContainer parent, Class childCriteria); + void addChildren(@Nonnull MarkupContainer parent, @Nonnull Class childCriteria); /** * Add JavasSript that will be evaluated on the client side after components are replaced diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerRequestHandler.java index 5279cadb56b..8fb9d74b94b 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerRequestHandler.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/ListenerRequestHandler.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.core.request.handler; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.IRequestListener; import org.apache.wicket.Page; @@ -59,7 +61,7 @@ public class ListenerRequestHandler * @param pageComponentProvider * @param behaviorIndex */ - public ListenerRequestHandler(IPageAndComponentProvider pageComponentProvider, Integer behaviorIndex) + public ListenerRequestHandler(@Nonnull IPageAndComponentProvider pageComponentProvider, Integer behaviorIndex) { Args.notNull(pageComponentProvider, "pageComponentProvider"); diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/PageAndComponentProvider.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/PageAndComponentProvider.java index 22931d5b447..eec99f5988a 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/PageAndComponentProvider.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/PageAndComponentProvider.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.core.request.handler; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Page; import org.apache.wicket.feedback.FeedbackDelay; import org.apache.wicket.request.component.IRequestableComponent; @@ -55,7 +57,7 @@ public PageAndComponentProvider(IRequestablePage page, String componentPath) * @param page * @param component */ - public PageAndComponentProvider(IRequestablePage page, IRequestableComponent component) + public PageAndComponentProvider(IRequestablePage page, @Nonnull IRequestableComponent component) { super(page); @@ -135,7 +137,7 @@ public PageAndComponentProvider(int pageId, Integer renderCount, String componen setComponentPath(componentPath); } - public PageAndComponentProvider(IRequestablePage page, IRequestableComponent component, + public PageAndComponentProvider(IRequestablePage page, @Nonnull IRequestableComponent component, PageParameters parameters) { super(page); @@ -210,7 +212,7 @@ public String getComponentPath() * * @param componentPath */ - private void setComponentPath(String componentPath) + private void setComponentPath(@Nonnull String componentPath) { Args.notNull(componentPath, "componentPath"); diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/PageProvider.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/PageProvider.java index 7193eb89bdd..0fdeb2b8427 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/PageProvider.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/PageProvider.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.core.request.handler; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.core.request.mapper.IPageSource; import org.apache.wicket.core.request.mapper.StalePageException; @@ -146,7 +148,7 @@ public PageProvider(Class pageClass) * * @param page */ - public PageProvider(IRequestablePage page) + public PageProvider(@Nonnull IRequestablePage page) { Args.notNull(page, "page"); @@ -300,7 +302,7 @@ public void setPageSource(IPageSource pageSource) * * @param pageClass */ - private void setPageClass(Class pageClass) + private void setPageClass(@Nonnull Class pageClass) { Args.notNull(pageClass, "pageClass"); diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/RenderPageRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/RenderPageRequestHandler.java index 156d42031ba..8b07651ad0f 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/RenderPageRequestHandler.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/RenderPageRequestHandler.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.core.request.handler; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.Session; import org.apache.wicket.core.request.handler.logger.PageLogData; @@ -123,7 +125,7 @@ public RenderPageRequestHandler(IPageProvider pageProvider) * @param pageProvider * @param redirectPolicy */ - public RenderPageRequestHandler(IPageProvider pageProvider, RedirectPolicy redirectPolicy) + public RenderPageRequestHandler(@Nonnull IPageProvider pageProvider, @Nonnull RedirectPolicy redirectPolicy) { Args.notNull(pageProvider, "pageProvider"); Args.notNull(redirectPolicy, "redirectPolicy"); diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/RequestSettingRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/RequestSettingRequestHandler.java index 06ee9aa5732..74b7d441d30 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/handler/RequestSettingRequestHandler.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/handler/RequestSettingRequestHandler.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.core.request.handler; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.IRequestCycle; import org.apache.wicket.request.IRequestHandler; import org.apache.wicket.request.IRequestHandlerDelegate; @@ -42,7 +44,7 @@ public class RequestSettingRequestHandler implements IRequestHandlerDelegate * @param delegate * The request handler to delegate responding to */ - public RequestSettingRequestHandler(Request request, IRequestHandler delegate) + public RequestSettingRequestHandler(@Nonnull Request request, @Nonnull IRequestHandler delegate) { this.request = Args.notNull(request, "request"); this.delegate = Args.notNull(delegate,"delegate"); diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/AbstractBookmarkableMapper.java b/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/AbstractBookmarkableMapper.java index 12298060b71..59ed67e4473 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/AbstractBookmarkableMapper.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/AbstractBookmarkableMapper.java @@ -20,6 +20,8 @@ import java.util.List; import java.util.Locale; +import jakarta.annotation.Nonnull; + import org.apache.wicket.IRequestListener; import org.apache.wicket.Session; import org.apache.wicket.core.request.handler.BookmarkableListenerRequestHandler; @@ -85,7 +87,7 @@ protected static final class UrlInfo * optional parameter providing pageParameters */ public UrlInfo(PageComponentInfo pageComponentInfo, - Class pageClass, PageParameters pageParameters) + @Nonnull Class pageClass, PageParameters pageParameters) { Args.notNull(pageClass, "pageClass"); @@ -162,7 +164,7 @@ public AbstractBookmarkableMapper() this("notUsed", new PageParametersEncoder()); } - public AbstractBookmarkableMapper(String mountPath, IPageParametersEncoder pageParametersEncoder) + public AbstractBookmarkableMapper(@Nonnull String mountPath, @Nonnull IPageParametersEncoder pageParametersEncoder) { Args.notEmpty(mountPath, "mountPath"); @@ -461,7 +463,7 @@ else if (requestHandler instanceof BookmarkableListenerRequestHandler) return null; } - protected final PageInfo getPageInfo(IPageRequestHandler handler) + protected final PageInfo getPageInfo(@Nonnull IPageRequestHandler handler) { Args.notNull(handler, "handler"); diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/AbstractComponentMapper.java b/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/AbstractComponentMapper.java index 71a28f55c83..5e0d68eee11 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/AbstractComponentMapper.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/AbstractComponentMapper.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.core.request.mapper; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.core.util.lang.WicketObjects; import org.apache.wicket.request.IRequestMapper; @@ -66,7 +68,7 @@ protected PageComponentInfo getPageComponentInfo(final Url url) * @param url * @param info */ - protected void encodePageComponentInfo(Url url, PageComponentInfo info) + protected void encodePageComponentInfo(@Nonnull Url url, PageComponentInfo info) { Args.notNull(url, "url"); @@ -100,7 +102,7 @@ protected Class getPageClass(String name) * The raw class name parsed from the url * @return The cleaned class name */ - protected String cleanClassName(String className) + protected String cleanClassName(@Nonnull String className) { Args.notEmpty(className, "className"); diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/BasicResourceReferenceMapper.java b/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/BasicResourceReferenceMapper.java index d353cd22740..2b876690e22 100755 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/BasicResourceReferenceMapper.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/BasicResourceReferenceMapper.java @@ -20,6 +20,8 @@ import java.util.StringTokenizer; import java.util.function.Supplier; +import jakarta.annotation.Nonnull; + import org.apache.wicket.core.util.lang.WicketObjects; import org.apache.wicket.request.IRequestHandler; import org.apache.wicket.request.Request; @@ -71,7 +73,7 @@ public class BasicResourceReferenceMapper extends AbstractResourceReferenceMappe * @param pageParametersEncoder * @param cachingStrategy */ - public BasicResourceReferenceMapper(IPageParametersEncoder pageParametersEncoder, + public BasicResourceReferenceMapper(@Nonnull IPageParametersEncoder pageParametersEncoder, Supplier cachingStrategy) { this.pageParametersEncoder = Args.notNull(pageParametersEncoder, "pageParametersEncoder"); diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/CryptoMapper.java b/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/CryptoMapper.java index 333250ecbff..d831acd0206 100755 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/CryptoMapper.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/CryptoMapper.java @@ -20,6 +20,8 @@ import java.util.List; import java.util.function.Supplier; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.core.request.handler.RequestSettingRequestHandler; import org.apache.wicket.protocol.http.PageExpiredException; @@ -138,7 +140,7 @@ public CryptoMapper(final IRequestMapper wrappedMapper, final Application applic * @param cryptProvider * the custom crypt provider */ - public CryptoMapper(final IRequestMapper wrappedMapper, final Supplier cryptProvider) + public CryptoMapper(@Nonnull final IRequestMapper wrappedMapper, @Nonnull final Supplier cryptProvider) { this.wrappedMapper = Args.notNull(wrappedMapper, "wrappedMapper"); this.cryptProvider = Args.notNull(cryptProvider, "cryptProvider"); diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/MapperUtils.java b/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/MapperUtils.java index 9cd1e62c516..bec0474180e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/MapperUtils.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/MapperUtils.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.core.request.mapper; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.IRequestMapper; import org.apache.wicket.request.Url; import org.apache.wicket.request.mapper.info.PageComponentInfo; @@ -39,7 +41,7 @@ private MapperUtils() * * @return The parsed {@link PageComponentInfo}, or {@code null} if the parameter could not be parsed. */ - public static PageComponentInfo parsePageComponentInfoParameter(final Url.QueryParameter parameter) + public static PageComponentInfo parsePageComponentInfoParameter(@Nonnull final Url.QueryParameter parameter) { Args.notNull(parameter, "parameter"); @@ -59,7 +61,7 @@ public static PageComponentInfo parsePageComponentInfoParameter(final Url.QueryP * * @return PageComponentInfo instance if one was encoded in URL, null otherwise. */ - public static PageComponentInfo getPageComponentInfo(final Url url) + public static PageComponentInfo getPageComponentInfo(@Nonnull final Url url) { Args.notNull(url, "url"); diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/MountedMapper.java b/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/MountedMapper.java index f2ab13d482d..9b20ae38719 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/MountedMapper.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/MountedMapper.java @@ -19,6 +19,8 @@ import java.util.Objects; import java.util.function.Supplier; +import jakarta.annotation.Nonnull; + import org.apache.wicket.core.request.handler.ListenerRequestHandler; import org.apache.wicket.request.IRequestHandler; import org.apache.wicket.request.Request; @@ -111,7 +113,7 @@ public MountedMapper(String mountPath, Class pageCla * @param pageParametersEncoder */ public MountedMapper(String mountPath, - Supplier> pageClassProvider, + @Nonnull Supplier> pageClassProvider, IPageParametersEncoder pageParametersEncoder) { super(mountPath, pageParametersEncoder); diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/PackageMapper.java b/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/PackageMapper.java index 5b14331fb19..ad847c9d9ab 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/PackageMapper.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/PackageMapper.java @@ -19,6 +19,8 @@ import java.lang.reflect.Modifier; import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.protocol.http.WebApplication; import org.apache.wicket.request.Request; import org.apache.wicket.request.Url; @@ -84,7 +86,7 @@ public PackageMapper(String mountPath, final PackageName packageName) * @param packageName * @param pageParametersEncoder */ - public PackageMapper(String mountPath, final PackageName packageName, + public PackageMapper(String mountPath, @Nonnull final PackageName packageName, final IPageParametersEncoder pageParametersEncoder) { super(mountPath, pageParametersEncoder); diff --git a/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/ResourceMapper.java b/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/ResourceMapper.java index 4928cc2e466..31a417f23c3 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/ResourceMapper.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/request/mapper/ResourceMapper.java @@ -18,6 +18,7 @@ import java.util.List; +import jakarta.annotation.Nonnull; import jakarta.servlet.http.HttpServletResponse; import org.apache.wicket.Application; @@ -108,7 +109,7 @@ public ResourceMapper(String path, ResourceReference resourceReference) * @param encoder * encoder for url parameters */ - public ResourceMapper(String path, ResourceReference resourceReference, + public ResourceMapper(String path, @Nonnull ResourceReference resourceReference, IPageParametersEncoder encoder) { super(path, encoder); diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/crypt/AESCrypt.java b/wicket-core/src/main/java/org/apache/wicket/core/util/crypt/AESCrypt.java index 59d1d4893e6..e3a4c01f1ef 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/util/crypt/AESCrypt.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/util/crypt/AESCrypt.java @@ -24,6 +24,8 @@ import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; +import jakarta.annotation.Nonnull; + import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; @@ -68,8 +70,8 @@ public AESCrypt(SecretKey secretKey, ISecureRandomSupplier randomSupplier) * @param randomSupplier * The {@link ISecureRandomSupplier} to use to generate random values. */ - public AESCrypt(SecretKey secretKey, String algorithm, - ISecureRandomSupplier randomSupplier) + public AESCrypt(@Nonnull SecretKey secretKey, @Nonnull String algorithm, + @Nonnull ISecureRandomSupplier randomSupplier) { Args.notNull(secretKey, "secretKey"); Args.notNull(algorithm, "algorithm"); @@ -129,4 +131,4 @@ protected byte[] encrypt(byte[] plainBytes) } } -} \ No newline at end of file +} diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/crypt/KeyInSessionSunJceCryptFactory.java b/wicket-core/src/main/java/org/apache/wicket/core/util/crypt/KeyInSessionSunJceCryptFactory.java index 49f69d0d4c6..c87077716ba 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/util/crypt/KeyInSessionSunJceCryptFactory.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/util/crypt/KeyInSessionSunJceCryptFactory.java @@ -27,6 +27,8 @@ import java.security.Security; import java.util.UUID; +import jakarta.annotation.Nonnull; + /** * Crypt factory that produces {@link SunJceCrypt} instances based on session-specific * encryption key. This allows each user to have his own encryption key, hardening against CSRF @@ -55,7 +57,7 @@ public KeyInSessionSunJceCryptFactory() * @param cryptMethod * the name of the crypt method (cipher) */ - public KeyInSessionSunJceCryptFactory(String cryptMethod) + public KeyInSessionSunJceCryptFactory(@Nonnull String cryptMethod) { this.cryptMethod = Args.notNull(cryptMethod, "Crypt method"); diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/file/WebApplicationPath.java b/wicket-core/src/main/java/org/apache/wicket/core/util/file/WebApplicationPath.java index 7be83131a67..5fc386f321f 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/util/file/WebApplicationPath.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/util/file/WebApplicationPath.java @@ -18,6 +18,7 @@ import java.net.URL; +import jakarta.annotation.Nonnull; import jakarta.servlet.ServletContext; import org.apache.wicket.core.util.resource.UrlResourceStream; @@ -73,7 +74,7 @@ public WebApplicationPath(final ServletContext servletContext, String path) * @see org.apache.wicket.util.file.IResourceFinder#find(Class, String) */ @Override - public IResourceStream find(final Class clazz, final String pathname) + public IResourceStream find(final Class clazz, @Nonnull final String pathname) { IResourceStream resourceStream = null; if (pathname.startsWith(WEB_INF) == false) diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/AbstractObjectChecker.java b/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/AbstractObjectChecker.java index eb2f8ecf050..7f4ee78c192 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/AbstractObjectChecker.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/util/objects/checker/AbstractObjectChecker.java @@ -18,6 +18,8 @@ import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.lang.Generics; import org.slf4j.Logger; @@ -38,7 +40,7 @@ protected AbstractObjectChecker() this(Generics.>newArrayList()); } - protected AbstractObjectChecker(List> exclusions) + protected AbstractObjectChecker(@Nonnull List> exclusions) { this.exclusions = Args.notNull(exclusions, "exclusions"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/resource/ClassPathResourceFinder.java b/wicket-core/src/main/java/org/apache/wicket/core/util/resource/ClassPathResourceFinder.java index fc4e0294c1a..2178d5f8483 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/util/resource/ClassPathResourceFinder.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/util/resource/ClassPathResourceFinder.java @@ -18,6 +18,8 @@ import java.net.URL; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.file.IResourceFinder; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.resource.IResourceStream; @@ -53,7 +55,7 @@ else if (prefix.endsWith("/")) } @Override - public IResourceStream find(Class clazz, String path) + public IResourceStream find(Class clazz, @Nonnull String path) { Args.notEmpty(path, "path"); String fullPath = prefix + (path.startsWith("/") ? path.substring(1) : path); diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/resource/UrlResourceStream.java b/wicket-core/src/main/java/org/apache/wicket/core/util/resource/UrlResourceStream.java index bf451c9d524..f844a893d43 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/util/resource/UrlResourceStream.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/util/resource/UrlResourceStream.java @@ -24,6 +24,9 @@ import java.time.Instant; import java.util.ArrayList; import java.util.List; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.util.io.Connections; import org.apache.wicket.util.io.IOUtils; @@ -96,7 +99,7 @@ private static class StreamData * @param url * URL of resource */ - public UrlResourceStream(final URL url) + public UrlResourceStream(@Nonnull final URL url) { this.url = Args.notNull(url, "url"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/resource/locator/caching/CachingResourceStreamLocator.java b/wicket-core/src/main/java/org/apache/wicket/core/util/resource/locator/caching/CachingResourceStreamLocator.java index 8dece40fd53..3fd12ee7b85 100644 --- a/wicket-core/src/main/java/org/apache/wicket/core/util/resource/locator/caching/CachingResourceStreamLocator.java +++ b/wicket-core/src/main/java/org/apache/wicket/core/util/resource/locator/caching/CachingResourceStreamLocator.java @@ -20,6 +20,8 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import jakarta.annotation.Nonnull; + import org.apache.wicket.core.util.resource.UrlResourceStream; import org.apache.wicket.core.util.resource.locator.IResourceNameIterator; import org.apache.wicket.core.util.resource.locator.IResourceStreamLocator; @@ -53,7 +55,7 @@ public class CachingResourceStreamLocator implements IResourceStreamLocator * @param resourceStreamLocator * the delegate */ - public CachingResourceStreamLocator(final IResourceStreamLocator resourceStreamLocator) + public CachingResourceStreamLocator(@Nonnull final IResourceStreamLocator resourceStreamLocator) { Args.notNull(resourceStreamLocator, "resourceStreamLocator"); diff --git a/wicket-core/src/main/java/org/apache/wicket/csp/ClonedCSPValue.java b/wicket-core/src/main/java/org/apache/wicket/csp/ClonedCSPValue.java index bd8dcb71295..480c2350d50 100644 --- a/wicket-core/src/main/java/org/apache/wicket/csp/ClonedCSPValue.java +++ b/wicket-core/src/main/java/org/apache/wicket/csp/ClonedCSPValue.java @@ -19,6 +19,8 @@ import java.util.List; import java.util.stream.Collectors; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.cycle.RequestCycle; import org.apache.wicket.util.lang.Args; @@ -41,7 +43,7 @@ public class ClonedCSPValue implements CSPRenderable * @param sourceDirective * the directive to clone; */ - public ClonedCSPValue(CSPHeaderConfiguration headerConfiguration, CSPDirective sourceDirective) + public ClonedCSPValue(@Nonnull CSPHeaderConfiguration headerConfiguration, @Nonnull CSPDirective sourceDirective) { this.headerConfiguration = Args.notNull(headerConfiguration, "headerConfiguration"); this.sourceDirective = Args.notNull(sourceDirective, "sourceDirective"); diff --git a/wicket-core/src/main/java/org/apache/wicket/csp/ContentSecurityPolicySettings.java b/wicket-core/src/main/java/org/apache/wicket/csp/ContentSecurityPolicySettings.java index 65b510b7f4f..390c80adad0 100644 --- a/wicket-core/src/main/java/org/apache/wicket/csp/ContentSecurityPolicySettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/csp/ContentSecurityPolicySettings.java @@ -22,6 +22,8 @@ import java.util.function.Predicate; import java.util.function.Supplier; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.MetaDataKey; import org.apache.wicket.Page; @@ -73,7 +75,7 @@ public class ContentSecurityPolicySettings private Supplier nonceCreator; - public ContentSecurityPolicySettings(Application application) + public ContentSecurityPolicySettings(@Nonnull Application application) { Args.notNull(application, "application"); @@ -99,7 +101,7 @@ public CSPHeaderConfiguration reporting() * The new creator, must not be null. * @return {@code this} for chaining. */ - public ContentSecurityPolicySettings setNonceCreator(Supplier nonceCreator) + public ContentSecurityPolicySettings setNonceCreator(@Nonnull Supplier nonceCreator) { Args.notNull(nonceCreator, "nonceCreator"); this.nonceCreator = nonceCreator; @@ -115,7 +117,7 @@ public ContentSecurityPolicySettings setNonceCreator(Supplier nonceCreat * @return {@code this} for chaining. */ public ContentSecurityPolicySettings setProtectedFilter( - Predicate protectedFilter) + @Nonnull Predicate protectedFilter) { Args.notNull(protectedFilter, "protectedFilter"); this.protectedFilter = protectedFilter; diff --git a/wicket-core/src/main/java/org/apache/wicket/csp/RelativeURICSPValue.java b/wicket-core/src/main/java/org/apache/wicket/csp/RelativeURICSPValue.java index 60aa0069e33..5b68f31eae2 100644 --- a/wicket-core/src/main/java/org/apache/wicket/csp/RelativeURICSPValue.java +++ b/wicket-core/src/main/java/org/apache/wicket/csp/RelativeURICSPValue.java @@ -19,6 +19,8 @@ import java.net.URI; import java.net.URISyntaxException; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.cycle.RequestCycle; import org.apache.wicket.util.lang.Args; @@ -37,7 +39,7 @@ public class RelativeURICSPValue implements CSPRenderable * @param relativeUri * The part of the URI relative to the context root of the Wicket application. */ - public RelativeURICSPValue(String relativeUri) + public RelativeURICSPValue(@Nonnull String relativeUri) { Args.notEmpty(relativeUri, "relativeUri"); this.relativeUri = relativeUri; diff --git a/wicket-core/src/main/java/org/apache/wicket/event/IEventSource.java b/wicket-core/src/main/java/org/apache/wicket/event/IEventSource.java index f84d5504bcd..720ecfdb849 100644 --- a/wicket-core/src/main/java/org/apache/wicket/event/IEventSource.java +++ b/wicket-core/src/main/java/org/apache/wicket/event/IEventSource.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.event; +import jakarta.annotation.Nonnull; + /** * Objects that can send events * @@ -38,5 +40,5 @@ public interface IEventSource * @param payload * event payload */ - void send(IEventSink sink, Broadcast broadcast, T payload); + void send(IEventSink sink, @Nonnull Broadcast broadcast, T payload); } diff --git a/wicket-core/src/main/java/org/apache/wicket/feedback/ContainerFeedbackMessageFilter.java b/wicket-core/src/main/java/org/apache/wicket/feedback/ContainerFeedbackMessageFilter.java index 065e4024826..d994d2016f5 100644 --- a/wicket-core/src/main/java/org/apache/wicket/feedback/ContainerFeedbackMessageFilter.java +++ b/wicket-core/src/main/java/org/apache/wicket/feedback/ContainerFeedbackMessageFilter.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.feedback; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.MarkupContainer; import org.apache.wicket.util.lang.Args; @@ -39,7 +41,7 @@ public class ContainerFeedbackMessageFilter implements IFeedbackMessageFilter * @param container * The container that message reporters must be a child of */ - public ContainerFeedbackMessageFilter(MarkupContainer container) + public ContainerFeedbackMessageFilter(@Nonnull MarkupContainer container) { this.container = Args.notNull(container, "container"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/feedback/FeedbackMessagesModel.java b/wicket-core/src/main/java/org/apache/wicket/feedback/FeedbackMessagesModel.java index 5a2c0862974..692dd064781 100644 --- a/wicket-core/src/main/java/org/apache/wicket/feedback/FeedbackMessagesModel.java +++ b/wicket-core/src/main/java/org/apache/wicket/feedback/FeedbackMessagesModel.java @@ -21,6 +21,8 @@ import java.util.Comparator; import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.Page; import org.apache.wicket.Session; @@ -61,7 +63,7 @@ public class FeedbackMessagesModel implements IModel> * The component where the page will be get from for which messages will be displayed * usually the same page as the one feedbackpanel is attached to */ - public FeedbackMessagesModel(Component pageResolvingComponent) + public FeedbackMessagesModel(@Nonnull Component pageResolvingComponent) { Args.notNull(pageResolvingComponent, "pageResolvingComponent"); this.pageResolvingComponent = pageResolvingComponent; diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/ComponentTag.java b/wicket-core/src/main/java/org/apache/wicket/markup/ComponentTag.java index addd760166c..c3a4cc53ac8 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/ComponentTag.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/ComponentTag.java @@ -24,6 +24,8 @@ import java.util.List; import java.util.Map; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.MarkupContainer; import org.apache.wicket.behavior.Behavior; @@ -203,7 +205,7 @@ public final boolean getFlag(final int flag) * * @param behavior */ - public final void addBehavior(final Behavior behavior) + public final void addBehavior(@Nonnull final Behavior behavior) { Args.notNull(behavior, "behavior"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/IMarkupCache.java b/wicket-core/src/main/java/org/apache/wicket/markup/IMarkupCache.java index da78753f1f2..f7a114a1155 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/IMarkupCache.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/IMarkupCache.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup; +import jakarta.annotation.Nonnull; + import org.apache.wicket.MarkupContainer; /** @@ -59,7 +61,7 @@ Markup getMarkup(final MarkupContainer container, final Class clazz, * @param cacheKey * @return The markup removed from the cache. Null, if nothing was found. */ - IMarkupFragment removeMarkup(final String cacheKey); + IMarkupFragment removeMarkup(@Nonnull final String cacheKey); /** * @return the number of elements currently in the cache. diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/Markup.java b/wicket-core/src/main/java/org/apache/wicket/markup/Markup.java index c5d28919199..cdbe3084db9 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/Markup.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/Markup.java @@ -22,6 +22,8 @@ import java.util.Iterator; import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.resource.ResourceStreamNotFoundException; import org.apache.wicket.util.string.AppendingStringBuffer; @@ -109,7 +111,7 @@ private Markup() * @param markupResourceStream * The associated Markup */ - public Markup(final MarkupResourceStream markupResourceStream) + public Markup(@Nonnull final MarkupResourceStream markupResourceStream) { Args.notNull(markupResourceStream, "markupResourceStream"); @@ -134,7 +136,7 @@ public final MarkupResourceStream getMarkupResourceStream() * @param index * @param elem */ - public final void replace(final int index, final MarkupElement elem) + public final void replace(final int index, @Nonnull final MarkupElement elem) { Args.notNull(elem, "elem"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/MarkupCache.java b/wicket-core/src/main/java/org/apache/wicket/markup/MarkupCache.java index 3caa46f1de2..b94ed764fb8 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/MarkupCache.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/MarkupCache.java @@ -20,6 +20,8 @@ import java.util.Iterator; import java.util.concurrent.ConcurrentHashMap; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.MarkupContainer; import org.apache.wicket.WicketRuntimeException; @@ -120,7 +122,7 @@ public void shutdown() * local application. */ @Override - public final IMarkupFragment removeMarkup(final String cacheKey) + public final IMarkupFragment removeMarkup(@Nonnull final String cacheKey) { Args.notNull(cacheKey, "cacheKey"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/MarkupFactory.java b/wicket-core/src/main/java/org/apache/wicket/markup/MarkupFactory.java index 0739ff87b22..bda014c077d 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/MarkupFactory.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/MarkupFactory.java @@ -18,6 +18,8 @@ import java.io.IOException; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.MarkupContainer; import org.apache.wicket.WicketRuntimeException; @@ -213,7 +215,7 @@ public final Markup getMarkup(final MarkupContainer container, final boolean enf * @return The markup associated with the container. Null, if the markup was not found or could * not yet be loaded (e.g. getMarkupType() == null). Wicket Exception in case of errors. */ - public final Markup getMarkup(final MarkupContainer container, final Class clazz, + public final Markup getMarkup(@Nonnull final MarkupContainer container, final Class clazz, final boolean enforceReload) { Args.notNull(container, "container"); @@ -301,7 +303,7 @@ protected final IMarkupResourceStreamProvider getMarkupResourceStreamProvider( * Either the container class or any super class. Might be null. * @return A IResourceStream if the resource was found */ - public final MarkupResourceStream getMarkupResourceStream(final MarkupContainer container, + public final MarkupResourceStream getMarkupResourceStream(@Nonnull final MarkupContainer container, Class clazz) { Args.notNull(container, "container"); @@ -346,7 +348,7 @@ public final MarkupResourceStream getMarkupResourceStream(final MarkupContainer * Either null, or a super class of container * @return The container class to be used */ - public final Class getContainerClass(final MarkupContainer container, final Class clazz) + public final Class getContainerClass(@Nonnull final MarkupContainer container, final Class clazz) { Args.notNull(container, "container"); @@ -380,8 +382,8 @@ else if (!clazz.isAssignableFrom(container.getClass())) * reloaded. Whatever is in the cache, it will be ignored * @return The markup. Null, if the markup was not found. Wicket Exception in case of errors. */ - public final Markup loadMarkup(final MarkupContainer container, - final MarkupResourceStream markupResourceStream, final boolean enforceReload) + public final Markup loadMarkup(@Nonnull final MarkupContainer container, + @Nonnull final MarkupResourceStream markupResourceStream, final boolean enforceReload) { // @TODO can markupResourceStream be replace with clazz??? Args.notNull(container, "container"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/MarkupFragment.java b/wicket-core/src/main/java/org/apache/wicket/markup/MarkupFragment.java index 570547c96c9..fb495678372 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/MarkupFragment.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/MarkupFragment.java @@ -18,6 +18,8 @@ import java.util.Iterator; +import jakarta.annotation.Nonnull; + import org.apache.wicket.markup.parser.filter.HtmlHandler; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.string.AppendingStringBuffer; @@ -57,7 +59,7 @@ public class MarkupFragment extends AbstractMarkupFragment * @throws IndexOutOfBoundsException * if the index is out of range (index < 0 || index >= size()) */ - public MarkupFragment(final IMarkupFragment markup, final int startIndex) + public MarkupFragment(@Nonnull final IMarkupFragment markup, final int startIndex) { Args.notNull(markup, "markup"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/MarkupResourceStream.java b/wicket-core/src/main/java/org/apache/wicket/markup/MarkupResourceStream.java index c848367b933..d5fb60a02cb 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/MarkupResourceStream.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/MarkupResourceStream.java @@ -22,6 +22,9 @@ import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.core.util.lang.WicketObjects; import org.apache.wicket.util.lang.Args; @@ -97,7 +100,7 @@ public MarkupResourceStream(final IResourceStream resourceStream) * @param containerInfo * @param markupClass */ - public MarkupResourceStream(final IResourceStream resourceStream, + public MarkupResourceStream(@Nonnull final IResourceStream resourceStream, final ContainerInfo containerInfo, final Class markupClass) { this.resourceStream = Args.notNull(resourceStream, "resourceStream"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/MarkupStream.java b/wicket-core/src/main/java/org/apache/wicket/markup/MarkupStream.java index d5d8b740344..70f91d67728 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/MarkupStream.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/MarkupStream.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.resource.IResourceStream; @@ -60,7 +62,7 @@ public class MarkupStream * @param markup * List of markup elements */ - public MarkupStream(final IMarkupFragment markup) + public MarkupStream(@Nonnull final IMarkupFragment markup) { Args.notNull(markup, "markup"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/TagUtils.java b/wicket-core/src/main/java/org/apache/wicket/markup/TagUtils.java index 98ce77ca3f5..547a2caa3b3 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/TagUtils.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/TagUtils.java @@ -19,6 +19,8 @@ import java.util.Deque; import java.util.LinkedList; +import jakarta.annotation.Nonnull; + import org.apache.wicket.MarkupContainer; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.value.IValueMap; @@ -229,7 +231,7 @@ public static void copyAttributes(final MarkupContainer component, final Compone * The offset in the markup stream from which to start searching. * @return the {@link IMarkupFragment} of the component tag if found, {@code null} is not found. */ - public static final IMarkupFragment findTagMarkup(IMarkupFragment fragment, String id, String tagName, int streamOffset) + public static final IMarkupFragment findTagMarkup(IMarkupFragment fragment, @Nonnull String id, String tagName, int streamOffset) { /* * We need streamOffset because MarkupFragment starts searching from offset 1. diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/AbstractCssReferenceHeaderItem.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/AbstractCssReferenceHeaderItem.java index cfe993b950b..7f275aacc72 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/head/AbstractCssReferenceHeaderItem.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/AbstractCssReferenceHeaderItem.java @@ -18,6 +18,8 @@ import java.util.Objects; +import jakarta.annotation.Nonnull; + import org.apache.wicket.core.util.string.CssUtils; import org.apache.wicket.markup.html.CrossOrigin; import org.apache.wicket.request.Response; @@ -82,7 +84,7 @@ public AbstractCssReferenceHeaderItem setIntegrity(String integrity) return this; } - protected final void internalRenderCSSReference(Response response, String url) + protected final void internalRenderCSSReference(Response response, @Nonnull String url) { Args.notEmpty(url, "url"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/AbstractJavaScriptReferenceHeaderItem.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/AbstractJavaScriptReferenceHeaderItem.java index 116da72435e..e70af75c293 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/head/AbstractJavaScriptReferenceHeaderItem.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/AbstractJavaScriptReferenceHeaderItem.java @@ -18,6 +18,8 @@ import java.util.Objects; +import jakarta.annotation.Nonnull; + import org.apache.wicket.core.util.string.JavaScriptUtils; import org.apache.wicket.markup.html.CrossOrigin; import org.apache.wicket.request.Response; @@ -113,7 +115,7 @@ public AbstractJavaScriptReferenceHeaderItem setType(final JavaScriptReferenceTy return this; } - protected final void internalRenderJavaScriptReference(Response response, String url) + protected final void internalRenderJavaScriptReference(Response response, @Nonnull String url) { Args.notEmpty(url, "url"); final AttributeMap attributes = createAttributeMap(url); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptReferenceHeaderItem.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptReferenceHeaderItem.java index a04c6ed3064..c504fb1ba8b 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptReferenceHeaderItem.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptReferenceHeaderItem.java @@ -20,6 +20,8 @@ import java.util.Collections; import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.IRequestHandler; import org.apache.wicket.request.Response; import org.apache.wicket.request.cycle.RequestCycle; @@ -53,7 +55,7 @@ public class JavaScriptReferenceHeaderItem extends AbstractJavaScriptReferenceHe * id that will be used to filter duplicate reference (it's still filtered by URL * too) */ - public JavaScriptReferenceHeaderItem(ResourceReference reference, PageParameters pageParameters, String id) + public JavaScriptReferenceHeaderItem(@Nonnull ResourceReference reference, PageParameters pageParameters, String id) { this.reference = Args.notNull(reference, "reference"); this.pageParameters = pageParameters; diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptReferenceType.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptReferenceType.java index e14ab6f5c4f..a23f000bc92 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptReferenceType.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptReferenceType.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup.head; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.io.IClusterable; import org.apache.wicket.util.lang.Args; @@ -30,7 +32,7 @@ public class JavaScriptReferenceType implements IClusterable { private final String type; - public JavaScriptReferenceType(final String type) { + public JavaScriptReferenceType(@Nonnull final String type) { this.type = Args.notEmpty(type, "type"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/MetaDataHeaderItem.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/MetaDataHeaderItem.java index 6649ef2b667..20fe679e013 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/head/MetaDataHeaderItem.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/MetaDataHeaderItem.java @@ -22,6 +22,8 @@ import java.util.Map; import java.util.Objects; +import jakarta.annotation.Nonnull; + import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; import org.apache.wicket.request.Response; @@ -59,7 +61,7 @@ public class MetaDataHeaderItem extends HeaderItem * @param tagName * the name of the tag */ - public MetaDataHeaderItem(String tagName) + public MetaDataHeaderItem(@Nonnull String tagName) { this.tagName = Args.notEmpty(tagName, "tagName"); this.tagAttributes = new ValueMap(); @@ -77,7 +79,7 @@ public MetaDataHeaderItem(String tagName) * @return * The current item. */ - public MetaDataHeaderItem addTagAttribute(String attributeName, Object attributeValue) + public MetaDataHeaderItem addTagAttribute(@Nonnull String attributeName, @Nonnull Object attributeValue) { Args.notEmpty(attributeName, "attributeName"); Args.notNull(attributeValue, "attributeValue"); @@ -95,7 +97,7 @@ public MetaDataHeaderItem addTagAttribute(String attributeName, Object attribute * @return * The current item. */ - public MetaDataHeaderItem addTagAttribute(String attributeName) + public MetaDataHeaderItem addTagAttribute(@Nonnull String attributeName) { Args.notEmpty(attributeName, "attributeName"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/OnEventHeaderItem.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/OnEventHeaderItem.java index 197500b0a6d..f7798544d1f 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/head/OnEventHeaderItem.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/OnEventHeaderItem.java @@ -21,6 +21,8 @@ import java.util.Locale; import java.util.Objects; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.Component; import org.apache.wicket.core.util.string.JavaScriptUtils; @@ -122,7 +124,7 @@ public OnEventHeaderItem(String target, String event) * @param event * @param javaScript */ - public OnEventHeaderItem(String target, String event, CharSequence javaScript) + public OnEventHeaderItem(@Nonnull String target, @Nonnull String event, CharSequence javaScript) { this.target = Args.notEmpty(target, "target"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/StringHeaderItem.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/StringHeaderItem.java index c1502ff3507..fc5e0827894 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/head/StringHeaderItem.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/StringHeaderItem.java @@ -19,6 +19,8 @@ import java.util.Collections; import java.util.Objects; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.Response; import org.apache.wicket.util.lang.Args; @@ -49,7 +51,7 @@ public static StringHeaderItem forString(CharSequence string) * * @param string */ - public StringHeaderItem(CharSequence string) + public StringHeaderItem(@Nonnull CharSequence string) { this.string = Args.notNull(string, "string"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/http2/PushHeaderItem.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/http2/PushHeaderItem.java index 377d1f7fc09..9c9aa3ef5f2 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/head/http2/PushHeaderItem.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/http2/PushHeaderItem.java @@ -30,6 +30,7 @@ import java.util.TreeSet; import java.util.concurrent.ConcurrentHashMap; +import jakarta.annotation.Nonnull; import jakarta.servlet.http.HttpServletRequest; import org.apache.wicket.Page; import org.apache.wicket.WicketRuntimeException; @@ -131,7 +132,7 @@ public PushHeaderItem(Page page, Request pageRequest, Response pageResponse) this(page, pageRequest, pageResponse, new PushBuilder()); } - public PushHeaderItem(Page page, Request pageRequest, Response pageResponse, IPushBuilder pushBuilder) + public PushHeaderItem(Page page, Request pageRequest, Response pageResponse, @Nonnull IPushBuilder pushBuilder) { if (!(page instanceof WebPage) || !(pageRequest instanceof WebRequest) || !(pageResponse instanceof WebResponse)) { diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/HeaderPartContainer.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/HeaderPartContainer.java index ec72ffa8853..9273ec27f46 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/HeaderPartContainer.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/HeaderPartContainer.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup.html; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.MarkupContainer; import org.apache.wicket.markup.ComponentTag; @@ -47,8 +49,8 @@ public final class HeaderPartContainer extends WebMarkupContainer implements ICo * The Panel (or bordered page) the header part is associated with * @param markup */ - public HeaderPartContainer(final String id, final MarkupContainer container, - final IMarkupFragment markup) + public HeaderPartContainer(final String id, @Nonnull final MarkupContainer container, + @Nonnull final IMarkupFragment markup) { super(id); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/HeaderResponseDecoratorCollection.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/HeaderResponseDecoratorCollection.java index 1b94522ca4a..01ad8913806 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/HeaderResponseDecoratorCollection.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/HeaderResponseDecoratorCollection.java @@ -19,6 +19,8 @@ import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; +import jakarta.annotation.Nonnull; + import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.head.ResourceAggregator; import org.apache.wicket.util.lang.Args; @@ -50,7 +52,7 @@ public HeaderResponseDecoratorCollection() * The decorator to add, cannot be null. * @return {@code this} for chaining. */ - public HeaderResponseDecoratorCollection add(IHeaderResponseDecorator decorator) + public HeaderResponseDecoratorCollection add(@Nonnull IHeaderResponseDecorator decorator) { Args.notNull(decorator, "decorator"); decorators.add(0, decorator); @@ -68,7 +70,7 @@ public HeaderResponseDecoratorCollection add(IHeaderResponseDecorator decorator) * @see ResourceAggregator */ public HeaderResponseDecoratorCollection addPreResourceAggregationDecorator( - IHeaderResponseDecorator decorator) + @Nonnull IHeaderResponseDecorator decorator) { Args.notNull(decorator, "decorator"); @@ -93,7 +95,7 @@ public HeaderResponseDecoratorCollection addPreResourceAggregationDecorator( * @return {@code this} for chaining. */ public HeaderResponseDecoratorCollection addPostProcessingDecorator( - IHeaderResponseDecorator decorator) + @Nonnull IHeaderResponseDecorator decorator) { Args.notNull(decorator, "decorator"); decorators.add(decorator); @@ -108,7 +110,7 @@ public HeaderResponseDecoratorCollection addPostProcessingDecorator( * The decorator to add, cannot be null. * @return {@code this} for chaining. */ - public HeaderResponseDecoratorCollection replaceAll(IHeaderResponseDecorator decorator) + public HeaderResponseDecoratorCollection replaceAll(@Nonnull IHeaderResponseDecorator decorator) { Args.notNull(decorator, "decorator"); decorators.clear(); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/MarkupUtil.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/MarkupUtil.java index 3de879c4b95..759b338a47d 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/MarkupUtil.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/MarkupUtil.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup.html; +import jakarta.annotation.Nonnull; + import org.apache.wicket.MarkupContainer; import org.apache.wicket.Page; import org.apache.wicket.WicketRuntimeException; @@ -41,7 +43,7 @@ public class MarkupUtil * @return True if the Page and all it's Panels, Borders etc. have HTML5 compliant markup. HTML5 * markup is identified by <DOCTYPE html> */ - public static boolean isMarkupHtml5Compliant(final MarkupContainer container) + public static boolean isMarkupHtml5Compliant(@Nonnull final MarkupContainer container) { Args.notNull(container, "container"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/basic/EnclosureContainer.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/basic/EnclosureContainer.java index 5b9f90b7b01..4b73c135d88 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/basic/EnclosureContainer.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/basic/EnclosureContainer.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup.html.basic; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.util.lang.Args; @@ -65,7 +67,7 @@ public class EnclosureContainer extends WebMarkupContainer * @param child * child component that will control the visibility of the enclosure */ - public EnclosureContainer(final String id, final Component child) + public EnclosureContainer(final String id, @Nonnull final Component child) { super(id); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/border/Body.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/border/Body.java index 524018f9ef5..cd5f7d16c06 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/border/Body.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/border/Body.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup.html.border; +import jakarta.annotation.Nonnull; + import org.apache.wicket.MarkupContainer; import org.apache.wicket.markup.IMarkupFragment; import org.apache.wicket.markup.html.WebMarkupContainer; @@ -73,7 +75,7 @@ public class Body extends WebMarkupContainer * @param markupProvider * Usually a Panel */ - public Body(final String id, final IModel model, final MarkupContainer markupProvider) + public Body(final String id, final IModel model, @Nonnull final MarkupContainer markupProvider) { super(id, model); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/border/Border.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/border/Border.java index 1feea65b2d1..da73fd5b338 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/border/Border.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/border/Border.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup.html.border; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.DequeueContext; import org.apache.wicket.DequeueTagAction; @@ -244,7 +246,7 @@ public Border addOrReplace(final Component... children) } @Override - public Border remove(final Component component) + public Border remove(final @Nonnull Component component) { if (component == body) { @@ -262,7 +264,7 @@ public Border remove(final Component component) @Override - public Border remove(final String id) + public Border remove(final @Nonnull String id) { if (body.getId().equals(id)) { @@ -285,7 +287,7 @@ public Border removeAll() } @Override - public Border replace(final Component replacement) + public Border replace(final @Nonnull Component replacement) { if (body.getId().equals(replacement.getId())) { @@ -544,7 +546,7 @@ public IMarkupFragment getMarkup() * @param name * @return null, if not found */ - private IMarkupFragment findByName(final IMarkupFragment markup, final String name) + private IMarkupFragment findByName(final IMarkupFragment markup, @Nonnull final String name) { Args.notEmpty(name, "name"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/CheckBoxMultipleChoice.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/CheckBoxMultipleChoice.java index 4ba0fad5230..5a46de5f3a6 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/CheckBoxMultipleChoice.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/CheckBoxMultipleChoice.java @@ -20,6 +20,8 @@ import java.util.List; import java.util.Map; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Page; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.model.IModel; @@ -316,7 +318,7 @@ public final CheckBoxMultipleChoice setSuffix(final String suffix) * The preferred position for the label * @return {@code this} instance, for chaining */ - public CheckBoxMultipleChoice setLabelPosition(LabelPosition labelPosition) + public CheckBoxMultipleChoice setLabelPosition(@Nonnull LabelPosition labelPosition) { Args.notNull(labelPosition, "labelPosition"); this.labelPosition = labelPosition; diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java index f8dcaf072d8..171dc9968e1 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/Form.java @@ -24,6 +24,7 @@ import java.util.Locale; import java.util.Map; +import jakarta.annotation.Nonnull; import jakarta.servlet.http.HttpServletRequest; import org.apache.commons.fileupload2.core.FileUploadException; import org.apache.commons.fileupload2.core.FileUploadByteCountLimitException; @@ -339,7 +340,7 @@ public Form(final String id, final IModel model) * if validator is null * @see IFormValidator */ - public void add(final IFormValidator validator) + public void add(@Nonnull final IFormValidator validator) { Args.notNull(validator, "validator"); @@ -362,7 +363,7 @@ public void add(final IFormValidator validator) * if validator is null * @see IFormValidator */ - public void remove(final IFormValidator validator) + public void remove(@Nonnull final IFormValidator validator) { Args.notNull(validator, "validator"); @@ -1998,7 +1999,7 @@ public void validate(final FormComponent formComponent) * * @param validator */ - protected final void validateFormValidator(final IFormValidator validator) + protected final void validateFormValidator(@Nonnull final IFormValidator validator) { Args.notNull(validator, "validator"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java index 28331766df4..7321c2aff04 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java @@ -31,6 +31,8 @@ import java.util.Map; import java.util.Set; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.Component; import org.apache.wicket.IConverterLocator; @@ -424,7 +426,7 @@ public boolean visitObject(Object object) * @return the visitor's result */ public static R visitComponentsPostOrder(Component component, - final org.apache.wicket.util.visit.IVisitor visitor) + @Nonnull final org.apache.wicket.util.visit.IVisitor visitor) { Args.notNull(visitor, "visitor"); @@ -520,7 +522,7 @@ public final String getDefaultLabel(String defaultValue) * @see IValidator */ @SuppressWarnings({ "rawtypes", "unchecked" }) - public final FormComponent add(final IValidator validator) + public final FormComponent add(@Nonnull final IValidator validator) { Args.notNull(validator, "validator"); @@ -546,7 +548,7 @@ public final FormComponent add(final IValidator validator) * @see #add(IValidator) * @return form component for chaining */ - public final FormComponent remove(final IValidator validator) + public final FormComponent remove(@Nonnull final IValidator validator) { Args.notNull(validator, "validator"); Behavior match = null; @@ -590,7 +592,7 @@ else if (behavior instanceof ValidatorAdapter) * if validator is null * @see IValidator */ - public final FormComponent add(final IValidator... validators) + public final FormComponent add(@Nonnull final IValidator... validators) { Args.notNull(validators, "validators"); @@ -657,7 +659,7 @@ public void clearInput() * @param error * validation error */ - public void error(IValidationError error) + public void error(@Nonnull IValidationError error) { Args.notNull(error, "error"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentLabel.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentLabel.java index 51ed7d35be0..d236fd24fff 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentLabel.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentLabel.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup.html.form; +import jakarta.annotation.Nonnull; + import org.apache.wicket.core.util.string.CssUtils; import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.html.WebMarkupContainer; @@ -52,7 +54,7 @@ public class FormComponentLabel extends WebMarkupContainer * @param component * component that this label is linked to */ - public FormComponentLabel(String id, LabeledWebMarkupContainer component) + public FormComponentLabel(String id, @Nonnull LabeledWebMarkupContainer component) { super(id); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentUpdatingBehavior.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentUpdatingBehavior.java index 577214fbf91..38ee05e3ffb 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentUpdatingBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentUpdatingBehavior.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup.html.form; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.IRequestListener; import org.apache.wicket.WicketRuntimeException; @@ -54,7 +56,7 @@ public boolean getStatelessHint(Component component) } @Override - public final void bind(final Component component) + public final void bind(@Nonnull final Component component) { Args.notNull(component, "component"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/JavaScriptReservedNames.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/JavaScriptReservedNames.java index 5c9b05e5b9f..27910c20500 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/JavaScriptReservedNames.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/JavaScriptReservedNames.java @@ -19,6 +19,8 @@ import java.util.HashSet; import java.util.Set; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; /** @@ -142,7 +144,7 @@ private JavaScriptReservedNames() * * @return {@code true} if the name is used by the JavaScript DOM API. */ - public static boolean isNameReserved(String name) + public static boolean isNameReserved(@Nonnull String name) { Args.notNull(name, "name"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/RadioChoice.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/RadioChoice.java index 60b6b27c67f..387ab7e36ec 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/RadioChoice.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/RadioChoice.java @@ -19,6 +19,8 @@ import java.util.List; import java.util.Map; +import jakarta.annotation.Nonnull; + import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.model.IModel; import org.apache.wicket.settings.DebugSettings; @@ -311,7 +313,7 @@ public final RadioChoice setSuffix(String suffix) * The preferred position for the label * @return {@code this} instance, for chaining */ - public RadioChoice setLabelPosition(LabelPosition labelPosition) + public RadioChoice setLabelPosition(@Nonnull LabelPosition labelPosition) { Args.notNull(labelPosition, "labelPosition"); this.labelPosition = labelPosition; diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ValidationErrorFeedback.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ValidationErrorFeedback.java index 48b8d0b698b..de873b4bef4 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ValidationErrorFeedback.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/ValidationErrorFeedback.java @@ -18,6 +18,8 @@ import java.io.Serializable; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.util.io.IClusterable; import org.apache.wicket.util.lang.Args; @@ -48,7 +50,7 @@ public class ValidationErrorFeedback implements IClusterable * @param error * @param message */ - public ValidationErrorFeedback(final IValidationError error, final Serializable message) + public ValidationErrorFeedback(@Nonnull final IValidationError error, final Serializable message) { this.error = Args.notNull(error, "error"); this.message = message; diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java index c555f08f5cb..90d36b4144b 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FileUpload.java @@ -24,6 +24,8 @@ import java.util.ArrayList; import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.commons.fileupload2.core.FileItem; import org.apache.wicket.Session; import org.apache.wicket.WicketRuntimeException; @@ -54,7 +56,7 @@ public class FileUpload * @param item * The uploaded file item */ - public FileUpload(final FileItem item) + public FileUpload(@Nonnull final FileItem item) { Args.notNull(item, "item"); this.item = item; @@ -106,7 +108,7 @@ public byte[] getBytes() * * @return The cryptographic digest of the file */ - public byte[] getDigest(String algorithm) + public byte[] getDigest(@Nonnull String algorithm) { try { diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FilesSelectedBehavior.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FilesSelectedBehavior.java index 5328abdc50f..70a4f5ddc4e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FilesSelectedBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/FilesSelectedBehavior.java @@ -18,6 +18,9 @@ import java.util.ArrayList; import java.util.List; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.ajax.AjaxRequestTarget; @@ -113,7 +116,7 @@ public void renderHead(Component component, IHeaderResponse response) * @return the {@link FilesSelectedBehavior} behavior */ public static FilesSelectedBehavior onSelected( - SerializableBiConsumer> select) + @Nonnull SerializableBiConsumer> select) { Args.notNull(select, "select"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/resource/FileUploadResourceReference.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/resource/FileUploadResourceReference.java index b57644503c3..ca2ef80198b 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/resource/FileUploadResourceReference.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/resource/FileUploadResourceReference.java @@ -17,6 +17,9 @@ package org.apache.wicket.markup.html.form.upload.resource; import java.util.List; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.markup.html.form.upload.FileUpload; import org.apache.wicket.protocol.http.servlet.ServletWebRequest; import org.apache.wicket.request.resource.IResource; @@ -67,7 +70,7 @@ public static FileUploadResourceReference createNewInstance(IUploadsFileManager return instance; } - protected FileUploadResourceReference(IUploadsFileManager uploadFileManager) + protected FileUploadResourceReference(@Nonnull IUploadsFileManager uploadFileManager) { super(FileUploadResourceReference.class, "file-uploads"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/resource/FolderUploadsFileManager.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/resource/FolderUploadsFileManager.java index 0146b820996..b71e5f32079 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/resource/FolderUploadsFileManager.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/upload/resource/FolderUploadsFileManager.java @@ -19,6 +19,9 @@ import java.io.FileOutputStream; import java.io.IOException; import java.nio.file.Files; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.markup.html.form.upload.FileUpload; import org.apache.wicket.util.file.File; @@ -35,7 +38,7 @@ public class FolderUploadsFileManager implements IUploadsFileManager private final File folder; - public FolderUploadsFileManager(File folder) + public FolderUploadsFileManager(@Nonnull File folder) { Args.notNull(folder, "folder"); if (!folder.exists()) diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/AbstractFormValidator.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/AbstractFormValidator.java index 6b5e80b418b..e5aaf25900d 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/AbstractFormValidator.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/AbstractFormValidator.java @@ -19,6 +19,8 @@ import java.util.HashMap; import java.util.Map; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.behavior.Behavior; @@ -46,7 +48,7 @@ public abstract class AbstractFormValidator extends Behavior implements IFormVal * if component is not a form */ @Override - public void bind(Component component) + public void bind(@Nonnull Component component) { if (!(component instanceof Form)) { @@ -113,7 +115,7 @@ public void error(FormComponent fc, final Map vars) * @param vars * The model for variable interpolation */ - public void error(FormComponent fc, final String resourceKey, Map vars) + public void error(@Nonnull FormComponent fc, @Nonnull final String resourceKey, @Nonnull Map vars) { Args.notNull(fc, "fc"); Args.notNull(vars, "vars"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/EqualInputValidator.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/EqualInputValidator.java index 8b1d72aed4a..a247d4b261f 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/EqualInputValidator.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/validation/EqualInputValidator.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup.html.form.validation; +import jakarta.annotation.Nonnull; + import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.form.FormComponent; import org.apache.wicket.util.lang.Args; @@ -48,7 +50,7 @@ public class EqualInputValidator extends AbstractFormValidator * @param formComponent2 * a form component */ - public EqualInputValidator(FormComponent formComponent1, FormComponent formComponent2) + public EqualInputValidator(@Nonnull FormComponent formComponent1, @Nonnull FormComponent formComponent2) { Args.notNull(formComponent1, "formComponent1"); Args.notNull(formComponent2, "formComponent2"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/include/Include.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/include/Include.java index 1d1ee4bd4d3..b171bbbf126 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/include/Include.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/include/Include.java @@ -20,6 +20,7 @@ import java.net.URL; import java.nio.charset.Charset; +import jakarta.annotation.Nonnull; import jakarta.servlet.ServletContext; import org.apache.wicket.IGenericComponent; @@ -156,7 +157,7 @@ public void onComponentTagBody(final MarkupStream markupStream, final ComponentT * the url to import * @return the imported url's contents */ - private String importRelativeUrl(String url) + private String importRelativeUrl(@Nonnull String url) { Args.notEmpty(url, "url"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DownloadLink.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DownloadLink.java index b6d72904ce3..2cebdc0548e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DownloadLink.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/link/DownloadLink.java @@ -30,6 +30,8 @@ import org.apache.wicket.util.string.Strings; import java.time.Duration; +import jakarta.annotation.Nonnull; + /** * A link that streams a file to the client. When clicked this link will prompt the save as dialog * in the browser. @@ -79,7 +81,7 @@ public class DownloadLink extends Link * @param file * file to stream to client */ - public DownloadLink(String id, File file) + public DownloadLink(String id, @Nonnull File file) { this(id, new Model(Args.notNull(file, "file"))); } @@ -122,7 +124,7 @@ public DownloadLink(String id, IModel model, String fileName) * @param fileName * name of the file */ - public DownloadLink(String id, File file, String fileName) + public DownloadLink(String id, @Nonnull File file, String fileName) { this(id, Model.of(Args.notNull(file, "file")), Model.of(fileName)); } diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AssociatedMarkupSourcingStrategy.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AssociatedMarkupSourcingStrategy.java index 618afc8f07a..a441f3d5bc0 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AssociatedMarkupSourcingStrategy.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AssociatedMarkupSourcingStrategy.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup.html.panel; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.MarkupContainer; import org.apache.wicket.WicketRuntimeException; @@ -49,7 +51,7 @@ public abstract class AssociatedMarkupSourcingStrategy extends AbstractMarkupSou * @param tagName * Either "panel" or "border" */ - public AssociatedMarkupSourcingStrategy(final String tagName) + public AssociatedMarkupSourcingStrategy(@Nonnull final String tagName) { this.tagName = Args.notNull(tagName, "tagName"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java index 25e9b10d9f8..62d5569c55f 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/Fragment.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup.html.panel; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.DequeueContext; import org.apache.wicket.IQueueRegion; @@ -88,7 +90,7 @@ public Fragment(final String id, final String markupId, final MarkupContainer ma * @param model * The model for this fragment */ - public Fragment(final String id, final String markupId, final MarkupContainer markupProvider, + public Fragment(final String id, @Nonnull final String markupId, final MarkupContainer markupProvider, final IModel model) { super(id, model); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FragmentMarkupSourcingStrategy.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FragmentMarkupSourcingStrategy.java index 4aa61df02d1..62e43a9f134 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FragmentMarkupSourcingStrategy.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/panel/FragmentMarkupSourcingStrategy.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup.html.panel; +import jakarta.annotation.Nonnull; + import static org.apache.wicket.markup.parser.filter.WicketTagIdentifier.FRAGMENT; import org.apache.wicket.Component; @@ -52,7 +54,7 @@ public class FragmentMarkupSourcingStrategy extends AbstractMarkupSourcingStrate * @param markupProvider * The component whose markup contains the fragment's markup */ - public FragmentMarkupSourcingStrategy(final String markupId, + public FragmentMarkupSourcingStrategy(@Nonnull final String markupId, final MarkupContainer markupProvider) { Args.notNull(markupId, "markupId"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/parser/IXmlPullParser.java b/wicket-core/src/main/java/org/apache/wicket/markup/parser/IXmlPullParser.java index 44cba9e851f..b94d14e7586 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/parser/IXmlPullParser.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/parser/IXmlPullParser.java @@ -20,6 +20,7 @@ import java.io.InputStream; import java.text.ParseException; +import jakarta.annotation.Nonnull; /** @@ -111,7 +112,7 @@ enum HttpTagType { * @throws IOException * Error while reading the resource */ - void parse(final CharSequence string) throws IOException; + void parse(@Nonnull final CharSequence string) throws IOException; /** * Reads and parses markup from an input stream, using UTF-8 encoding by default when not @@ -135,7 +136,7 @@ enum HttpTagType { * @throws IOException * Error while reading the resource */ - void parse(InputStream inputStream, final String encoding) throws IOException; + void parse(@Nonnull InputStream inputStream, final String encoding) throws IOException; /** * Move to the next XML element diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/parser/XmlPullParser.java b/wicket-core/src/main/java/org/apache/wicket/markup/parser/XmlPullParser.java index 82aa9291f53..bf54e87c82c 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/parser/XmlPullParser.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/parser/XmlPullParser.java @@ -23,6 +23,8 @@ import java.text.ParseException; import java.util.Locale; +import jakarta.annotation.Nonnull; + import org.apache.wicket.markup.parser.XmlTag.TagType; import org.apache.wicket.markup.parser.XmlTag.TextSegment; import org.apache.wicket.util.io.FullyBufferedReader; @@ -561,7 +563,7 @@ else if (charAt == ch) * Error while reading the resource */ @Override - public void parse(final CharSequence string) throws IOException + public void parse(@Nonnull final CharSequence string) throws IOException { Args.notNull(string, "string"); @@ -598,7 +600,7 @@ public void parse(final InputStream in) throws IOException * @throws IOException */ @Override - public void parse(final InputStream inputStream, final String encoding) throws IOException + public void parse(@Nonnull final InputStream inputStream, final String encoding) throws IOException { Args.notNull(inputStream, "inputStream"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/StyleAndScriptIdentifier.java b/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/StyleAndScriptIdentifier.java index cc34edfcbff..5c829cb4726 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/StyleAndScriptIdentifier.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/StyleAndScriptIdentifier.java @@ -28,6 +28,8 @@ import java.text.ParseException; import java.util.regex.Pattern; +import jakarta.annotation.Nonnull; + /** * An IMarkupFilter that wraps the body of all <style> elements and <script> @@ -122,7 +124,7 @@ public void postProcess(Markup markup) // OES/*OES visit) { * @param headerContainer * @param rootComponent */ - abstract protected void renderChildHeaders(final HtmlHeaderContainer headerContainer, - final Component rootComponent); + abstract protected void renderChildHeaders(@Nonnull final HtmlHeaderContainer headerContainer, + @Nonnull final Component rootComponent); /** * Render the application level headers * * @param headerContainer */ - protected final void renderApplicationLevelHeaders(final HtmlHeaderContainer headerContainer) + protected final void renderApplicationLevelHeaders(@Nonnull final HtmlHeaderContainer headerContainer) { Args.notNull(headerContainer, "headerContainer"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/renderStrategy/ChildFirstHeaderRenderStrategy.java b/wicket-core/src/main/java/org/apache/wicket/markup/renderStrategy/ChildFirstHeaderRenderStrategy.java index d22f61ea3f4..f087bf488fe 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/renderStrategy/ChildFirstHeaderRenderStrategy.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/renderStrategy/ChildFirstHeaderRenderStrategy.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup.renderStrategy; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.MarkupContainer; import org.apache.wicket.markup.html.internal.HtmlHeaderContainer; @@ -44,8 +46,8 @@ public ChildFirstHeaderRenderStrategy() } @Override - public void renderHeader(final HtmlHeaderContainer headerContainer, - HeaderStreamState headerStreamState, final Component rootComponent) + public void renderHeader(@Nonnull final HtmlHeaderContainer headerContainer, + HeaderStreamState headerStreamState, @Nonnull final Component rootComponent) { Args.notNull(headerContainer, "headerContainer"); Args.notNull(rootComponent, "rootComponent"); @@ -67,8 +69,8 @@ public void renderHeader(final HtmlHeaderContainer headerContainer, * @param rootComponent */ @Override - protected void renderChildHeaders(final HtmlHeaderContainer headerContainer, - final Component rootComponent) + protected void renderChildHeaders(@Nonnull final HtmlHeaderContainer headerContainer, + @Nonnull final Component rootComponent) { Args.notNull(headerContainer, "headerContainer"); Args.notNull(rootComponent, "rootComponent"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/renderStrategy/DeepChildFirstVisitor.java b/wicket-core/src/main/java/org/apache/wicket/markup/renderStrategy/DeepChildFirstVisitor.java index abdd8e95f76..1d896e3f910 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/renderStrategy/DeepChildFirstVisitor.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/renderStrategy/DeepChildFirstVisitor.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup.renderStrategy; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.MarkupContainer; import org.apache.wicket.util.lang.Args; @@ -58,7 +60,7 @@ public final Visit visit(final Component rootComponent) * @param visit * @return The object return by component() */ - public final Visit visit(final Component rootComponent, final Visit visit) + public final Visit visit(@Nonnull final Component rootComponent, @Nonnull final Visit visit) { Args.notNull(rootComponent, "rootComponent"); Args.notNull(visit, "visit"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/renderStrategy/IHeaderRenderStrategy.java b/wicket-core/src/main/java/org/apache/wicket/markup/renderStrategy/IHeaderRenderStrategy.java index 7a82bd7888e..b4aeae40a5a 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/renderStrategy/IHeaderRenderStrategy.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/renderStrategy/IHeaderRenderStrategy.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup.renderStrategy; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.markup.html.internal.HtmlHeaderContainer; import org.apache.wicket.markup.html.internal.HtmlHeaderContainer.HeaderStreamState; @@ -40,6 +42,6 @@ public interface IHeaderRenderStrategy * @param component * The root component (e.g. Page) to start the render process */ - void renderHeader(HtmlHeaderContainer headerContainer, HeaderStreamState headerStreamState, - Component component); + void renderHeader(@Nonnull HtmlHeaderContainer headerContainer, HeaderStreamState headerStreamState, + @Nonnull Component component); } diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/renderStrategy/ParentFirstHeaderRenderStrategy.java b/wicket-core/src/main/java/org/apache/wicket/markup/renderStrategy/ParentFirstHeaderRenderStrategy.java index 93f4e2fafb7..77d38fc97c3 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/renderStrategy/ParentFirstHeaderRenderStrategy.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/renderStrategy/ParentFirstHeaderRenderStrategy.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup.renderStrategy; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.MarkupContainer; import org.apache.wicket.markup.html.internal.HtmlHeaderContainer; @@ -44,8 +46,8 @@ public ParentFirstHeaderRenderStrategy() } @Override - protected void renderChildHeaders(final HtmlHeaderContainer headerContainer, - final Component rootComponent) + protected void renderChildHeaders(@Nonnull final HtmlHeaderContainer headerContainer, + @Nonnull final Component rootComponent) { Args.notNull(headerContainer, "headerContainer"); Args.notNull(rootComponent, "rootComponent"); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/repeater/data/DataViewBase.java b/wicket-core/src/main/java/org/apache/wicket/markup/repeater/data/DataViewBase.java index 8f25e47421a..47ad5e238a4 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/repeater/data/DataViewBase.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/repeater/data/DataViewBase.java @@ -18,6 +18,8 @@ import java.util.Iterator; +import jakarta.annotation.Nonnull; + import org.apache.wicket.markup.html.navigation.paging.IPageable; import org.apache.wicket.markup.repeater.AbstractPageableView; import org.apache.wicket.markup.repeater.RefreshingView; @@ -52,7 +54,7 @@ public abstract class DataViewBase extends AbstractPageableView * @param dataProvider * data provider */ - public DataViewBase(String id, IDataProvider dataProvider) + public DataViewBase(String id, @Nonnull IDataProvider dataProvider) { super(id); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/repeater/data/GridView.java b/wicket-core/src/main/java/org/apache/wicket/markup/repeater/data/GridView.java index 8ad92863770..b27c8750e14 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/repeater/data/GridView.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/repeater/data/GridView.java @@ -18,6 +18,8 @@ import java.util.Iterator; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.MarkupContainer; import org.apache.wicket.markup.repeater.Item; @@ -273,7 +275,7 @@ public static class ItemsIterator implements Iterator> * @param rows * iterator over child row views */ - public ItemsIterator(Iterator rows) + public ItemsIterator(@Nonnull Iterator rows) { this.rows = Args.notNull(rows, "rows"); findNext(); @@ -335,4 +337,4 @@ private void findNext() } } -} \ No newline at end of file +} diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/repeater/util/ModelIteratorAdapter.java b/wicket-core/src/main/java/org/apache/wicket/markup/repeater/util/ModelIteratorAdapter.java index 6c255a838a6..cb3b494f77b 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/repeater/util/ModelIteratorAdapter.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/repeater/util/ModelIteratorAdapter.java @@ -18,6 +18,8 @@ import java.util.Iterator; +import jakarta.annotation.Nonnull; + import org.apache.wicket.markup.repeater.RefreshingView; import org.apache.wicket.model.IModel; import org.apache.wicket.util.lang.Args; @@ -41,7 +43,7 @@ public abstract class ModelIteratorAdapter implements Iterator> * @param iterable * iterable whose iterator will be wrapped */ - public ModelIteratorAdapter(Iterable iterable) + public ModelIteratorAdapter(@Nonnull Iterable iterable) { Args.notNull(iterable, "iterable"); this.delegate = iterable.iterator(); diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/transformer/XsltTransformerBehavior.java b/wicket-core/src/main/java/org/apache/wicket/markup/transformer/XsltTransformerBehavior.java index d1c3efabd4b..a6c55fe4df8 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/transformer/XsltTransformerBehavior.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/transformer/XsltTransformerBehavior.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.markup.transformer; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.Page; import org.apache.wicket.WicketRuntimeException; @@ -85,7 +87,7 @@ public CharSequence transform(final Component component, final CharSequence outp } @Override - public void bind(final Component component) + public void bind(@Nonnull final Component component) { if (component instanceof Page) { diff --git a/wicket-core/src/main/java/org/apache/wicket/mock/MockWebResponse.java b/wicket-core/src/main/java/org/apache/wicket/mock/MockWebResponse.java index d9acbab7815..a156b9c5458 100644 --- a/wicket-core/src/main/java/org/apache/wicket/mock/MockWebResponse.java +++ b/wicket-core/src/main/java/org/apache/wicket/mock/MockWebResponse.java @@ -23,6 +23,8 @@ import java.util.Collections; import java.util.List; import java.util.Set; + +import jakarta.annotation.Nonnull; import jakarta.servlet.http.Cookie; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.request.HttpHeaderCollection; @@ -143,7 +145,7 @@ public String getContentType() } @Override - public void setDateHeader(String name, Instant date) + public void setDateHeader(String name, @Nonnull Instant date) { Args.notNull(date, "date"); headers.setDateHeader(name, date); diff --git a/wicket-core/src/main/java/org/apache/wicket/model/IModel.java b/wicket-core/src/main/java/org/apache/wicket/model/IModel.java index c58e7448b16..bb654ac8784 100644 --- a/wicket-core/src/main/java/org/apache/wicket/model/IModel.java +++ b/wicket-core/src/main/java/org/apache/wicket/model/IModel.java @@ -17,6 +17,8 @@ package org.apache.wicket.model; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; import org.danekja.java.util.function.serializable.SerializableBiConsumer; import org.danekja.java.util.function.serializable.SerializableBiFunction; @@ -98,7 +100,7 @@ default void detach() * a predicate to be used for testing the contained object * @return a new IModel */ - default IModel filter(SerializablePredicate predicate) + default IModel filter(@Nonnull SerializablePredicate predicate) { Args.notNull(predicate, "predicate"); return new IModel() @@ -134,7 +136,7 @@ public void detach() * a mapper, to be applied to the contained object * @return a new IModel */ - default IModel map(SerializableFunction mapper) + default IModel map(@Nonnull SerializableFunction mapper) { Args.notNull(mapper, "mapper"); return new IModel() { @@ -173,8 +175,8 @@ public void detach() * a function combining this and the others object to a result. * @return a new IModel */ - default IModel combineWith(IModel other, - SerializableBiFunction combiner) + default IModel combineWith(@Nonnull IModel other, + @Nonnull SerializableBiFunction combiner) { Args.notNull(combiner, "combiner"); Args.notNull(other, "other"); @@ -212,7 +214,7 @@ public void detach() * @return a new IModel * @see LambdaModel#of(IModel, SerializableFunction, SerializableBiConsumer) */ - default IModel flatMap(SerializableFunction> mapper) + default IModel flatMap(@Nonnull SerializableFunction> mapper) { Args.notNull(mapper, "mapper"); return new IModel() @@ -324,7 +326,7 @@ public void detach() * a supplier to be used as a default * @return a new IModel */ - default IModel orElseGet(SerializableSupplier other) + default IModel orElseGet(@Nonnull SerializableSupplier other) { Args.notNull(other, "other"); return new IModel() { @@ -378,7 +380,7 @@ public void detach() * @param clazz the {@code Class} the current model object should be an instance of * @return a new IModel */ - default IModel as(Class clazz) { + default IModel as(@Nonnull Class clazz) { Args.notNull(clazz, "clazz"); return filter(clazz::isInstance).map(clazz::cast); } diff --git a/wicket-core/src/main/java/org/apache/wicket/model/LambdaModel.java b/wicket-core/src/main/java/org/apache/wicket/model/LambdaModel.java index af857dc7cc6..1f9774c6d76 100644 --- a/wicket-core/src/main/java/org/apache/wicket/model/LambdaModel.java +++ b/wicket-core/src/main/java/org/apache/wicket/model/LambdaModel.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.model; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; import org.danekja.java.util.function.serializable.SerializableBiConsumer; import org.danekja.java.util.function.serializable.SerializableConsumer; @@ -89,7 +91,7 @@ public static IModel of(SerializableSupplier getter) * @param * model object type */ - public static IModel of(SerializableSupplier getter, SerializableConsumer setter) + public static IModel of(@Nonnull SerializableSupplier getter, @Nonnull SerializableConsumer setter) { Args.notNull(getter, "getter"); Args.notNull(setter, "setter"); @@ -138,8 +140,8 @@ public void setObject(R r) * @return model * @see IModel#flatMap(SerializableFunction) */ - public static IModel of(IModel target, SerializableFunction getter, - SerializableBiConsumer setter) + public static IModel of(@Nonnull IModel target, @Nonnull SerializableFunction getter, + @Nonnull SerializableBiConsumer setter) { Args.notNull(target, "target"); Args.notNull(getter, "getter"); diff --git a/wicket-core/src/main/java/org/apache/wicket/model/StringResourceModel.java b/wicket-core/src/main/java/org/apache/wicket/model/StringResourceModel.java index 2364fa2aa39..fc21eecdec7 100644 --- a/wicket-core/src/main/java/org/apache/wicket/model/StringResourceModel.java +++ b/wicket-core/src/main/java/org/apache/wicket/model/StringResourceModel.java @@ -20,6 +20,8 @@ import java.util.Arrays; import java.util.Locale; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.Component; import org.apache.wicket.Localizer; @@ -300,7 +302,7 @@ public IModel getWrappedModel() * @param model * The model to use for property substitutions */ - public StringResourceModel(final String resourceKey, final Component component, final IModel model) + public StringResourceModel(@Nonnull final String resourceKey, final Component component, final IModel model) { Args.notNull(resourceKey, "resource key"); diff --git a/wicket-core/src/main/java/org/apache/wicket/page/DefaultPageLockManager.java b/wicket-core/src/main/java/org/apache/wicket/page/DefaultPageLockManager.java index d20ea5a09a1..a8cfca923df 100644 --- a/wicket-core/src/main/java/org/apache/wicket/page/DefaultPageLockManager.java +++ b/wicket-core/src/main/java/org/apache/wicket/page/DefaultPageLockManager.java @@ -23,6 +23,8 @@ import java.util.concurrent.ConcurrentMap; import java.util.function.Supplier; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.settings.ExceptionSettings; import org.apache.wicket.util.LazyInitializer; @@ -62,7 +64,7 @@ protected ConcurrentMap createInstance * @param timeout * timeout value for acquiring a page lock */ - public DefaultPageLockManager(Duration timeout) + public DefaultPageLockManager(@Nonnull Duration timeout) { this.timeout = Args.notNull(timeout, "timeout"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/page/PageAccessSynchronizer.java b/wicket-core/src/main/java/org/apache/wicket/page/PageAccessSynchronizer.java index 743f56f3b89..8e41064b0f4 100644 --- a/wicket-core/src/main/java/org/apache/wicket/page/PageAccessSynchronizer.java +++ b/wicket-core/src/main/java/org/apache/wicket/page/PageAccessSynchronizer.java @@ -19,6 +19,8 @@ import java.io.Serializable; import java.time.Duration; +import jakarta.annotation.Nonnull; + import org.apache.wicket.pageStore.IPageStore; import org.apache.wicket.util.lang.Args; import org.slf4j.Logger; @@ -54,7 +56,7 @@ public PageAccessSynchronizer(Duration timeout) * * @param pageLockManager the lock manager */ - public PageAccessSynchronizer(IPageLockManager pageLockManager) + public PageAccessSynchronizer(@Nonnull IPageLockManager pageLockManager) { this.pageLockManager = Args.notNull(pageLockManager, "pageLockManager"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/page/PageManager.java b/wicket-core/src/main/java/org/apache/wicket/page/PageManager.java index 02bf13cc928..8a79ab80213 100644 --- a/wicket-core/src/main/java/org/apache/wicket/page/PageManager.java +++ b/wicket-core/src/main/java/org/apache/wicket/page/PageManager.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.page; +import jakarta.annotation.Nonnull; + import org.apache.wicket.pageStore.DefaultPageContext; import org.apache.wicket.pageStore.IPageContext; import org.apache.wicket.pageStore.IPageStore; @@ -31,7 +33,7 @@ public class PageManager implements IPageManager { private final IPageStore store; - public PageManager(IPageStore store) { + public PageManager(@Nonnull IPageStore store) { this.store = Args.notNull(store, "store"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/page/PartialPageUpdate.java b/wicket-core/src/main/java/org/apache/wicket/page/PartialPageUpdate.java index 98fb9880a72..33d0d3f7599 100644 --- a/wicket-core/src/main/java/org/apache/wicket/page/PartialPageUpdate.java +++ b/wicket-core/src/main/java/org/apache/wicket/page/PartialPageUpdate.java @@ -23,6 +23,8 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; + +import jakarta.annotation.Nonnull; import jakarta.servlet.http.Cookie; import org.apache.wicket.Application; @@ -503,7 +505,7 @@ public int hashCode() * @param javascript * the javascript to execute */ - public final void appendJavaScript(final CharSequence javascript) + public final void appendJavaScript(@Nonnull final CharSequence javascript) { Args.notNull(javascript, "javascript"); @@ -521,7 +523,7 @@ public final void appendJavaScript(final CharSequence javascript) * @param javascript * the javascript to execute */ - public final void prependJavaScript(CharSequence javascript) + public final void prependJavaScript(@Nonnull CharSequence javascript) { Args.notNull(javascript, "javascript"); @@ -545,7 +547,7 @@ public final void prependJavaScript(CharSequence javascript) * @throws IllegalStateException * thrown when components no more can be added for replacement. */ - public final void add(final Component component, final String markupId) + public final void add(@Nonnull final Component component, @Nonnull final String markupId) { Args.notEmpty(markupId, "markupId"); Args.notNull(component, "component"); @@ -925,7 +927,7 @@ public void addHeader(String name, String value) } @Override - public void setDateHeader(String name, Instant date) + public void setDateHeader(String name, @Nonnull Instant date) { originalResponse.setDateHeader(name, date); } diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java index 0a4cd5dfafb..fd45cab7265 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/AbstractPersistentPageStore.java @@ -20,6 +20,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import jakarta.annotation.Nonnull; import jakarta.servlet.http.HttpSessionBindingEvent; import jakarta.servlet.http.HttpSessionBindingListener; @@ -58,7 +59,7 @@ protected Boolean initialValue() private final String storeKey; - protected AbstractPersistentPageStore(String applicationName) + protected AbstractPersistentPageStore(@Nonnull String applicationName) { this.storeKey = Args.notNull(applicationName, "applicationName") + ":" + getClass().getSimpleName(); @@ -197,7 +198,7 @@ private static class SessionAttribute implements Serializable, HttpSessionBindin */ public final String sessionIdentifier; - public SessionAttribute(String storeKey, String sessionIdentifier) + public SessionAttribute(@Nonnull String storeKey, @Nonnull String sessionIdentifier) { this.storeKey = Args.notNull(storeKey, "storeKey"); this.sessionIdentifier = Args.notNull(sessionIdentifier, "sessionIdentifier"); diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousPageStore.java index 18838e85380..ef2973fe5a5 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousPageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/AsynchronousPageStore.java @@ -26,6 +26,8 @@ import java.util.concurrent.TimeUnit; import java.util.function.Supplier; +import jakarta.annotation.Nonnull; + import org.apache.wicket.MetaDataKey; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.page.IManageablePage; @@ -142,7 +144,7 @@ private static class PendingAdd implements IPageContext */ private final Map, Serializable> dataCache = new HashMap<>(); - public PendingAdd(final IPageContext context, final IManageablePage page) + public PendingAdd(@Nonnull final IPageContext context, @Nonnull final IManageablePage page) { this.context = Args.notNull(context, "context"); this.page = Args.notNull(page, "page"); diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/CryptingPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/CryptingPageStore.java index 32185a620b0..c962851f325 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/CryptingPageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/CryptingPageStore.java @@ -19,6 +19,8 @@ import java.io.Serializable; import java.security.SecureRandom; +import jakarta.annotation.Nonnull; + import javax.crypto.SecretKey; import org.apache.wicket.Application; @@ -56,7 +58,7 @@ public class CryptingPageStore extends DelegatingPageStore * @param application * the application */ - public CryptingPageStore(IPageStore delegate, Application application) + public CryptingPageStore(IPageStore delegate, @Nonnull Application application) { super(delegate); this.application = Args.notNull(application, "application"); @@ -146,7 +148,7 @@ private static class SessionData implements Serializable private final SecretKey key; - public SessionData(SecretKey key) + public SessionData(@Nonnull SecretKey key) { Args.notNull(key, "key"); diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/DelegatingPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/DelegatingPageStore.java index 3402b2c3004..6d7ce4a4f11 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/DelegatingPageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/DelegatingPageStore.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.pageStore; +import jakarta.annotation.Nonnull; + import org.apache.wicket.page.IManageablePage; import org.apache.wicket.util.lang.Args; @@ -26,7 +28,7 @@ public abstract class DelegatingPageStore implements IPageStore { private final IPageStore delegate; - protected DelegatingPageStore(IPageStore delegate) + protected DelegatingPageStore(@Nonnull IPageStore delegate) { this.delegate = Args.notNull(delegate, "delegate"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/DiskPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/DiskPageStore.java index e2e78a13bc5..13a011a30c0 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/DiskPageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/DiskPageStore.java @@ -36,6 +36,8 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import jakarta.annotation.Nonnull; + import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.page.IManageablePage; import org.apache.wicket.pageStore.disk.NestedFolders; @@ -89,7 +91,7 @@ public class DiskPageStore extends AbstractPersistentPageStore implements IPersi * * @see SerializingPageStore */ - public DiskPageStore(String applicationName, File fileStoreFolder, Bytes maxSizePerSession) + public DiskPageStore(String applicationName, File fileStoreFolder, @Nonnull Bytes maxSizePerSession) { super(applicationName); diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/FilePageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/FilePageStore.java index f15d5bdd8b0..98f365ce953 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/FilePageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/FilePageStore.java @@ -32,6 +32,8 @@ import java.util.List; import java.util.Set; +import jakarta.annotation.Nonnull; + import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.page.IManageablePage; import org.apache.wicket.pageStore.disk.NestedFolders; @@ -75,7 +77,7 @@ public class FilePageStore extends AbstractPersistentPageStore implements IPersi * * @see SerializingPageStore */ - public FilePageStore(String applicationName, File fileStoreFolder, Bytes maxSizePerSession) + public FilePageStore(String applicationName, File fileStoreFolder, @Nonnull Bytes maxSizePerSession) { super(applicationName); diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/InMemoryPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/InMemoryPageStore.java index e33d4ed5e8f..5b0cb0a1d00 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/InMemoryPageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/InMemoryPageStore.java @@ -27,6 +27,8 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.core.util.lang.WicketObjects; @@ -339,7 +341,7 @@ protected static class SizeLimitedData extends MemoryData private long size; - public SizeLimitedData(Bytes maxBytes) + public SizeLimitedData(@Nonnull Bytes maxBytes) { Args.notNull(maxBytes, "maxBytes"); diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/InSessionPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/InSessionPageStore.java index 54d2fa8a9c8..16c2902c4e1 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/InSessionPageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/InSessionPageStore.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.function.Supplier; +import jakarta.annotation.Nonnull; import jakarta.servlet.http.HttpSession; import org.apache.wicket.MetaDataKey; @@ -194,7 +195,7 @@ protected abstract static class SessionData implements Serializable * Call this method if session serialization should be supported, i.e. all pages get * serialized along with the session. */ - public void supportSessionSerialization(ISerializer serializer) + public void supportSessionSerialization(@Nonnull ISerializer serializer) { this.serializer = Args.notNull(serializer, "serializer"); } @@ -328,7 +329,7 @@ static class SizeLimitedData extends SessionData private long size; - public SizeLimitedData(Bytes maxBytes) + public SizeLimitedData(@Nonnull Bytes maxBytes) { Args.notNull(maxBytes, "maxBytes"); diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/SerializedPage.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/SerializedPage.java index 78e4310cdfe..2cc257e5961 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/SerializedPage.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/SerializedPage.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.pageStore; +import jakarta.annotation.Nonnull; + import org.apache.wicket.page.IManageablePage; import org.apache.wicket.util.lang.Args; @@ -57,7 +59,7 @@ public SerializedPage(int pageId, byte[] data) * @param pageType type of page, might be {@code null} * @param data */ - public SerializedPage(int pageId, String pageType, byte[] data) + public SerializedPage(int pageId, String pageType, @Nonnull byte[] data) { this.pageId = pageId; this.pageType = pageType; diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/SerializingPageStore.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/SerializingPageStore.java index c62df9f4447..fa415a8636a 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/SerializingPageStore.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/SerializingPageStore.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.pageStore; +import jakarta.annotation.Nonnull; + import org.apache.wicket.page.IManageablePage; import org.apache.wicket.serialize.ISerializer; import org.apache.wicket.util.lang.Args; @@ -35,7 +37,7 @@ public class SerializingPageStore extends DelegatingPageStore * @param serializer * serializer to use if session gets persisted */ - public SerializingPageStore(IPageStore delegate, ISerializer serializer) + public SerializingPageStore(IPageStore delegate, @Nonnull ISerializer serializer) { super(delegate); diff --git a/wicket-core/src/main/java/org/apache/wicket/pageStore/disk/NestedFolders.java b/wicket-core/src/main/java/org/apache/wicket/pageStore/disk/NestedFolders.java index f4d00e645cb..fd69fa17b31 100644 --- a/wicket-core/src/main/java/org/apache/wicket/pageStore/disk/NestedFolders.java +++ b/wicket-core/src/main/java/org/apache/wicket/pageStore/disk/NestedFolders.java @@ -21,6 +21,8 @@ import java.util.HashSet; import java.util.Set; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.file.Files; import org.apache.wicket.util.lang.Args; @@ -38,7 +40,7 @@ public class NestedFolders * * @param base base has to be a folder */ - public NestedFolders(File base) + public NestedFolders(@Nonnull File base) { this.base = Args.notNull(base, "base"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/AbstractRequestLogger.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/AbstractRequestLogger.java index 1bbf74b9128..d1161aded82 100644 --- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/AbstractRequestLogger.java +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/AbstractRequestLogger.java @@ -27,6 +27,9 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.MetaDataKey; import org.apache.wicket.Session; @@ -495,7 +498,7 @@ else if (newCapacity < oldCapacity) * the date to format * @return the formatted date */ - protected String formatDate(final Date date) + protected String formatDate(@Nonnull final Date date) { Args.notNull(date, "date"); diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/BufferedWebResponse.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/BufferedWebResponse.java index 3aadc644858..94a1198d339 100644 --- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/BufferedWebResponse.java +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/BufferedWebResponse.java @@ -24,6 +24,8 @@ import java.util.Collections; import java.util.List; import java.util.function.Consumer; + +import jakarta.annotation.Nonnull; import jakarta.servlet.http.Cookie; import org.apache.wicket.Application; import org.apache.wicket.WicketRuntimeException; @@ -186,7 +188,7 @@ public void setContentType(String mimeType) } @Override - public void setDateHeader(String name, Instant date) + public void setDateHeader(String name, @Nonnull Instant date) { Args.notNull(date, "date"); actions.add(ActionType.HEADER.action(res -> res.setDateHeader(name, date))); @@ -336,7 +338,7 @@ public void sendError(int sc, String msg) * * @param response */ - public void writeTo(final WebResponse response) + public void writeTo(@Nonnull final WebResponse response) { Args.notNull(response, "response"); diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/HeaderBufferingWebResponse.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/HeaderBufferingWebResponse.java index 37494a723dd..32b187e7086 100644 --- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/HeaderBufferingWebResponse.java +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/HeaderBufferingWebResponse.java @@ -17,6 +17,8 @@ package org.apache.wicket.protocol.http; import java.time.Instant; + +import jakarta.annotation.Nonnull; import jakarta.servlet.http.Cookie; import jakarta.servlet.http.HttpServletResponse; import org.apache.wicket.request.http.WebResponse; @@ -129,7 +131,7 @@ public void setContentType(String mimeType) } @Override - public void setDateHeader(String name, Instant date) + public void setDateHeader(String name, @Nonnull Instant date) { Args.notNull(date, "date"); getMetaResponse().setDateHeader(name, date); diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/OriginResourceIsolationPolicy.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/OriginResourceIsolationPolicy.java index ab78bc885e0..573f01af34e 100644 --- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/OriginResourceIsolationPolicy.java +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/OriginResourceIsolationPolicy.java @@ -22,6 +22,7 @@ import java.util.Collection; import java.util.Locale; +import jakarta.annotation.Nonnull; import jakarta.servlet.http.HttpServletRequest; import org.apache.wicket.request.component.IRequestablePage; @@ -63,9 +64,9 @@ public class OriginResourceIsolationPolicy implements IResourceIsolationPolicy * the acceptable origin * @return this */ - public OriginResourceIsolationPolicy addAcceptedOrigin(String acceptedOrigin) + public OriginResourceIsolationPolicy addAcceptedOrigin(@Nonnull String acceptedOrigin) { - Checks.notNull("acceptedOrigin", acceptedOrigin); + Checks.notNull(acceptedOrigin, "acceptedOrigin"); // strip any leading dot characters final int len = acceptedOrigin.length(); diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebApplication.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebApplication.java index 687ae3bfb95..3a28ec66047 100644 --- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebApplication.java +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/WebApplication.java @@ -85,6 +85,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import jakarta.annotation.Nonnull; import jakarta.servlet.ServletContext; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; @@ -323,7 +324,7 @@ public void logResponseTarget(IRequestHandler target) * @param mapper * the encoder that will be used for this mount */ - public void mount(final IRequestMapper mapper) + public void mount(@Nonnull final IRequestMapper mapper) { Args.notNull(mapper, "mapper"); getRootRequestMapperAsCompound().add(mapper); @@ -405,7 +406,7 @@ public

PackageMapper mountPackage(final String path, final Clas * @param path * the path to unmount */ - public void unmount(String path) + public void unmount(@Nonnull String path) { Args.notNull(path, "path"); @@ -670,7 +671,7 @@ public void sessionUnbound(final String sessionId) * @param wicketFilter * The wicket filter instance for this application */ - public final void setWicketFilter(final WicketFilter wicketFilter) + public final void setWicketFilter(@Nonnull final WicketFilter wicketFilter) { Args.notNull(wicketFilter, "wicketFilter"); this.wicketFilter = wicketFilter; @@ -804,7 +805,7 @@ protected void validateInit() * * @param configurationType */ - public Application setConfigurationType(RuntimeConfigurationType configurationType) + public Application setConfigurationType(@Nonnull RuntimeConfigurationType configurationType) { if (this.configurationType != null) { diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java index 108aefd6c4c..84ec3a6d93f 100644 --- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/WicketFilter.java @@ -21,6 +21,7 @@ import java.util.HashSet; import java.util.Set; +import jakarta.annotation.Nonnull; import jakarta.servlet.Filter; import jakarta.servlet.FilterChain; import jakarta.servlet.FilterConfig; @@ -117,7 +118,7 @@ public WicketFilter() * @param application * web application */ - public WicketFilter(WebApplication application) + public WicketFilter(@Nonnull WebApplication application) { this.application = Args.notNull(application, "application"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/Cookies.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/Cookies.java index df8958e5da4..6d3f13d39b6 100644 --- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/Cookies.java +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/mock/Cookies.java @@ -19,6 +19,7 @@ import java.io.Serializable; import java.util.Objects; +import jakarta.annotation.Nonnull; import jakarta.servlet.http.Cookie; import org.apache.wicket.util.lang.Args; @@ -69,7 +70,7 @@ public static Key keyOf(Cookie cookie) * the second cookie * @return {@code true} only if the cookies have the same name, path and domain */ - public static boolean isEqual(Cookie c1, Cookie c2) + public static boolean isEqual(@Nonnull Cookie c1, @Nonnull Cookie c2) { Args.notNull(c1, "c1"); Args.notNull(c2, "c2"); @@ -95,7 +96,7 @@ public static class Key implements Serializable private final String path; private final String domain; - protected Key(Cookie cookie) + protected Key(@Nonnull Cookie cookie) { Args.notNull(cookie, "cookie"); name = cookie.getName(); diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ErrorAttributes.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ErrorAttributes.java index 7d0fdf7766e..382d48cd6f7 100644 --- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ErrorAttributes.java +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ErrorAttributes.java @@ -16,6 +16,7 @@ */ package org.apache.wicket.protocol.http.servlet; +import jakarta.annotation.Nonnull; import jakarta.servlet.RequestDispatcher; import jakarta.servlet.ServletRequest; import jakarta.servlet.http.HttpServletRequest; @@ -142,7 +143,7 @@ public Throwable getException() * @param request * @return instance of request contains error attributes or {@code null} if it does not. */ - public static ErrorAttributes of(HttpServletRequest request, String filterPrefix) + public static ErrorAttributes of(@Nonnull HttpServletRequest request, String filterPrefix) { Args.notNull(request, "request"); Integer code = (Integer)request.getAttribute(RequestDispatcher.ERROR_STATUS_CODE); diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ForwardAttributes.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ForwardAttributes.java index 7b05647b71c..8a6b1a134e7 100644 --- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ForwardAttributes.java +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ForwardAttributes.java @@ -16,6 +16,7 @@ */ package org.apache.wicket.protocol.http.servlet; +import jakarta.annotation.Nonnull; import jakarta.servlet.RequestDispatcher; import jakarta.servlet.ServletRequest; import jakarta.servlet.http.HttpServletRequest; @@ -126,7 +127,7 @@ public String getPathInfo() { * @param request * @return instance of request contains forward attributes or {@code null} if it does not. */ - public static ForwardAttributes of(HttpServletRequest request, String filterPrefix) + public static ForwardAttributes of(@Nonnull HttpServletRequest request, String filterPrefix) { Args.notNull(request, "request"); diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequest.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequest.java index 754913e20d2..47825133d09 100644 --- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequest.java +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequest.java @@ -19,6 +19,7 @@ import java.util.List; import java.util.Map; +import jakarta.annotation.Nonnull; import jakarta.servlet.http.HttpServletRequest; import org.apache.commons.fileupload2.core.FileItem; @@ -122,7 +123,7 @@ public Bytes getMaxSize() return maxSize; } - public void setMaxSize(Bytes maxSize) + public void setMaxSize(@Nonnull Bytes maxSize) { Args.notNull(maxSize, "maxSize"); this.maxSize = maxSize; diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequestImpl.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequestImpl.java index 6ae48f25a6e..7cd7ebe087d 100644 --- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequestImpl.java +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/MultipartServletWebRequestImpl.java @@ -25,6 +25,7 @@ import java.util.List; import java.util.Map; +import jakarta.annotation.Nonnull; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.Part; @@ -117,7 +118,7 @@ public MultipartServletWebRequestImpl(HttpServletRequest request, String filterP * Thrown if something goes wrong with upload */ public MultipartServletWebRequestImpl(HttpServletRequest request, String filterPrefix, - Bytes maxSize, String upload, FileItemFactory factory) throws FileUploadException + Bytes maxSize, @Nonnull String upload, FileItemFactory factory) throws FileUploadException { super(request, filterPrefix); @@ -521,7 +522,7 @@ private static String getSessionKey(String upload) * upload identifier * @return {@link UploadInfo} object from session, or null if not found */ - public static UploadInfo getUploadInfo(final HttpServletRequest req, String upload) + public static UploadInfo getUploadInfo(@Nonnull final HttpServletRequest req, String upload) { Args.notNull(req, "req"); return (UploadInfo)req.getSession().getAttribute(getSessionKey(upload)); @@ -537,8 +538,8 @@ public static UploadInfo getUploadInfo(final HttpServletRequest req, String uplo * @param uploadInfo * {@link UploadInfo} object to be put into session, not null */ - public static void setUploadInfo(final HttpServletRequest req, String upload, - final UploadInfo uploadInfo) + public static void setUploadInfo(@Nonnull final HttpServletRequest req, @Nonnull String upload, + @Nonnull final UploadInfo uploadInfo) { Args.notNull(req, "req"); Args.notNull(upload, "upload"); @@ -554,7 +555,7 @@ public static void setUploadInfo(final HttpServletRequest req, String upload, * @param upload * upload identifier */ - public static void clearUploadInfo(final HttpServletRequest req, String upload) + public static void clearUploadInfo(@Nonnull final HttpServletRequest req, @Nonnull String upload) { Args.notNull(req, "req"); Args.notNull(upload, "upload"); diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletPartFileItem.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletPartFileItem.java index e09f7dd07f0..3eed02be579 100644 --- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletPartFileItem.java +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletPartFileItem.java @@ -25,6 +25,7 @@ import java.nio.file.Path; import java.util.Collection; +import jakarta.annotation.Nonnull; import jakarta.servlet.http.Part; import org.apache.commons.fileupload2.core.FileItem; @@ -50,7 +51,7 @@ class ServletPartFileItem implements FileItem /** * Constructor */ - ServletPartFileItem(Part part) + ServletPartFileItem(@Nonnull Part part) { Args.notNull(part, "part"); this.part = part; diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java index e597a46cf63..5b59407a369 100644 --- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebRequest.java @@ -27,6 +27,8 @@ import java.util.Locale; import java.util.Map; import java.util.Set; + +import jakarta.annotation.Nonnull; import jakarta.servlet.http.Cookie; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; @@ -88,7 +90,7 @@ public ServletWebRequest(HttpServletRequest httpServletRequest, String filterPre * contentPath + filterPath, used to extract the actual {@link Url} * @param url */ - public ServletWebRequest(HttpServletRequest httpServletRequest, String filterPrefix, Url url) + public ServletWebRequest(@Nonnull HttpServletRequest httpServletRequest, @Nonnull String filterPrefix, Url url) { Args.notNull(httpServletRequest, "httpServletRequest"); Args.notNull(filterPrefix, "filterPrefix"); diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebResponse.java b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebResponse.java index 3e82c846f77..f5b33fd5688 100644 --- a/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebResponse.java +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/http/servlet/ServletWebResponse.java @@ -18,6 +18,8 @@ import java.io.IOException; import java.time.Instant; + +import jakarta.annotation.Nonnull; import jakarta.servlet.http.Cookie; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; @@ -46,7 +48,7 @@ public class ServletWebResponse extends WebResponse * @param webRequest * @param httpServletResponse */ - public ServletWebResponse(ServletWebRequest webRequest, HttpServletResponse httpServletResponse) + public ServletWebResponse(@Nonnull ServletWebRequest webRequest, @Nonnull HttpServletResponse httpServletResponse) { Args.notNull(webRequest, "webRequest"); Args.notNull(httpServletResponse, "httpServletResponse"); @@ -82,7 +84,7 @@ public void setContentType(String mimeType) } @Override - public void setDateHeader(String name, Instant date) + public void setDateHeader(String name, @Nonnull Instant date) { Args.notNull(date, "date"); httpServletResponse.setDateHeader(name, date.toEpochMilli()); @@ -173,7 +175,7 @@ public void sendError(int sc, String msg) } @Override - public String encodeURL(CharSequence url) + public String encodeURL(@Nonnull CharSequence url) { Args.notNull(url, "url"); @@ -223,7 +225,7 @@ private UrlRenderer getUrlRenderer() } @Override - public String encodeRedirectURL(CharSequence url) + public String encodeRedirectURL(@Nonnull CharSequence url) { Args.notNull(url, "url"); diff --git a/wicket-core/src/main/java/org/apache/wicket/protocol/https/HttpsMapper.java b/wicket-core/src/main/java/org/apache/wicket/protocol/https/HttpsMapper.java index 25dbd202777..5a6e97b21a4 100644 --- a/wicket-core/src/main/java/org/apache/wicket/protocol/https/HttpsMapper.java +++ b/wicket-core/src/main/java/org/apache/wicket/protocol/https/HttpsMapper.java @@ -16,6 +16,7 @@ */ package org.apache.wicket.protocol.https; +import jakarta.annotation.Nonnull; import jakarta.servlet.http.HttpServletRequest; import org.apache.wicket.Session; @@ -73,7 +74,7 @@ public class HttpsMapper implements IRequestMapperDelegate * @param delegate * @param config */ - public HttpsMapper(IRequestMapper delegate, HttpsConfig config) + public HttpsMapper(@Nonnull IRequestMapper delegate, HttpsConfig config) { this.delegate = Args.notNull(delegate, "delegate"); this.config = config; @@ -320,7 +321,7 @@ public static class RedirectHandler implements IRequestHandler * @param url * redirect location */ - public RedirectHandler(String url, HttpsConfig config) + public RedirectHandler(@Nonnull String url, @Nonnull HttpsConfig config) { this.url = Args.notNull(url, "url"); this.config = Args.notNull(config, "config"); diff --git a/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java b/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java index 8df80b8f4e7..188760e26be 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/cycle/RequestCycle.java @@ -18,6 +18,8 @@ import java.util.Optional; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.IMetadataContext; import org.apache.wicket.IWicketInternalException; @@ -130,7 +132,7 @@ private static void set(RequestCycle requestCycle) * * @param context */ - public RequestCycle(RequestCycleContext context) + public RequestCycle(@Nonnull RequestCycleContext context) { Args.notNull(context, "context"); Args.notNull(context.getRequest(), "context.request"); @@ -283,7 +285,7 @@ public boolean processRequest() * * @param handler */ - private void execute(IRequestHandler handler) + private void execute(@Nonnull IRequestHandler handler) { Args.notNull(handler, "handler"); diff --git a/wicket-core/src/main/java/org/apache/wicket/request/handler/resource/ResourceReferenceRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/request/handler/resource/ResourceReferenceRequestHandler.java index 77dc67ddea9..9457c00ce49 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/handler/resource/ResourceReferenceRequestHandler.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/handler/resource/ResourceReferenceRequestHandler.java @@ -18,6 +18,8 @@ import java.util.Locale; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.ILoggableRequestHandler; import org.apache.wicket.request.IRequestCycle; import org.apache.wicket.request.IRequestHandler; @@ -56,7 +58,7 @@ public ResourceReferenceRequestHandler(ResourceReference resourceReference) * @param resourceReference * @param pageParameters */ - public ResourceReferenceRequestHandler(ResourceReference resourceReference, + public ResourceReferenceRequestHandler(@Nonnull ResourceReference resourceReference, PageParameters pageParameters) { Args.notNull(resourceReference, "resourceReference"); diff --git a/wicket-core/src/main/java/org/apache/wicket/request/handler/resource/ResourceRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/request/handler/resource/ResourceRequestHandler.java index ea257d375cd..737ae77c4c7 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/handler/resource/ResourceRequestHandler.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/handler/resource/ResourceRequestHandler.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.request.handler.resource; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.Session; import org.apache.wicket.authorization.IAuthorizationStrategy; @@ -42,7 +44,7 @@ public class ResourceRequestHandler implements IRequestHandler * @param resource * @param parameters */ - public ResourceRequestHandler(IResource resource, PageParameters parameters) + public ResourceRequestHandler(@Nonnull IResource resource, PageParameters parameters) { Args.notNull(resource, "resource"); diff --git a/wicket-core/src/main/java/org/apache/wicket/request/handler/resource/ResourceStreamRequestHandler.java b/wicket-core/src/main/java/org/apache/wicket/request/handler/resource/ResourceStreamRequestHandler.java index 1f2ee183423..0ec12060987 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/handler/resource/ResourceStreamRequestHandler.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/handler/resource/ResourceStreamRequestHandler.java @@ -27,6 +27,9 @@ import org.apache.wicket.util.resource.IResourceStream; import org.apache.wicket.util.string.Strings; import java.time.Duration; + +import jakarta.annotation.Nonnull; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -79,7 +82,7 @@ public ResourceStreamRequestHandler(IResourceStream resourceStream) * the resource stream for the response * @param fileName */ - public ResourceStreamRequestHandler(IResourceStream resourceStream, String fileName) + public ResourceStreamRequestHandler(@Nonnull IResourceStream resourceStream, String fileName) { Args.notNull(resourceStream, "resourceStream"); diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java index 91464131df8..cf64ed3efc5 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/AbstractResource.java @@ -25,6 +25,7 @@ import java.util.Locale; import java.util.Set; +import jakarta.annotation.Nonnull; import jakarta.servlet.http.HttpServletResponse; import org.apache.wicket.Application; @@ -264,7 +265,7 @@ public String getFileName() * * @return {@code this}, for chaining. */ - public ResourceResponse setContentDisposition(ContentDisposition contentDisposition) + public ResourceResponse setContentDisposition(@Nonnull ContentDisposition contentDisposition) { Args.notNull(contentDisposition, "contentDisposition"); this.contentDisposition = contentDisposition; @@ -483,7 +484,7 @@ public ResourceResponse setCacheDurationToMaximum() * * @return {@code this}, for chaining. */ - public ResourceResponse setCacheDuration(Duration duration) + public ResourceResponse setCacheDuration(@Nonnull Duration duration) { cacheDuration = Args.notNull(duration, "duration"); return this; @@ -540,7 +541,7 @@ public WebResponse.CacheScope getCacheScope() * * @return {@code this}, for chaining. */ - public ResourceResponse setCacheScope(WebResponse.CacheScope scope) + public ResourceResponse setCacheScope(@Nonnull WebResponse.CacheScope scope) { cacheScope = Args.notNull(scope, "scope"); return this; @@ -559,7 +560,7 @@ public ResourceResponse setCacheScope(WebResponse.CacheScope scope) * * @return {@code this}, for chaining. */ - public ResourceResponse setWriteCallback(final WriteCallback writeCallback) + public ResourceResponse setWriteCallback(@Nonnull final WriteCallback writeCallback) { Args.notNull(writeCallback, "writeCallback"); this.writeCallback = writeCallback; @@ -691,7 +692,7 @@ private boolean needsBody(Integer statusCode) * @throws IllegalArgumentException * if access is forbidden */ - private void checkHeaderAccess(String name) + private void checkHeaderAccess(@Nonnull String name) { name = Args.notEmpty(name.trim().toLowerCase(Locale.ROOT), "name"); diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/ContextRelativeResource.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/ContextRelativeResource.java index d5f5e8b89ed..5a37104de3d 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/resource/ContextRelativeResource.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/ContextRelativeResource.java @@ -20,6 +20,8 @@ import java.io.InputStream; import java.io.Serializable; +import jakarta.annotation.Nonnull; + import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.core.util.resource.WebExternalResourceStream; import org.apache.wicket.request.resource.caching.IStaticCacheableResource; @@ -51,7 +53,7 @@ public class ContextRelativeResource extends AbstractResource implements IStatic * * @param pathRelativeToContextRoot */ - public ContextRelativeResource(String pathRelativeToContextRoot) + public ContextRelativeResource(@Nonnull String pathRelativeToContextRoot) { Args.notNull(pathRelativeToContextRoot, "pathRelativeToContextRoot"); diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/ContextRelativeResourceReference.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/ContextRelativeResourceReference.java index 55d281c98e1..b01ba692058 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/resource/ContextRelativeResourceReference.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/ContextRelativeResourceReference.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.request.resource; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.resource.ResourceUtils; @@ -92,7 +94,7 @@ public ContextRelativeResourceReference(final String name, final String minPostf * @param minifyIt * says if the resource name can be minified or not */ - public ContextRelativeResourceReference(final String name, final String minPostfix, final boolean minifyIt) + public ContextRelativeResourceReference(final String name, @Nonnull final String minPostfix, final boolean minifyIt) { super(name); diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/DynamicImageResource.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/DynamicImageResource.java index d5456ad010a..56ac5050d86 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/resource/DynamicImageResource.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/DynamicImageResource.java @@ -21,6 +21,8 @@ import java.io.IOException; import java.time.Instant; import javax.imageio.ImageIO; + +import jakarta.annotation.Nonnull; import jakarta.servlet.http.HttpServletResponse; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.util.lang.Args; @@ -71,7 +73,7 @@ public synchronized final String getFormat() * @param format * The format (jpg, png or gif..) */ - public synchronized final void setFormat(String format) + public synchronized final void setFormat(@Nonnull String format) { Args.notNull(format, "format"); this.format = format; diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/IResource.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/IResource.java index 82078d154f6..7b54a04cabf 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/resource/IResource.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/IResource.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.request.resource; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.Request; import org.apache.wicket.request.Response; import org.apache.wicket.request.handler.resource.ResourceRequestHandler; @@ -51,7 +53,7 @@ class Attributes * @param response * @param parameters */ - public Attributes(Request request, Response response, PageParameters parameters) + public Attributes(@Nonnull Request request, @Nonnull Response response, PageParameters parameters) { Args.notNull(request, "request"); Args.notNull(response, "response"); diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/PartWriterCallback.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/PartWriterCallback.java index 6b6b4c9a6a8..05fbe6d5891 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/resource/PartWriterCallback.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/PartWriterCallback.java @@ -20,6 +20,8 @@ import java.io.InputStream; import java.io.OutputStream; +import jakarta.annotation.Nonnull; + import org.apache.commons.io.input.BoundedInputStream; import org.apache.wicket.protocol.http.servlet.ResponseIOException; import org.apache.wicket.request.resource.AbstractResource.WriteCallback; @@ -90,7 +92,7 @@ public class PartWriterCallback extends WriteCallback * the end position to read to (if not null the stream is going to be read till * endbyte, else to the end of the whole stream) */ - public PartWriterCallback(InputStream inputStream, Long contentLength, Long startbyte, + public PartWriterCallback(InputStream inputStream, @Nonnull Long contentLength, Long startbyte, Long endbyte) { this.inputStream = inputStream; diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/ResourceReference.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/ResourceReference.java index 9b96144ff2c..e160ea173ab 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/resource/ResourceReference.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/ResourceReference.java @@ -21,6 +21,8 @@ import java.util.List; import java.util.Locale; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.core.util.lang.WicketObjects; import org.apache.wicket.markup.head.HeaderItem; @@ -53,7 +55,7 @@ public abstract class ResourceReference implements IClusterable * @param key * The data making up the resource reference */ - public ResourceReference(final Key key) + public ResourceReference(@Nonnull final Key key) { Args.notNull(key, "key"); @@ -74,7 +76,7 @@ public ResourceReference(final Key key) * @param variation * resource variation */ - public ResourceReference(Class scope, String name, Locale locale, String style, + public ResourceReference(@Nonnull Class scope, @Nonnull String name, Locale locale, String style, String variation) { Args.notNull(scope, "scope"); @@ -279,13 +281,13 @@ public static final class LambdaResourceReference extends ResourceReference final SerializableSupplier resourceBuilder; - public LambdaResourceReference(String name, SerializableSupplier resourceBuilder) + public LambdaResourceReference(String name, @Nonnull SerializableSupplier resourceBuilder) { super(name); this.resourceBuilder = Args.notNull(resourceBuilder, "resourceBuilder"); } - public LambdaResourceReference(Key key, SerializableSupplier resourceBuilder) + public LambdaResourceReference(Key key, @Nonnull SerializableSupplier resourceBuilder) { super(key); this.resourceBuilder = Args.notNull(resourceBuilder, "resourceBuilder"); @@ -437,7 +439,7 @@ public Key(final ResourceReference reference) * @param variation * resource variation */ - public Key(final String scope, final String name, final Locale locale, final String style, + public Key(@Nonnull final String scope, @Nonnull final String name, final Locale locale, final String style, final String variation) { Args.notNull(scope, "scope"); diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/ResourceReferenceRegistry.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/ResourceReferenceRegistry.java index b021342f8d1..f18eb82a426 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/resource/ResourceReferenceRegistry.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/ResourceReferenceRegistry.java @@ -21,6 +21,8 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.resource.ResourceReference.Key; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.lang.Generics; @@ -107,7 +109,7 @@ public ResourceReferenceRegistry() * @param resourceReferenceFactory * The factory that will create ResourceReference by Key when there is no registered one */ - public ResourceReferenceRegistry(IResourceReferenceFactory resourceReferenceFactory) + public ResourceReferenceRegistry(@Nonnull IResourceReferenceFactory resourceReferenceFactory) { this.resourceReferenceFactory = Args.notNull(resourceReferenceFactory, "resourceReferenceFactory"); @@ -142,7 +144,7 @@ public final boolean registerResourceReference(final ResourceReference reference * @return {@code true} if the resource was registered successfully or has been registered previously * already. */ - private Key _registerResourceReference(final ResourceReference reference) + private Key _registerResourceReference(@Nonnull final ResourceReference reference) { Args.notNull(reference, "reference"); @@ -164,7 +166,7 @@ private Key _registerResourceReference(final ResourceReference reference) * the {@link ResourceReference}'s identifier * @return The removed ResourceReference or {@code null} if the registry did not contain an entry for this key. */ - public final ResourceReference unregisterResourceReference(final Key key) + public final ResourceReference unregisterResourceReference(@Nonnull final Key key) { Args.notNull(key, "key"); diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/UrlResourceReference.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/UrlResourceReference.java index 20cb74cbb68..66db9c863b0 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/resource/UrlResourceReference.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/UrlResourceReference.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.request.resource; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.IUrlRenderer; import org.apache.wicket.request.Url; import org.apache.wicket.request.UrlUtils; @@ -75,7 +77,7 @@ public UrlResourceReference(final Url url) this.url = url; } - private static String asName(Url externalUrl) + private static String asName(@Nonnull Url externalUrl) { Args.notNull(externalUrl, "url"); return externalUrl.toString(); diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/FilenameWithVersionResourceCachingStrategy.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/FilenameWithVersionResourceCachingStrategy.java index e1b25940063..dca7624cf22 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/FilenameWithVersionResourceCachingStrategy.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/FilenameWithVersionResourceCachingStrategy.java @@ -18,6 +18,8 @@ import java.util.regex.Pattern; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.cycle.RequestCycle; import org.apache.wicket.request.http.WebResponse; import org.apache.wicket.request.resource.AbstractResource; @@ -83,8 +85,8 @@ public FilenameWithVersionResourceCachingStrategy(IResourceVersion resourceVersi * * @see #FilenameWithVersionResourceCachingStrategy(org.apache.wicket.request.resource.caching.version.IResourceVersion) */ - public FilenameWithVersionResourceCachingStrategy(String versionPrefix, - IResourceVersion resourceVersion) + public FilenameWithVersionResourceCachingStrategy(@Nonnull String versionPrefix, + @Nonnull IResourceVersion resourceVersion) { this.resourceVersion = Args.notNull(resourceVersion, "resourceVersion"); this.versionPrefix = Args.notEmpty(versionPrefix, "versionPrefix"); diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/QueryStringWithVersionResourceCachingStrategy.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/QueryStringWithVersionResourceCachingStrategy.java index 117db371b71..92f42a83f80 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/QueryStringWithVersionResourceCachingStrategy.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/QueryStringWithVersionResourceCachingStrategy.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.request.resource.caching; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.cycle.RequestCycle; import org.apache.wicket.request.http.WebResponse; import org.apache.wicket.request.mapper.parameter.INamedParameters; @@ -79,8 +81,8 @@ public QueryStringWithVersionResourceCachingStrategy(IResourceVersion resourceVe * @param resourceVersion * resource version provider */ - public QueryStringWithVersionResourceCachingStrategy(String versionParameter, - IResourceVersion resourceVersion) + public QueryStringWithVersionResourceCachingStrategy(@Nonnull String versionParameter, + @Nonnull IResourceVersion resourceVersion) { this.versionParameter = Args.notEmpty(versionParameter, "versionParameter"); this.resourceVersion = Args.notNull(resourceVersion, "resourceVersion"); diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/version/CachingResourceVersion.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/version/CachingResourceVersion.java index 4ee03bd3547..f51cee506b5 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/version/CachingResourceVersion.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/version/CachingResourceVersion.java @@ -21,6 +21,8 @@ import java.util.Map; import java.util.regex.Pattern; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.resource.caching.IStaticCacheableResource; import org.apache.wicket.util.collections.MostRecentlyUsedMap; import org.apache.wicket.util.lang.Args; @@ -82,7 +84,7 @@ public CachingResourceVersion(IResourceVersion delegate) * @param maxEntries * maximum number of cache entries */ - public CachingResourceVersion(IResourceVersion delegate, int maxEntries) + public CachingResourceVersion(@Nonnull IResourceVersion delegate, int maxEntries) { if (maxEntries < 1) { @@ -146,7 +148,7 @@ public Pattern getVersionPattern() { * @param resource * cacheable resource */ - public void invalidate(IStaticCacheableResource resource) + public void invalidate(@Nonnull IStaticCacheableResource resource) { // get cache key for resource reference final Serializable key = Args.notNull(resource, "resource").getCacheKey(); diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/version/MessageDigestResourceVersion.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/version/MessageDigestResourceVersion.java index 6c371499e26..bc0f3fb9d2b 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/version/MessageDigestResourceVersion.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/version/MessageDigestResourceVersion.java @@ -22,6 +22,8 @@ import java.security.NoSuchAlgorithmException; import java.util.regex.Pattern; +import jakarta.annotation.Nonnull; + import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.request.resource.caching.IStaticCacheableResource; import org.apache.wicket.util.io.IOUtils; @@ -113,7 +115,7 @@ public MessageDigestResourceVersion(String algorithm) * @param bufferSize * maximum size for internal buffer */ - public MessageDigestResourceVersion(String algorithm, Bytes bufferSize) + public MessageDigestResourceVersion(@Nonnull String algorithm, @Nonnull Bytes bufferSize) { this.algorithm = Args.notEmpty(algorithm, "algorithm"); this.bufferSize = Args.notNull(bufferSize, "bufferSize"); diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/version/RequestCycleCachedResourceVersion.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/version/RequestCycleCachedResourceVersion.java index 739782b142f..f976cd0d17b 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/version/RequestCycleCachedResourceVersion.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/version/RequestCycleCachedResourceVersion.java @@ -20,6 +20,8 @@ import java.util.Map; import java.util.regex.Pattern; +import jakarta.annotation.Nonnull; + import org.apache.wicket.MetaDataKey; import org.apache.wicket.ThreadContext; import org.apache.wicket.request.cycle.RequestCycle; @@ -55,7 +57,7 @@ public class RequestCycleCachedResourceVersion implements IResourceVersion * @param delegate * resource version provider to cache */ - public RequestCycleCachedResourceVersion(IResourceVersion delegate) + public RequestCycleCachedResourceVersion(@Nonnull IResourceVersion delegate) { this.delegate = Args.notNull(delegate, "delegate"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/version/StaticResourceVersion.java b/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/version/StaticResourceVersion.java index 5d4b9417373..ff88a24daa7 100644 --- a/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/version/StaticResourceVersion.java +++ b/wicket-core/src/main/java/org/apache/wicket/request/resource/caching/version/StaticResourceVersion.java @@ -18,6 +18,8 @@ import java.util.regex.Pattern; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.resource.caching.IStaticCacheableResource; import org.apache.wicket.util.lang.Args; @@ -39,7 +41,7 @@ public class StaticResourceVersion implements IResourceVersion * @param version * static version string to deliver for all queries resources */ - public StaticResourceVersion(String version) + public StaticResourceVersion(@Nonnull String version) { this.version = Args.notNull(version, "version"); this.pattern = Pattern.compile(Pattern.quote(version)); diff --git a/wicket-core/src/main/java/org/apache/wicket/resource/ResourceUtil.java b/wicket-core/src/main/java/org/apache/wicket/resource/ResourceUtil.java index 28ed7e2562e..00c12af758a 100644 --- a/wicket-core/src/main/java/org/apache/wicket/resource/ResourceUtil.java +++ b/wicket-core/src/main/java/org/apache/wicket/resource/ResourceUtil.java @@ -22,6 +22,8 @@ import java.util.Locale; import java.util.regex.Pattern; +import jakarta.annotation.Nonnull; + import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.request.Url; import org.apache.wicket.request.resource.ResourceReference; @@ -82,7 +84,7 @@ else if (split.length == 3) * * @see ResourceReference.UrlAttributes */ - public static ResourceReference.UrlAttributes decodeResourceReferenceAttributes(Url url) + public static ResourceReference.UrlAttributes decodeResourceReferenceAttributes(@Nonnull Url url) { Args.notNull(url, "url"); @@ -152,7 +154,7 @@ public static String encodeResourceReferenceAttributes(ResourceReference.UrlAttr * @see ResourceReference.UrlAttributes * @see Url */ - public static void encodeResourceReferenceAttributes(Url url, ResourceReference reference) + public static void encodeResourceReferenceAttributes(@Nonnull Url url, @Nonnull ResourceReference reference) { Args.notNull(url, "url"); Args.notNull(reference, "reference"); diff --git a/wicket-core/src/main/java/org/apache/wicket/resource/bundles/ConcatBundleResource.java b/wicket-core/src/main/java/org/apache/wicket/resource/bundles/ConcatBundleResource.java index af2329f662e..e30e9c7a4fb 100644 --- a/wicket-core/src/main/java/org/apache/wicket/resource/bundles/ConcatBundleResource.java +++ b/wicket-core/src/main/java/org/apache/wicket/resource/bundles/ConcatBundleResource.java @@ -25,6 +25,7 @@ import java.util.List; import java.util.MissingResourceException; +import jakarta.annotation.Nonnull; import jakarta.servlet.http.HttpServletResponse; import org.apache.wicket.Application; @@ -72,7 +73,7 @@ public class ConcatBundleResource extends AbstractResource implements IStaticCac * * @param providedResources */ - public ConcatBundleResource(List providedResources) + public ConcatBundleResource(@Nonnull List providedResources) { this.providedResources = Args.notNull(providedResources, "providedResources"); cachingEnabled = true; diff --git a/wicket-core/src/main/java/org/apache/wicket/resource/bundles/ConcatResourceBundleReference.java b/wicket-core/src/main/java/org/apache/wicket/resource/bundles/ConcatResourceBundleReference.java index d75b74405c8..7c2cfe7071a 100644 --- a/wicket-core/src/main/java/org/apache/wicket/resource/bundles/ConcatResourceBundleReference.java +++ b/wicket-core/src/main/java/org/apache/wicket/resource/bundles/ConcatResourceBundleReference.java @@ -22,6 +22,8 @@ import java.util.Locale; import java.util.Set; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.ResourceBundles; import org.apache.wicket.markup.head.HeaderItem; @@ -114,7 +116,7 @@ public ConcatResourceBundleReference(String name, T... resources) * the resources that are concatenated */ public ConcatResourceBundleReference(Class scope, String name, Locale locale, String style, - String variation, List resources) + String variation, @Nonnull List resources) { super(scope, name, locale, style, variation); providedResources = Args.notNull(resources, "resources"); diff --git a/wicket-core/src/main/java/org/apache/wicket/resource/loader/ClassStringResourceLoader.java b/wicket-core/src/main/java/org/apache/wicket/resource/loader/ClassStringResourceLoader.java index 3e47a7aad0e..b4977680407 100644 --- a/wicket-core/src/main/java/org/apache/wicket/resource/loader/ClassStringResourceLoader.java +++ b/wicket-core/src/main/java/org/apache/wicket/resource/loader/ClassStringResourceLoader.java @@ -19,6 +19,8 @@ import java.lang.ref.WeakReference; import java.util.Locale; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.util.lang.Args; @@ -44,7 +46,7 @@ public class ClassStringResourceLoader extends ComponentStringResourceLoader * @param clazz * The class that this resource loader is associated with */ - public ClassStringResourceLoader(final Class clazz) + public ClassStringResourceLoader(@Nonnull final Class clazz) { Args.notNull(clazz, "clazz"); clazzRef = new WeakReference<>(clazz); diff --git a/wicket-core/src/main/java/org/apache/wicket/resource/loader/ComponentStringResourceLoader.java b/wicket-core/src/main/java/org/apache/wicket/resource/loader/ComponentStringResourceLoader.java index ae5ec60be53..260f5bc3188 100644 --- a/wicket-core/src/main/java/org/apache/wicket/resource/loader/ComponentStringResourceLoader.java +++ b/wicket-core/src/main/java/org/apache/wicket/resource/loader/ComponentStringResourceLoader.java @@ -20,6 +20,8 @@ import java.util.List; import java.util.Locale; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.Component; import org.apache.wicket.MarkupContainer; @@ -268,7 +270,7 @@ public String loadStringResource(final Component component, final String key, * @param component * @return path */ - protected String getResourcePath(final Component component) + protected String getResourcePath(@Nonnull final Component component) { Component current = Args.notNull(component, "component"); diff --git a/wicket-core/src/main/java/org/apache/wicket/resource/loader/InitializerStringResourceLoader.java b/wicket-core/src/main/java/org/apache/wicket/resource/loader/InitializerStringResourceLoader.java index c9fd6b5ec7f..07c40c17e5c 100644 --- a/wicket-core/src/main/java/org/apache/wicket/resource/loader/InitializerStringResourceLoader.java +++ b/wicket-core/src/main/java/org/apache/wicket/resource/loader/InitializerStringResourceLoader.java @@ -23,6 +23,8 @@ import java.util.List; import java.util.Locale; +import jakarta.annotation.Nonnull; + /** * This is one of Wicket's default string resource loaders. It is designed to let wicket extension @@ -48,7 +50,7 @@ public class InitializerStringResourceLoader extends ComponentStringResourceLoad * @param initializers * initializers */ - public InitializerStringResourceLoader(List initializers) + public InitializerStringResourceLoader(@Nonnull List initializers) { this.initializers = Args.notNull(initializers, "initializers"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/resource/loader/NestedStringResourceLoader.java b/wicket-core/src/main/java/org/apache/wicket/resource/loader/NestedStringResourceLoader.java index a2ec9c6e5bb..60d2162173f 100644 --- a/wicket-core/src/main/java/org/apache/wicket/resource/loader/NestedStringResourceLoader.java +++ b/wicket-core/src/main/java/org/apache/wicket/resource/loader/NestedStringResourceLoader.java @@ -28,6 +28,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import jakarta.annotation.Nonnull; + /** * Creates a nested string resource loader which resolves nested keys.
*
@@ -64,7 +66,7 @@ public class NestedStringResourceLoader implements IStringResourceLoader * the pattern for nested keys. Example for #(key) is the pattern: * Pattern.compile("#\\(([^ ]*?)\\)"); */ - public NestedStringResourceLoader(List loaders, Pattern pattern) + public NestedStringResourceLoader(List loaders, @Nonnull Pattern pattern) { this.loaders = new ArrayList<>(loaders); this.pattern = Args.notNull(pattern, "pattern"); diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/ApplicationSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/ApplicationSettings.java index 3d5141cc381..1bccaa334db 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/ApplicationSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/ApplicationSettings.java @@ -18,6 +18,8 @@ import java.lang.ref.WeakReference; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Page; import org.apache.wicket.application.DefaultClassResolver; import org.apache.wicket.application.IClassResolver; @@ -186,7 +188,7 @@ public ApplicationSettings setDefaultMaximumUploadSize(Bytes defaultMaximumUploa * @return {@code this} object for chaining * @see org.apache.wicket.request.cycle.IRequestCycleListener#onException(RequestCycle, Exception) */ - public ApplicationSettings setInternalErrorPage(final Class internalErrorPage) + public ApplicationSettings setInternalErrorPage(@Nonnull final Class internalErrorPage) { Args.notNull(internalErrorPage, "internalErrorPage"); checkPageClass(internalErrorPage); @@ -202,7 +204,7 @@ public ApplicationSettings setInternalErrorPage(final Class inte * The pageExpiredErrorPage to set. * @return {@code this} object for chaining */ - public ApplicationSettings setPageExpiredErrorPage(final Class pageExpiredErrorPage) + public ApplicationSettings setPageExpiredErrorPage(@Nonnull final Class pageExpiredErrorPage) { Args.notNull(pageExpiredErrorPage, "pageExpiredErrorPage"); checkPageClass(pageExpiredErrorPage); @@ -252,7 +254,7 @@ private void checkPageClass(final Class pageClass) * @param filter * @return {@code this} object for chaining */ - public ApplicationSettings setFeedbackMessageCleanupFilter(IFeedbackMessageFilter filter) + public ApplicationSettings setFeedbackMessageCleanupFilter(@Nonnull IFeedbackMessageFilter filter) { Args.notNull(filter, "filter"); feedbackMessageCleanupFilter = filter; diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/DebugSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/DebugSettings.java index 9b2a449e039..1192e8d7828 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/DebugSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/DebugSettings.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.settings; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; /** @@ -202,7 +204,7 @@ public DebugSettings setOutputMarkupContainerClassName(boolean enable) * @param strategy * @return {@code this} object for chaining */ - public DebugSettings setOutputMarkupContainerClassNameStrategy(ClassOutputStrategy strategy) + public DebugSettings setOutputMarkupContainerClassNameStrategy(@Nonnull ClassOutputStrategy strategy) { outputMarkupContainerClassNameStrategy = Args.notNull(strategy, "strategy"); return this; diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/ExceptionSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/ExceptionSettings.java index 53d07454f4f..9f5a83d4aff 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/ExceptionSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/ExceptionSettings.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.settings; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.lang.EnumeratedType; @@ -200,7 +202,7 @@ public ExceptionSettings setAjaxErrorHandlingStrategy( * @param strategy * @return {@code this} object for chaining */ - public ExceptionSettings setThreadDumpStrategy(ThreadDumpStrategy strategy) + public ExceptionSettings setThreadDumpStrategy(@Nonnull ThreadDumpStrategy strategy) { threadDumpStrategy = Args.notNull(strategy, "strategy"); return this; diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/FrameworkSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/FrameworkSettings.java index 9f8e02d9e35..4cc72325bf0 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/FrameworkSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/FrameworkSettings.java @@ -19,6 +19,8 @@ import java.util.ArrayList; import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.Component; import org.apache.wicket.IComponentAwareEventSink; @@ -138,7 +140,7 @@ public FrameworkSettings setDetachListener(IDetachListener detachListener) * @param dispatcher {@link IEventDispatcher} * @return {@code this} object for chaining */ - public FrameworkSettings add(IEventDispatcher dispatcher) + public FrameworkSettings add(@Nonnull IEventDispatcher dispatcher) { Args.notNull(dispatcher, "dispatcher"); if (eventDispatchers == null) @@ -209,7 +211,7 @@ public FrameworkSettings setDefaultEventDispatcher(IEventDispatcher defaultEvent * the {@link ISerializer} to use * @return {@code this} object for chaining */ - public FrameworkSettings setSerializer(ISerializer serializer) + public FrameworkSettings setSerializer(@Nonnull ISerializer serializer) { this.serializer = Args.notNull(serializer, "serializer"); return this; diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/JavaScriptLibrarySettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/JavaScriptLibrarySettings.java index 6ec43dc1aa5..48201818f99 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/JavaScriptLibrarySettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/JavaScriptLibrarySettings.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.settings; +import jakarta.annotation.Nonnull; + import org.apache.wicket.ajax.WicketAjaxJQueryResourceReference; import org.apache.wicket.request.resource.ResourceReference; import org.apache.wicket.resource.JQueryResourceReference; @@ -54,7 +56,7 @@ public ResourceReference getJQueryReference() * wicket-event and wicket-ajax * @return {@code this} object for chaining */ - public JavaScriptLibrarySettings setJQueryReference(ResourceReference jQueryReference) + public JavaScriptLibrarySettings setJQueryReference(@Nonnull ResourceReference jQueryReference) { this.jQueryReference = Args.notNull(jQueryReference, "jQueryReference"); return this; @@ -73,9 +75,9 @@ public ResourceReference getWicketAjaxReference() * a reference to the implementation of wicket-ajax.js * @return {@code this} object for chaining */ - public JavaScriptLibrarySettings setWicketAjaxReference(ResourceReference wicketAjaxReference) + public JavaScriptLibrarySettings setWicketAjaxReference(@Nonnull ResourceReference wicketAjaxReference) { this.wicketAjaxReference = Args.notNull(wicketAjaxReference, "wicketAjaxReference"); return this; } -} \ No newline at end of file +} diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/MarkupSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/MarkupSettings.java index dd464fb6cee..65148594fec 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/MarkupSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/MarkupSettings.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.settings; +import jakarta.annotation.Nonnull; + import org.apache.wicket.DefaultMarkupIdGenerator; import org.apache.wicket.IMarkupIdGenerator; import org.apache.wicket.markup.MarkupFactory; @@ -213,7 +215,7 @@ public MarkupSettings setDefaultMarkupEncoding(final String encoding) * @param factory * @return {@code this} object for chaining */ - public MarkupSettings setMarkupFactory(final MarkupFactory factory) + public MarkupSettings setMarkupFactory(@Nonnull final MarkupFactory factory) { Args.notNull(factory, "markup factory"); markupFactory = factory; @@ -274,7 +276,7 @@ public IMarkupIdGenerator getMarkupIdGenerator() * The generator of markup ids for the components * @return {@code this} object for chaining */ - public MarkupSettings setMarkupIdGenerator(IMarkupIdGenerator markupIdGenerator) + public MarkupSettings setMarkupIdGenerator(@Nonnull IMarkupIdGenerator markupIdGenerator) { this.markupIdGenerator = Args.notNull(markupIdGenerator, "markupIdGenerator"); return this; diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/RequestCycleSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/RequestCycleSettings.java index b40317b9a18..39a44b5eaba 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/RequestCycleSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/RequestCycleSettings.java @@ -20,6 +20,9 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.response.filter.IResponseFilter; import org.apache.wicket.util.lang.Args; @@ -375,7 +378,7 @@ public RequestCycleSettings setRenderStrategy(RequestCycleSettings.RenderStrateg * The request and response encoding to be used. * @return {@code this} object for chaining */ - public RequestCycleSettings setResponseRequestEncoding(final String encoding) + public RequestCycleSettings setResponseRequestEncoding(@Nonnull final String encoding) { Args.notNull(encoding, "encoding"); this.responseRequestEncoding = encoding; @@ -389,7 +392,7 @@ public RequestCycleSettings setResponseRequestEncoding(final String encoding) * @param timeout * @return {@code this} object for chaining */ - public RequestCycleSettings setTimeout(Duration timeout) + public RequestCycleSettings setTimeout(@Nonnull Duration timeout) { Args.notNull(timeout, "timeout"); this.timeout = timeout; diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/ResourceSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/ResourceSettings.java index b8966c50a8e..39b8921ed65 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/ResourceSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/ResourceSettings.java @@ -22,6 +22,8 @@ import java.util.List; import java.util.Map; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.Component; import org.apache.wicket.IResourceFactory; @@ -419,7 +421,7 @@ public ResourceSettings setLocalizer(final Localizer localizer) * The package resource guard * @return {@code this} object for chaining */ - public ResourceSettings setPackageResourceGuard(IPackageResourceGuard packageResourceGuard) + public ResourceSettings setPackageResourceGuard(@Nonnull IPackageResourceGuard packageResourceGuard) { this.packageResourceGuard = Args.notNull(packageResourceGuard, "packageResourceGuard"); return this; @@ -447,7 +449,7 @@ public ResourceSettings setPropertiesFactory(org.apache.wicket.resource.IPropert * The resourceFinders to set * @return {@code this} object for chaining */ - public ResourceSettings setResourceFinders(final List resourceFinders) + public ResourceSettings setResourceFinders(@Nonnull final List resourceFinders) { Args.notNull(resourceFinders, "resourceFinders"); this.resourceFinders = resourceFinders; @@ -539,7 +541,7 @@ public final Duration getDefaultCacheDuration() * @see org.apache.wicket.request.http.WebResponse#MAX_CACHE_DURATION * @return {@code this} object for chaining */ - public final ResourceSettings setDefaultCacheDuration(Duration duration) + public final ResourceSettings setDefaultCacheDuration(@Nonnull Duration duration) { Args.notNull(duration, "duration"); defaultCacheDuration = duration; diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/SecuritySettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/SecuritySettings.java index 1c55aadadff..7f09a2bba18 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/SecuritySettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/SecuritySettings.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.settings; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.Component; import org.apache.wicket.authentication.IAuthenticationStrategy; @@ -171,7 +173,7 @@ public IUnauthorizedComponentInstantiationListener getUnauthorizedComponentInsta * new authorization strategy * @return {@code this} object for chaining */ - public SecuritySettings setAuthorizationStrategy(IAuthorizationStrategy strategy) + public SecuritySettings setAuthorizationStrategy(@Nonnull IAuthorizationStrategy strategy) { Args.notNull(strategy, "strategy"); authorizationStrategy = strategy; @@ -185,7 +187,7 @@ public SecuritySettings setAuthorizationStrategy(IAuthorizationStrategy strategy * @param cryptFactory * @return {@code this} object for chaining */ - public SecuritySettings setCryptFactory(ICryptFactory cryptFactory) + public SecuritySettings setCryptFactory(@Nonnull ICryptFactory cryptFactory) { Args.notNull(cryptFactory, "cryptFactory"); this.cryptFactory = cryptFactory; @@ -201,7 +203,7 @@ public SecuritySettings setCryptFactory(ICryptFactory cryptFactory) * The new supplier, must not be null. * @return {@code this} object for chaining */ - public SecuritySettings setRandomSupplier(ISecureRandomSupplier randomSupplier) + public SecuritySettings setRandomSupplier(@Nonnull ISecureRandomSupplier randomSupplier) { Args.notNull(randomSupplier, "randomSupplier"); this.randomSupplier = randomSupplier; diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/StoreSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/StoreSettings.java index a6ab0cb5aab..e2d90e8cf17 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/StoreSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/StoreSettings.java @@ -20,6 +20,8 @@ import java.io.IOException; import java.util.function.Supplier; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.pageStore.crypt.DefaultCrypter; @@ -85,7 +87,7 @@ public Bytes getMaxSizePerSession() * bytes. * @return {@code this} object for chaining */ - public StoreSettings setMaxSizePerSession(final Bytes maxSizePerSession) + public StoreSettings setMaxSizePerSession(@Nonnull final Bytes maxSizePerSession) { this.maxSizePerSession = Args.notNull(maxSizePerSession, "maxSizePerSession"); return this; @@ -130,7 +132,7 @@ public File getFileStoreFolder() * the new location * @return {@code this} object for chaining */ - public StoreSettings setFileStoreFolder(final File fileStoreFolder) + public StoreSettings setFileStoreFolder(@Nonnull final File fileStoreFolder) { this.fileStoreFolder = Args.notNull(fileStoreFolder, "fileStoreFolder"); return this; diff --git a/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java b/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java index a4b16f78097..e2be10f24a3 100644 --- a/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java +++ b/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java @@ -20,6 +20,7 @@ import java.time.LocalDateTime; import java.time.ZoneId; +import jakarta.annotation.Nonnull; import jakarta.servlet.ServletContext; import jakarta.servlet.http.Cookie; import org.apache.wicket.markup.html.form.FormComponent; @@ -354,7 +355,7 @@ protected void initializeCookie(final Cookie cookie) * @param attributeValue * The value of the attribute */ - public static void setAttribute(final Cookie cookie, String attributeName, String attributeValue) + public static void setAttribute(final Cookie cookie, @Nonnull String attributeName, String attributeValue) { Args.notEmpty(attributeName, "attributeName"); diff --git a/wicket-core/src/main/java/org/apache/wicket/util/template/TextTemplateDecorator.java b/wicket-core/src/main/java/org/apache/wicket/util/template/TextTemplateDecorator.java index 053d38785f7..c9213bedc90 100644 --- a/wicket-core/src/main/java/org/apache/wicket/util/template/TextTemplateDecorator.java +++ b/wicket-core/src/main/java/org/apache/wicket/util/template/TextTemplateDecorator.java @@ -23,6 +23,9 @@ import java.util.Collections; import java.util.Locale; import java.util.Map; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.resource.ResourceStreamNotFoundException; @@ -49,7 +52,7 @@ public abstract class TextTemplateDecorator extends TextTemplate * @param textTemplate * a TextTemplate to decorate */ - public TextTemplateDecorator(TextTemplate textTemplate) + public TextTemplateDecorator(@Nonnull TextTemplate textTemplate) { Args.notNull(textTemplate, "textTemplate"); diff --git a/wicket-core/src/main/java/org/apache/wicket/validation/CompoundValidator.java b/wicket-core/src/main/java/org/apache/wicket/validation/CompoundValidator.java index 7dcada88d4b..d35927fdd24 100644 --- a/wicket-core/src/main/java/org/apache/wicket/validation/CompoundValidator.java +++ b/wicket-core/src/main/java/org/apache/wicket/validation/CompoundValidator.java @@ -21,6 +21,8 @@ import java.util.Iterator; import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.behavior.Behavior; import org.apache.wicket.event.IEvent; @@ -57,7 +59,7 @@ public CompoundValidator() * an IValidator to be added * @return this ValidationError for chaining purposes */ - public final CompoundValidator add(IValidator validator) + public final CompoundValidator add(@Nonnull IValidator validator) { Args.notNull(validator, "validator"); @@ -109,7 +111,7 @@ public void afterRender(Component component) } @Override - public void bind(Component component) + public void bind(@Nonnull Component component) { for (IValidator validator : validators) { if (validator instanceof Behavior) { diff --git a/wicket-core/src/main/java/org/apache/wicket/validation/RawValidationError.java b/wicket-core/src/main/java/org/apache/wicket/validation/RawValidationError.java index 7b0b4e54e72..5561dd95cc4 100644 --- a/wicket-core/src/main/java/org/apache/wicket/validation/RawValidationError.java +++ b/wicket-core/src/main/java/org/apache/wicket/validation/RawValidationError.java @@ -18,6 +18,8 @@ import java.io.Serializable; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; /** @@ -40,7 +42,7 @@ public class RawValidationError implements IValidationError * @param errorMessage * the custom error message that will be rendered by a custom FeedbackPanel */ - public RawValidationError(final Serializable errorMessage) + public RawValidationError(@Nonnull final Serializable errorMessage) { this.errorMessage = Args.notNull(errorMessage, "errorMessage"); } diff --git a/wicket-core/src/main/java/org/apache/wicket/validation/ValidationError.java b/wicket-core/src/main/java/org/apache/wicket/validation/ValidationError.java index 255215acd6b..004b43e5796 100644 --- a/wicket-core/src/main/java/org/apache/wicket/validation/ValidationError.java +++ b/wicket-core/src/main/java/org/apache/wicket/validation/ValidationError.java @@ -24,6 +24,8 @@ import java.util.Map; import java.util.Map.Entry; +import jakarta.annotation.Nonnull; + import org.apache.wicket.markup.html.form.ValidationErrorFeedback; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.lang.Classes; @@ -115,7 +117,7 @@ public ValidationError(String message) * a message key to be added * @return this ValidationError for chaining purposes */ - public ValidationError addKey(String key) + public ValidationError addKey(@Nonnull String key) { Args.notEmpty(key, "key"); @@ -135,7 +137,7 @@ public ValidationError addKey(String key) * validator * @return {@code this} */ - public ValidationError addKey(IValidator validator) + public ValidationError addKey(@Nonnull IValidator validator) { Args.notNull(validator, "validator"); addKey(Classes.simpleName(validator.getClass())); @@ -155,7 +157,7 @@ public ValidationError addKey(IValidator validator) * key variation * @return {@code this} */ - public ValidationError addKey(IValidator validator, String variation) + public ValidationError addKey(@Nonnull IValidator validator, String variation) { Args.notNull(validator, "validator"); String key = Classes.simpleName(validator.getClass()); @@ -176,7 +178,7 @@ public ValidationError addKey(IValidator validator, String variation) * a variable value * @return this ValidationError for chaining purposes */ - public ValidationError setVariable(String name, Object value) + public ValidationError setVariable(@Nonnull String name, Object value) { Args.notEmpty(name, "name"); @@ -206,7 +208,7 @@ public final Map getVariables() * a variables map * @return this ValidationError for chaining purposes */ - public final ValidationError setVariables(Map vars) + public final ValidationError setVariables(@Nonnull Map vars) { Args.notNull(vars, "vars"); @@ -264,7 +266,7 @@ public final String getMessage() * * @return this ValidationError for chaining purposes */ - public final ValidationError setMessage(String message) + public final ValidationError setMessage(@Nonnull String message) { Args.notNull(message, "message"); diff --git a/wicket-core/src/main/java/org/apache/wicket/validation/ValidatorAdapter.java b/wicket-core/src/main/java/org/apache/wicket/validation/ValidatorAdapter.java index 0c20e5e79e9..216aad64ae0 100644 --- a/wicket-core/src/main/java/org/apache/wicket/validation/ValidatorAdapter.java +++ b/wicket-core/src/main/java/org/apache/wicket/validation/ValidatorAdapter.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.validation; +import jakarta.annotation.Nonnull; + import org.apache.wicket.behavior.Behavior; import org.apache.wicket.util.lang.Args; @@ -38,7 +40,7 @@ public class ValidatorAdapter extends Behavior implements IValidator * @param validator * validator to be adapted */ - public ValidatorAdapter(IValidator validator) + public ValidatorAdapter(@Nonnull IValidator validator) { Args.notNull(validator, "validator"); diff --git a/wicket-devutils/pom.xml b/wicket-devutils/pom.xml index b34a6b8d4e5..b3ff1a81782 100644 --- a/wicket-devutils/pom.xml +++ b/wicket-devutils/pom.xml @@ -36,6 +36,10 @@ !java*,!kotlin*,!sun.nio.ch,org.slf4j*;version="[1.7,3)",* + + jakarta.annotation + jakarta.annotation-api + org.apache.wicket wicket-core diff --git a/wicket-devutils/src/main/java/module-info.java b/wicket-devutils/src/main/java/module-info.java index b28d5c9cdeb..bcd299c4920 100644 --- a/wicket-devutils/src/main/java/module-info.java +++ b/wicket-devutils/src/main/java/module-info.java @@ -21,6 +21,7 @@ requires org.apache.wicket.core; requires org.apache.wicket.extensions; requires org.slf4j; + requires jakarta.annotation; provides org.apache.wicket.IInitializer with org.apache.wicket.devutils.debugbar.DebugBarInitializer; diff --git a/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/DebugBar.java b/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/DebugBar.java index 8a7bfaaadb4..e7372109eb9 100644 --- a/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/DebugBar.java +++ b/wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/DebugBar.java @@ -19,6 +19,8 @@ import java.util.ArrayList; import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.AttributeModifier; import org.apache.wicket.Component; @@ -207,7 +209,7 @@ public static void registerContributor(final IDebugBarContributor contrib) * @param contrib * custom contributor - can not be null */ - public static void registerContributor(final IDebugBarContributor contrib, + public static void registerContributor(@Nonnull final IDebugBarContributor contrib, final Application application) { Args.notNull(contrib, "contrib"); @@ -223,7 +225,7 @@ public static List getContributors(final Application appli return list == null ? new ArrayList() : list; } - public static void setContributors(List contributors, Application application) + public static void setContributors(List contributors, @Nonnull Application application) { Args.notNull(application, "application"); diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/upload/UploadToResourcePage.java b/wicket-examples/src/main/java/org/apache/wicket/examples/upload/UploadToResourcePage.java index 0f5f0413b30..9586a70df72 100644 --- a/wicket-examples/src/main/java/org/apache/wicket/examples/upload/UploadToResourcePage.java +++ b/wicket-examples/src/main/java/org/apache/wicket/examples/upload/UploadToResourcePage.java @@ -17,6 +17,9 @@ package org.apache.wicket.examples.upload; import java.util.List; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.markup.html.AjaxLink; @@ -50,7 +53,7 @@ private static class UpdateInEachAjaxRequestBehavior extends Behavior { @Override - public void bind(Component component) + public void bind(@Nonnull Component component) { component.setOutputMarkupPlaceholderTag(true); } diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/wizard/WizardPage.java b/wicket-examples/src/main/java/org/apache/wicket/examples/wizard/WizardPage.java index ab568b1b229..800d8ce418b 100644 --- a/wicket-examples/src/main/java/org/apache/wicket/examples/wizard/WizardPage.java +++ b/wicket-examples/src/main/java/org/apache/wicket/examples/wizard/WizardPage.java @@ -18,6 +18,8 @@ import java.lang.reflect.Constructor; +import jakarta.annotation.Nonnull; + import org.apache.wicket.examples.WicketExamplePage; import org.apache.wicket.extensions.wizard.Wizard; import org.apache.wicket.markup.head.CssHeaderItem; @@ -41,7 +43,7 @@ public class WizardPage extends WicketExamplePage * @param wizardClass * class of the wizard component */ - public WizardPage(Class wizardClass) + public WizardPage(@Nonnull Class wizardClass) { Args.notNull(wizardClass, "wizardClass"); try diff --git a/wicket-extensions/pom.xml b/wicket-extensions/pom.xml index abdb420a2cb..4be47c7ae27 100644 --- a/wicket-extensions/pom.xml +++ b/wicket-extensions/pom.xml @@ -75,6 +75,10 @@ org.apache.wicket.extensions.wizard.dynamic;-noimport:=true !java*,!kotlin*,!sun.nio.ch,org.slf4j*;version="[1.7,3)",* + + jakarta.annotation + jakarta.annotation-api + com.fasterxml.jackson.core jackson-databind diff --git a/wicket-extensions/src/main/java/module-info.java b/wicket-extensions/src/main/java/module-info.java index 5b90e73de6f..ffb52895ac1 100644 --- a/wicket-extensions/src/main/java/module-info.java +++ b/wicket-extensions/src/main/java/module-info.java @@ -26,6 +26,7 @@ requires org.apache.wicket.request; requires org.apache.wicket.core; requires org.danekja.jdk.serializable.functional; + requires jakarta.annotation; provides org.apache.wicket.IInitializer with org.apache.wicket.extensions.Initializer; diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/AjaxDownloadBehavior.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/AjaxDownloadBehavior.java index 1397db3eec3..4d70c83f2ca 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/AjaxDownloadBehavior.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/AjaxDownloadBehavior.java @@ -17,7 +17,11 @@ package org.apache.wicket.extensions.ajax; import java.util.Locale; + +import jakarta.annotation.Nonnull; import jakarta.servlet.http.Cookie; + +import com.github.openjson.JSONObject; import org.apache.wicket.Component; import org.apache.wicket.IRequestListener; import org.apache.wicket.WicketRuntimeException; @@ -42,8 +46,6 @@ import org.apache.wicket.util.cookies.CookieUtils; import org.apache.wicket.util.lang.Args; -import com.github.openjson.JSONObject; - /** * Download resources via Ajax. *

@@ -136,7 +138,7 @@ public enum Location { * @param resource * resource to download */ - public AjaxDownloadBehavior(IResource resource) + public AjaxDownloadBehavior(@Nonnull IResource resource) { Args.notNull(resource, "resource"); this.resourceBehavior = new ResourceBehavior(resource); @@ -170,7 +172,7 @@ public AjaxDownloadBehavior(ResourceReference reference) * @param resourceParameters * parameters for the resource */ - public AjaxDownloadBehavior(ResourceReference reference, PageParameters resourceParameters) + public AjaxDownloadBehavior(@Nonnull ResourceReference reference, PageParameters resourceParameters) { this.resourceBehavior = null; @@ -338,7 +340,7 @@ public Location getLocation() { return location; } - public AjaxDownloadBehavior setLocation(final Location location) { + public AjaxDownloadBehavior setLocation(@Nonnull final Location location) { this.location = Args.notNull(location, "location"); return this; } @@ -360,7 +362,7 @@ private class ResourceBehavior extends Behavior implements IRequestListener private static final long serialVersionUID = 1L; private final IResource resource; - private ResourceBehavior(IResource resource) + private ResourceBehavior(@Nonnull IResource resource) { this.resource = Args.notNull(resource, "resource"); } @@ -450,7 +452,7 @@ public CookieDefaults.SameSite getSameSite() * * @param sameSite The non-null sameSite attribute */ - public void setSameSite(CookieDefaults.SameSite sameSite) + public void setSameSite(@Nonnull CookieDefaults.SameSite sameSite) { Args.notNull(sameSite, "sameSite"); this.sameSite = sameSite; diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/AjaxFileDropBehavior.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/AjaxFileDropBehavior.java index b8a76b0020a..386a126946a 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/AjaxFileDropBehavior.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/AjaxFileDropBehavior.java @@ -19,6 +19,8 @@ import java.util.ArrayList; import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.commons.fileupload2.core.FileItem; import org.apache.commons.fileupload2.core.FileUploadException; import org.apache.wicket.Component; @@ -165,7 +167,7 @@ public Bytes getMaxSize() * * @param maxSize maximum size, must not be null */ - public void setMaxSize(Bytes maxSize) + public void setMaxSize(@Nonnull Bytes maxSize) { Args.notNull(maxSize, "maxSize"); this.maxSize = maxSize; diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxIndicatorAppender.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxIndicatorAppender.java index 3a5c2e5773c..66f4185e8af 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxIndicatorAppender.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/AjaxIndicatorAppender.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.extensions.ajax.markup.html; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior; import org.apache.wicket.ajax.IAjaxIndicatorAware; @@ -133,7 +135,7 @@ public String getMarkupId() } @Override - public final void bind(final Component component) + public final void bind(@Nonnull final Component component) { this.component = component; } diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java index 6c2ee5d283d..762afe16e4d 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxButton.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.extensions.ajax.markup.html; +import jakarta.annotation.Nonnull; + import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.IAjaxIndicatorAware; import org.apache.wicket.ajax.markup.html.form.AjaxButton; @@ -97,7 +99,7 @@ public String getAjaxIndicatorMarkupId() public static IndicatingAjaxButton onSubmit(String id, - SerializableBiConsumer onSubmit) + @Nonnull SerializableBiConsumer onSubmit) { Args.notNull(onSubmit, "onSubmit"); @@ -110,4 +112,4 @@ public void onSubmit(AjaxRequestTarget target) } }; } -} \ No newline at end of file +} diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxLink.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxLink.java index 02aa57e693e..fc89495d08f 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxLink.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/IndicatingAjaxLink.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.extensions.ajax.markup.html; +import jakarta.annotation.Nonnull; + import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.ajax.IAjaxIndicatorAware; import org.apache.wicket.ajax.markup.html.AjaxLink; @@ -68,7 +70,7 @@ public String getAjaxIndicatorMarkupId() public static IndicatingAjaxLink onClick(String id, - SerializableBiConsumer, AjaxRequestTarget> onClick) + @Nonnull SerializableBiConsumer, AjaxRequestTarget> onClick) { Args.notNull(onClick, "onClick"); diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteBehavior.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteBehavior.java index a5a1b7fdd3e..f508d3c0da6 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteBehavior.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/autocomplete/AutoCompleteBehavior.java @@ -18,6 +18,8 @@ import java.util.Iterator; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.AttributeModifier; import org.apache.wicket.Component; @@ -79,7 +81,7 @@ public AutoCompleteBehavior(final IAutoCompleteRenderer renderer, final boole * @param settings * settings for the autocomplete list */ - public AutoCompleteBehavior(final IAutoCompleteRenderer renderer, + public AutoCompleteBehavior(@Nonnull final IAutoCompleteRenderer renderer, final AutoCompleteSettings settings) { super(settings); diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/form/upload/UploadProgressBar.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/form/upload/UploadProgressBar.java index 52e4d29a553..8d165e26fae 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/form/upload/UploadProgressBar.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/form/upload/UploadProgressBar.java @@ -18,6 +18,8 @@ import java.util.Formatter; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.IInitializer; import org.apache.wicket.MarkupContainer; @@ -167,7 +169,7 @@ public UploadProgressBar(final String id, final Form form) * the file upload field to check for a file upload, or null to display the upload * field for every submit of the given form */ - public UploadProgressBar(final String id, final Form form, final FileUploadField uploadField) + public UploadProgressBar(final String id, @Nonnull final Form form, final FileUploadField uploadField) { super(id); diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/BreadCrumbModelListenerSupport.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/BreadCrumbModelListenerSupport.java index 6bd82d8a25b..587a1548174 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/BreadCrumbModelListenerSupport.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/BreadCrumbModelListenerSupport.java @@ -19,6 +19,8 @@ import java.util.ArrayList; import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.io.IClusterable; import org.apache.wicket.util.lang.Args; @@ -42,7 +44,7 @@ public final class BreadCrumbModelListenerSupport implements IClusterable * @param listener * The listener to add */ - public final void addListener(final IBreadCrumbModelListener listener) + public final void addListener(@Nonnull final IBreadCrumbModelListener listener) { Args.notNull(listener, "listener"); listeners.add(listener); diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelFactory.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelFactory.java index d743618d4b2..e7414915154 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelFactory.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelFactory.java @@ -18,6 +18,8 @@ import java.lang.reflect.Constructor; +import jakarta.annotation.Nonnull; + import org.apache.wicket.extensions.breadcrumb.IBreadCrumbModel; import org.apache.wicket.util.lang.Args; @@ -43,7 +45,7 @@ public final class BreadCrumbPanelFactory implements IBreadCrumbPanelFactory * and must have constructor * {@link BreadCrumbPanel#BreadCrumbPanel(String, IBreadCrumbModel)} */ - public BreadCrumbPanelFactory(final Class panelClass) + public BreadCrumbPanelFactory(@Nonnull final Class panelClass) { Args.notNull(panelClass, "panelClass"); diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelLink.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelLink.java index f0fb9b97079..3fab66333c1 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelLink.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanelLink.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.extensions.breadcrumb.panel; +import jakarta.annotation.Nonnull; + import org.apache.wicket.extensions.breadcrumb.BreadCrumbLink; import org.apache.wicket.extensions.breadcrumb.IBreadCrumbModel; import org.apache.wicket.extensions.breadcrumb.IBreadCrumbParticipant; @@ -84,8 +86,8 @@ public BreadCrumbPanelLink(final String id, final IBreadCrumbModel breadCrumbMod * @param breadCrumbPanelFactory * The factory to create bread crumb panels */ - public BreadCrumbPanelLink(final String id, final IBreadCrumbModel breadCrumbModel, - final IBreadCrumbPanelFactory breadCrumbPanelFactory) + public BreadCrumbPanelLink(final String id, @Nonnull final IBreadCrumbModel breadCrumbModel, + @Nonnull final IBreadCrumbPanelFactory breadCrumbPanelFactory) { super(id, breadCrumbModel); diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/datetime/ZonedToLocalDateTimeModel.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/datetime/ZonedToLocalDateTimeModel.java index e4b27dedd09..6d461d3e891 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/datetime/ZonedToLocalDateTimeModel.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/datetime/ZonedToLocalDateTimeModel.java @@ -21,6 +21,8 @@ import java.time.ZonedDateTime; import java.util.TimeZone; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Session; import org.apache.wicket.core.request.ClientInfo; import org.apache.wicket.model.IModel; @@ -43,7 +45,7 @@ public class ZonedToLocalDateTimeModel implements IModel * * @param model zoned date time */ - public ZonedToLocalDateTimeModel(IModel model) + public ZonedToLocalDateTimeModel(@Nonnull IModel model) { Args.notNull(model, "model"); @@ -107,4 +109,4 @@ public void setObject(LocalDateTime dateTime) model.setObject(dateTime.atZone(getClientTimeZone()).withZoneSameInstant(getTargetTimeZone())); } } -} \ No newline at end of file +} diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/select/Select.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/select/Select.java index a5eb2bcb0a9..0360de5ee26 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/select/Select.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/form/select/Select.java @@ -21,6 +21,8 @@ import java.util.Collection; import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.form.FormComponent; @@ -247,7 +249,7 @@ public void updateModel() * @param option * @return {@code true} if the option is selected, {@code false} otherwise */ - boolean isSelected(final SelectOption option) + boolean isSelected(@Nonnull final SelectOption option) { Args.notNull(option, "option"); diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/image/resource/ThumbnailImageResource.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/image/resource/ThumbnailImageResource.java index 1f9bb17f53c..719fb873205 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/image/resource/ThumbnailImageResource.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/image/resource/ThumbnailImageResource.java @@ -23,6 +23,9 @@ import java.io.IOException; import java.io.InputStream; import java.time.Instant; + +import jakarta.annotation.Nonnull; + import javax.imageio.ImageIO; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.request.resource.DynamicImageResource; @@ -61,7 +64,7 @@ public class ThumbnailImageResource extends DynamicImageResource * @param maxSize * maximum size (width or height) for resize operation */ - public ThumbnailImageResource(final IResource unscaledImageResource, final int maxSize) + public ThumbnailImageResource(@Nonnull final IResource unscaledImageResource, final int maxSize) { Args.notNull(unscaledImageResource, "unscaledImageResource"); diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/sort/ISortState.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/sort/ISortState.java index c3126af827b..10fe0363de0 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/sort/ISortState.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/sort/ISortState.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.extensions.markup.html.repeater.data.sort; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.io.IClusterable; /** @@ -36,7 +38,7 @@ public interface ISortState extends IClusterable * @param order * sort order */ - void setPropertySortOrder(S property, SortOrder order); + void setPropertySortOrder(@Nonnull S property, @Nonnull SortOrder order); /** * Gets the sort order of a property @@ -45,6 +47,6 @@ public interface ISortState extends IClusterable * sort property to be checked * @return sort order */ - SortOrder getPropertySortOrder(S property); + SortOrder getPropertySortOrder(@Nonnull S property); } diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/sort/OrderByLink.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/sort/OrderByLink.java index 6eaadfe3944..0f715673604 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/sort/OrderByLink.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/sort/OrderByLink.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.extensions.markup.html.repeater.data.sort; +import jakarta.annotation.Nonnull; + import org.apache.wicket.markup.html.link.Link; import org.apache.wicket.util.lang.Args; @@ -52,7 +54,7 @@ public class OrderByLink extends Link * sorted properties * */ - public OrderByLink(final String id, final S property, final ISortStateLocator stateLocator) + public OrderByLink(final String id, @Nonnull final S property, final ISortStateLocator stateLocator) { super(id); @@ -123,4 +125,4 @@ protected SortOrder nextSortOrder(final SortOrder order) return order == SortOrder.ASCENDING ? SortOrder.DESCENDING : SortOrder.ASCENDING; } } -} \ No newline at end of file +} diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/DataTable.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/DataTable.java index 5a05abc6a77..6ce598e896a 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/DataTable.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/DataTable.java @@ -18,6 +18,8 @@ import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.AttributeModifier; import org.apache.wicket.Component; import org.apache.wicket.behavior.Behavior; @@ -141,7 +143,7 @@ public void onComponentTag(final Component component, final ComponentTag tag) * @param rowsPerPage * number of rows per page */ - public DataTable(final String id, final List> columns, + public DataTable(final String id, @Nonnull final List> columns, final IDataProvider dataProvider, final long rowsPerPage) { super(id); @@ -376,7 +378,7 @@ public long getItemCount() return datagrid.getItemCount(); } - private void addToolbar(final AbstractToolbar toolbar, final ToolbarsContainer container) + private void addToolbar(@Nonnull final AbstractToolbar toolbar, final ToolbarsContainer container) { Args.notNull(toolbar, "toolbar"); diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/LambdaColumn.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/LambdaColumn.java index d1ffab57f52..5cd070c4c2e 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/LambdaColumn.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/LambdaColumn.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.extensions.markup.html.repeater.data.table; +import jakarta.annotation.Nonnull; + import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator; import org.apache.wicket.extensions.markup.html.repeater.data.table.export.IExportableColumn; import org.apache.wicket.markup.html.basic.Label; @@ -73,7 +75,7 @@ public LambdaColumn(final IModel displayModel, * Wicket function to be applied to each row */ public LambdaColumn(final IModel displayModel, final S sortProperty, - final SerializableFunction function) + @Nonnull final SerializableFunction function) { super(displayModel, sortProperty); diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/export/CSVDataExporter.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/export/CSVDataExporter.java index c189178a545..ae528bfb15d 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/export/CSVDataExporter.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/export/CSVDataExporter.java @@ -25,6 +25,8 @@ import java.util.Iterator; import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.IConverterLocator; import org.apache.wicket.Session; @@ -100,7 +102,7 @@ public String getCharacterSet() * The character set encoding to be used when exporting data. * @return {@code this}, for chaining. */ - public CSVDataExporter setCharacterSet(String characterSet) + public CSVDataExporter setCharacterSet(@Nonnull String characterSet) { this.characterSet = Args.notNull(characterSet, "characterSer"); return this; diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/export/ExportToolbar.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/export/ExportToolbar.java index 765cd6bdaf4..2628712fe70 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/export/ExportToolbar.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/export/ExportToolbar.java @@ -21,6 +21,9 @@ import java.time.Duration; import java.util.LinkedList; import java.util.List; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.AttributeModifier; import org.apache.wicket.Component; import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractToolbar; @@ -114,7 +117,7 @@ public ExportToolbar(DataTable table, IModel messageModel, IModel< * the models of the export message displayed in the toolbar. * @return {@code this}, for chaining. */ - public ExportToolbar setMessageModel(IModel messageModel) + public ExportToolbar setMessageModel(@Nonnull IModel messageModel) { this.messageModel = wrap(Args.notNull(messageModel, "messageModel")); return this; @@ -127,7 +130,7 @@ public ExportToolbar setMessageModel(IModel messageModel) * The model of the file name used for the exported data. * @return {@code this}, for chaining. */ - public ExportToolbar setFileNameModel(IModel fileNameModel) + public ExportToolbar setFileNameModel(@Nonnull IModel fileNameModel) { this.fileNameModel = wrap(Args.notNull(fileNameModel, "fileNameModel")); return this; @@ -287,7 +290,7 @@ protected void onDetach() * The {@link IDataExporter} to add to the toolbar. * @return {@code this}, for chaining. */ - public ExportToolbar addDataExporter(IDataExporter exporter) + public ExportToolbar addDataExporter(@Nonnull IDataExporter exporter) { Args.notNull(exporter, "exporter"); dataExporters.add(exporter); diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterForm.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterForm.java index a3099c74556..f5b9836e40a 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterForm.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterForm.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.extensions.markup.html.repeater.data.table.filter; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.behavior.Behavior; import org.apache.wicket.markup.ComponentTag; @@ -134,7 +136,7 @@ public final void enableFocusTracking(final FormComponent fc) private static final long serialVersionUID = 1L; @Override - public void bind(Component component) + public void bind(@Nonnull Component component) { super.bind(component); component.setOutputMarkupId(true); diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterToolbar.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterToolbar.java index 74d30ef495a..88848c2b7c5 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterToolbar.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/FilterToolbar.java @@ -19,6 +19,8 @@ import java.util.LinkedList; import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.behavior.Behavior; import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractToolbar; @@ -59,7 +61,7 @@ public class FilterToolbar extends AbstractToolbar * the type of filter state object * */ - public FilterToolbar(final DataTable table, final FilterForm form) + public FilterToolbar(@Nonnull final DataTable table, final FilterForm form) { super(table); diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/util/SingleSortState.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/util/SingleSortState.java index 5039ca72210..70ac9474628 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/util/SingleSortState.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/util/SingleSortState.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.extensions.markup.html.repeater.util; +import jakarta.annotation.Nonnull; + import org.apache.wicket.extensions.markup.html.repeater.data.sort.ISortState; import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder; import org.apache.wicket.util.io.IClusterable; @@ -36,7 +38,7 @@ public class SingleSortState implements ISortState, IClusterable SortParam param; @Override - public void setPropertySortOrder(final T property, final SortOrder order) + public void setPropertySortOrder(@Nonnull final T property, @Nonnull final SortOrder order) { Args.notNull(property, "property"); Args.notNull(order, "order"); @@ -55,7 +57,7 @@ public void setPropertySortOrder(final T property, final SortOrder order) } @Override - public SortOrder getPropertySortOrder(final T property) + public SortOrder getPropertySortOrder(@Nonnull final T property) { Args.notNull(property, "property"); diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/util/SortParam.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/util/SortParam.java index 93b16964794..8ffbaed0864 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/util/SortParam.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/util/SortParam.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.extensions.markup.html.repeater.util; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.io.IClusterable; import org.apache.wicket.util.lang.Args; @@ -40,7 +42,7 @@ public class SortParam implements IClusterable * true if sort order is ascending, false if sort order is * descending */ - public SortParam(final T property, final boolean ascending) + public SortParam(@Nonnull final T property, final boolean ascending) { Args.notNull(property, "property"); this.property = property; diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tabs/TabbedPanel.java b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tabs/TabbedPanel.java index a115cb42aa4..3c36ddc460f 100644 --- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tabs/TabbedPanel.java +++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/tabs/TabbedPanel.java @@ -18,6 +18,8 @@ import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.core.util.string.CssUtils; @@ -116,7 +118,7 @@ public TabbedPanel(final String id, final List tabs) * @param model * model holding the index of the selected tab */ - public TabbedPanel(final String id, final List tabs, IModel model) + public TabbedPanel(final String id, @Nonnull final List tabs, IModel model) { super(id, model); diff --git a/wicket-guice/pom.xml b/wicket-guice/pom.xml index 5db09f63cd2..1c1a5700da3 100644 --- a/wicket-guice/pom.xml +++ b/wicket-guice/pom.xml @@ -56,6 +56,11 @@ org.apache.wicket wicket-ioc + + jakarta.annotation + jakarta.annotation-api + test + org.apache.wicket wicket-tester diff --git a/wicket-guice/src/test/java/org/apache/wicket/guice/JakartaInjectTestBehavior.java b/wicket-guice/src/test/java/org/apache/wicket/guice/JakartaInjectTestBehavior.java index ff810092edc..581fdd3a847 100644 --- a/wicket-guice/src/test/java/org/apache/wicket/guice/JakartaInjectTestBehavior.java +++ b/wicket-guice/src/test/java/org/apache/wicket/guice/JakartaInjectTestBehavior.java @@ -16,13 +16,14 @@ */ package org.apache.wicket.guice; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - import jakarta.inject.Inject; import org.apache.wicket.Component; import org.apache.wicket.behavior.Behavior; +import javax.annotation.Nonnull; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; /** * A behavior that will be use injected services @@ -38,7 +39,7 @@ public class JakartaInjectTestBehavior extends Behavior private ITestService injectedFieldBlue; @Override - public void bind(Component component) + public void bind(@Nonnull Component component) { super.bind(component); diff --git a/wicket-guice/src/test/java/org/apache/wicket/guice/TestBehavior.java b/wicket-guice/src/test/java/org/apache/wicket/guice/TestBehavior.java index 08c8b71fd08..5c2f8ac053c 100644 --- a/wicket-guice/src/test/java/org/apache/wicket/guice/TestBehavior.java +++ b/wicket-guice/src/test/java/org/apache/wicket/guice/TestBehavior.java @@ -38,7 +38,7 @@ public class TestBehavior extends Behavior private ITestService injectedFieldBlue; @Override - public void bind(Component component) + public void bind(@jakarta.annotation.Nonnull Component component) { super.bind(component); diff --git a/wicket-ioc/pom.xml b/wicket-ioc/pom.xml index 889bd2f1e66..8d443247c0a 100644 --- a/wicket-ioc/pom.xml +++ b/wicket-ioc/pom.xml @@ -35,6 +35,10 @@ !java*,!kotlin*,!sun.nio.ch,org.slf4j*;version="[1.7,3)",* + + jakarta.annotation + jakarta.annotation-api + jakarta.inject jakarta.inject-api diff --git a/wicket-ioc/src/main/java/module-info.java b/wicket-ioc/src/main/java/module-info.java index f0ca78b04b1..ac8d4a2b2ca 100644 --- a/wicket-ioc/src/main/java/module-info.java +++ b/wicket-ioc/src/main/java/module-info.java @@ -20,6 +20,7 @@ requires org.apache.wicket.core; requires net.bytebuddy; requires org.objenesis; + requires jakarta.annotation; exports org.apache.wicket.injection; exports org.apache.wicket.proxy; diff --git a/wicket-ioc/src/main/java/org/apache/wicket/injection/CompoundFieldValueFactory.java b/wicket-ioc/src/main/java/org/apache/wicket/injection/CompoundFieldValueFactory.java index b32eb05106c..8e120139a7e 100644 --- a/wicket-ioc/src/main/java/org/apache/wicket/injection/CompoundFieldValueFactory.java +++ b/wicket-ioc/src/main/java/org/apache/wicket/injection/CompoundFieldValueFactory.java @@ -21,6 +21,8 @@ import java.util.Arrays; import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; /** @@ -42,7 +44,7 @@ public class CompoundFieldValueFactory implements IFieldValueFactory * * @param factories */ - public CompoundFieldValueFactory(final IFieldValueFactory[] factories) + public CompoundFieldValueFactory(@Nonnull final IFieldValueFactory[] factories) { Args.notNull(factories, "factories"); @@ -54,7 +56,7 @@ public CompoundFieldValueFactory(final IFieldValueFactory[] factories) * * @param factories */ - public CompoundFieldValueFactory(final List factories) + public CompoundFieldValueFactory(@Nonnull final List factories) { Args.notNull(factories, "factories"); @@ -67,7 +69,7 @@ public CompoundFieldValueFactory(final List factories) * @param f1 * @param f2 */ - public CompoundFieldValueFactory(final IFieldValueFactory f1, final IFieldValueFactory f2) + public CompoundFieldValueFactory(@Nonnull final IFieldValueFactory f1, @Nonnull final IFieldValueFactory f2) { Args.notNull(f1, "f1"); Args.notNull(f2, "f2"); @@ -81,7 +83,7 @@ public CompoundFieldValueFactory(final IFieldValueFactory f1, final IFieldValueF * * @param factory */ - public void addFactory(final IFieldValueFactory factory) + public void addFactory(@Nonnull final IFieldValueFactory factory) { Args.notNull(factory, "factory"); diff --git a/wicket-native-websocket/wicket-native-websocket-core/pom.xml b/wicket-native-websocket/wicket-native-websocket-core/pom.xml index 191619c2063..fb5b87cb825 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/pom.xml +++ b/wicket-native-websocket/wicket-native-websocket-core/pom.xml @@ -34,6 +34,10 @@ !java*,!kotlin*,!sun.nio.ch,org.slf4j*;version="[1.7,3)",* + + jakarta.annotation + jakarta.annotation-api + org.apache.wicket wicket-core diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/module-info.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/module-info.java index 56535e2f98a..0ebf1c38e1d 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/module-info.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/module-info.java @@ -21,6 +21,7 @@ requires org.apache.wicket.core; requires static jakarta.servlet; requires org.slf4j; + requires jakarta.annotation; exports org.apache.wicket.protocol.ws; exports org.apache.wicket.protocol.ws.api; diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java index eccf2593270..7c7ccfaa6f8 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/WebSocketSettings.java @@ -16,6 +16,16 @@ */ package org.apache.wicket.protocol.ws; +import java.util.concurrent.SynchronousQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Function; + +import jakarta.annotation.Nonnull; +import jakarta.servlet.http.HttpServletRequest; + import org.apache.wicket.Application; import org.apache.wicket.MetaDataKey; import org.apache.wicket.Page; @@ -40,14 +50,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import jakarta.servlet.http.HttpServletRequest; -import java.util.concurrent.SynchronousQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Function; - /** * Web Socket related settings. * @@ -205,7 +207,7 @@ public void setNotifyOnErrorEvent(Function notifyOnErrorEven * @param executor * The executor used for processing push messages. */ - public WebSocketSettings setWebSocketPushMessageExecutor(Executor executor) + public WebSocketSettings setWebSocketPushMessageExecutor(@Nonnull Executor executor) { Args.notNull(executor, "executor"); this.webSocketPushMessageExecutor = executor; @@ -235,7 +237,7 @@ public IWebSocketConnectionRegistry getConnectionRegistry() * The registry that tracks all currently connected WebSocket clients * @return {@code this}, for method chaining */ - public WebSocketSettings setConnectionRegistry(IWebSocketConnectionRegistry connectionRegistry) + public WebSocketSettings setConnectionRegistry(@Nonnull IWebSocketConnectionRegistry connectionRegistry) { Args.notNull(connectionRegistry, "connectionRegistry"); this.connectionRegistry = connectionRegistry; @@ -252,7 +254,7 @@ public WebSocketSettings setConnectionRegistry(IWebSocketConnectionRegistry conn * {@link org.apache.wicket.protocol.ws.api.WebSocketBehavior}s and * {@link org.apache.wicket.protocol.ws.api.WebSocketResource}s. */ - public WebSocketSettings setSendPayloadExecutor(Executor sendPayloadExecutor) + public WebSocketSettings setSendPayloadExecutor(@Nonnull Executor sendPayloadExecutor) { Args.notNull(sendPayloadExecutor, "sendPayloadExecutor"); this.sendPayloadExecutor = sendPayloadExecutor; @@ -277,7 +279,7 @@ public Executor getSendPayloadExecutor() * Sets the IWebSocketSessionConfigurer * @param socketSessionConfigurer A non-null {@link org.apache.wicket.protocol.ws.api.IWebSocketSessionConfigurer} */ - public void setSocketSessionConfigurer(IWebSocketSessionConfigurer socketSessionConfigurer) { + public void setSocketSessionConfigurer(@Nonnull IWebSocketSessionConfigurer socketSessionConfigurer) { Args.notNull(socketSessionConfigurer, "socketSessionConfigurer"); this.socketSessionConfigurer = socketSessionConfigurer; } diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketConnection.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketConnection.java index 1b6154a93df..79d4f9e795f 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketConnection.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketConnection.java @@ -23,6 +23,8 @@ import java.util.concurrent.Future; +import jakarta.annotation.Nonnull; + /** * Abstract class handling the Web Socket broadcast messages. */ @@ -41,7 +43,7 @@ public abstract class AbstractWebSocketConnection implements IWebSocketConnectio * @param webSocketProcessor * the web socket processor to delegate to */ - public AbstractWebSocketConnection(AbstractWebSocketProcessor webSocketProcessor) + public AbstractWebSocketConnection(@Nonnull AbstractWebSocketProcessor webSocketProcessor) { this.applicationName = webSocketProcessor.getApplication().getName(); this.sessionId = webSocketProcessor.getSessionId(); diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java index c9fa0fb4ba3..724eca3bab0 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/AbstractWebSocketProcessor.java @@ -16,6 +16,7 @@ */ package org.apache.wicket.protocol.ws.api; +import jakarta.annotation.Nonnull; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpSession; @@ -103,7 +104,7 @@ public abstract class AbstractWebSocketProcessor implements IWebSocketProcessor * @param application * the current Wicket Application */ - public AbstractWebSocketProcessor(final HttpServletRequest request, final WebApplication application) + public AbstractWebSocketProcessor(final HttpServletRequest request, @Nonnull final WebApplication application) { final HttpSession httpSession = request.getSession(true); if (httpSession == null) diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/BaseWebSocketBehavior.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/BaseWebSocketBehavior.java index 4e37f54732e..a1689035807 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/BaseWebSocketBehavior.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/BaseWebSocketBehavior.java @@ -19,6 +19,7 @@ import java.util.Map; import java.util.Set; +import jakarta.annotation.Nonnull; import jakarta.servlet.SessionTrackingMode; import jakarta.servlet.http.Cookie; import jakarta.servlet.http.HttpServletRequest; @@ -94,7 +95,7 @@ public BaseWebSocketBehavior(String resourceName) * @param connectionToken * an optional token to support connections to the same resource from multiple browser tabs */ - public BaseWebSocketBehavior(String resourceName, String connectionToken) + public BaseWebSocketBehavior(@Nonnull String resourceName, String connectionToken) { this.resourceName = Args.notEmpty(resourceName, "resourceName"); this.connectionToken = connectionToken; diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/IWebSocketRequestHandler.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/IWebSocketRequestHandler.java index eae4504d046..dce8f2c76e0 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/IWebSocketRequestHandler.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/IWebSocketRequestHandler.java @@ -21,6 +21,8 @@ import java.util.concurrent.Future; +import jakarta.annotation.Nonnull; + /** * An interface for outbound communication with web socket clients * @@ -34,7 +36,7 @@ public interface IWebSocketRequestHandler extends IPartialPageRequestHandler, IL * @param message * the text message to push to the client if the web socket connection is open */ - void push(CharSequence message); + void push(@Nonnull CharSequence message); /** * Pushes a text message to the client in an asynchronous way. @@ -56,7 +58,7 @@ public interface IWebSocketRequestHandler extends IPartialPageRequestHandler, IL * @return * a {@link java.util.concurrent.Future} representing the send operation. Or null if connection is closed. */ - Future pushAsync(CharSequence message, long timeout); + Future pushAsync(@Nonnull CharSequence message, long timeout); /** * Pushes a binary message to the client. @@ -68,7 +70,7 @@ public interface IWebSocketRequestHandler extends IPartialPageRequestHandler, IL * @param length * how many bytes to read from the message */ - void push(byte[] message, int offset, int length); + void push(@Nonnull byte[] message, int offset, int length); /** * Pushes a binary message to the client. @@ -82,7 +84,7 @@ public interface IWebSocketRequestHandler extends IPartialPageRequestHandler, IL * @return * a {@link java.util.concurrent.Future} representing the send operation. Or null if connection is closed. */ - Future pushAsync(byte[] message, int offset, int length); + Future pushAsync(@Nonnull byte[] message, int offset, int length); /** * Pushes a binary message to the client. @@ -98,5 +100,5 @@ public interface IWebSocketRequestHandler extends IPartialPageRequestHandler, IL * @return * a {@link java.util.concurrent.Future} representing the send operation. Or null if connection is closed. */ - Future pushAsync(byte[] message, int offset, int length, long timeout); + Future pushAsync(@Nonnull byte[] message, int offset, int length, long timeout); } diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketConnectionOriginFilter.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketConnectionOriginFilter.java index 5009b5b4876..c6bbe8e3d10 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketConnectionOriginFilter.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketConnectionOriginFilter.java @@ -20,6 +20,7 @@ import java.util.Enumeration; import java.util.List; +import jakarta.annotation.Nonnull; import jakarta.servlet.http.HttpServletRequest; import org.apache.wicket.util.lang.Args; @@ -53,7 +54,7 @@ public class WebSocketConnectionOriginFilter implements IWebSocketConnectionFilt private final List allowedDomains; - public WebSocketConnectionOriginFilter(final List allowedDomains) + public WebSocketConnectionOriginFilter(@Nonnull final List allowedDomains) { this.allowedDomains = Args.notNull(allowedDomains, "allowedDomains"); } diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketMessageBroadcastHandler.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketMessageBroadcastHandler.java index 3cb433bd67c..2fdcef67159 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketMessageBroadcastHandler.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketMessageBroadcastHandler.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.protocol.ws.api; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.Page; import org.apache.wicket.Session; @@ -51,7 +53,7 @@ public class WebSocketMessageBroadcastHandler implements IRequestHandler * @param payload * The payload to broadcast */ - WebSocketMessageBroadcastHandler(int pageId, String resourceName, WebSocketPayload payload) + WebSocketMessageBroadcastHandler(int pageId, String resourceName, @Nonnull WebSocketPayload payload) { this.pageId = pageId; this.resourceName = resourceName; diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketPushBroadcaster.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketPushBroadcaster.java index 8ddb4ab3ed7..83399f13307 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketPushBroadcaster.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketPushBroadcaster.java @@ -20,6 +20,8 @@ import java.util.Collection; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.protocol.ws.WebSocketSettings; import org.apache.wicket.protocol.ws.api.message.ConnectedMessage; @@ -39,7 +41,7 @@ public class WebSocketPushBroadcaster { private final IWebSocketConnectionRegistry registry; - public WebSocketPushBroadcaster(IWebSocketConnectionRegistry registry) + public WebSocketPushBroadcaster(@Nonnull IWebSocketConnectionRegistry registry) { Args.notNull(registry, "registry"); @@ -63,7 +65,7 @@ public WebSocketPushBroadcaster(IWebSocketConnectionRegistry registry) * @param message * The push message event */ - public void broadcast(ConnectedMessage connection, IWebSocketPushMessage message) + public void broadcast(@Nonnull ConnectedMessage connection, @Nonnull IWebSocketPushMessage message) { Args.notNull(connection, "connection"); Args.notNull(message, "message"); @@ -96,7 +98,7 @@ public void broadcast(ConnectedMessage connection, IWebSocketPushMessage message * @param message * The push message event */ - public void broadcastAll(Application application, IWebSocketPushMessage message) + public void broadcastAll(@Nonnull Application application, @Nonnull IWebSocketPushMessage message) { Args.notNull(application, "application"); Args.notNull(message, "message"); @@ -129,7 +131,7 @@ public void broadcastAll(Application application, IWebSocketPushMessage message) * @param message * The push message event */ - public void broadcastAllInSession(Application application, String sessionId, IWebSocketPushMessage message) + public void broadcastAllInSession(@Nonnull Application application, @Nonnull String sessionId, @Nonnull IWebSocketPushMessage message) { Args.notNull(application, "application"); Args.notNull(message, "message"); @@ -163,7 +165,7 @@ public void broadcastAllInSession(Application application, String sessionId, IWe * @param message * The push message event */ - public void broadcastAllMatchingFilter(Application application, IWebSocketConnectionRegistry.IConnectionsFilter connectionsFilter, IWebSocketPushMessage message) + public void broadcastAllMatchingFilter(@Nonnull Application application, @Nonnull IWebSocketConnectionRegistry.IConnectionsFilter connectionsFilter, @Nonnull IWebSocketPushMessage message) { Args.notNull(application, "application"); Args.notNull(message, "message"); diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketRequestHandler.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketRequestHandler.java index 72624b9db1f..9e4124ab8d8 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketRequestHandler.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketRequestHandler.java @@ -22,6 +22,8 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Future; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.core.request.handler.AbstractPartialPageRequestHandler; import org.apache.wicket.core.request.handler.logger.PageLogData; @@ -50,14 +52,14 @@ public class WebSocketRequestHandler extends AbstractPartialPageRequestHandler i private PageLogData logData; - public WebSocketRequestHandler(final Component component, final IWebSocketConnection connection) + public WebSocketRequestHandler(@Nonnull final Component component, @Nonnull final IWebSocketConnection connection) { super(Args.notNull(component, "component").getPage()); this.connection = Args.notNull(connection, "connection"); } @Override - public void push(CharSequence message) + public void push(@Nonnull CharSequence message) { if (connection.isOpen()) { @@ -77,7 +79,7 @@ public void push(CharSequence message) } @Override - public Future pushAsync(CharSequence message, long timeout) + public Future pushAsync(@Nonnull CharSequence message, long timeout) { if (connection.isOpen()) { @@ -98,7 +100,7 @@ public Future pushAsync(CharSequence message) } @Override - public void push(byte[] message, int offset, int length) + public void push(@Nonnull byte[] message, int offset, int length) { if (connection.isOpen()) { @@ -118,13 +120,13 @@ public void push(byte[] message, int offset, int length) } @Override - public Future pushAsync(byte[] message, int offset, int length) + public Future pushAsync(@Nonnull byte[] message, int offset, int length) { return pushAsync(message, offset, length, -1); } @Override - public Future pushAsync(byte[] message, int offset, int length, long timeout) + public Future pushAsync(@Nonnull byte[] message, int offset, int length, long timeout) { if (connection.isOpen()) { diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java index 05669cd8b0b..dbf09e19b4a 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/WebSocketResponse.java @@ -19,6 +19,8 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.time.Instant; + +import jakarta.annotation.Nonnull; import jakarta.servlet.http.Cookie; import org.apache.wicket.request.Response; import org.apache.wicket.request.http.WebResponse; @@ -151,7 +153,7 @@ public void reset() } @Override - public String encodeURL(CharSequence url) + public String encodeURL(@Nonnull CharSequence url) { return url.toString(); } @@ -192,7 +194,7 @@ public void addHeader(String name, String value) } @Override - public void setDateHeader(String name, Instant date) + public void setDateHeader(String name, @Nonnull Instant date) { throw new UnsupportedOperationException(); } @@ -226,7 +228,7 @@ public void sendError(int sc, String msg) } @Override - public String encodeRedirectURL(CharSequence url) + public String encodeRedirectURL(@Nonnull CharSequence url) { return url.toString(); } diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/event/WebSocketBinaryPayload.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/event/WebSocketBinaryPayload.java index 25e2af2e5a6..bcbaa532535 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/event/WebSocketBinaryPayload.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/event/WebSocketBinaryPayload.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.protocol.ws.api.event; +import jakarta.annotation.Nonnull; + import org.apache.wicket.protocol.ws.api.WebSocketRequestHandler; import org.apache.wicket.protocol.ws.api.message.BinaryMessage; import org.apache.wicket.util.lang.Args; @@ -29,7 +31,7 @@ public class WebSocketBinaryPayload extends WebSocketPayload { private final BinaryMessage binaryMessage; - public WebSocketBinaryPayload(BinaryMessage binaryMessage, WebSocketRequestHandler handler) + public WebSocketBinaryPayload(@Nonnull BinaryMessage binaryMessage, WebSocketRequestHandler handler) { super(handler); diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/event/WebSocketPayload.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/event/WebSocketPayload.java index 4ea75466b03..c7d297d759f 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/event/WebSocketPayload.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/event/WebSocketPayload.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.protocol.ws.api.event; +import jakarta.annotation.Nonnull; + import org.apache.wicket.protocol.ws.api.WebSocketRequestHandler; import org.apache.wicket.util.lang.Args; @@ -28,7 +30,7 @@ public abstract class WebSocketPayload { private final WebSocketRequestHandler handler; - public WebSocketPayload(final WebSocketRequestHandler handler) + public WebSocketPayload(@Nonnull final WebSocketRequestHandler handler) { this.handler = Args.notNull(handler, "handler"); } diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/event/WebSocketPushPayload.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/event/WebSocketPushPayload.java index 2da41376f07..55ea4cda88c 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/event/WebSocketPushPayload.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/event/WebSocketPushPayload.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.protocol.ws.api.event; +import jakarta.annotation.Nonnull; + import org.apache.wicket.protocol.ws.api.WebSocketRequestHandler; import org.apache.wicket.protocol.ws.api.message.IWebSocketPushMessage; import org.apache.wicket.util.lang.Args; @@ -29,7 +31,7 @@ public class WebSocketPushPayload extends WebSocketPayload { private final TextMessage data; - public WebSocketTextPayload(TextMessage data, WebSocketRequestHandler handler) + public WebSocketTextPayload(@Nonnull TextMessage data, WebSocketRequestHandler handler) { super(handler); diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/message/AbstractClientMessage.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/message/AbstractClientMessage.java index 11b49d38cb7..1d264224aad 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/message/AbstractClientMessage.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/message/AbstractClientMessage.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.protocol.ws.api.message; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.protocol.ws.api.registry.IKey; import org.apache.wicket.util.lang.Args; @@ -29,7 +31,7 @@ public abstract class AbstractClientMessage implements IWebSocketMessage private final String sessionId; private final IKey key; - public AbstractClientMessage(Application application, String sessionId, IKey key) + public AbstractClientMessage(@Nonnull Application application, @Nonnull String sessionId, @Nonnull IKey key) { this.applicationName = Args.notNull(application, "application").getName(); this.sessionId = Args.notNull(sessionId, "sessionId"); diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/message/TextMessage.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/message/TextMessage.java index 993c94d9e85..9b7c8795c7d 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/message/TextMessage.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/message/TextMessage.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.protocol.ws.api.message; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.protocol.ws.api.registry.IKey; import org.apache.wicket.util.lang.Args; @@ -40,7 +42,7 @@ public class TextMessage extends AbstractClientMessage * @param text * the message sent from the client */ - public TextMessage(Application application, String sessionId, IKey key, CharSequence text) + public TextMessage(Application application, String sessionId, IKey key, @Nonnull CharSequence text) { super(application, sessionId, key); this.text = Args.notEmpty(text, "text"); diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/IWebSocketConnectionRegistry.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/IWebSocketConnectionRegistry.java index 76656082467..d0dc7cc711c 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/IWebSocketConnectionRegistry.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/IWebSocketConnectionRegistry.java @@ -18,6 +18,8 @@ import java.util.Collection; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.protocol.ws.api.IWebSocketConnection; @@ -49,7 +51,7 @@ interface IConnectionsFilter * the web socket client key * @return the web socket connection used by a client from the specified coordinates */ - IWebSocketConnection getConnection(Application application, String sessionId, IKey key); + IWebSocketConnection getConnection(@Nonnull Application application, @Nonnull String sessionId, @Nonnull IKey key); /** * @param application @@ -58,7 +60,7 @@ interface IConnectionsFilter * the http session id * @return collection of web socket connections used by a client with the given session id */ - Collection getConnections(Application application, String sessionId); + Collection getConnections(@Nonnull Application application, @Nonnull String sessionId); /** @@ -70,7 +72,7 @@ interface IConnectionsFilter * * @return collection of web socket connections that match certain filter */ - Collection getConnections(Application application, IConnectionsFilter connectionsFilter); + Collection getConnections(@Nonnull Application application, @Nonnull IConnectionsFilter connectionsFilter); /** @@ -78,7 +80,7 @@ interface IConnectionsFilter * the web application to look in * @return collection of web socket connection used by any client connected to specified application */ - Collection getConnections(Application application); + Collection getConnections(@Nonnull Application application); /** * Adds a new connection into the registry at the specified coordinates (application+session+page) @@ -92,7 +94,7 @@ interface IConnectionsFilter * @param connection * the web socket connection to add */ - void setConnection(Application application, String sessionId, IKey key, IWebSocketConnection connection); + void setConnection(@Nonnull Application application, @Nonnull String sessionId, @Nonnull IKey key, IWebSocketConnection connection); /** * Removes a web socket connection from the registry at the specified coordinates (application+session+page) diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/PageIdKey.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/PageIdKey.java index 2aa7de0b7d6..0b5c5bfca2b 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/PageIdKey.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/PageIdKey.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.protocol.ws.api.registry; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Session; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.page.IManageablePage; @@ -33,7 +35,7 @@ public PageIdKey(Integer pageId) this(pageId, null); } - public PageIdKey(Integer pageId, String context) + public PageIdKey(@Nonnull Integer pageId, String context) { super(context); this.pageId = Args.notNull(pageId, "pageId"); diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/ResourceNameKey.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/ResourceNameKey.java index c5f4bc42c93..ade28283692 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/ResourceNameKey.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/ResourceNameKey.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.protocol.ws.api.registry; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; /** @@ -30,7 +32,7 @@ public ResourceNameKey(String resourceName) this(resourceName, null); } - public ResourceNameKey(String resourceName, String context) + public ResourceNameKey(@Nonnull String resourceName, String context) { super(context); this.resourceName = Args.notNull(resourceName, "resourceName"); diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/ResourceNameTokenKey.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/ResourceNameTokenKey.java index e4b890a2bea..8f92f4d89ea 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/ResourceNameTokenKey.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/ResourceNameTokenKey.java @@ -18,6 +18,8 @@ import java.util.Objects; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; /** @@ -34,7 +36,7 @@ public ResourceNameTokenKey(String resourceName, String connectionToken) this(resourceName, connectionToken, null); } - public ResourceNameTokenKey(String resourceName, String connectionToken, String context) + public ResourceNameTokenKey(@Nonnull String resourceName, @Nonnull String connectionToken, String context) { super(context); this.resourceName = Args.notNull(resourceName, "resourceName"); diff --git a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/SimpleWebSocketConnectionRegistry.java b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/SimpleWebSocketConnectionRegistry.java index 69932309cb7..4f816c45ed0 100644 --- a/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/SimpleWebSocketConnectionRegistry.java +++ b/wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/registry/SimpleWebSocketConnectionRegistry.java @@ -22,6 +22,8 @@ import java.util.Map; import java.util.concurrent.ConcurrentMap; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.MetaDataKey; import org.apache.wicket.protocol.ws.api.IWebSocketConnection; @@ -42,7 +44,7 @@ public class SimpleWebSocketConnectionRegistry implements IWebSocketConnectionRe }; @Override - public IWebSocketConnection getConnection(Application application, String sessionId, IKey key) + public IWebSocketConnection getConnection(@Nonnull Application application, @Nonnull String sessionId, @Nonnull IKey key) { Args.notNull(application, "application"); Args.notNull(sessionId, "sessionId"); @@ -62,7 +64,7 @@ public IWebSocketConnection getConnection(Application application, String sessio } @Override - public Collection getConnections(Application application, String sessionId) + public Collection getConnections(@Nonnull Application application, @Nonnull String sessionId) { Args.notNull(application, "application"); Args.notNull(sessionId, "sessionId"); @@ -81,7 +83,7 @@ public Collection getConnections(Application application, } @Override - public Collection getConnections(Application application, IConnectionsFilter connectionsFilter) + public Collection getConnections(@Nonnull Application application, @Nonnull IConnectionsFilter connectionsFilter) { Args.notNull(application, "application"); Args.notNull(connectionsFilter, "connectionsFilter"); @@ -113,7 +115,7 @@ public Collection getConnections(Application application, * @return a collection of currently active websockets */ @Override - public Collection getConnections(Application application) + public Collection getConnections(@Nonnull Application application) { Args.notNull(application, "application"); @@ -130,7 +132,7 @@ public Collection getConnections(Application application) } @Override - public void setConnection(Application application, String sessionId, IKey key, IWebSocketConnection connection) + public void setConnection(@Nonnull Application application, @Nonnull String sessionId, @Nonnull IKey key, IWebSocketConnection connection) { Args.notNull(application, "application"); Args.notNull(sessionId, "sessionId"); diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/module-info.java b/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/module-info.java index 0f62b0b2e2f..9abe70404e9 100644 --- a/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/module-info.java +++ b/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/module-info.java @@ -23,6 +23,7 @@ requires static jakarta.servlet; requires jakarta.websocket; requires org.slf4j; + requires jakarta.annotation; exports org.apache.wicket.protocol.ws.javax; } diff --git a/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketConnection.java b/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketConnection.java index a8b8d3e1d9c..4288cde3689 100644 --- a/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketConnection.java +++ b/wicket-native-websocket/wicket-native-websocket-javax/src/main/java/org/apache/wicket/protocol/ws/javax/JavaxWebSocketConnection.java @@ -20,6 +20,7 @@ import java.nio.ByteBuffer; import java.util.concurrent.Future; +import jakarta.annotation.Nonnull; import jakarta.websocket.CloseReason; import jakarta.websocket.RemoteEndpoint; import jakarta.websocket.Session; @@ -48,7 +49,7 @@ public class JavaxWebSocketConnection extends AbstractWebSocketConnection * @param session * the WebSocket session */ - public JavaxWebSocketConnection(Session session, AbstractWebSocketProcessor webSocketProcessor) + public JavaxWebSocketConnection(@Nonnull Session session, AbstractWebSocketProcessor webSocketProcessor) { super(webSocketProcessor); this.session = Args.notNull(session, "session"); diff --git a/wicket-native-websocket/wicket-native-websocket-tester/pom.xml b/wicket-native-websocket/wicket-native-websocket-tester/pom.xml index e9296064099..ff40eb208b0 100644 --- a/wicket-native-websocket/wicket-native-websocket-tester/pom.xml +++ b/wicket-native-websocket/wicket-native-websocket-tester/pom.xml @@ -34,6 +34,10 @@ !java*,!kotlin*,!sun.nio.ch,org.slf4j*;version="[1.7,3)",* + + jakarta.annotation + jakarta.annotation-api + org.apache.wicket wicket-core diff --git a/wicket-native-websocket/wicket-native-websocket-tester/src/main/java/module-info.java b/wicket-native-websocket/wicket-native-websocket-tester/src/main/java/module-info.java index aa105d933d9..57022ffe243 100644 --- a/wicket-native-websocket/wicket-native-websocket-tester/src/main/java/module-info.java +++ b/wicket-native-websocket/wicket-native-websocket-tester/src/main/java/module-info.java @@ -24,6 +24,7 @@ requires org.junit.jupiter.api; requires org.slf4j; requires org.apache.wicket.tester; + requires jakarta.annotation; exports org.apache.wicket.protocol.ws.tester; } diff --git a/wicket-native-websocket/wicket-native-websocket-tester/src/main/java/org/apache/wicket/protocol/ws/tester/TestWebSocketProcessor.java b/wicket-native-websocket/wicket-native-websocket-tester/src/main/java/org/apache/wicket/protocol/ws/tester/TestWebSocketProcessor.java index 9adf77a75be..1546f91f3e9 100644 --- a/wicket-native-websocket/wicket-native-websocket-tester/src/main/java/org/apache/wicket/protocol/ws/tester/TestWebSocketProcessor.java +++ b/wicket-native-websocket/wicket-native-websocket-tester/src/main/java/org/apache/wicket/protocol/ws/tester/TestWebSocketProcessor.java @@ -16,6 +16,7 @@ */ package org.apache.wicket.protocol.ws.tester; +import jakarta.annotation.Nonnull; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpSession; @@ -90,7 +91,7 @@ public TestWebSocketProcessor(final WicketTester wicketTester, final String reso * the page that may have registered {@link org.apache.wicket.protocol.ws.api.WebSocketBehavior} * @return a mock http request */ - private static HttpServletRequest createRequest(final WicketTester wicketTester, final Page page) + private static HttpServletRequest createRequest(final WicketTester wicketTester, @Nonnull final Page page) { Args.notNull(page, "page"); MockHttpServletRequest request = createRequest(wicketTester); @@ -106,7 +107,7 @@ private static HttpServletRequest createRequest(final WicketTester wicketTester, * the page that may have registered {@link org.apache.wicket.protocol.ws.api.WebSocketBehavior} * @return a mock http request */ - private static HttpServletRequest createRequest(final WicketTester wicketTester, final String resourceName, final Page page) + private static HttpServletRequest createRequest(final WicketTester wicketTester, @Nonnull final String resourceName, final Page page) { Args.notNull(resourceName, "resourceName"); MockHttpServletRequest request = createRequest(wicketTester); diff --git a/wicket-native-websocket/wicket-native-websocket-tester/src/main/java/org/apache/wicket/protocol/ws/tester/WebSocketTester.java b/wicket-native-websocket/wicket-native-websocket-tester/src/main/java/org/apache/wicket/protocol/ws/tester/WebSocketTester.java index 98e0238cf10..415f81ba6ca 100644 --- a/wicket-native-websocket/wicket-native-websocket-tester/src/main/java/org/apache/wicket/protocol/ws/tester/WebSocketTester.java +++ b/wicket-native-websocket/wicket-native-websocket-tester/src/main/java/org/apache/wicket/protocol/ws/tester/WebSocketTester.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.protocol.ws.tester; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Application; import org.apache.wicket.Page; import org.apache.wicket.protocol.http.WebApplication; @@ -45,7 +47,7 @@ public class WebSocketTester * @param page * the page that may have registered {@link org.apache.wicket.protocol.ws.api.WebSocketBehavior} */ - public WebSocketTester(final WicketTester wicketTester, final Page page) + public WebSocketTester(@Nonnull final WicketTester wicketTester, @Nonnull final Page page) { Args.notNull(wicketTester, "wicketTester"); Args.notNull(page, "page"); @@ -85,7 +87,7 @@ protected void onOutMessage(byte[] message, int offset, int length) * @param resourceName * the name of the shared WebSocketResource that will handle the web socket messages */ - public WebSocketTester(final WicketTester wicketTester, final String resourceName) + public WebSocketTester(@Nonnull final WicketTester wicketTester, @Nonnull final String resourceName) { Args.notNull(wicketTester, "wicketTester"); Args.notNull(resourceName, "resourceName"); diff --git a/wicket-request/pom.xml b/wicket-request/pom.xml index 512c0cc4fc2..9d84a03c27a 100755 --- a/wicket-request/pom.xml +++ b/wicket-request/pom.xml @@ -34,6 +34,10 @@ + + jakarta.annotation + jakarta.annotation-api + org.apache.wicket wicket-util diff --git a/wicket-request/src/main/java/module-info.java b/wicket-request/src/main/java/module-info.java index 90f87d5d033..a4586c5ab68 100644 --- a/wicket-request/src/main/java/module-info.java +++ b/wicket-request/src/main/java/module-info.java @@ -21,6 +21,7 @@ requires org.apache.wicket.util; requires org.slf4j; requires static jakarta.servlet; + requires jakarta.annotation; exports org.apache.wicket.request; exports org.apache.wicket.request.flow; diff --git a/wicket-request/src/main/java/org/apache/wicket/request/HttpHeaderCollection.java b/wicket-request/src/main/java/org/apache/wicket/request/HttpHeaderCollection.java index adbb68e6471..cf6465c5824 100644 --- a/wicket-request/src/main/java/org/apache/wicket/request/HttpHeaderCollection.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/HttpHeaderCollection.java @@ -27,6 +27,9 @@ import java.util.Locale; import java.util.Map; import java.util.Set; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.time.Instants; @@ -100,7 +103,7 @@ public void setHeader(String name, String value) * @param value * header value */ - public void addHeader(String name, String value) + public void addHeader(String name, @Nonnull String value) { // be lenient and strip leading / trailing blanks value = Args.notNull(value, "value").trim(); @@ -315,7 +318,7 @@ private static class HeaderKey private final String key; private final String name; - private HeaderKey(String name) + private HeaderKey(@Nonnull String name) { this.name = Args.notEmpty(name, "name").trim(); key = this.name.toLowerCase(Locale.US); diff --git a/wicket-request/src/main/java/org/apache/wicket/request/Response.java b/wicket-request/src/main/java/org/apache/wicket/request/Response.java index 08a073cd1c2..58e8d7b73f8 100644 --- a/wicket-request/src/main/java/org/apache/wicket/request/Response.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/Response.java @@ -19,6 +19,8 @@ import java.io.IOException; import java.io.OutputStream; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; /** @@ -124,7 +126,7 @@ private static class StreamAdapter extends OutputStream { private final Response response; - public StreamAdapter(Response response) + public StreamAdapter(@Nonnull Response response) { Args.notNull(response, "response"); this.response = response; diff --git a/wicket-request/src/main/java/org/apache/wicket/request/Url.java b/wicket-request/src/main/java/org/apache/wicket/request/Url.java index ab505f5497c..584f015f7c1 100755 --- a/wicket-request/src/main/java/org/apache/wicket/request/Url.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/Url.java @@ -25,6 +25,8 @@ import java.util.List; import java.util.Locale; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.encoding.UrlDecoder; import org.apache.wicket.util.encoding.UrlEncoder; import org.apache.wicket.util.lang.Args; @@ -150,7 +152,7 @@ public Url(final Charset charset) * @param url * url being copied */ - public Url(final Url url) + public Url(@Nonnull final Url url) { Args.notNull(url, "url"); @@ -193,7 +195,7 @@ public Url(final List segments, final Charset charset) * @param parameters * @param charset */ - public Url(final List segments, final List parameters, + public Url(@Nonnull final List segments, @Nonnull final List parameters, final Charset charset) { Args.notNull(segments, "segments"); @@ -239,7 +241,7 @@ public static Url parse(CharSequence _url, Charset charset) * a hint whether to try to parse the protocol, host and port part of the url * @return Url object */ - public static Url parse(CharSequence _url, Charset charset, boolean isFullHint) + public static Url parse(@Nonnull CharSequence _url, Charset charset, boolean isFullHint) { Args.notNull(_url, "_url"); @@ -577,7 +579,7 @@ public void removeLeadingSegments(final int count) * * @param newSegments */ - public void prependLeadingSegments(final List newSegments) + public void prependLeadingSegments(@Nonnull final List newSegments) { Args.notNull(newSegments, "segments"); segments.addAll(0, newSegments); @@ -965,7 +967,7 @@ public final static class QueryParameter implements Serializable * @param value * parameter value */ - public QueryParameter(final String name, final String value) + public QueryParameter(@Nonnull final String name, @Nonnull final String value) { Args.notNull(name, "name"); Args.notNull(value, "value"); @@ -1233,7 +1235,7 @@ public String getPath(Charset charset) * * @return path string */ - private CharSequence getPathInternal(Charset charset) + private CharSequence getPathInternal(@Nonnull Charset charset) { Args.notNull(charset, "charset"); @@ -1282,7 +1284,7 @@ public String getPath() * the return value does not contain any "?" and could be null * @return query string (null if empty) */ - public String getQueryString(Charset charset) + public String getQueryString(@Nonnull Charset charset) { Args.notNull(charset, "charset"); diff --git a/wicket-request/src/main/java/org/apache/wicket/request/UrlRenderer.java b/wicket-request/src/main/java/org/apache/wicket/request/UrlRenderer.java index 4d0421f46db..04cb5651ad2 100644 --- a/wicket-request/src/main/java/org/apache/wicket/request/UrlRenderer.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/UrlRenderer.java @@ -21,6 +21,8 @@ import java.util.List; import java.util.Map; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.string.PrependingStringBuffer; import org.apache.wicket.util.string.Strings; @@ -69,7 +71,7 @@ public UrlRenderer(final Request request) * @param base * @return original base Url */ - public Url setBaseUrl(final Url base) + public Url setBaseUrl(@Nonnull final Url base) { Args.notNull(base, "base"); @@ -229,7 +231,7 @@ protected String resolveProtocol(final Url url) * @param url * @return Url rendered as string */ - public String renderRelativeUrl(final Url url) + public String renderRelativeUrl(@Nonnull final Url url) { Args.notNull(url, "url"); @@ -394,7 +396,7 @@ protected boolean shouldRenderAsFull(final Url url) * @param url * @return relative URL */ - public String renderContextRelativeUrl(String url) + public String renderContextRelativeUrl(@Nonnull String url) { Args.notNull(url, "url"); diff --git a/wicket-request/src/main/java/org/apache/wicket/request/handler/TextRequestHandler.java b/wicket-request/src/main/java/org/apache/wicket/request/handler/TextRequestHandler.java index 06e0965486e..b916fa70130 100644 --- a/wicket-request/src/main/java/org/apache/wicket/request/handler/TextRequestHandler.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/handler/TextRequestHandler.java @@ -19,6 +19,8 @@ import java.io.IOException; import java.nio.charset.Charset; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.IRequestCycle; import org.apache.wicket.request.IRequestHandler; import org.apache.wicket.request.http.WebResponse; @@ -67,7 +69,7 @@ public TextRequestHandler(final String string) * @param string * string for the response */ - public TextRequestHandler(final String contentType, final String encoding, final String string) + public TextRequestHandler(@Nonnull final String contentType, final String encoding, @Nonnull final String string) { this.contentType = Args.notEmpty(contentType, "contentType"); this.string = Args.notNull(string, "string"); diff --git a/wicket-request/src/main/java/org/apache/wicket/request/http/WebResponse.java b/wicket-request/src/main/java/org/apache/wicket/request/http/WebResponse.java index 3e87c15abe2..b5a9d7bcd2d 100644 --- a/wicket-request/src/main/java/org/apache/wicket/request/http/WebResponse.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/http/WebResponse.java @@ -20,6 +20,8 @@ import java.nio.charset.StandardCharsets; import java.time.Duration; import java.time.Instant; + +import jakarta.annotation.Nonnull; import jakarta.servlet.http.Cookie; import org.apache.wicket.request.Response; import org.apache.wicket.util.encoding.UrlEncoder; @@ -84,7 +86,7 @@ public abstract class WebResponse extends Response * @param name * @param date */ - public abstract void setDateHeader(String name, Instant date); + public abstract void setDateHeader(String name, @Nonnull Instant date); /** * Set the content length on the response, if appropriate in the subclass. This default @@ -258,7 +260,7 @@ public void disableCaching() * * @see WebResponse#MAX_CACHE_DURATION */ - public void enableCaching(Duration duration, final WebResponse.CacheScope scope) + public void enableCaching(@Nonnull Duration duration, @Nonnull final WebResponse.CacheScope scope) { Args.notNull(duration, "duration"); Args.notNull(scope, "scope"); diff --git a/wicket-request/src/main/java/org/apache/wicket/request/http/handler/RedirectRequestHandler.java b/wicket-request/src/main/java/org/apache/wicket/request/http/handler/RedirectRequestHandler.java index 680fe1ab680..38d1822875e 100644 --- a/wicket-request/src/main/java/org/apache/wicket/request/http/handler/RedirectRequestHandler.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/http/handler/RedirectRequestHandler.java @@ -16,6 +16,7 @@ */ package org.apache.wicket.request.http.handler; +import jakarta.annotation.Nonnull; import jakarta.servlet.http.HttpServletResponse; import org.apache.wicket.request.IRequestCycle; @@ -77,7 +78,7 @@ public RedirectRequestHandler(final String redirectUrl) * @param status * 301 (Moved permanently) or 302 (Moved temporarily) */ - public RedirectRequestHandler(final String redirectUrl, final int status) + public RedirectRequestHandler(@Nonnull final String redirectUrl, final int status) { if ((status != HttpServletResponse.SC_MOVED_PERMANENTLY) && (status != HttpServletResponse.SC_MOVED_TEMPORARILY) && diff --git a/wicket-request/src/main/java/org/apache/wicket/request/mapper/AbstractMapper.java b/wicket-request/src/main/java/org/apache/wicket/request/mapper/AbstractMapper.java index ff1a851923b..4828a7cda6d 100644 --- a/wicket-request/src/main/java/org/apache/wicket/request/mapper/AbstractMapper.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/mapper/AbstractMapper.java @@ -19,6 +19,8 @@ import java.util.List; import java.util.Locale; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.IRequestMapper; import org.apache.wicket.request.Request; import org.apache.wicket.request.Url; @@ -158,8 +160,8 @@ protected String safeSegmentGetter(List segments, int index, String defa * @param encoder * @return PageParameters instance */ - protected PageParameters extractPageParameters(final Request request, int segmentsToSkip, - final IPageParametersEncoder encoder) + protected PageParameters extractPageParameters(@Nonnull final Request request, int segmentsToSkip, + @Nonnull final IPageParametersEncoder encoder) { Args.notNull(request, "request"); Args.notNull(encoder, "encoder"); @@ -204,8 +206,8 @@ protected void removeMetaParameter(final Url urlCopy) * @param encoder * @return URL with encoded parameters */ - protected Url encodePageParameters(Url url, PageParameters pageParameters, - final IPageParametersEncoder encoder) + protected Url encodePageParameters(@Nonnull Url url, PageParameters pageParameters, + @Nonnull final IPageParametersEncoder encoder) { Args.notNull(url, "url"); Args.notNull(encoder, "encoder"); diff --git a/wicket-request/src/main/java/org/apache/wicket/request/mapper/ParentPathReferenceRewriter.java b/wicket-request/src/main/java/org/apache/wicket/request/mapper/ParentPathReferenceRewriter.java index 3508c3dbe19..142170b571d 100755 --- a/wicket-request/src/main/java/org/apache/wicket/request/mapper/ParentPathReferenceRewriter.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/mapper/ParentPathReferenceRewriter.java @@ -18,6 +18,8 @@ import java.util.function.Supplier; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.IRequestHandler; import org.apache.wicket.request.IRequestMapper; import org.apache.wicket.request.Request; @@ -43,8 +45,8 @@ public class ParentPathReferenceRewriter implements IRequestMapperDelegate * * @param escapeSequence */ - public ParentPathReferenceRewriter(final IRequestMapper chain, - final Supplier escapeSequence) + public ParentPathReferenceRewriter(@Nonnull final IRequestMapper chain, + @Nonnull final Supplier escapeSequence) { Args.notNull(chain, "chain"); Args.notNull(escapeSequence, "relativePathPartEscapeSequence"); diff --git a/wicket-request/src/main/java/org/apache/wicket/request/mapper/info/ComponentInfo.java b/wicket-request/src/main/java/org/apache/wicket/request/mapper/info/ComponentInfo.java index fdbbef05abe..058376f1b6c 100644 --- a/wicket-request/src/main/java/org/apache/wicket/request/mapper/info/ComponentInfo.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/mapper/info/ComponentInfo.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.request.mapper.info; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.string.Strings; @@ -127,7 +129,7 @@ private static String decodeComponentPath(CharSequence path) * @param componentPath * @param behaviorId */ - public ComponentInfo(final Integer renderCount, final String componentPath, final Integer behaviorId) + public ComponentInfo(final Integer renderCount, @Nonnull final String componentPath, final Integer behaviorId) { Args.notNull(componentPath, "componentPath"); diff --git a/wicket-request/src/main/java/org/apache/wicket/request/mapper/info/PageComponentInfo.java b/wicket-request/src/main/java/org/apache/wicket/request/mapper/info/PageComponentInfo.java index 7a77cedff50..4a842b67e5e 100644 --- a/wicket-request/src/main/java/org/apache/wicket/request/mapper/info/PageComponentInfo.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/mapper/info/PageComponentInfo.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.request.mapper.info; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.string.Strings; @@ -39,7 +41,7 @@ public class PageComponentInfo * @param pageInfo * @param componentInfo */ - public PageComponentInfo(final PageInfo pageInfo, final ComponentInfo componentInfo) + public PageComponentInfo(@Nonnull final PageInfo pageInfo, final ComponentInfo componentInfo) { Args.notNull(pageInfo, "pageInfo"); diff --git a/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/INamedParameters.java b/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/INamedParameters.java index 000e34f8731..b24b15875e6 100644 --- a/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/INamedParameters.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/INamedParameters.java @@ -19,6 +19,8 @@ import java.util.List; import java.util.Set; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.IRequestMapper; import org.apache.wicket.util.io.IClusterable; import org.apache.wicket.util.lang.Args; @@ -83,7 +85,7 @@ public NamedPair(final String key, final String value) * @param value * @param type */ - public NamedPair(final String key, final String value, Type type) + public NamedPair(@Nonnull final String key, @Nonnull final String value, @Nonnull Type type) { this.key = Args.notEmpty(key, "key"); this.value = Args.notNull(value, "value"); @@ -150,7 +152,7 @@ public int hashCode() * @param name * @return parameter value */ - StringValue get(final String name); + StringValue get(@Nonnull final String name); /** * Return list of all values for named parameter with given name @@ -158,7 +160,7 @@ public int hashCode() * @param name * @return list of parameter values */ - List getValues(final String name); + List getValues(@Nonnull final String name); /** * @return All named parameters in exact order. @@ -191,7 +193,7 @@ public int hashCode() * to any of the criteria. * @return this */ - INamedParameters remove(final String name, String... values); + INamedParameters remove(@Nonnull final String name, String... values); /** * Adds value to named parameter with given name. @@ -213,7 +215,7 @@ public int hashCode() * @param type * @return this */ - INamedParameters add(final String name, final Object value, final int index, Type type); + INamedParameters add(@Nonnull final String name, @Nonnull final Object value, final int index, Type type); /** * Sets the named parameter on specified position. The {@link IRequestMapper}s may or may not diff --git a/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/PageParameters.java b/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/PageParameters.java index 59e05a61562..9b1d4f74c73 100644 --- a/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/PageParameters.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/PageParameters.java @@ -24,6 +24,8 @@ import java.util.Set; import java.util.TreeSet; +import jakarta.annotation.Nonnull; + import org.apache.commons.collections4.CollectionUtils; import org.apache.wicket.request.IRequestMapper; import org.apache.wicket.util.io.IClusterable; @@ -164,7 +166,7 @@ public Set getNamedKeys() * @param name the parameter name * @return {@code true} if the parameter exists, {@code false} otherwise */ - public boolean contains(final String name) + public boolean contains(@Nonnull final String name) { Args.notNull(name, "name"); @@ -182,7 +184,7 @@ public boolean contains(final String name) } @Override - public StringValue get(final String name) + public StringValue get(@Nonnull final String name) { Args.notNull(name, "name"); @@ -200,7 +202,7 @@ public StringValue get(final String name) } @Override - public List getValues(final String name) + public List getValues(@Nonnull final String name) { Args.notNull(name, "name"); @@ -266,7 +268,7 @@ public int getPosition(final String name) } @Override - public PageParameters remove(final String name, final String... values) + public PageParameters remove(@Nonnull final String name, final String... values) { Args.notNull(name, "name"); @@ -317,7 +319,7 @@ public PageParameters add(final String name, final Object value, Type type) } @Override - public PageParameters add(final String name, final Object value, final int index, Type type) + public PageParameters add(@Nonnull final String name, @Nonnull final Object value, final int index, Type type) { Args.notEmpty(name, "name"); Args.notNull(value, "value"); diff --git a/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/UrlPathPageParametersEncoder.java b/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/UrlPathPageParametersEncoder.java index 497c21eac59..df2b3e7e8d0 100644 --- a/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/UrlPathPageParametersEncoder.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/mapper/parameter/UrlPathPageParametersEncoder.java @@ -18,6 +18,8 @@ import java.util.Iterator; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.Url; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.string.Strings; @@ -46,7 +48,7 @@ public class UrlPathPageParametersEncoder implements IPageParametersEncoder { @Override - public Url encodePageParameters(PageParameters params) + public Url encodePageParameters(@Nonnull PageParameters params) { Args.notNull(params, "params"); Args.isTrue(params.getIndexedCount() == 0, diff --git a/wicket-request/src/main/java/org/apache/wicket/request/parameter/CombinedRequestParametersAdapter.java b/wicket-request/src/main/java/org/apache/wicket/request/parameter/CombinedRequestParametersAdapter.java index 87451ede4b6..396b8f4975c 100755 --- a/wicket-request/src/main/java/org/apache/wicket/request/parameter/CombinedRequestParametersAdapter.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/parameter/CombinedRequestParametersAdapter.java @@ -22,6 +22,8 @@ import java.util.List; import java.util.Set; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.IRequestParameters; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.string.StringValue; @@ -40,7 +42,7 @@ public class CombinedRequestParametersAdapter implements IRequestParameters * * @param parameters */ - public CombinedRequestParametersAdapter(final IRequestParameters... parameters) + public CombinedRequestParametersAdapter(@Nonnull final IRequestParameters... parameters) { this.parameters = Args.notNull(parameters, "parameters"); } diff --git a/wicket-request/src/main/java/org/apache/wicket/request/parameter/UrlRequestParametersAdapter.java b/wicket-request/src/main/java/org/apache/wicket/request/parameter/UrlRequestParametersAdapter.java index 632dac07981..e14b923a091 100755 --- a/wicket-request/src/main/java/org/apache/wicket/request/parameter/UrlRequestParametersAdapter.java +++ b/wicket-request/src/main/java/org/apache/wicket/request/parameter/UrlRequestParametersAdapter.java @@ -22,6 +22,8 @@ import java.util.List; import java.util.Set; +import jakarta.annotation.Nonnull; + import org.apache.wicket.request.IRequestParameters; import org.apache.wicket.request.Url; import org.apache.wicket.request.Url.QueryParameter; @@ -43,7 +45,7 @@ public class UrlRequestParametersAdapter implements IRequestParameters * * @param url */ - public UrlRequestParametersAdapter(final Url url) + public UrlRequestParametersAdapter(@Nonnull final Url url) { Args.notNull(url, "url"); diff --git a/wicket-spring/pom.xml b/wicket-spring/pom.xml index 38ad194795f..11d8a6b54c0 100644 --- a/wicket-spring/pom.xml +++ b/wicket-spring/pom.xml @@ -32,6 +32,10 @@ !java*,!kotlin*,!sun.nio.ch,org.slf4j*;version="[1.7,3)",* + + jakarta.annotation + jakarta.annotation-api + org.springframework spring-web diff --git a/wicket-spring/src/main/java/module-info.java b/wicket-spring/src/main/java/module-info.java index 89c5c38ca02..ca08aaa53eb 100644 --- a/wicket-spring/src/main/java/module-info.java +++ b/wicket-spring/src/main/java/module-info.java @@ -25,6 +25,7 @@ requires spring.context; requires spring.core; requires spring.web; + requires jakarta.annotation; exports org.apache.wicket.spring; exports org.apache.wicket.spring.injection.annot; diff --git a/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java b/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java index af0d490c7e9..75db4f5a85b 100644 --- a/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java +++ b/wicket-spring/src/main/java/org/apache/wicket/spring/SpringBeanLocator.java @@ -25,6 +25,8 @@ import java.util.Map; import java.util.Set; +import jakarta.annotation.Nonnull; + import org.apache.wicket.core.util.lang.WicketObjects; import org.apache.wicket.proxy.IProxyTargetLocator; import org.apache.wicket.util.lang.Args; @@ -114,8 +116,8 @@ public SpringBeanLocator(final Class beanType, Field beanField, * @param locator * spring context locator */ - public SpringBeanLocator(final String beanName, final Class beanType, Field beanField, - final ISpringContextLocator locator) + public SpringBeanLocator(final String beanName, @Nonnull final Class beanType, Field beanField, + @Nonnull final ISpringContextLocator locator) { Args.notNull(locator, "locator"); Args.notNull(beanType, "beanType"); diff --git a/wicket-spring/src/main/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactory.java b/wicket-spring/src/main/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactory.java index 692857f86cc..5f848ac9257 100644 --- a/wicket-spring/src/main/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactory.java +++ b/wicket-spring/src/main/java/org/apache/wicket/spring/injection/annot/AnnotProxyFieldValueFactory.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.concurrent.ConcurrentMap; +import jakarta.annotation.Nonnull; import jakarta.inject.Inject; import jakarta.inject.Named; @@ -103,7 +104,7 @@ public AnnotProxyFieldValueFactory(final ISpringContextLocator contextLocator) * whether or not wicket should wrap dependencies with specialized proxies that can * be safely serialized. in most cases this should be set to true. */ - public AnnotProxyFieldValueFactory(final ISpringContextLocator contextLocator, + public AnnotProxyFieldValueFactory(@Nonnull final ISpringContextLocator contextLocator, final boolean wrapInProxies) { this.contextLocator = Args.notNull(contextLocator, "contextLocator"); diff --git a/wicket-spring/src/main/java/org/apache/wicket/spring/injection/annot/SpringComponentInjector.java b/wicket-spring/src/main/java/org/apache/wicket/spring/injection/annot/SpringComponentInjector.java index 7d08c4405d6..fdfe47cd788 100644 --- a/wicket-spring/src/main/java/org/apache/wicket/spring/injection/annot/SpringComponentInjector.java +++ b/wicket-spring/src/main/java/org/apache/wicket/spring/injection/annot/SpringComponentInjector.java @@ -16,6 +16,7 @@ */ package org.apache.wicket.spring.injection.annot; +import jakarta.annotation.Nonnull; import jakarta.servlet.ServletContext; import org.apache.wicket.Application; @@ -104,7 +105,7 @@ public SpringComponentInjector(final WebApplication webapp, final ApplicationCon * whether or not wicket should wrap dependencies with specialized proxies that can * be safely serialized. in most cases this should be set to true. */ - public SpringComponentInjector(final WebApplication webapp, final ApplicationContext ctx, + public SpringComponentInjector(@Nonnull final WebApplication webapp, @Nonnull final ApplicationContext ctx, final boolean wrapInProxies) { Args.notNull(webapp, "webapp"); @@ -185,7 +186,7 @@ private static ApplicationContext getDefaultContext(final WebApplication webapp) * @param context * context to use as default if non is explicitely specified for the injector */ - public static void setDefaultContext(final WebApplication webapp, ApplicationContext context) + public static void setDefaultContext(final WebApplication webapp, @Nonnull ApplicationContext context) { Args.notNull(context, "context"); diff --git a/wicket-tester/pom.xml b/wicket-tester/pom.xml index 5c9b7e14296..f9615e02056 100644 --- a/wicket-tester/pom.xml +++ b/wicket-tester/pom.xml @@ -34,6 +34,10 @@ !java*,!kotlin*,!sun.nio.ch,org.slf4j*;version="[1.7,3)",* + + jakarta.annotation + jakarta.annotation-api + org.apache.wicket wicket-core diff --git a/wicket-tester/src/main/java/module-info.java b/wicket-tester/src/main/java/module-info.java index 0aeca3e5e66..834886efc86 100644 --- a/wicket-tester/src/main/java/module-info.java +++ b/wicket-tester/src/main/java/module-info.java @@ -16,15 +16,16 @@ */ module org.apache.wicket.tester { - requires org.apache.wicket.util; - requires org.apache.wicket.request; - requires org.apache.wicket.core; + requires org.apache.wicket.util; + requires org.apache.wicket.request; + requires org.apache.wicket.core; requires org.slf4j; requires static jakarta.servlet; requires org.junit.jupiter.api; requires org.apache.commons.collections4; requires org.danekja.jdk.serializable.functional; requires org.assertj.core; + requires jakarta.annotation; exports org.apache.wicket.util.tester; diff --git a/wicket-tester/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java b/wicket-tester/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java index 4c409658f0d..dee7a9c7531 100644 --- a/wicket-tester/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java +++ b/wicket-tester/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java @@ -16,9 +16,6 @@ */ package org.apache.wicket.util.tester; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.fail; - import java.io.IOException; import java.io.Serializable; import java.lang.reflect.Constructor; @@ -37,6 +34,12 @@ import java.util.UUID; import java.util.regex.Pattern; +import jakarta.annotation.Nonnull; +import jakarta.servlet.FilterConfig; +import jakarta.servlet.ServletContext; +import jakarta.servlet.http.Cookie; +import jakarta.servlet.http.HttpSession; + import org.apache.wicket.Application; import org.apache.wicket.Component; import org.apache.wicket.IPageManagerProvider; @@ -130,10 +133,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import jakarta.servlet.FilterConfig; -import jakarta.servlet.ServletContext; -import jakarta.servlet.http.Cookie; -import jakarta.servlet.http.HttpSession; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.fail; /** * A helper class to ease unit testing of Wicket applications without the need for a servlet @@ -279,7 +280,7 @@ public BaseWicketTester(final WebApplication application, boolean init) * @param init * force the application to be initialized (default = true) */ - public BaseWicketTester(final WebApplication application, final ServletContext servletCtx, + public BaseWicketTester(@Nonnull final WebApplication application, final ServletContext servletCtx, boolean init) { if (!init) @@ -840,7 +841,7 @@ else if (originalPort.equals(newPort) == false) * @param key * @param value */ - public final void addRequestHeader(final String key, final String value) + public final void addRequestHeader(@Nonnull final String key, final String value) { Args.notEmpty(key, "key"); @@ -1077,7 +1078,7 @@ public Url urlFor(final IRequestHandler handler) * @param link * @return url for Link */ - public String urlFor(Link link) + public String urlFor(@Nonnull Link link) { Args.notNull(link, "link"); @@ -1093,7 +1094,7 @@ public String urlFor(Link link) * * @param component */ - public void executeListener(final Component component) + public void executeListener(@Nonnull final Component component) { Args.notNull(component, "component"); @@ -1129,7 +1130,7 @@ public void executeListener(final Component component) * * @param component */ - public void invokeListener(final Component component) + public void invokeListener(@Nonnull final Component component) { Args.notNull(component, "component"); @@ -1151,7 +1152,7 @@ public void invokeListener(final Component component) * @param component * @param behavior */ - public void invokeListener(Component component, final Behavior behavior) + public void invokeListener(@Nonnull Component component, @Nonnull final Behavior behavior) { Args.notNull(component, "component"); Args.notNull(behavior, "behavior"); @@ -1171,7 +1172,7 @@ public void invokeListener(Component component, final Behavior behavior) * @param behavior * an AbstractAjaxBehavior to execute */ - public void executeBehavior(final AbstractAjaxBehavior behavior) + public void executeBehavior(@Nonnull final AbstractAjaxBehavior behavior) { Args.notNull(behavior, "behavior"); @@ -1230,7 +1231,7 @@ public Url urlFor(final AjaxLink link) * * @param url */ - public void executeAjaxUrl(final Url url) + public void executeAjaxUrl(@Nonnull final Url url) { Args.notNull(url, "url"); @@ -1266,7 +1267,7 @@ public final C startPage(final Class pageClass) * @return the rendered Page */ @SuppressWarnings("unchecked") - public final C startPage(final Class pageClass, + public final C startPage(@Nonnull final Class pageClass, final PageParameters parameters) { Args.notNull(pageClass, "pageClass"); @@ -1358,7 +1359,7 @@ public final C startComponentInPage(final Class compone * the markup for the Page that will be automatically created. May be {@code null}. * @return The component processed */ - public final C startComponentInPage(final Class componentClass, + public final C startComponentInPage(@Nonnull final Class componentClass, final IMarkupFragment pageMarkup) { Args.notNull(componentClass, "componentClass"); @@ -1426,7 +1427,7 @@ public final C startComponentInPage(final C component) * the markup for the Page that will be automatically created. May be {@code null}. * @return The component processed */ - public final C startComponentInPage(final C component, + public final C startComponentInPage(@Nonnull final C component, IMarkupFragment pageMarkup) { Args.notNull(component, "component"); @@ -2112,7 +2113,7 @@ private Url transform(final Url url) * expected class of last rendered page * @return a Result */ - public Result isRenderedPage(Class expectedRenderedPageClass) + public Result isRenderedPage(@Nonnull Class expectedRenderedPageClass) { Args.notNull(expectedRenderedPageClass, "expectedRenderedPageClass"); @@ -2464,7 +2465,7 @@ private void internalExecuteAllTimerBehaviors(final Component component) * the event to simulate being fired. If event is null, the * test will fail. */ - public void executeAjaxEvent(final Component component, final String event) + public void executeAjaxEvent(@Nonnull final Component component, @Nonnull final String event) { Args.notNull(component, "component"); Args.notNull(event, "event"); @@ -2578,7 +2579,7 @@ public void component(final FormComponent formComponent, final IVisit v public String getContentTypeFromResponseHeader() { String contentType = getLastResponse().getContentType(); - assertNotNull("No Content-Type header found", contentType); + assertNotNull(contentType, "No Content-Type header found"); return contentType; } @@ -2590,7 +2591,7 @@ public String getContentTypeFromResponseHeader() public int getContentLengthFromResponseHeader() { String contentLength = getLastResponse().getHeader("Content-Length"); - assertNotNull("No Content-Length header found", contentLength); + assertNotNull(contentLength, "No Content-Length header found"); return Integer.parseInt(contentLength); } diff --git a/wicket-tester/src/main/java/org/apache/wicket/util/tester/DiffUtil.java b/wicket-tester/src/main/java/org/apache/wicket/util/tester/DiffUtil.java index 68f129a4b15..0f5c3284f3c 100644 --- a/wicket-tester/src/main/java/org/apache/wicket/util/tester/DiffUtil.java +++ b/wicket-tester/src/main/java/org/apache/wicket/util/tester/DiffUtil.java @@ -26,6 +26,8 @@ import java.net.URISyntaxException; import java.net.URL; +import jakarta.annotation.Nonnull; + import org.apache.wicket.markup.MarkupParser; import org.apache.wicket.markup.MarkupStream; import org.apache.wicket.util.diff.Diff; @@ -100,7 +102,7 @@ public static void replaceExpectedResultFile(final String document, final Class< * @return true, if equal * @throws IOException */ - public static boolean validatePage(String document, final Class clazz, + public static boolean validatePage(@Nonnull String document, final Class clazz, final String file, boolean failWithAssert) throws IOException { Args.notNull(document, "document"); diff --git a/wicket-tester/src/main/java/org/apache/wicket/util/tester/FormTester.java b/wicket-tester/src/main/java/org/apache/wicket/util/tester/FormTester.java index d06503a6240..a701351bf13 100644 --- a/wicket-tester/src/main/java/org/apache/wicket/util/tester/FormTester.java +++ b/wicket-tester/src/main/java/org/apache/wicket/util/tester/FormTester.java @@ -25,6 +25,8 @@ import java.util.List; import java.util.Objects; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.ajax.markup.html.form.AjaxButton; @@ -381,7 +383,7 @@ private boolean allowMultipleChoice(FormComponent formComponent) * specifies whether to fill child TextComponents with blank * Strings */ - protected FormTester(final String path, final Form workingForm, + protected FormTester(final String path, @Nonnull final Form workingForm, final BaseWicketTester wicketTester, final boolean fillBlankString) { this.workingForm = Objects.requireNonNull(workingForm, String.format(NO_FORM_FOR_PATH, path)); @@ -599,7 +601,7 @@ public FormTester setValue(final String formComponentId, final String value) * the field value * @return This */ - public FormTester setValue(final Component formComponent, final String value) + public FormTester setValue(@Nonnull final Component formComponent, final String value) { Args.notNull(formComponent, "formComponent"); @@ -749,7 +751,7 @@ public FormTester submit(final String buttonComponentId) * relative path (from Form) to the button * @return This */ - public FormTester submit(final Component buttonComponent) + public FormTester submit(@Nonnull final Component buttonComponent) { Args.notNull(buttonComponent, "buttonComponent"); diff --git a/wicket-tester/src/main/java/org/apache/wicket/util/tester/TagTester.java b/wicket-tester/src/main/java/org/apache/wicket/util/tester/TagTester.java index 0436aff51a6..f7082b8f2f5 100644 --- a/wicket-tester/src/main/java/org/apache/wicket/util/tester/TagTester.java +++ b/wicket-tester/src/main/java/org/apache/wicket/util/tester/TagTester.java @@ -26,6 +26,8 @@ import java.util.function.Function; import java.util.regex.Pattern; +import jakarta.annotation.Nonnull; + import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.markup.parser.XmlPullParser; import org.apache.wicket.markup.parser.XmlTag; @@ -245,7 +247,7 @@ public boolean getAttributeEndsWith(String attribute, String expected) * the tag name to search for * @return true if this tag has a child with the given tagName. */ - public boolean hasChildTag(String tagName) + public boolean hasChildTag(@Nonnull String tagName) { Args.notEmpty(tagName, "tagName"); @@ -292,7 +294,7 @@ public boolean hasChildTag(String tagName) * the tag name to search for * @return true if this tag has a child with the given tagName. */ - public TagTester getChild(String tagName) + public TagTester getChild(@Nonnull String tagName) { Args.notNull(tagName, "tagName"); @@ -563,4 +565,4 @@ else if (requiresCloseTag(openTag.getName()) == false) return testers; } -} \ No newline at end of file +} diff --git a/wicket-tester/src/main/java/org/apache/wicket/util/tester/WicketTester.java b/wicket-tester/src/main/java/org/apache/wicket/util/tester/WicketTester.java index ad299704949..7898816603e 100644 --- a/wicket-tester/src/main/java/org/apache/wicket/util/tester/WicketTester.java +++ b/wicket-tester/src/main/java/org/apache/wicket/util/tester/WicketTester.java @@ -28,6 +28,7 @@ import java.util.List; import java.util.Locale; +import jakarta.annotation.Nonnull; import jakarta.servlet.ServletContext; import org.apache.commons.collections4.CollectionUtils; @@ -320,7 +321,7 @@ public void assertComponent(String path, Class expectedComp * @param expectedBehaviorClass * expected Behavior class */ - public void assertBehavior(String path, Class expectedBehaviorClass) + public void assertBehavior(String path, @Nonnull Class expectedBehaviorClass) { Args.notNull(expectedBehaviorClass, "expectedBehaviorClass"); @@ -537,7 +538,7 @@ public void assertFeedbackMessages(IFeedbackMessageFilter filter, * the filter that decides in which messages to look in. E.g. with a specific level, * rendered or not, etc. */ - public void assertComponentFeedbackMessage(Component component, String key, IModel model, + public void assertComponentFeedbackMessage(Component component, @Nonnull String key, IModel model, IFeedbackMessageFilter filter) { Args.notNull(key, "key"); diff --git a/wicket-tester/src/main/java/org/apache/wicket/util/tester/WicketTesterHelper.java b/wicket-tester/src/main/java/org/apache/wicket/util/tester/WicketTesterHelper.java index 2bd94e49267..e2f1f7fcb3c 100644 --- a/wicket-tester/src/main/java/org/apache/wicket/util/tester/WicketTesterHelper.java +++ b/wicket-tester/src/main/java/org/apache/wicket/util/tester/WicketTesterHelper.java @@ -23,6 +23,8 @@ import java.util.Iterator; import java.util.List; +import jakarta.annotation.Nonnull; + import org.apache.wicket.Component; import org.apache.wicket.Page; import org.apache.wicket.ajax.AjaxEventBehavior; @@ -200,7 +202,7 @@ public static AjaxEventBehavior findAjaxEventBehavior(Component component, Strin * @param event * @return a list of all found AjaxEventBehavior or an empty list */ - public static List findAjaxEventBehaviors(Component component, String event) + public static List findAjaxEventBehaviors(Component component, @Nonnull String event) { Args.notEmpty(event, "event"); List behaviors = new ArrayList<>(); diff --git a/wicket-util/pom.xml b/wicket-util/pom.xml index 6fb85ebfb0c..40963b40e2d 100755 --- a/wicket-util/pom.xml +++ b/wicket-util/pom.xml @@ -32,6 +32,10 @@ org.apache.wicket.util + + jakarta.annotation + jakarta.annotation-api + commons-io commons-io diff --git a/wicket-util/src/main/java/module-info.java b/wicket-util/src/main/java/module-info.java index a61323893a7..597abcf6f71 100644 --- a/wicket-util/src/main/java/module-info.java +++ b/wicket-util/src/main/java/module-info.java @@ -25,6 +25,7 @@ requires org.apache.commons.collections4; requires org.slf4j; requires static jakarta.servlet; + requires jakarta.annotation; exports org.apache.wicket.util; exports org.apache.wicket.util.collections; diff --git a/wicket-util/src/main/java/org/apache/wicket/util/convert/ConversionException.java b/wicket-util/src/main/java/org/apache/wicket/util/convert/ConversionException.java index 504c7816133..f1c515b2111 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/convert/ConversionException.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/convert/ConversionException.java @@ -20,6 +20,8 @@ import java.util.Locale; import java.util.Map; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.lang.Generics; @@ -236,7 +238,7 @@ public ConversionException setResourceKey(final String resourceKey) * variable value * @return this for chaining */ - public ConversionException setVariable(final String name, final Object value) + public ConversionException setVariable(@Nonnull final String name, @Nonnull final Object value) { Args.notEmpty(name, "name"); Args.notNull(value, "value"); @@ -259,4 +261,4 @@ public Map getVariables() { return vars; } -} \ No newline at end of file +} diff --git a/wicket-util/src/main/java/org/apache/wicket/util/convert/MaskConverter.java b/wicket-util/src/main/java/org/apache/wicket/util/convert/MaskConverter.java index 27717f82252..3ec85a3be0c 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/convert/MaskConverter.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/convert/MaskConverter.java @@ -19,6 +19,8 @@ import java.text.ParseException; import java.util.Locale; +import jakarta.annotation.Nonnull; + import javax.swing.text.MaskFormatter; import org.apache.wicket.util.lang.Args; @@ -100,7 +102,7 @@ public class MaskConverter implements IConverter * @param maskFormatter * The mask formatter to use for masking and unmasking values */ - public MaskConverter(final MaskFormatter maskFormatter) + public MaskConverter(@Nonnull final MaskFormatter maskFormatter) { Args.notNull(maskFormatter, "maskFormatter"); diff --git a/wicket-util/src/main/java/org/apache/wicket/util/convert/converter/CalendarConverter.java b/wicket-util/src/main/java/org/apache/wicket/util/convert/converter/CalendarConverter.java index 4d371e6d921..19c640f93f1 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/convert/converter/CalendarConverter.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/convert/converter/CalendarConverter.java @@ -20,6 +20,8 @@ import java.util.Date; import java.util.Locale; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.convert.IConverter; import org.apache.wicket.util.lang.Args; @@ -46,7 +48,7 @@ public CalendarConverter() * @param dateConverter * delegated converter, not null */ - public CalendarConverter(IConverter dateConverter) + public CalendarConverter(@Nonnull IConverter dateConverter) { Args.notNull(dateConverter, "dateConverter"); diff --git a/wicket-util/src/main/java/org/apache/wicket/util/crypt/CryptFactoryCachingDecorator.java b/wicket-util/src/main/java/org/apache/wicket/util/crypt/CryptFactoryCachingDecorator.java index 9fc71424b60..475bde65d2e 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/crypt/CryptFactoryCachingDecorator.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/crypt/CryptFactoryCachingDecorator.java @@ -17,6 +17,8 @@ package org.apache.wicket.util.crypt; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; /** @@ -35,7 +37,7 @@ public class CryptFactoryCachingDecorator implements ICryptFactory * @param delegate * the crypt factory whose {@link ICryptFactory#newCrypt()} call will be cached */ - public CryptFactoryCachingDecorator(final ICryptFactory delegate) + public CryptFactoryCachingDecorator(@Nonnull final ICryptFactory delegate) { Args.notNull(delegate, "delegate"); this.delegate = delegate; diff --git a/wicket-util/src/main/java/org/apache/wicket/util/crypt/SunJceCrypt.java b/wicket-util/src/main/java/org/apache/wicket/util/crypt/SunJceCrypt.java index f4cf621a146..9a0ed87ce8f 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/crypt/SunJceCrypt.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/crypt/SunJceCrypt.java @@ -23,6 +23,8 @@ import java.security.spec.KeySpec; import java.util.Random; +import jakarta.annotation.Nonnull; + import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; @@ -77,7 +79,7 @@ public SunJceCrypt(byte[] salt, int iterationCount) * @param iterationCount * iteration count */ - public SunJceCrypt(String cryptMethod, byte[] salt, int iterationCount) + public SunJceCrypt(@Nonnull String cryptMethod, @Nonnull byte[] salt, int iterationCount) { this.cryptMethod = Args.notNull(cryptMethod, "Crypt method"); this.salt = Args.notNull(salt, "salt"); diff --git a/wicket-util/src/main/java/org/apache/wicket/util/encoding/UrlDecoder.java b/wicket-util/src/main/java/org/apache/wicket/util/encoding/UrlDecoder.java index da54b8bc75a..32aeec8f508 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/encoding/UrlDecoder.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/encoding/UrlDecoder.java @@ -22,6 +22,8 @@ import java.nio.charset.IllegalCharsetNameException; import java.nio.charset.UnsupportedCharsetException; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -77,7 +79,7 @@ private UrlDecoder(final boolean decodePlus) * encoding to decode with * @return decoded string */ - public String decode(final String s, final String enc) + public String decode(final String s, @Nonnull final String enc) { Args.notNull(enc, "enc"); @@ -98,7 +100,7 @@ public String decode(final String s, final String enc) * encoding to decode with * @return decoded string */ - public String decode(final String source, final Charset charset) + public String decode(final String source, @Nonnull final Charset charset) { if (source == null || source.isEmpty()) { diff --git a/wicket-util/src/main/java/org/apache/wicket/util/encoding/UrlEncoder.java b/wicket-util/src/main/java/org/apache/wicket/util/encoding/UrlEncoder.java index 422ad779741..6b9342b755c 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/encoding/UrlEncoder.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/encoding/UrlEncoder.java @@ -22,6 +22,8 @@ import java.nio.charset.IllegalCharsetNameException; import java.nio.charset.UnsupportedCharsetException; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; /** @@ -177,7 +179,7 @@ protected UrlEncoder(final Type type) * charset to use for encoding * @return encoded string */ - public String encode(final String s, final String charsetName) + public String encode(final String s, @Nonnull final String charsetName) { Args.notNull(charsetName, "charsetName"); @@ -198,7 +200,7 @@ public String encode(final String s, final String charsetName) * encoding to use * @return encoded string */ - public String encode(final String unsafeInput, final Charset charset) + public String encode(final String unsafeInput, @Nonnull final Charset charset) { if (unsafeInput == null || unsafeInput.isEmpty()) { diff --git a/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleanerTrackerAdapter.java b/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleanerTrackerAdapter.java index 059ef49fb01..07ec866414a 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleanerTrackerAdapter.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/file/FileCleanerTrackerAdapter.java @@ -17,6 +17,8 @@ package org.apache.wicket.util.file; +import jakarta.annotation.Nonnull; + import org.apache.commons.io.FileCleaningTracker; import org.apache.commons.io.FileDeleteStrategy; import org.apache.wicket.util.lang.Args; @@ -34,7 +36,7 @@ public class FileCleanerTrackerAdapter extends FileCleaningTracker * @param fileCleaner * the cleaner to adapt */ - public FileCleanerTrackerAdapter(IFileCleaner fileCleaner) + public FileCleanerTrackerAdapter(@Nonnull IFileCleaner fileCleaner) { this.fileCleaner = Args.notNull(fileCleaner, "fileCleaner"); } diff --git a/wicket-util/src/main/java/org/apache/wicket/util/file/Files.java b/wicket-util/src/main/java/org/apache/wicket/util/file/Files.java index e8ba6164a73..95858eb6017 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/file/Files.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/file/Files.java @@ -26,6 +26,9 @@ import java.net.URL; import java.nio.charset.StandardCharsets; import java.time.Instant; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.encoding.UrlDecoder; import org.apache.wicket.util.io.IOUtils; import org.apache.wicket.util.io.Streams; @@ -191,7 +194,7 @@ public static boolean removeFolder(final File folder) * @return {@code false} if the {@code file} is null or a folder, {@code true} - * otherwise (i.e. if it is scheduled) */ - public static boolean removeAsync(final File file, final IFileCleaner fileCleaner) + public static boolean removeAsync(final File file, @Nonnull final IFileCleaner fileCleaner) { if (file == null || file.isDirectory()) { @@ -216,7 +219,7 @@ public static boolean removeAsync(final File file, final IFileCleaner fileCleane * @return {@code false} if the {@code folder} is null or a normal file, {@code true} - * otherwise (i.e. if it is scheduled) */ - public static boolean removeFolderAsync(final File folder, final IFileCleaner fileCleaner) + public static boolean removeFolderAsync(final File folder, @Nonnull final IFileCleaner fileCleaner) { if (folder == null || folder.isFile()) { @@ -361,7 +364,7 @@ public static void copy(final File sourceFile, final File targetFile) throws IOE * * @see #getLocalFileFromUrl(String) */ - public static File getLocalFileFromUrl(URL url) + public static File getLocalFileFromUrl(@Nonnull URL url) { final URL location = Args.notNull(url, "url"); return getLocalFileFromUrl(UrlDecoder.PATH_INSTANCE.decode(location.toExternalForm(), StandardCharsets.UTF_8)); @@ -378,7 +381,7 @@ public static File getLocalFileFromUrl(URL url) * * @see #getLocalFileFromUrl(URL) */ - public static File getLocalFileFromUrl(String url) + public static File getLocalFileFromUrl(@Nonnull String url) { final String location = Args.notNull(url, "url"); diff --git a/wicket-util/src/main/java/org/apache/wicket/util/file/IResourceFinder.java b/wicket-util/src/main/java/org/apache/wicket/util/file/IResourceFinder.java index 931c91bb31e..f22efb4fc96 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/file/IResourceFinder.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/file/IResourceFinder.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.util.file; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.resource.IResourceStream; /** @@ -35,5 +37,5 @@ public interface IResourceFinder * The filename with possible path * @return The resource stream */ - IResourceStream find(final Class clazz, final String pathname); + IResourceStream find(final Class clazz, @Nonnull final String pathname); } diff --git a/wicket-util/src/main/java/org/apache/wicket/util/file/Path.java b/wicket-util/src/main/java/org/apache/wicket/util/file/Path.java index bf2f25a5962..90cb2ae2792 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/file/Path.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/file/Path.java @@ -18,6 +18,8 @@ import java.io.IOException; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.resource.FileResourceStream; import org.apache.wicket.util.resource.IResourceStream; @@ -68,7 +70,7 @@ public Path(final Folder folder) * @see org.apache.wicket.util.file.IResourceFinder#find(Class, String) */ @Override - public IResourceStream find(final Class clazz, final String pathname) + public IResourceStream find(final Class clazz, @Nonnull final String pathname) { final File file = new File(folder, pathname); diff --git a/wicket-util/src/main/java/org/apache/wicket/util/io/DeferredFileOutputStream.java b/wicket-util/src/main/java/org/apache/wicket/util/io/DeferredFileOutputStream.java index 20fd966e7fa..3d033313a58 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/io/DeferredFileOutputStream.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/io/DeferredFileOutputStream.java @@ -21,6 +21,8 @@ import java.io.IOException; import java.io.OutputStream; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; @@ -67,7 +69,7 @@ public class DeferredFileOutputStream extends ThresholdingOutputStream * @param outputFile * The file to which data is saved beyond the threshold. */ - public DeferredFileOutputStream(final int threshold, final File outputFile) + public DeferredFileOutputStream(final int threshold, @Nonnull final File outputFile) { super(threshold); @@ -87,7 +89,7 @@ public DeferredFileOutputStream(final int threshold, final File outputFile) * @param fileFactory * The FileFactory to create the file. */ - public DeferredFileOutputStream(final int threshold, final FileFactory fileFactory) + public DeferredFileOutputStream(final int threshold, @Nonnull final FileFactory fileFactory) { super(threshold); this.fileFactory = Args.notNull(fileFactory, "fileFactory"); diff --git a/wicket-util/src/main/java/org/apache/wicket/util/io/Streams.java b/wicket-util/src/main/java/org/apache/wicket/util/io/Streams.java index 131f5fcf33e..535197f5438 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/io/Streams.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/io/Streams.java @@ -26,6 +26,8 @@ import java.net.URLConnection; import java.util.Properties; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; /** @@ -144,7 +146,7 @@ public static void loadFromXml(final Properties properties, final InputStream in * @return the input stream for this url * @throws IOException when a connection cannot be opened */ - public static InputStream readNonCaching(final URL url) throws IOException + public static InputStream readNonCaching(@Nonnull final URL url) throws IOException { Args.notNull(url, "url"); diff --git a/wicket-util/src/main/java/org/apache/wicket/util/io/XmlReader.java b/wicket-util/src/main/java/org/apache/wicket/util/io/XmlReader.java index accc68c799e..7a3c75b1928 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/io/XmlReader.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/io/XmlReader.java @@ -24,6 +24,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.string.Strings; @@ -63,7 +65,7 @@ public final class XmlReader extends Reader * @throws IOException * In case something went wrong while reading the data */ - public XmlReader(final InputStream inputStream, final String defaultEncoding) + public XmlReader(@Nonnull final InputStream inputStream, final String defaultEncoding) throws IOException { Args.notNull(inputStream, "inputStream"); diff --git a/wicket-util/src/main/java/org/apache/wicket/util/lang/Args.java b/wicket-util/src/main/java/org/apache/wicket/util/lang/Args.java index 3d8c9e56ba5..2a89e7ff046 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/lang/Args.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/lang/Args.java @@ -18,6 +18,8 @@ import java.util.Collection; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.string.Strings; /** @@ -135,8 +137,8 @@ public static > T notEmpty(final T collection, final Str * @return the {code value} * @throws IllegalArgumentException */ - public static > T withinRange(final T min, final T max, - final T value, final String name) + public static > T withinRange(@Nonnull final T min, @Nonnull final T max, + @Nonnull final T value, final String name) { notNull(min, name); notNull(max, name); diff --git a/wicket-util/src/main/java/org/apache/wicket/util/lang/Checks.java b/wicket-util/src/main/java/org/apache/wicket/util/lang/Checks.java index 6dd414df64f..a86b360dc83 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/lang/Checks.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/lang/Checks.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.util.lang; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.string.Strings; /** @@ -65,8 +67,8 @@ public static void notEmpty(final String argument, final String message, final O * @param message * @throws IllegalStateException */ - public static > void withinRange(final T min, final T max, - final T value, final String message) + public static > void withinRange(@Nonnull final T min, @Nonnull final T max, + @Nonnull final T value, final String message) { notNull(min, message); notNull(max, message); @@ -111,8 +113,8 @@ public static void notEmptyShort(final String argument, final String name) * @param name * @throws IllegalStateException */ - public static > void withinRangeShort(final T min, final T max, - final T value, final String name) + public static > void withinRangeShort(@Nonnull final T min, @Nonnull final T max, + @Nonnull final T value, final String name) { withinRange(min, max, value, String.format("%s must have a value within [%s,%s], but was %s", name, min, max, value)); diff --git a/wicket-util/src/main/java/org/apache/wicket/util/lang/Threads.java b/wicket-util/src/main/java/org/apache/wicket/util/lang/Threads.java index 7f0ffdc1276..5f5ba41ef88 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/lang/Threads.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/lang/Threads.java @@ -22,6 +22,8 @@ import java.util.Map; import java.util.Map.Entry; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.string.interpolator.MapVariableInterpolator; import org.slf4j.Logger; @@ -49,7 +51,7 @@ private Threads() * @param logger * the logger where the collected information will be written */ - public static void dumpAllThreads(Logger logger) + public static void dumpAllThreads(@Nonnull Logger logger) { Args.notNull(logger, "logger"); if (!logger.isWarnEnabled()) @@ -89,7 +91,7 @@ public static void dumpAllThreads(Logger logger) * @param thread * the thread to dump */ - public static void dumpSingleThread(Logger logger, Thread thread) + public static void dumpSingleThread(@Nonnull Logger logger, Thread thread) { Args.notNull(logger, "logger"); if (!logger.isWarnEnabled()) diff --git a/wicket-util/src/main/java/org/apache/wicket/util/resource/FileResourceStream.java b/wicket-util/src/main/java/org/apache/wicket/util/resource/FileResourceStream.java index 87e2b201712..359b758fe5d 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/resource/FileResourceStream.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/resource/FileResourceStream.java @@ -22,6 +22,9 @@ import java.io.InputStream; import java.net.URLConnection; import java.time.Instant; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.file.File; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.lang.Bytes; @@ -52,7 +55,7 @@ public class FileResourceStream extends AbstractResourceStream * @param file * {@link File} containing resource */ - public FileResourceStream(final File file) + public FileResourceStream(@Nonnull final File file) { Args.notNull(file, "file"); this.file = file; diff --git a/wicket-util/src/main/java/org/apache/wicket/util/resource/FileSystemResourceStream.java b/wicket-util/src/main/java/org/apache/wicket/util/resource/FileSystemResourceStream.java index aae172bc410..13a1986e18a 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/resource/FileSystemResourceStream.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/resource/FileSystemResourceStream.java @@ -24,6 +24,9 @@ import java.nio.file.attribute.BasicFileAttributes; import java.nio.file.attribute.FileTime; import java.time.Instant; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.file.File; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.lang.Bytes; @@ -53,7 +56,7 @@ public class FileSystemResourceStream extends AbstractResourceStream * @param path * {@link Path} containing resource */ - public FileSystemResourceStream(final Path path) + public FileSystemResourceStream(@Nonnull final Path path) { Args.notNull(path, "path"); this.path = path; @@ -65,7 +68,7 @@ public FileSystemResourceStream(final Path path) * @param file * {@link java.io.File} containing resource */ - public FileSystemResourceStream(final java.io.File file) + public FileSystemResourceStream(@Nonnull final java.io.File file) { Args.notNull(file, "file"); this.path = file.toPath(); @@ -77,7 +80,7 @@ public FileSystemResourceStream(final java.io.File file) * @param file * {@link File} containing resource */ - public FileSystemResourceStream(final File file) + public FileSystemResourceStream(@Nonnull final File file) { Args.notNull(file, "file"); this.path = file.toPath(); diff --git a/wicket-util/src/main/java/org/apache/wicket/util/resource/ResourceStreamWrapper.java b/wicket-util/src/main/java/org/apache/wicket/util/resource/ResourceStreamWrapper.java index bc5a6119b1a..c082c278ccd 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/resource/ResourceStreamWrapper.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/resource/ResourceStreamWrapper.java @@ -20,6 +20,9 @@ import java.io.InputStream; import java.time.Instant; import java.util.Locale; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.lang.Bytes; @@ -37,7 +40,7 @@ public class ResourceStreamWrapper implements IResourceStream * * @param delegate */ - public ResourceStreamWrapper(IResourceStream delegate) + public ResourceStreamWrapper(@Nonnull IResourceStream delegate) { this.delegate = Args.notNull(delegate, "delegate"); } diff --git a/wicket-util/src/main/java/org/apache/wicket/util/resource/ZipResourceStream.java b/wicket-util/src/main/java/org/apache/wicket/util/resource/ZipResourceStream.java index bc9d3c3764a..da41ff5f686 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/resource/ZipResourceStream.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/resource/ZipResourceStream.java @@ -25,6 +25,9 @@ import java.time.Instant; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; + +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.file.File; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.lang.Bytes; @@ -67,7 +70,7 @@ public class ZipResourceStream extends AbstractResourceStream * @param recursive * If true, all subdirs will be zipped as well */ - public ZipResourceStream(final File dir, final boolean recursive) + public ZipResourceStream(@Nonnull final File dir, final boolean recursive) { Args.notNull(dir, "dir"); Args.isTrue(dir.isDirectory(), "Not a directory: '{}'", dir); @@ -119,7 +122,7 @@ public ZipResourceStream(final File dir) * If true, all subdirs will be zipped as well * @throws IOException */ - private static void zipDir(final File dir, final ZipOutputStream out, final String path, + private static void zipDir(@Nonnull final File dir, final ZipOutputStream out, final String path, final boolean recursive) throws IOException { Args.notNull(dir, "dir"); diff --git a/wicket-util/src/main/java/org/apache/wicket/util/string/StringValue.java b/wicket-util/src/main/java/org/apache/wicket/util/string/StringValue.java index 7e991c2179d..a528799ea1e 100755 --- a/wicket-util/src/main/java/org/apache/wicket/util/string/StringValue.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/string/StringValue.java @@ -25,6 +25,8 @@ import java.time.format.DateTimeParseException; import java.util.Locale; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.io.IClusterable; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.lang.Objects; @@ -901,7 +903,7 @@ public final > T toEnum(Class eClass) throws StringValueCon * @return The value as an enum */ @SuppressWarnings("unchecked") - public final > T toEnum(final T defaultValue) + public final > T toEnum(@Nonnull final T defaultValue) { Args.notNull(defaultValue, "defaultValue"); return toEnum((Class)defaultValue.getClass(), defaultValue); diff --git a/wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java b/wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java index 70d8d7195f4..5a1eb120d12 100755 --- a/wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/string/Strings.java @@ -24,6 +24,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; /** @@ -1311,7 +1313,7 @@ private static char toHex(final int nibble) * (optional) character set to use when converting string to bytes * @return length of string in bytes */ - public static int lengthInBytes(final String string, final Charset charset) + public static int lengthInBytes(@Nonnull final String string, final Charset charset) { Args.notNull(string, "string"); if (charset != null) @@ -1518,7 +1520,7 @@ else if (m == 0) * * @return hex string */ - public static String toHexString(byte[] bytes) + public static String toHexString(@Nonnull byte[] bytes) { Args.notNull(bytes, "bytes"); @@ -1542,7 +1544,7 @@ public static String toHexString(byte[] bytes) * the enum type * @return an enum value */ - public static > T toEnum(final CharSequence value, final Class enumClass) + public static > T toEnum(@Nonnull final CharSequence value, @Nonnull final Class enumClass) { Args.notNull(enumClass, "enumClass"); Args.notNull(value, "value"); diff --git a/wicket-util/src/main/java/org/apache/wicket/util/value/LongValue.java b/wicket-util/src/main/java/org/apache/wicket/util/value/LongValue.java index 3e5e4bc42c9..4f7fabb8f9d 100755 --- a/wicket-util/src/main/java/org/apache/wicket/util/value/LongValue.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/value/LongValue.java @@ -18,6 +18,8 @@ import java.io.Serializable; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.lang.Primitives; @@ -227,7 +229,7 @@ public String toString() * if either argument is {@code null} * @return min value */ - public static T min(final T lhs, final T rhs) + public static T min(@Nonnull final T lhs, @Nonnull final T rhs) { Args.notNull(lhs, "lhs"); Args.notNull(rhs, "rhs"); @@ -248,7 +250,7 @@ public static T min(final T lhs, final T rhs) * if either argument is {@code null} * @return max value */ - public static T max(final T lhs, final T rhs) + public static T max(@Nonnull final T lhs, @Nonnull final T rhs) { Args.notNull(lhs, "lhs"); Args.notNull(rhs, "rhs"); diff --git a/wicket-util/src/main/java/org/apache/wicket/util/visit/ClassVisitFilter.java b/wicket-util/src/main/java/org/apache/wicket/util/visit/ClassVisitFilter.java index 2fe3b4b0f29..44b771d0c81 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/visit/ClassVisitFilter.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/visit/ClassVisitFilter.java @@ -16,6 +16,8 @@ */ package org.apache.wicket.util.visit; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; /** @@ -33,7 +35,7 @@ public class ClassVisitFilter implements IVisitFilter * @param clazz * class of objects that visitors should be restricted to */ - public ClassVisitFilter(final Class clazz) + public ClassVisitFilter(@Nonnull final Class clazz) { Args.notNull(clazz, "clazz"); diff --git a/wicket-util/src/main/java/org/apache/wicket/util/visit/Visits.java b/wicket-util/src/main/java/org/apache/wicket/util/visit/Visits.java index 562e7d41477..2080b0b6c77 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/visit/Visits.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/visit/Visits.java @@ -19,6 +19,8 @@ import java.util.Collections; import java.util.Iterator; +import jakarta.annotation.Nonnull; + import org.apache.wicket.util.lang.Args; /** @@ -126,7 +128,7 @@ public static R visitChildren(final Iterable container, @SuppressWarnings("unchecked") private static void visitChildren(final Iterable container, - final IVisitor visitor, final IVisitFilter filter, final Visit visit) + @Nonnull final IVisitor visitor, final IVisitFilter filter, final Visit visit) { Args.notNull(visitor, "visitor"); @@ -237,7 +239,7 @@ public static R visitPostOrder(final S root, * @return return value from the {@code visitor} or {@code null} if none */ public static R visitPostOrder(final Object root, - final org.apache.wicket.util.visit.IVisitor visitor, final IVisitFilter filter) + @Nonnull final org.apache.wicket.util.visit.IVisitor visitor, final IVisitFilter filter) { Args.notNull(visitor, "visitor"); diff --git a/wicket-util/src/main/java/org/apache/wicket/util/xml/CustomEntityResolver.java b/wicket-util/src/main/java/org/apache/wicket/util/xml/CustomEntityResolver.java index 46326c099a7..e2b93a31a7b 100644 --- a/wicket-util/src/main/java/org/apache/wicket/util/xml/CustomEntityResolver.java +++ b/wicket-util/src/main/java/org/apache/wicket/util/xml/CustomEntityResolver.java @@ -21,6 +21,7 @@ import java.util.HashMap; import java.util.Map; +import jakarta.annotation.Nonnull; import jakarta.servlet.Filter; import org.apache.wicket.util.lang.Args; @@ -62,7 +63,7 @@ public static CustomEntityResolver getPreloaded() * @param locator * locator for looking up entity */ - public void put(final EntityKey key, final EntityLocator locator) + public void put(@Nonnull final EntityKey key, @Nonnull final EntityLocator locator) { Args.notNull(key, "key"); Args.notNull(locator, "locator"); @@ -94,7 +95,7 @@ public static class EntityKey private final String id; private final String url; - private EntityKey(final String id, final String url) + private EntityKey(@Nonnull final String id, @Nonnull final String url) { Args.notEmpty(id, "id"); Args.notEmpty(url, "url"); diff --git a/wicket-velocity/pom.xml b/wicket-velocity/pom.xml index ed3776f134a..d06fdd4fbac 100644 --- a/wicket-velocity/pom.xml +++ b/wicket-velocity/pom.xml @@ -36,6 +36,10 @@ !java*,!kotlin*,!sun.nio.ch,org.slf4j*;version="[1.7,3)",* + + jakarta.annotation + jakarta.annotation-api + org.apache.velocity velocity-engine-core diff --git a/wicket-velocity/src/main/java/module-info.java b/wicket-velocity/src/main/java/module-info.java index ad8eb7ea2a4..c6ccb387857 100644 --- a/wicket-velocity/src/main/java/module-info.java +++ b/wicket-velocity/src/main/java/module-info.java @@ -21,6 +21,7 @@ requires org.apache.wicket.core; requires org.slf4j; requires velocity.engine.core; + requires jakarta.annotation; exports org.apache.wicket.velocity; } diff --git a/wicket-velocity/src/main/java/org/apache/wicket/velocity/VelocityContributor.java b/wicket-velocity/src/main/java/org/apache/wicket/velocity/VelocityContributor.java index 64bf10c997c..a6c79d30ed7 100644 --- a/wicket-velocity/src/main/java/org/apache/wicket/velocity/VelocityContributor.java +++ b/wicket-velocity/src/main/java/org/apache/wicket/velocity/VelocityContributor.java @@ -19,6 +19,8 @@ import java.io.StringWriter; import java.util.Map; +import jakarta.annotation.Nonnull; + import org.apache.velocity.VelocityContext; import org.apache.velocity.app.Velocity; import org.apache.wicket.Component; @@ -56,7 +58,7 @@ public class VelocityContributor extends Behavior * @param templateName * @param model */ - public VelocityContributor(final String templateName, final IModel> model) + public VelocityContributor(final String templateName, @Nonnull final IModel> model) { Args.notNull(model, "model");