You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by jd...@apache.org on 2025/07/15 22:48:49 UTC
(grails-core) 02/03: style: reformat grails-core per styling rules
This is an automated email from the ASF dual-hosted git repository.
jdaugherty pushed a commit to branch style-enforcement
in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 1fb64db53246582ad45af84f2a49dc6e90d1bf9b
Author: James Daugherty <jd...@jdresources.net>
AuthorDate: Sun Jul 13 22:19:23 2025 -0400
style: reformat grails-core per styling rules
---
etc/config/checkstyle/checkstyle.xml | 15 +-
etc/config/checkstyle/suppressions.xml | 31 +
gradle/style-enforcement-config.gradle | 7 +-
grails-async/core/build.gradle | 1 +
.../main/groovy/grails/async/DelegateAsync.groovy | 7 +-
.../main/groovy/grails/async/PromiseFactory.groovy | 12 +-
.../main/groovy/grails/async/PromiseList.groovy | 2 +-
.../src/main/groovy/grails/async/PromiseMap.groovy | 32 +-
.../src/main/groovy/grails/async/Promises.groovy | 48 +-
.../async/factory/AbstractPromiseFactory.groovy | 24 +-
.../org/grails/async/factory/BoundPromise.groovy | 3 +-
.../async/factory/PromiseFactoryBuilder.groovy | 7 +-
.../grails/async/factory/SynchronousPromise.groovy | 23 +-
.../async/factory/SynchronousPromiseFactory.groovy | 9 +-
.../future/CachedThreadPoolPromiseFactory.groovy | 24 +-
.../factory/future/ExecutorPromiseFactory.groovy | 1 -
.../factory/future/FutureTaskChildPromise.groovy | 16 +-
.../async/factory/future/FutureTaskPromise.groovy | 7 +-
...elegateAsyncTransactionalMethodTransformer.java | 1 +
.../internal/DelegateAsyncTransformation.java | 57 +-
.../transform/internal/DelegateAsyncUtils.groovy | 6 +-
grails-async/gpars/build.gradle | 1 +
.../grails/async/factory/gpars/GparsPromise.groovy | 6 +-
.../async/factory/gpars/GparsPromiseFactory.groovy | 29 +-
.../async/factory/gpars/LoggingPoolFactory.groovy | 15 +-
grails-async/plugin/build.gradle | 1 +
.../PersistenceContextPromiseDecorator.groovy | 7 +-
.../services/TransactionalPromiseDecorator.groovy | 7 +-
.../groovy/grails/async/web/AsyncController.groovy | 8 +-
.../grails/async/web/AsyncGrailsWebRequest.groovy | 26 +-
.../groovy/grails/async/web/WebPromises.groovy | 47 +-
...egateAsyncTransactionalMethodTransformer.groovy | 71 +-
.../async/TransactionalAsyncTransformUtils.groovy | 1 -
.../async/AsyncWebRequestPromiseDecorator.groovy | 39 +-
...WebRequestPromiseDecoratorLookupStrategy.groovy | 5 +-
.../web/async/ControllersAsyncGrailsPlugin.groovy | 12 +-
.../plugins/web/async/GrailsAsyncContext.groovy | 9 +-
.../async/mvc/AsyncActionResultTransformer.groovy | 19 +-
.../web/async/spring/PromiseFactoryBean.groovy | 2 +-
grails-async/rxjava/build.gradle | 1 +
.../grails/async/factory/rxjava/RxPromise.groovy | 29 +-
.../async/factory/rxjava/RxPromiseFactory.groovy | 23 +-
.../factory/rxjava/RxJavaPromiseListSpec.groovy | 1 -
.../factory/rxjava/RxJavaPromiseMapSpec.groovy | 1 -
.../async/factory/rxjava/RxJavaPromiseSpec.groovy | 1 -
grails-async/rxjava2/build.gradle | 1 +
.../grails/async/factory/rxjava2/RxPromise.groovy | 23 +-
.../async/factory/rxjava2/RxPromiseFactory.groovy | 25 +-
.../async/factory/rxjava2/RxPromiseSpec.groovy | 1 -
grails-async/rxjava3/build.gradle | 1 +
.../grails/async/factory/rxjava3/RxPromise.groovy | 22 +-
.../async/factory/rxjava3/RxPromiseFactory.groovy | 25 +-
.../async/factory/rxjava3/RxPromiseSpec.groovy | 1 -
grails-bom/build.gradle | 1 +
grails-bootstrap/build.gradle | 1 +
.../groovy/grails/build/logging/ConsoleLogger.java | 7 +-
.../groovy/grails/build/logging/GrailsConsole.java | 105 +-
.../grails/build/logging/GrailsEclipseConsole.java | 3 +-
.../proxy/SystemPropertiesAuthenticator.groovy | 3 +-
.../build/support/MetaClassRegistryCleaner.java | 34 +-
.../main/groovy/grails/codegen/model/Model.groovy | 1 -
.../grails/codegen/model/ModelBuilder.groovy | 14 +-
.../src/main/groovy/grails/io/ResourceUtils.groovy | 21 +-
.../grails/io/support/SystemOutErrCapturer.groovy | 28 +-
.../io/support/SystemStreamsRedirector.groovy | 29 +-
.../groovy/grails/plugins/GrailsPluginInfo.java | 7 +-
.../grails/plugins/GrailsVersionUtils.groovy | 14 +-
.../groovy/grails/plugins/VersionComparator.groovy | 13 +-
.../grails/plugins/metadata/GrailsPlugin.java | 4 +-
.../grails/plugins/metadata/PluginSource.java | 1 +
.../groovy/grails/util/CosineSimilarity.groovy | 7 +-
.../src/main/groovy/grails/util/Described.groovy | 2 -
.../CandidateListCompletionHandler.java | 7 +-
.../build/logging/GrailsConsoleAntBuilder.java | 10 +-
.../build/logging/GrailsConsoleBuildListener.java | 16 +-
.../logging/GrailsConsoleErrorPrintStream.java | 2 +-
.../build/logging/GrailsConsolePrintStream.java | 2 +-
.../grails/build/parsing/ScriptNameResolver.groovy | 2 +-
.../groovy/org/grails/config/CodeGenConfig.groovy | 118 +-
.../groovy/org/grails/config/NavigableMap.groovy | 229 ++-
.../org/grails/exceptions/ExceptionUtils.groovy | 6 +-
.../reporting/DefaultStackTraceFilterer.java | 52 +-
.../reporting/DefaultStackTracePrinter.groovy | 8 +-
.../exceptions/reporting/SourceCodeAware.java | 1 +
.../exceptions/reporting/StackTraceFilterer.java | 7 +-
.../org/grails/io/support/AntPathMatcher.java | 240 +--
.../grails/io/support/DevNullPrintStream.groovy | 1 -
.../io/support/FileSystemResourceLoader.java | 5 +-
.../PathMatchingResourcePatternResolver.java | 65 +-
.../org/grails/io/support/ResourceLocator.java | 18 +-
.../grails/io/support/StaticResourceLoader.java | 1 -
.../grails/io/watch/AbstractDirectoryWatcher.java | 21 +-
.../org/grails/io/watch/DirectoryWatcher.java | 89 +-
.../watch/FileExtensionFileChangeListener.groovy | 5 +-
.../watch/MacOsWatchServiceDirectoryWatcher.java | 206 +-
.../grails/io/watch/PollingDirectoryWatcher.java | 40 +-
.../io/watch/WatchServiceDirectoryWatcher.java | 281 +--
grails-cache/build.gradle | 1 +
.../taglib/grails/plugin/cache/CacheTagLib.groovy | 1 -
.../ast/groovy/grails/plugin/cache/CacheEvict.java | 53 +-
.../ast/groovy/grails/plugin/cache/CachePut.java | 31 +-
.../ast/groovy/grails/plugin/cache/Cacheable.java | 4 +-
.../plugin/cache/CustomCacheKeyGenerator.groovy | 1 -
.../grails/plugin/cache/GrailsCacheManager.java | 27 +-
.../compiler/AbstractCacheTransformation.groovy | 39 +-
.../cache/compiler/CachePutTransformation.groovy | 10 +-
.../cache/compiler/CacheableTransformation.groovy | 14 +-
.../grails/plugin/cache/CacheException.groovy | 1 -
.../grails/plugin/cache/CacheGrailsPlugin.groovy | 2 -
.../plugin/cache/CachePluginConfiguration.groovy | 1 -
.../groovy/grails/plugin/cache/GrailsCache.java | 6 +-
.../plugin/cache/GrailsCacheAdminService.groovy | 8 +-
.../cache/GrailsConcurrentLinkedMapCache.java | 269 +--
.../GrailsConcurrentLinkedMapCacheManager.groovy | 64 +-
.../plugin/cache/GrailsConcurrentMapCache.java | 40 +-
.../cache/GrailsConcurrentMapCacheManager.groovy | 62 +-
.../grails/plugin/cache/GrailsValueWrapper.java | 16 +-
.../grails/plugin/cache/util/ClassUtils.java | 5 +-
.../grails/plugin/cache/CacheTagLibSpec.groovy | 1 -
.../grails/plugin/cache/CacheableParseSpec.groovy | 3 -
grails-codecs-core/build.gradle | 1 +
.../org/grails/plugins/codecs/DigestUtils.groovy | 6 +-
.../plugins/codecs/HexCodecExtensionMethods.groovy | 3 +-
.../codecs/MD5BytesCodecExtensionMethods.groovy | 2 +-
.../codecs/SHA1BytesCodecExtensionMethods.groovy | 2 +-
.../codecs/SHA1CodecExtensionMethods.groovy | 2 +-
.../codecs/SHA256BytesCodecExtensionMethods.groovy | 2 +-
.../codecs/SHA256CodecExtensionMethods.groovy | 2 +-
grails-codecs/build.gradle | 1 +
.../org/grails/commons/CodecArtefactHandler.java | 4 +-
.../grails/commons/DefaultGrailsCodecClass.java | 156 +-
.../org/grails/commons/GrailsCodecClass.java | 3 +-
.../plugins/codecs/CodecsGrailsPlugin.groovy | 1 +
.../grails/plugins/codecs/DefaultCodecLookup.java | 17 +-
.../org/grails/plugins/codecs/HTMLCodec.java | 16 +-
.../org/grails/plugins/codecs/URLCodec.groovy | 1 +
grails-common/build.gradle | 1 +
.../AbstractRecursiveAnnotationVisitor.java | 42 +-
.../AnnotationAttributesReadingVisitor.java | 48 +-
.../AnnotationMetadataReadingVisitor.java | 45 +-
.../annotation/AnnotationReadingVisitorUtils.java | 68 +-
.../annotation/ClassMetadataReadingVisitor.java | 40 +-
.../annotation/MethodMetadataReadingVisitor.java | 38 +-
.../RecursiveAnnotationArrayVisitor.java | 46 +-
.../RecursiveAnnotationAttributesVisitor.java | 30 +-
.../common/compiler/GroovyTransformOrder.groovy | 27 +-
.../compiler/asm/AnnotationMetadataReader.java | 48 +-
.../grails/common/compiler/asm/Attribute.java | 208 +-
.../grails/common/compiler/asm/ByteVector.java | 100 +-
.../grails/common/compiler/asm/ClassReader.java | 435 ++---
.../apache/grails/common/compiler/asm/Context.java | 43 +-
.../grails/common/compiler/asm/TypePath.java | 77 +-
.../common/properties/PropertyFileUtils.groovy | 26 +-
grails-console/build.gradle | 1 +
.../GrailsApplicationContextCommandRunner.groovy | 29 +-
.../grails/ui/console/GrailsSwingConsole.groovy | 14 +-
.../support/GroovyConsoleApplicationContext.groovy | 1 -
.../GroovyConsoleWebApplicationContext.groovy | 5 -
.../ui/script/GrailsApplicationScriptRunner.groovy | 3 +-
.../main/groovy/grails/ui/shell/GrailsShell.groovy | 13 +-
.../ui/support/DevelopmentGrailsApplication.groovy | 1 -
.../DevelopmentWebApplicationContext.groovy | 1 -
grails-controllers/build.gradle | 1 +
.../main/groovy/grails/artefact/Controller.groovy | 80 +-
.../controller/support/AllowedMethodsHelper.groovy | 7 +-
.../controller/support/RequestForwarder.groovy | 30 +-
.../controller/support/ResponseRedirector.groovy | 23 +-
.../controller/support/ResponseRenderer.groovy | 32 +-
.../compiler/traits/ControllerTraitInjector.groovy | 2 +-
.../src/main/groovy/grails/web/Controller.groovy | 3 +-
.../compiler/web/ControllerActionTransformer.java | 387 ++--
.../web/ControllerArtefactTypeTransformation.java | 6 +-
.../compiler/web/ControllerDomainTransformer.java | 2 +-
.../ControllerExceptionHandlerMetaData.java | 3 +
.../controllers/ControllersAutoConfiguration.java | 13 +-
.../web/controllers/ControllersGrailsPlugin.groovy | 82 +-
...efaultControllerExceptionHandlerMetaData.groovy | 1 +
.../api/ControllersDomainBindingApi.java | 14 +-
.../controllers/metaclass/RenderDynamicMethod.java | 3 +-
.../servlet/context/BootStrapClassRunner.groovy | 17 +-
.../web/servlet/mvc/InvalidResponseHandler.groovy | 1 -
.../web/servlet/mvc/ValidResponseHandler.groovy | 1 -
.../support/AllowedMethodsHelperSpec.groovy | 3 -
.../controller/support/RequestForwarderSpec.groovy | 1 -
.../web/ControllerActionTransformerSpec.groovy | 4 -
grails-converters/build.gradle | 1 +
.../src/main/groovy/grails/converters/JSON.java | 167 +-
.../src/main/groovy/grails/converters/XML.java | 91 +-
.../main/groovy/grails/encoders/JSONEncoder.java | 4 +-
.../main/groovy/grails/encoders/XMLEncoder.java | 6 +-
.../src/main/groovy/grails/web/JSONBuilder.groovy | 27 +-
.../converters/ConvertersDomainTransformer.java | 2 +-
.../web/converters/RenderConverterTrait.groovy | 6 +-
.../org/grails/plugins/codecs/JSONCodec.java | 4 +-
.../groovy/org/grails/plugins/codecs/XMLCodec.java | 4 +-
.../converters/ConvertersGrailsPlugin.groovy | 32 +-
.../plugins/converters/api/ConvertersApi.java | 6 +-
.../grails/web/converters/AbstractConverter.java | 4 +-
...AbstractParsingParameterCreationListener.groovy | 20 +-
.../web/converters/ConfigurableConverter.groovy | 2 +-
.../org/grails/web/converters/Converter.java | 12 +-
.../org/grails/web/converters/ConverterUtil.java | 37 +-
.../web/converters/ConvertersExtension.groovy | 25 +-
.../ChainedConverterConfiguration.java | 32 +-
.../configuration/ConverterConfiguration.java | 15 +-
.../ConvertersConfigurationHolder.java | 38 +-
.../ConvertersConfigurationInitializer.java | 64 +-
.../DefaultConverterConfiguration.java | 115 +-
.../ImmutableConverterConfiguration.java | 7 +-
.../web/converters/configuration/configtest.groovy | 19 +-
.../converters/exceptions/ConverterException.java | 1 -
.../marshaller/ByDatasourceDomainClassFetcher.java | 6 +-
.../ByGrailsApplicationDomainClassFetcher.java | 3 +-
.../marshaller/ClosureObjectMarshaller.java | 10 +-
.../converters/marshaller/DomainClassFetcher.java | 3 +-
.../IncludeExcludePropertyMarshaller.java | 4 +-
.../converters/marshaller/NameAwareMarshaller.java | 1 +
.../converters/marshaller/ObjectMarshaller.java | 5 +-
.../marshaller/ProxyUnwrappingMarshaller.java | 12 +-
.../marshaller/json/ArrayMarshaller.java | 7 +-
.../marshaller/json/ByteArrayMarshaller.java | 1 -
.../marshaller/json/CollectionMarshaller.java | 7 +-
.../converters/marshaller/json/DateMarshaller.java | 13 +-
.../marshaller/json/DomainClassMarshaller.java | 109 +-
.../converters/marshaller/json/EnumMarshaller.java | 20 +-
.../marshaller/json/GenericJavaBeanMarshaller.java | 42 +-
.../marshaller/json/GroovyBeanMarshaller.java | 38 +-
.../json/InstanceMethodBasedMarshaller.java | 14 +-
.../marshaller/json/JavascriptDateMarshaller.java | 11 +-
.../converters/marshaller/json/MapMarshaller.java | 11 +-
.../marshaller/json/ToStringBeanMarshaller.java | 5 +-
.../json/ValidationErrorsMarshaller.java | 19 +-
.../converters/marshaller/xml/ArrayMarshaller.java | 6 +-
.../marshaller/xml/Base64ByteArrayMarshaller.java | 15 +-
.../marshaller/xml/CollectionMarshaller.java | 10 +-
.../converters/marshaller/xml/DateMarshaller.java | 13 +-
.../marshaller/xml/DeepDomainClassMarshaller.java | 1 -
.../marshaller/xml/DomainClassMarshaller.java | 82 +-
.../converters/marshaller/xml/EnumMarshaller.java | 14 +-
.../marshaller/xml/GenericJavaBeanMarshaller.java | 13 +-
.../marshaller/xml/GroovyBeanMarshaller.java | 47 +-
.../xml/InstanceMethodBasedMarshaller.java | 12 +-
.../converters/marshaller/xml/MapMarshaller.java | 9 +-
.../marshaller/xml/ToStringBeanMarshaller.java | 5 +-
.../marshaller/xml/ValidationErrorsMarshaller.java | 17 +-
.../json/DomainClassMarshallerSpec.groovy | 1 -
grails-core/build.gradle | 1 +
.../src/main/groovy/grails/artefact/Enhanced.java | 3 +
.../grails/beans/util/LazyMetaPropertyMap.java | 41 +-
.../src/main/groovy/grails/boot/GrailsApp.groovy | 19 +-
.../groovy/grails/boot/GrailsAppBuilder.groovy | 2 +-
.../config/GrailsApplicationPostProcessor.groovy | 56 +-
.../boot/config/GrailsAutoConfiguration.groovy | 17 +-
.../boot/config/tools/ClassPathScanner.groovy | 27 +-
.../ProfilingGrailsApplicationPostProcessor.groovy | 6 +-
.../grails/boot/config/tools/SettingsFile.groovy | 2 -
.../groovy/grails/compiler/DelegatingMethod.groovy | 1 -
.../grails/compiler/GrailsCompileStatic.groovy | 14 +-
.../grails/compiler/GrailsTypeChecked.groovy | 14 +-
.../compiler/ast/AnnotatedClassInjector.java | 3 +-
.../groovy/grails/compiler/ast/AstTransformer.java | 3 +-
.../groovy/grails/compiler/ast/ClassInjector.java | 16 +-
.../grails/compiler/ast/GlobalClassInjector.groovy | 2 +-
.../compiler/ast/GlobalClassInjectorAdapter.groovy | 2 +-
.../compiler/ast/GrailsDomainClassInjector.java | 1 -
.../grails/compiler/ast/SupportsClassNode.java | 3 +-
.../grails/compiler/traits/TraitInjector.java | 3 +-
.../src/main/groovy/grails/config/Config.groovy | 2 +-
.../groovy/grails/config/ConfigProperties.groovy | 9 +-
.../src/main/groovy/grails/config/Settings.groovy | 2 +-
...ilteringMap.groovy => WriteFilteringMap.groovy} | 0
.../groovy/grails/core/ApplicationAttributes.java | 1 +
.../main/groovy/grails/core/ArtefactHandler.java | 12 +-
.../groovy/grails/core/ArtefactHandlerAdapter.java | 49 +-
.../src/main/groovy/grails/core/ArtefactInfo.java | 7 +-
.../groovy/grails/core/DefaultArtefactInfo.java | 16 +-
.../grails/core/DefaultGrailsApplication.java | 135 +-
.../main/groovy/grails/core/GrailsApplication.java | 46 +-
.../grails/core/GrailsApplicationClass.groovy | 1 -
.../core/GrailsApplicationLifeCycleAdapter.groovy | 4 +-
.../src/main/groovy/grails/core/GrailsClass.java | 13 +-
.../groovy/grails/core/GrailsControllerClass.java | 8 +-
.../main/groovy/grails/core/GrailsDataSource.java | 2 +
.../main/groovy/grails/core/GrailsDomainClass.java | 7 +-
.../groovy/grails/core/GrailsServiceClass.java | 2 +
.../groovy/grails/core/GrailsUrlMappingsClass.java | 3 +-
.../core/events/ArtefactAdditionEvent.groovy | 6 +-
.../core/support/GrailsApplicationAware.java | 3 +-
.../core/support/GrailsConfigurationAware.java | 1 -
.../support/ParentApplicationContextAware.java | 3 +-
.../core/support/proxy/EntityProxyHandler.java | 2 +-
.../grails/core/support/proxy/ProxyHandler.java | 5 +-
.../grails/dev/commands/ApplicationCommand.groovy | 2 +-
.../ApplicationContextCommandRegistry.groovy | 2 +-
.../dev/commands/GrailsApplicationCommand.groovy | 6 +-
.../dev/commands/io/FileSystemInteraction.groovy | 6 +-
.../commands/io/FileSystemInteractionImpl.groovy | 49 +-
.../dev/commands/template/TemplateException.groovy | 1 -
.../dev/commands/template/TemplateRenderer.groovy | 7 +-
.../commands/template/TemplateRendererImpl.groovy | 4 +-
.../src/main/groovy/grails/persistence/Entity.java | 4 +-
.../src/main/groovy/grails/persistence/Event.java | 8 +-
.../grails/persistence/PersistenceMethod.java | 1 +
.../support/NullPersistentContextInterceptor.java | 1 +
.../support/PersistenceContextInterceptor.java | 3 +-
.../PersistenceContextInterceptorExecutor.groovy | 2 -
.../grails/plugins/DefaultGrailsPluginManager.java | 35 +-
.../main/groovy/grails/plugins/GrailsPlugin.java | 18 +-
.../groovy/grails/plugins/GrailsPluginManager.java | 37 +-
.../src/main/groovy/grails/plugins/Plugin.groovy | 20 +-
.../main/groovy/grails/plugins/PluginFilter.java | 3 +-
.../groovy/grails/plugins/PluginManagerAware.java | 3 +-
.../grails/util/AbstractTypeConvertingMap.java | 127 +-
.../src/main/groovy/grails/util/CacheEntry.java | 103 +-
.../groovy/grails/util/ClosureToMapPopulator.java | 12 +-
.../src/main/groovy/grails/util/DomainBuilder.java | 27 +-
.../src/main/groovy/grails/util/ExtendedProxy.java | 14 +-
.../groovy/grails/util/GrailsArrayUtils.groovy | 38 +-
.../main/groovy/grails/util/GrailsClassUtils.java | 186 +-
.../grails/util/GrailsMessageSourceUtils.groovy | 16 +-
.../groovy/grails/util/GrailsMetaClassUtils.java | 70 +-
.../groovy/grails/util/GrailsStringUtils.groovy | 40 +-
.../src/main/groovy/grails/util/GrailsUtil.java | 24 +-
.../src/main/groovy/grails/util/Holders.java | 34 +-
grails-core/src/main/groovy/grails/util/Mixin.java | 8 +-
.../groovy/grails/util/MixinTargetAware.groovy | 2 +-
grails-core/src/main/groovy/grails/util/Pair.java | 27 +-
.../src/main/groovy/grails/util/Triple.java | 34 +-
.../groovy/grails/util/TypeConvertingMap.groovy | 1 +
.../main/groovy/grails/validation/Constrained.java | 4 +-
.../grails/validation/ConstraintsEvaluator.java | 9 +-
.../grails/validation/DeferredBindingActions.java | 4 +-
.../grails/validation/ValidationException.java | 11 +-
grails-core/src/main/groovy/grails/web/Action.java | 1 +
.../groovy/grails/web/CamelCaseUrlConverter.java | 1 -
.../groovy/grails/web/HyphenatedUrlConverter.java | 1 -
.../src/main/groovy/grails/web/UrlConverter.java | 1 +
.../org/grails/beans/support/PropertiesEditor.java | 15 +-
.../boot/internal/EnableAutoConfiguration.java | 1 +
.../org/grails/boot/internal/JavaCompiler.groovy | 1 -
.../compiler/CriteriaTypeCheckingExtension.groovy | 30 +-
.../DomainMappingTypeCheckingExtension.groovy | 21 +-
.../DynamicFinderTypeCheckingExtension.groovy | 22 +-
.../HttpServletRequestTypeCheckingExtension.groovy | 7 +-
.../NamedQueryTypeCheckingExtension.groovy | 10 +-
...hipManagementMethodTypeCheckingExtension.groovy | 7 +-
.../ValidateableTypeCheckingExtension.groovy | 17 +-
.../WhereQueryTypeCheckingExtension.groovy | 30 +-
.../grails/compiler/injection/ASTErrorsHelper.java | 4 +-
.../injection/ASTValidationErrorsHelper.java | 27 +-
.../AbstractArtefactTypeAstTransformation.java | 12 +-
.../AbstractGrailsArtefactTransformer.java | 143 +-
.../injection/ApiDelegateTransformation.java | 11 +-
.../injection/ApplicationClassInjector.groovy | 16 +-
.../injection/ArtefactTypeAstTransformation.java | 60 +-
.../DefaultGrailsDomainClassInjector.java | 36 +-
.../injection/EnhancesTraitTransformation.groovy | 24 +-
.../injection/EntityASTTransformation.java | 14 +-
.../injection/GlobalImportTransformation.groovy | 3 +-
.../grails/compiler/injection/GrailsASTUtils.java | 470 +++--
.../compiler/injection/GrailsAwareClassLoader.java | 9 +-
.../injection/GrailsAwareInjectionOperation.java | 23 +-
.../GroovyEclipseCompilationHelper.groovy | 34 +-
.../compiler/injection/MixinTransformation.java | 41 +-
.../grails/compiler/injection/PluginAstReader.java | 39 +-
.../injection/TraitInjectionSupport.groovy | 8 +-
.../compiler/injection/TraitInjectionUtils.java | 40 +-
.../groovy/org/grails/config/CompositeConfig.java | 57 +-
.../config/EnvironmentAwarePropertySource.java | 28 +-
.../org/grails/config/NavigableMapConfig.java | 55 +-
.../config/NavigableMapPropertySource.groovy | 7 +-
.../groovy/org/grails/config/PrefixedConfig.java | 31 +-
.../grails/config/PrefixedMapPropertySource.groovy | 1 +
.../org/grails/config/PropertySourcesConfig.java | 26 +-
.../config/yaml/YamlPropertySourceLoader.java | 13 +-
.../org/grails/core/AbstractGrailsApplication.java | 1 +
.../org/grails/core/AbstractGrailsClass.java | 32 +-
.../grails/core/AbstractInjectableGrailsClass.java | 1 -
.../grails/core/DefaultGrailsControllerClass.java | 51 +-
.../org/grails/core/DefaultGrailsDomainClass.java | 25 +-
.../grails/core/DefaultGrailsUrlMappingsClass.java | 2 +-
.../AnnotationDomainClassArtefactHandler.java | 4 +-
.../core/artefact/ControllerArtefactHandler.java | 5 +-
.../core/artefact/DomainClassArtefactHandler.java | 28 +-
.../grails/core/cfg/CustomSafeConstructor.groovy | 4 +-
.../cfg/GroovyConfigPropertySourceLoader.groovy | 17 +-
.../core/exceptions/DefaultErrorsPrinter.groovy | 22 +-
...chingPathMatchingResourcePatternResolver.groovy | 3 +-
.../org/grails/core/io/DefaultResourceLocator.java | 37 +-
.../grails/core/io/GrailsByteArrayResource.java | 4 +-
.../org/grails/core/io/GrailsResource.groovy | 2 +-
.../org/grails/core/io/MockFileResource.java | 4 +-
.../org/grails/core/io/MockResourceLoader.java | 4 +-
.../grails/core/io/MockStringResourceLoader.java | 8 +-
.../PluginPathAwareFileSystemResourceLoader.java | 4 +-
.../groovy/org/grails/core/io/ResourceLocator.java | 4 +-
.../groovy/org/grails/core/io/SpringResource.java | 3 +-
.../org/grails/core/io/StaticResourceLoader.java | 14 +-
.../org/grails/core/io/StaticResourceLocator.java | 5 +-
.../core/io/support/GrailsFactoriesLoader.groovy | 29 +-
.../grails/core/lifecycle/ShutdownOperations.java | 29 +-
.../org/grails/core/support/ClassEditor.java | 13 +-
.../GrailsApplicationDiscoveryStrategy.groovy | 2 +-
.../internal/tools/ClassRelativeClassLoader.java | 20 +-
.../ClassRelativeResourcePatternResolver.java | 1 -
.../internal/tools/MetaClassChangeReporter.java | 5 +-
.../util/BeanCreationProfilingPostProcessor.java | 4 +-
.../groovy/org/grails/core/util/StopWatch.java | 36 +-
.../dev/support/DevelopmentShutdownHook.groovy | 3 +-
.../org/grails/plugins/AbstractGrailsPlugin.java | 77 +-
.../plugins/AbstractGrailsPluginManager.java | 121 +-
.../org/grails/plugins/BasePluginFilter.java | 26 +-
.../org/grails/plugins/BinaryGrailsPlugin.java | 65 +-
.../plugins/BinaryGrailsPluginDescriptor.java | 3 +-
.../org/grails/plugins/CoreGrailsPlugin.groovy | 136 +-
.../org/grails/plugins/CorePluginFinder.java | 29 +-
.../org/grails/plugins/DefaultGrailsPlugin.java | 224 +--
.../org/grails/plugins/ExcludingPluginFilter.java | 4 +-
.../org/grails/plugins/IdentityPluginFilter.java | 2 +-
.../org/grails/plugins/IncludingPluginFilter.java | 2 +-
.../grails/plugins/MockGrailsPluginManager.java | 7 +-
.../org/grails/plugins/PluginFilterRetriever.java | 24 +-
.../plugins/ProfilingGrailsPluginManager.java | 11 +-
.../grails/plugins/core/CoreAutoConfiguration.java | 2 +-
.../grails/plugins/support/WatchPatternParser.java | 20 +-
.../spring/RuntimeSpringConfigUtilities.java | 31 +-
...vyAwareAspectJAwareAdvisorAutoProxyCreator.java | 6 -
.../beans/ClassLoaderAwareBeanPostProcessor.java | 2 +-
.../GrailsApplicationAwareBeanPostProcessor.java | 4 +-
.../beans/PluginManagerAwareBeanPostProcessor.java | 15 +-
.../beans/factory/GenericBeanFactoryAccessor.java | 12 +-
.../HotSwappableTargetSourceFactoryBean.groovy | 2 +-
.../spring/beans/factory/InstanceFactoryBean.java | 13 +-
.../context/ApplicationContextExtension.groovy | 7 +-
...sIgnoringComponentScanBeanDefinitionParser.java | 197 +-
.../spring/context/annotation/grails-context.xsd | 1 -
.../support/GrailsPlaceholderConfigurer.java | 11 +-
.../MapBasedSmartPropertyOverrideConfigurer.groovy | 10 +-
.../PluginAwareResourceBundleMessageSource.java | 57 +-
.../ReloadableResourceBundleMessageSource.java | 1143 +++++------
.../transaction/ChainedTransactionManager.java | 377 ++--
.../ChainedTransactionManagerPostProcessor.java | 111 +-
.../transaction/GrailsTransactionAttribute.java | 30 +-
...GroovyAwareNamedTransactionAttributeSource.java | 13 +-
.../grails/transaction/MultiTransactionStatus.java | 348 ++--
.../SpringTransactionSynchronizationManager.java | 46 +-
.../grails/transaction/SynchronizationManager.java | 9 +-
.../TransactionManagerPostProcessor.java | 9 +-
.../grails/validation/ConstraintEvalUtils.groovy | 5 +-
.../groovy/grails/artefact/EnhancesSpec.groovy | 1 -
.../grails/config/PropertySourceConfigSpec.groovy | 1 -
.../ArtefactTypeAstTransformationSpec.groovy | 3 -
...balGrailsClassInjectorTransformationSpec.groovy | 1 -
.../config/NavigableMapNestedEqualitySpec.groovy | 1 -
.../org/grails/plugins/BinaryPluginSpec.groovy | 1 -
.../input/AbstractInputObjectTypeBuilder.groovy | 2 +-
grails-data-hibernate5/boot-plugin/build.gradle | 1 +
.../HibernateGormAutoConfiguration.groovy | 33 +-
.../compiler/GormCompilerAutoConfiguration.groovy | 7 +-
grails-data-hibernate5/core/build.gradle | 1 +
.../grails/orm/HibernateCriteriaBuilder.java | 46 +-
.../main/groovy/grails/orm/PagedResultList.java | 4 +-
.../main/groovy/grails/orm/RlikeExpression.java | 8 +-
.../grails/orm/hibernate/HibernateEntity.groovy | 2 +-
.../orm/hibernate/annotation/ManagedEntity.java | 1 -
.../orm/hibernate/mapping/MappingBuilder.groovy | 3 +-
.../orm/hibernate/AbstractHibernateDatastore.java | 83 +-
.../AbstractHibernateGormInstanceApi.groovy | 56 +-
.../AbstractHibernateGormStaticApi.groovy | 226 +--
.../AbstractHibernateGormValidationApi.groovy | 12 +-
.../orm/hibernate/AbstractHibernateSession.java | 23 +-
.../orm/hibernate/EventListenerIntegrator.java | 50 +-
.../orm/hibernate/GrailsHibernateTemplate.java | 341 ++--
.../GrailsHibernateTransactionManager.groovy | 13 +-
.../grails/orm/hibernate/GrailsSessionContext.java | 63 +-
.../grails/orm/hibernate/HibernateDatastore.java | 203 +-
.../orm/hibernate/HibernateGormEnhancer.groovy | 1 +
.../orm/hibernate/HibernateGormInstanceApi.groovy | 18 +-
.../orm/hibernate/HibernateGormStaticApi.groovy | 59 +-
.../hibernate/HibernateGormValidationApi.groovy | 4 +-
.../HibernateMappingContextSessionFactoryBean.java | 75 +-
.../org/grails/orm/hibernate/HibernateSession.java | 69 +-
.../grails/orm/hibernate/IHibernateTemplate.java | 6 +-
.../grails/orm/hibernate/SessionFactoryHolder.java | 2 +-
.../access/TraitPropertyAccessStrategy.java | 47 +-
.../hibernate/cfg/AbstractGrailsDomainBinder.java | 7 +-
.../grails/orm/hibernate/cfg/CacheConfig.groovy | 3 +-
.../grails/orm/hibernate/cfg/ColumnConfig.groovy | 1 +
.../orm/hibernate/cfg/CompositeIdentity.groovy | 1 +
.../orm/hibernate/cfg/DiscriminatorConfig.groovy | 1 +
.../orm/hibernate/cfg/GrailsDomainBinder.java | 1098 +++++------
.../orm/hibernate/cfg/GrailsHibernateUtil.java | 89 +-
.../cfg/GrailsIdentifierGeneratorFactory.java | 11 +-
.../hibernate/cfg/HibernateMappingBuilder.groovy | 128 +-
.../orm/hibernate/cfg/HibernateMappingContext.java | 71 +-
.../cfg/HibernateMappingContextConfiguration.java | 81 +-
.../hibernate/cfg/HibernatePersistentEntity.java | 11 +-
.../org/grails/orm/hibernate/cfg/Identity.groovy | 1 +
.../grails/orm/hibernate/cfg/IdentityEnumType.java | 33 +-
.../grails/orm/hibernate/cfg/InstanceProxy.groovy | 9 +-
.../org/grails/orm/hibernate/cfg/JoinTable.groovy | 1 +
.../org/grails/orm/hibernate/cfg/Mapping.groovy | 108 +-
.../org/grails/orm/hibernate/cfg/NaturalId.groovy | 1 +
.../cfg/PersistentEntityNamingStrategy.java | 1 -
.../grails/orm/hibernate/cfg/PropertyConfig.groovy | 91 +-
.../cfg/PropertyDefinitionDelegate.groovy | 8 +-
.../org/grails/orm/hibernate/cfg/Settings.java | 1 -
.../org/grails/orm/hibernate/cfg/SortConfig.groovy | 1 +
.../org/grails/orm/hibernate/cfg/Table.groovy | 1 +
.../compiler/HibernateEntityTransformation.groovy | 80 +-
.../AbstractHibernateConnectionSourceFactory.java | 42 +-
.../connections/HibernateConnectionSource.java | 7 +-
.../HibernateConnectionSourceFactory.java | 42 +-
.../HibernateConnectionSourceSettings.groovy | 49 +-
...HibernateConnectionSourceSettingsBuilder.groovy | 13 +-
.../datasource/MultipleDataSourceSupport.java | 1 +
.../dirty/GrailsEntityDirtinessStrategy.groovy | 35 +-
.../listener/AbstractHibernateEventListener.java | 3 +-
.../event/listener/HibernateEventListener.java | 41 +-
...CouldNotDetermineHibernateDialectException.java | 3 +-
.../GrailsHibernateConfigurationException.java | 2 +-
.../exceptions/GrailsHibernateException.java | 1 -
.../hibernate/exceptions/GrailsQueryException.java | 1 -
.../multitenancy/MultiTenantEventListener.java | 41 +-
.../orm/hibernate/proxy/HibernateProxyHandler.java | 22 +-
.../proxy/SimpleHibernateProxyHandler.java | 35 +-
.../query/AbstractHibernateCriteriaBuilder.java | 502 ++---
.../query/AbstractHibernateCriterionAdapter.java | 181 +-
.../hibernate/query/AbstractHibernateQuery.java | 313 +--
.../hibernate/query/GrailsHibernateQueryUtils.java | 26 +-
.../hibernate/query/HibernateCriterionAdapter.java | 3 -
.../orm/hibernate/query/HibernateHqlQuery.java | 7 +-
.../query/HibernateProjectionAdapter.java | 36 +-
.../grails/orm/hibernate/query/HibernateQuery.java | 14 +-
.../hibernate/query/HibernateQueryConstants.java | 3 +-
.../orm/hibernate/query/PagedResultList.java | 8 +-
.../AbstractClosureEventTriggeringInterceptor.java | 11 +-
.../hibernate/support/ClosureEventListener.java | 61 +-
.../support/ClosureEventTriggeringInterceptor.java | 42 +-
.../hibernate/support/DataSourceFactoryBean.groovy | 4 +-
...rnateDatastoreConnectionSourcesRegistrar.groovy | 8 +-
.../support/HibernateDatastoreFactoryBean.groovy | 3 +-
.../HibernateDialectDetectorFactoryBean.java | 25 +-
.../hibernate/support/HibernateRuntimeUtils.groovy | 37 +-
.../hibernate/support/HibernateVersionSupport.java | 17 +-
.../org/grails/orm/hibernate/support/SoftKey.java | 6 +-
.../HibernateJtaTransactionManagerAdapter.java | 88 +-
.../PlatformTransactionManagerProxy.java | 4 +-
grails-data-hibernate5/dbmigration/build.gradle | 1 +
.../dbmigration/grails-app/conf/logback.groovy | 2 +-
.../command/DatabaseMigrationCommand.groovy | 2 -
.../GroovyDiffToChangeLogCommandStep.groovy | 2 +-
.../GroovyGenerateChangeLogCommandStep.groovy | 2 +-
grails-data-hibernate5/grails-plugin/build.gradle | 1 +
.../HibernateDatastoreSpringInitializer.groovy | 28 +-
.../plugin/hibernate/HibernateGrailsPlugin.groovy | 61 +-
.../hibernate/commands/SchemaExportCommand.groovy | 28 +-
.../grails/test/hibernate/HibernateSpec.groovy | 15 +-
...urceAggregatePersistenceContextInterceptor.java | 4 +-
.../AggregatePersistenceContextInterceptor.java | 1 -
.../GrailsOpenSessionInViewInterceptor.java | 12 +-
.../HibernatePersistenceContextInterceptor.java | 76 +-
grails-data-mongodb/boot-plugin/build.gradle | 1 +
.../MongoDbGormAutoConfiguration.groovy | 30 +-
grails-data-mongodb/bson/build.gradle | 1 +
.../datastore/bson/codecs/BigDecimalCodec.groovy | 1 +
.../datastore/bson/codecs/BigIntegerCodec.groovy | 1 +
.../bson/codecs/BsonPersistentEntityCodec.groovy | 145 +-
.../bson/codecs/CodecCustomTypeMarshaller.groovy | 6 +-
.../datastore/bson/codecs/CodecExtensions.groovy | 109 +-
.../bson/codecs/CodecRegistryAware.groovy | 1 +
.../bson/codecs/CodecRegistryProvider.groovy | 1 +
.../decoders/BasicCollectionTypeDecoder.groovy | 23 +-
.../bson/codecs/decoders/CustomTypeDecoder.groovy | 13 +-
.../decoders/EmbeddedCollectionDecoder.groovy | 16 +-
.../bson/codecs/decoders/EmbeddedDecoder.groovy | 4 +-
.../bson/codecs/decoders/IdentityDecoder.groovy | 13 +-
.../bson/codecs/decoders/InstantDecoder.groovy | 2 +-
.../bson/codecs/decoders/LocalDateDecoder.groovy | 2 +-
.../codecs/decoders/LocalDateTimeDecoder.groovy | 2 +-
.../bson/codecs/decoders/LocalTimeDecoder.groovy | 2 +-
.../codecs/decoders/OffsetDateTimeDecoder.groovy | 2 +-
.../bson/codecs/decoders/OffsetTimeDecoder.groovy | 2 +-
.../bson/codecs/decoders/PeriodDecoder.groovy | 2 +-
.../bson/codecs/decoders/SimpleDecoder.groovy | 69 +-
.../bson/codecs/decoders/TenantIdDecoder.groovy | 6 +-
.../codecs/decoders/ZonedDateTimeDecoder.groovy | 2 +-
.../encoders/BasicCollectionTypeEncoder.groovy | 25 +-
.../bson/codecs/encoders/CustomTypeEncoder.groovy | 9 +-
.../encoders/EmbeddedCollectionEncoder.groovy | 26 +-
.../bson/codecs/encoders/EmbeddedEncoder.groovy | 4 +-
.../bson/codecs/encoders/IdentityEncoder.groovy | 5 +-
.../bson/codecs/encoders/InstantEncoder.groovy | 4 +-
.../bson/codecs/encoders/LocalDateEncoder.groovy | 4 +-
.../codecs/encoders/LocalDateTimeEncoder.groovy | 4 +-
.../bson/codecs/encoders/LocalTimeEncoder.groovy | 4 +-
.../codecs/encoders/OffsetDateTimeEncoder.groovy | 4 +-
.../bson/codecs/encoders/OffsetTimeEncoder.groovy | 4 +-
.../bson/codecs/encoders/PeriodEncoder.groovy | 4 +-
.../bson/codecs/encoders/SimpleEncoder.groovy | 50 +-
.../bson/codecs/encoders/TenantIdEncoder.groovy | 5 +-
.../codecs/encoders/ZonedDateTimeEncoder.groovy | 4 +-
.../codecs/temporal/InstantBsonConverter.groovy | 2 +-
.../codecs/temporal/LocalDateBsonConverter.groovy | 2 +-
.../temporal/LocalDateTimeBsonConverter.groovy | 2 +-
.../codecs/temporal/LocalTimeBsonConverter.groovy | 2 +-
.../temporal/OffsetDateTimeBsonConverter.groovy | 2 +-
.../codecs/temporal/OffsetTimeBsonConverter.groovy | 2 +-
.../org/grails/datastore/bson/json/JsonReader.java | 11 +-
.../grails/datastore/bson/json/JsonScanner.java | 46 +-
.../org/grails/datastore/bson/json/JsonWriter.java | 18 +-
.../org/grails/datastore/bson/query/BsonQuery.java | 174 +-
.../query/CodecRegistryEmbeddedQueryEncoder.groovy | 2 +-
.../datastore/bson/query/EmbeddedQueryEncoder.java | 1 -
grails-data-mongodb/core/build.gradle | 1 +
.../main/groovy/grails/mongodb/MongoEntity.groovy | 19 +-
.../grails/mongodb/api/MongoAllOperations.groovy | 1 +
.../mongodb/api/MongoStaticOperations.groovy | 2 +-
.../MongoDbDataStoreSpringInitializer.groovy | 30 +-
.../src/main/groovy/grails/mongodb/geo/Box.groovy | 8 +-
.../main/groovy/grails/mongodb/geo/Circle.groovy | 14 +-
.../grails/mongodb/geo/GeometryCollection.groovy | 12 +-
.../groovy/grails/mongodb/geo/LineString.groovy | 22 +-
.../main/groovy/grails/mongodb/geo/Metric.groovy | 3 +-
.../grails/mongodb/geo/MultiLineString.groovy | 12 +-
.../groovy/grails/mongodb/geo/MultiPoint.groovy | 12 +-
.../groovy/grails/mongodb/geo/MultiPolygon.groovy | 13 +-
.../main/groovy/grails/mongodb/geo/Point.groovy | 23 +-
.../main/groovy/grails/mongodb/geo/Polygon.groovy | 84 +-
.../main/groovy/grails/mongodb/geo/Sphere.groovy | 17 +-
.../grails/mongodb/mapping/MappingBuilder.groovy | 3 +-
.../datastore/gorm/mongo/GeoIntersects.groovy | 5 +-
.../grails/datastore/gorm/mongo/GeoWithin.groovy | 5 +-
.../datastore/gorm/mongo/MongoCriteriaBuilder.java | 79 +-
.../gorm/mongo/MongoEntityTraitProvider.groovy | 1 +
.../datastore/gorm/mongo/MongoGormEnhancer.groovy | 2 +-
.../org/grails/datastore/gorm/mongo/Near.java | 23 +-
.../grails/datastore/gorm/mongo/NearSphere.java | 38 +-
.../org/grails/datastore/gorm/mongo/WithinBox.java | 44 +-
.../grails/datastore/gorm/mongo/WithinCircle.java | 16 +-
.../grails/datastore/gorm/mongo/WithinPolygon.java | 11 +-
.../datastore/gorm/mongo/api/MongoStaticApi.groovy | 78 +-
.../gorm/mongo/geo/AbstractShapeCoordsType.groovy | 12 +-
.../grails/datastore/gorm/mongo/geo/BoxType.groovy | 6 +-
.../datastore/gorm/mongo/geo/CircleType.groovy | 5 +-
.../datastore/gorm/mongo/geo/GeoJSONType.groovy | 25 +-
.../gorm/mongo/geo/GeometryCollectionType.groovy | 14 +-
.../datastore/gorm/mongo/geo/LineStringType.groovy | 4 +-
.../gorm/mongo/geo/MultiLineStringType.groovy | 2 +-
.../gorm/mongo/geo/MultiPolygonType.groovy | 3 +-
.../datastore/gorm/mongo/geo/PointType.groovy | 5 +-
.../datastore/gorm/mongo/geo/ShapeType.groovy | 15 +-
.../datastore/gorm/mongo/simple/EnumType.groovy | 34 +-
.../mapping/mongo/AbstractMongoSession.java | 31 +-
.../mapping/mongo/MongoCodecSession.groovy | 112 +-
.../datastore/mapping/mongo/MongoConstants.groovy | 9 +-
.../datastore/mapping/mongo/MongoDatastore.java | 285 +--
.../datastore/mapping/mongo/MongoSession.java | 124 +-
.../mapping/mongo/config/MongoAttribute.groovy | 8 +-
.../mongo/config/MongoClientOptionsBuilder.groovy | 39 +-
.../mapping/mongo/config/MongoCollection.groovy | 25 +-
.../mapping/mongo/config/MongoMappingContext.java | 201 +-
.../mapping/mongo/config/MongoSettings.groovy | 1 +
.../AbstractMongoConnectionSourceSettings.groovy | 10 +-
.../MongoConnectionSourceFactory.groovy | 8 +-
.../MongoConnectionSourceSettings.groovy | 2 +-
.../MongoConnectionSourceSettingsBuilder.groovy | 10 +-
.../connections/MongoConnectionSources.groovy | 9 +-
.../engine/AbstractMongoObectEntityPersister.java | 66 +-
.../mongo/engine/MongoCodecEntityPersister.groovy | 29 +-
.../mapping/mongo/engine/MongoEntityPersister.java | 115 +-
.../engine/codecs/PersistentEntityCodec.groovy | 340 ++--
.../datastore/mapping/mongo/query/MongoQuery.java | 218 +--
.../test/groovy/grails/gorm/tests/Person.groovy | 2 +-
grails-data-mongodb/ext/build.gradle | 1 +
.../gorm/mongo/extensions/MongoExtensions.groovy | 156 +-
grails-data-mongodb/grails-plugin/build.gradle | 1 +
.../plugins/mongodb/MongodbGrailsPlugin.groovy | 7 +-
.../groovy/grails/test/mongodb/MongoSpec.groovy | 13 +-
grails-data-mongodb/gson-templates/build.gradle | 1 +
.../src/templates/org/bson/types/_objectId.gson | 1 -
grails-data-simple/build.gradle | 1 +
.../mapping/simple/SimpleMapDatastore.java | 148 +-
.../datastore/mapping/simple/SimpleMapSession.java | 12 +-
.../SimpleMapConnectionSourceFactory.groovy | 12 +-
.../simple/engine/SimpleMapEntityPersister.groovy | 27 +-
.../mapping/simple/query/SimpleMapQuery.groovy | 797 ++++----
.../simple/query/SimpleMapResultList.groovy | 3 +-
grails-databinding-core/build.gradle | 1 +
.../groovy/grails/databinding/BindInitializer.java | 36 +-
.../main/groovy/grails/databinding/BindUsing.java | 40 +-
.../groovy/grails/databinding/BindingFormat.java | 18 +-
.../groovy/grails/databinding/BindingHelper.java | 6 +-
.../databinding/CollectionDataBindingSource.java | 1 +
.../main/groovy/grails/databinding/DataBinder.java | 96 +-
.../grails/databinding/DataBindingSource.java | 2 +
.../grails/databinding/SimpleDataBinder.groovy | 200 +-
.../databinding/StructuredBindingEditor.java | 83 +-
.../databinding/TypedStructuredBindingEditor.java | 7 +-
.../converters/FormattedValueConverter.java | 43 +-
.../databinding/converters/ValueConverter.java | 3 +
.../grails/databinding/errors/BindingError.java | 11 +-
.../databinding/events/DataBindingListener.java | 19 +-
.../events/DataBindingListenerAdapter.java | 2 +-
.../databinding/initializers/ValueInitializer.java | 4 +-
.../databinding/ClosureValueConverter.groovy | 2 +-
.../databinding/ClosureValueInitializer.groovy | 2 +-
.../IndexedPropertyReferenceDescriptor.groovy | 1 +
.../compiler/BindingFormatASTTransformation.java | 61 +-
.../AbstractStructuredDateBindingEditor.groovy | 16 +-
.../databinding/converters/ConversionService.java | 2 +
.../converters/CurrencyValueConverter.groovy | 13 +-
.../converters/DateConversionHelper.groovy | 8 +-
.../converters/FormattedDateValueConverter.groovy | 12 +-
.../FormattedLocalDateTimeValueConverter.groovy | 12 +-
.../converters/LocalDateTimeConverter.groovy | 1 +
.../StructuredCalendarBindingEditor.groovy | 2 -
.../converters/TimeZoneConverter.groovy | 4 +-
.../databinding/converters/UUIDConverter.groovy | 6 +-
.../databinding/errors/SimpleBindingError.java | 2 +-
.../GPathResultCollectionDataBindingSource.groovy | 8 +-
.../grails/databinding/xml/GPathResultMap.groovy | 21 +-
grails-databinding/build.gradle | 1 +
.../Jsr310ConvertersConfiguration.groovy | 59 +-
.../web/LocaleAwareBigDecimalConverter.groovy | 2 +-
.../web/LocaleAwareNumberConverter.groovy | 27 +-
.../AbstractDataBindingGrailsPlugin.groovy | 112 +-
.../databinding/DataBindingConfiguration.java | 11 +-
grails-datamapping-async/build.gradle | 1 +
.../groovy/grails/gorm/async/AsyncEntity.groovy | 1 +
.../grails/datastore/gorm/async/AsyncQuery.groovy | 8 +-
.../datastore/gorm/async/GormAsyncStaticApi.groovy | 13 +-
grails-datamapping-core/build.gradle | 1 +
.../main/groovy/grails/gorm/CriteriaBuilder.java | 14 +-
.../groovy/grails/gorm/DetachedCriteria.groovy | 210 +-
.../src/main/groovy/grails/gorm/MultiTenant.groovy | 2 +-
.../main/groovy/grails/gorm/PagedResultList.java | 16 +-
.../main/groovy/grails/gorm/annotation/Entity.java | 4 +-
.../groovy/grails/gorm/annotation/JpaEntity.java | 1 +
.../grails/gorm/api/GormInstanceOperations.groovy | 4 +-
.../grails/gorm/api/GormStaticOperations.groovy | 29 +-
.../grails/gorm/dirty/checking/DirtyCheck.groovy | 2 +-
.../grails/gorm/multitenancy/CurrentTenant.java | 10 +-
.../groovy/grails/gorm/multitenancy/Tenant.java | 10 +-
.../groovy/grails/gorm/multitenancy/Tenants.groovy | 72 +-
.../grails/gorm/multitenancy/WithoutTenant.java | 11 +-
.../src/main/groovy/grails/gorm/services/Join.java | 3 +-
.../main/groovy/grails/gorm/services/Query.groovy | 1 +
.../main/groovy/grails/gorm/services/Service.java | 3 +-
.../main/groovy/grails/gorm/services/Where.java | 2 +-
.../grails/gorm/time/LocalDateConverter.groovy | 7 +-
.../transactions/GrailsTransactionAttribute.groovy | 23 +-
.../transactions/GrailsTransactionTemplate.groovy | 12 +-
.../gorm/transactions/NotTransactional.groovy | 14 +-
.../groovy/grails/gorm/transactions/ReadOnly.java | 16 +-
.../grails/gorm/transactions/Rollback.groovy | 1 -
.../gorm/transactions/TransactionService.groovy | 14 +-
.../grails/gorm/transactions/Transactional.java | 12 +-
.../compiler/gorm/DirtyCheckingTransformer.groovy | 132 +-
.../compiler/gorm/GlobalJpaEntityTransform.groovy | 5 +-
.../compiler/gorm/GormEntityTransformation.groovy | 28 +-
.../gorm/JpaGormEntityTransformation.groovy | 6 +-
.../datastore/gorm/AbstractDatastoreApi.groovy | 9 +-
.../grails/datastore/gorm/AbstractGormApi.groovy | 47 +-
.../org/grails/datastore/gorm/CurrentTenant.groovy | 2 +-
.../org/grails/datastore/gorm/GormEnhancer.groovy | 104 +-
.../org/grails/datastore/gorm/GormEntity.groovy | 91 +-
.../org/grails/datastore/gorm/GormEntityApi.groovy | 3 +-
.../datastore/gorm/GormEntityDirtyCheckable.groovy | 12 +-
.../grails/datastore/gorm/GormInstanceApi.groovy | 67 +-
.../org/grails/datastore/gorm/GormStaticApi.groovy | 153 +-
.../grails/datastore/gorm/GormValidateable.groovy | 9 +-
.../grails/datastore/gorm/GormValidationApi.groovy | 51 +-
.../bootstrap/AbstractDatastoreInitializer.groovy | 84 +-
.../bootstrap/support/InstanceFactoryBean.java | 4 +-
.../support/ServiceRegistryFactoryBean.groovy | 25 +-
.../gorm/events/AutoTimestampEventListener.java | 76 +-
.../events/DefaultApplicationEventPublisher.groovy | 19 +-
.../datastore/gorm/events/DomainEventListener.java | 111 +-
.../gorm/finders/AbstractFindByFinder.java | 11 +-
.../datastore/gorm/finders/AbstractFinder.java | 11 +-
.../datastore/gorm/finders/CountByFinder.java | 11 +-
.../datastore/gorm/finders/DynamicFinder.java | 221 +--
.../gorm/finders/FindAllByBooleanFinder.java | 9 +-
.../datastore/gorm/finders/FindAllByFinder.java | 11 +-
.../gorm/finders/FindByBooleanFinder.java | 5 +-
.../datastore/gorm/finders/FindByFinder.java | 4 +-
.../gorm/finders/FindOrCreateByFinder.java | 9 +-
.../datastore/gorm/finders/FindOrSaveByFinder.java | 5 +-
.../datastore/gorm/finders/FinderMethod.java | 13 +-
.../datastore/gorm/finders/ListOrderByFinder.java | 20 +-
.../grails/datastore/gorm/finders/MatchSpec.groovy | 1 -
.../datastore/gorm/finders/MethodExpression.java | 105 +-
.../gorm/finders/QueryBuildingFinder.java | 3 +-
.../internal/InstanceMethodInvokingClosure.groovy | 7 +-
.../gorm/internal/MethodInvokingClosure.groovy | 12 +-
.../datastore/gorm/internal/RuntimeSupport.groovy | 10 +-
.../internal/StaticMethodInvokingClosure.groovy | 3 +-
.../datastore/gorm/jdbc/DataSourceBuilder.java | 48 +-
.../grails/datastore/gorm/jdbc/DatabaseDriver.java | 13 +-
.../gorm/jdbc/MultiTenantConnection.groovy | 6 +-
.../gorm/jdbc/MultiTenantDataSource.groovy | 3 +-
.../gorm/jdbc/OriginCapablePropertyValue.java | 3 +-
.../grails/datastore/gorm/jdbc/PropertyOrigin.java | 4 +-
.../gorm/jdbc/RelaxedConversionService.java | 12 +-
.../datastore/gorm/jdbc/RelaxedDataBinder.java | 49 +-
.../grails/datastore/gorm/jdbc/RelaxedNames.java | 12 +-
.../CachedDataSourceConnectionSourceFactory.java | 12 +-
.../connections/DataSourceConnectionSource.java | 6 +-
.../DataSourceConnectionSourceFactory.java | 38 +-
.../jdbc/connections/DataSourceSettings.groovy | 14 +-
.../connections/DataSourceSettingsBuilder.groovy | 1 +
.../SpringDataSourceConnectionSourceFactory.java | 2 +-
.../gorm/jdbc/schema/DefaultSchemaHandler.groovy | 2 +-
.../multitenancy/MultiTenantEventListener.java | 49 +-
.../TenantDelegatingGormOperations.groovy | 197 +-
.../multitenancy/transform/TenantTransform.groovy | 81 +-
.../PersistenceContextInterceptorAggregator.groovy | 10 +-
.../datastore/gorm/proxy/GroovyProxyFactory.groovy | 20 +-
.../gorm/proxy/ProxyInstanceMetaClass.java | 17 +-
.../datastore/gorm/query/AbstractResultList.java | 47 +-
.../gorm/query/GormQueryOperations.groovy | 6 +-
.../datastore/gorm/query/NamedCriteriaProxy.groovy | 55 +-
.../gorm/query/NamedQueriesBuilder.groovy | 8 +-
.../query/criteria/AbstractCriteriaBuilder.java | 214 +--
.../query/criteria/AbstractDetachedCriteria.groovy | 86 +-
.../criteria/DetachedAssociationCriteria.groovy | 1 -
.../transform/ApplyDetachedCriteriaTransform.java | 4 +-
.../DetachedCriteriaASTTransformation.java | 2 +-
.../transform/DetachedCriteriaTransformer.java | 216 ++-
.../GlobalDetachedCriteriaASTTransformation.java | 3 +-
.../gorm/schemaless/DynamicAttributeHelper.java | 1 -
.../gorm/schemaless/DynamicAttributes.groovy | 19 +-
.../gorm/services/DefaultTenantService.groovy | 21 +-
.../gorm/services/DefaultTransactionService.groovy | 42 +-
.../datastore/gorm/services/Implemented.groovy | 1 +
...AbstractArrayOrIterableResultImplementer.groovy | 11 +-
...stractDetachedCriteriaServiceImplementor.groovy | 42 +-
.../AbstractProjectionImplementer.groovy | 8 +-
.../AbstractReadOperationImplementer.groovy | 6 +-
.../implementers/AbstractSaveImplementer.groovy | 14 +-
.../implementers/AbstractServiceImplementer.groovy | 49 +-
.../AbstractStringQueryImplementer.groovy | 16 +-
.../implementers/AbstractWhereImplementer.groovy | 31 +-
.../AbstractWriteOperationImplementer.groovy | 8 +-
.../implementers/AdaptedImplementer.groovy | 1 +
.../AnnotatedServiceImplementer.groovy | 2 +-
.../implementers/CountByImplementer.groovy | 3 +-
.../services/implementers/CountImplementer.groovy | 5 +-
.../implementers/CountWhereImplementer.groovy | 4 +-
.../services/implementers/DeleteImplementer.groovy | 38 +-
.../implementers/DeleteWhereImplementer.groovy | 9 +-
.../implementers/FindAllByImplementer.groovy | 48 +-
.../implementers/FindAllImplementer.groovy | 15 +-
.../FindAllInterfaceProjectionImplementer.groovy | 7 +-
.../FindAllPropertyProjectionImplementer.groovy | 5 +-
.../FindAllStringQueryImplementer.groovy | 3 +-
.../implementers/FindAllWhereImplementer.groovy | 7 +-
.../implementers/FindAndDeleteImplementer.groovy | 20 +-
.../implementers/FindOneByImplementer.groovy | 20 +-
.../implementers/FindOneImplementer.groovy | 14 +-
.../FindOneInterfaceProjectionImplementer.groovy | 2 +-
...nterfaceProjectionStringQueryImplementer.groovy | 2 +-
...ndOneInterfaceProjectionWhereImplementer.groovy | 2 +-
.../FindOnePropertyProjectionImplementer.groovy | 14 +-
.../FindOneStringQueryImplementer.groovy | 33 +-
.../implementers/FindOneWhereImplementer.groovy | 3 +-
.../implementers/InterfaceProjectionBuilder.groovy | 13 +-
.../IterableInterfaceProjectionBuilder.groovy | 37 +-
.../IterableProjectionServiceImplementer.groovy | 3 +-
.../implementers/IterableServiceImplementer.groovy | 2 +-
.../implementers/PrefixedServiceImplementer.groovy | 1 +
.../implementers/QueryStringImplementer.groovy | 1 -
.../services/implementers/SaveImplementer.groovy | 23 +-
.../SingleResultInterfaceProjectionBuilder.groovy | 38 +-
.../SingleResultServiceImplementer.groovy | 2 +-
.../implementers/UpdateOneImplementer.groovy | 27 +-
.../transform/QueryStringTransformer.groovy | 156 +-
.../transform/ServiceTransformation.groovy | 77 +-
...ractDatastorePersistenceContextInterceptor.java | 15 +-
.../gorm/timestamp/AggregateTimestampProvider.java | 19 +-
.../gorm/timestamp/DefaultTimestampProvider.java | 18 +-
.../gorm/timestamp/TimestampProvider.java | 5 +-
.../transform/TransactionalTransform.groovy | 169 +-
...tDatastoreMethodDecoratingTransformation.groovy | 87 +-
.../AbstractMethodDecoratingTransformation.groovy | 81 +-
...stractTraitApplyingGormASTTransformation.groovy | 6 +-
.../gorm/transform/AstMethodDispatchUtils.groovy | 27 +-
.../gorm/transform/AstPropertyResolveUtils.java | 30 +-
.../gorm/transform/GormASTTransformationClass.java | 1 +
.../transform/OrderedGormTransformation.groovy | 27 +-
.../utils/AnnotationMetadataReaderFactory.java | 2 +-
.../gorm/utils/ClasspathEntityScanner.groovy | 15 +-
.../gorm/validation/CascadingValidator.java | 5 +-
.../gorm/validation/ValidatorProvider.groovy | 2 +-
.../MappingContextAwareConstraintFactory.groovy | 3 +-
.../constraints/builtin/UniqueConstraint.groovy | 26 +-
.../ConfigurableParameterNameProvider.groovy | 16 +-
.../jakarta/ConstraintViolationUtils.groovy | 5 +-
.../validation/jakarta/GormValidatorAdapter.groovy | 7 +-
.../jakarta/GormValidatorFactoryAdapter.groovy | 6 +-
.../jakarta/JakartaValidatorRegistry.groovy | 31 +-
.../MappingContextTraversableResolver.groovy | 24 +-
.../gorm/validation/jakarta/MethodKey.java | 14 +-
.../jakarta/services/ValidatedService.groovy | 31 +-
.../MethodValidationImplementer.groovy | 90 +-
.../listener/ValidationEventListener.groovy | 28 +-
.../registry/support/ValidatorRegistries.java | 16 +-
.../datastore/rx/AbstractRxDatastoreClient.groovy | 8 +-
.../org/grails/gorm/rx/api/RxGormStaticApi.groovy | 4 +-
grails-datamapping-support/build.gradle | 1 +
.../compiler/gorm/EntityTraitInjector.groovy | 1 -
.../org/grails/compiler/gorm/GormTransformer.java | 9 +-
.../gorm/plugin/support/ConfigSupport.groovy | 5 +-
.../gorm/proxy/EntityProxyHandlerAdapter.java | 3 +-
.../datastore/gorm/proxy/ProxyHandlerAdapter.java | 1 -
.../AggregatePersistenceContextInterceptor.java | 2 +-
.../DatastorePersistenceContextInterceptor.java | 1 +
grails-datamapping-tck/build.gradle | 1 +
.../testing/tck/base/GrailsDataTckManager.groovy | 1 +
.../data/testing/tck/base/GrailsDataTckSpec.groovy | 1 +
.../grails/data/testing/tck/domains/Book.groovy | 1 +
.../grails/data/testing/tck/domains/Child.groovy | 1 +
.../data/testing/tck/domains/ChildEntity.groovy | 1 +
.../grails/data/testing/tck/domains/City.groovy | 1 +
.../tck/domains/ClassWithHungarianNotation.groovy | 1 +
.../domains/ClassWithListArgBeforeValidate.groovy | 1 +
.../domains/ClassWithNoArgBeforeValidate.groovy | 1 +
.../ClassWithOverloadedBeforeValidate.groovy | 1 +
.../data/testing/tck/domains/CommonTypes.groovy | 1 +
.../grails/data/testing/tck/domains/Country.groovy | 1 +
.../grails/data/testing/tck/domains/Dog.groovy | 1 +
.../data/testing/tck/domains/EnumThing.groovy | 1 +
.../grails/data/testing/tck/domains/Face.groovy | 2 +-
.../data/testing/tck/domains/GroupWithin.groovy | 1 +
.../grails/data/testing/tck/domains/Highway.groovy | 1 +
.../data/testing/tck/domains/ModifyPerson.groovy | 1 +
.../grails/data/testing/tck/domains/Nose.groovy | 1 +
.../testing/tck/domains/OptLockNotVersioned.groovy | 1 +
.../testing/tck/domains/OptLockVersioned.groovy | 1 +
.../grails/data/testing/tck/domains/Parent.groovy | 1 +
.../grails/data/testing/tck/domains/Person.groovy | 5 +-
.../data/testing/tck/domains/PersonEvent.groovy | 3 +-
.../tck/domains/PersonWithCompositeKey.groovy | 1 +
.../grails/data/testing/tck/domains/Pet.groovy | 1 +
.../grails/data/testing/tck/domains/PetType.groovy | 1 +
.../grails/data/testing/tck/domains/Plant.groovy | 1 +
.../data/testing/tck/domains/PlantCategory.groovy | 1 +
.../data/testing/tck/domains/Practice.groovy | 1 +
.../data/testing/tck/domains/Publication.groovy | 7 +-
.../grails/data/testing/tck/domains/Record.groovy | 1 +
.../data/testing/tck/domains/SimpleWidget.groovy | 1 +
.../domains/SimpleWidgetWithNonStandardId.groovy | 1 +
.../grails/data/testing/tck/domains/Simples.groovy | 1 +
.../grails/data/testing/tck/domains/Task.groovy | 1 +
.../data/testing/tck/domains/TestEntity.groovy | 1 +
.../data/testing/tck/domains/TestEnum.groovy | 1 +
.../data/testing/tck/domains/TestPlayer.groovy | 1 +
.../data/testing/tck/domains/UniqueGroup.groovy | 1 +
...intWorksWithTargetProxiesConstraintsSpec.groovy | 4 +-
grails-datamapping-validation/build.gradle | 1 +
.../grails/gorm/validation/CascadingValidator.java | 5 +-
.../gorm/validation/ConstrainedProperty.groovy | 40 +-
.../groovy/grails/gorm/validation/Constraint.java | 8 +-
.../validation/DefaultConstrainedProperty.groovy | 107 +-
.../validation/PersistentEntityValidator.groovy | 95 +-
.../grails/gorm/validation/VetoingConstraint.java | 5 +-
.../ValidationConfigurationException.groovy | 2 +-
.../gorm/support/BeforeValidateHelper.java | 46 +-
.../datastore/gorm/support/EventTriggerCaller.java | 75 +-
.../validation/constraints/AbstractConstraint.java | 42 +-
.../constraints/AbstractVetoingConstraint.java | 1 -
.../validation/constraints/BlankConstraint.java | 3 +-
.../constraints/CreditCardConstraint.java | 4 +-
.../validation/constraints/EmailConstraint.java | 5 +-
.../validation/constraints/InListConstraint.java | 3 +-
.../validation/constraints/MatchesConstraint.java | 4 +-
.../gorm/validation/constraints/MaxConstraint.java | 10 +-
.../validation/constraints/MaxSizeConstraint.java | 15 +-
.../gorm/validation/constraints/MinConstraint.java | 6 +-
.../validation/constraints/MinSizeConstraint.java | 13 +-
.../validation/constraints/NotEqualConstraint.java | 11 +-
.../validation/constraints/NullableConstraint.java | 3 +-
.../validation/constraints/RangeConstraint.java | 13 +-
.../validation/constraints/ScaleConstraint.java | 22 +-
.../validation/constraints/SizeConstraint.java | 22 +-
.../gorm/validation/constraints/UrlConstraint.java | 11 +-
.../constraints/ValidatorConstraint.java | 36 +-
.../builder/ConstrainedPropertyBuilder.java | 56 +-
.../eval/DefaultConstraintEvaluator.java | 63 +-
.../factory/DefaultConstraintFactory.groovy | 6 +-
.../registry/DefaultConstraintRegistry.groovy | 8 +-
.../registry/DefaultValidatorRegistry.groovy | 17 +-
grails-datasource/build.gradle | 1 +
.../DataSourceConnectionSourcesFactoryBean.groovy | 11 +-
.../datasource/DataSourceGrailsPlugin.groovy | 76 +-
.../plugins/datasource/DataSourceUtils.groovy | 2 +-
.../datasource/EmbeddedDatabaseShutdownHook.groovy | 28 +-
.../ReadOnlyDriverManagerDataSource.java | 4 +-
.../datasource/TomcatJDBCPoolMBeanExporter.groovy | 34 +-
grails-datastore-async/build.gradle | 1 +
.../gorm/async/transform/DelegateAsync.groovy | 8 +-
.../transform/DelegateAsyncTransformation.java | 66 +-
grails-datastore-core/build.gradle | 1 +
.../datastore/mapping/cache/TPCacheAdapter.java | 7 +-
.../mapping/cache/TPCacheAdapterRepository.java | 12 +-
.../mapping/cache/exception/CacheException.java | 5 +-
.../mapping/cache/impl/HashMapTPCacheAdapter.java | 6 +-
.../cache/impl/TPCacheAdapterRepositoryImpl.java | 6 +-
.../collection/AbstractPersistentCollection.java | 28 +-
.../mapping/collection/PersistentCollection.java | 2 +
.../mapping/collection/PersistentList.java | 16 +-
.../mapping/collection/PersistentSet.java | 18 +-
.../mapping/collection/PersistentSortedSet.java | 13 +-
.../datastore/mapping/column/ColumnDatastore.java | 4 +-
.../mapping/config/AbstractGormMappingFactory.java | 69 +-
.../mapping/config/ConfigurationBuilder.groovy | 45 +-
.../mapping/config/ConfigurationUtils.java | 30 +-
.../grails/datastore/mapping/config/Entity.groovy | 79 +-
.../datastore/mapping/config/Property.groovy | 10 +-
.../grails/datastore/mapping/config/Settings.java | 3 +-
.../DefaultMappingConfigurationBuilder.groovy | 17 +-
.../mapping/config/utils/ConfigUtils.groovy | 2 +-
.../config/utils/PropertyResolverMap.groovy | 6 +-
.../core/AbstractAttributeStoringSession.java | 12 +-
.../datastore/mapping/core/AbstractDatastore.java | 33 +-
.../datastore/mapping/core/AbstractSession.java | 74 +-
.../grails/datastore/mapping/core/Datastore.java | 10 +-
.../datastore/mapping/core/DatastoreAware.java | 1 +
.../datastore/mapping/core/DatastoreUtils.java | 220 +--
.../mapping/core/OptimisticLockingException.java | 2 +-
.../org/grails/datastore/mapping/core/Ordered.java | 5 +-
.../org/grails/datastore/mapping/core/Session.java | 50 +-
.../datastore/mapping/core/SessionCallback.java | 5 +-
.../mapping/core/SessionCreationEvent.java | 1 -
.../datastore/mapping/core/SessionImplementor.java | 46 +-
.../datastore/mapping/core/SoftThreadLocalMap.java | 2 -
.../datastore/mapping/core/StatelessDatastore.java | 3 +-
.../mapping/core/VoidSessionCallback.java | 3 +-
.../AbstractConnectionSourceFactory.java | 9 +-
.../connections/AbstractConnectionSources.groovy | 22 +-
.../mapping/core/connections/ConnectionSource.java | 3 +-
.../core/connections/ConnectionSourceFactory.java | 26 +-
.../connections/ConnectionSourceSettings.groovy | 4 +-
.../ConnectionSourceSettingsBuilder.groovy | 1 +
.../core/connections/ConnectionSources.java | 17 +-
.../ConnectionSourcesInitializer.groovy | 7 +-
.../connections/ConnectionSourcesListener.groovy | 2 +-
.../connections/ConnectionSourcesProvider.java | 3 +-
.../core/connections/ConnectionSourcesSupport.java | 18 +-
.../core/connections/DefaultConnectionSource.java | 15 +-
.../connections/InMemoryConnectionSources.groovy | 17 +-
.../connections/SingletonConnectionSources.groovy | 5 +-
.../connections/StaticConnectionSources.groovy | 3 +-
.../core/exceptions/ConfigurationException.java | 1 -
.../core/grailsversion/GrailsVersion.groovy | 6 +-
.../datastore/mapping/core/impl/PendingDelete.java | 1 +
.../mapping/core/impl/PendingDeleteAdapter.java | 7 +-
.../datastore/mapping/core/impl/PendingInsert.java | 5 +-
.../mapping/core/impl/PendingInsertAdapter.java | 6 +-
.../mapping/core/impl/PendingOperation.java | 16 +-
.../mapping/core/impl/PendingOperationAdapter.java | 9 +-
.../core/impl/PendingOperationExecution.java | 3 +-
.../datastore/mapping/core/impl/PendingUpdate.java | 5 +-
.../mapping/core/impl/PendingUpdateAdapter.java | 6 +-
.../mapping/dirty/checking/DirtyCheckable.groovy | 33 +-
.../dirty/checking/DirtyCheckableCollection.java | 1 -
.../dirty/checking/DirtyCheckingCollection.groovy | 4 +-
.../dirty/checking/DirtyCheckingList.groovy | 6 +-
.../mapping/dirty/checking/DirtyCheckingMap.groovy | 3 +-
.../mapping/dirty/checking/DirtyCheckingSet.groovy | 3 +-
.../dirty/checking/DirtyCheckingSortedSet.groovy | 4 +-
.../dirty/checking/DirtyCheckingSupport.groovy | 47 +-
.../mapping/document/DocumentDatastore.java | 4 +-
.../document/config/DocumentMappingContext.java | 4 +-
.../document/config/DocumentPersistentEntity.java | 11 +-
.../mapping/engine/AssociationIndexer.java | 13 +-
.../datastore/mapping/engine/BeanEntityAccess.java | 25 +-
.../datastore/mapping/engine/EntityAccess.java | 13 +-
.../datastore/mapping/engine/EntityPersister.java | 115 +-
.../mapping/engine/LockableEntityPersister.java | 23 +-
.../engine/ModificationTrackingEntityAccess.groovy | 5 +-
.../mapping/engine/NativeEntryEntityPersister.java | 617 +++---
.../grails/datastore/mapping/engine/Persister.java | 10 +-
.../mapping/engine/PropertyValueIndexer.java | 12 +-
.../engine/ThirdPartyCacheEntityPersister.java | 1 +
.../engine/event/AbstractPersistenceEvent.java | 26 +-
.../event/AbstractPersistenceEventListener.java | 11 +-
.../engine/event/DatastoreInitializedEvent.groovy | 2 +-
.../engine/event/PersistenceEventListener.java | 1 +
.../mapping/engine/event/PostDeleteEvent.java | 2 +-
.../mapping/engine/event/PostInsertEvent.java | 2 +-
.../mapping/engine/event/PostLoadEvent.java | 2 +-
.../mapping/engine/event/PostUpdateEvent.java | 2 +-
.../mapping/engine/event/PreDeleteEvent.java | 2 +-
.../mapping/engine/event/PreInsertEvent.java | 2 +-
.../mapping/engine/event/PreLoadEvent.java | 2 +-
.../mapping/engine/event/PreUpdateEvent.java | 2 +-
.../mapping/engine/event/SaveOrUpdateEvent.java | 3 +-
.../mapping/engine/event/ValidationEvent.java | 9 +-
.../mapping/engine/internal/MappingUtils.java | 55 +-
.../AbstractMappingAwareCustomTypeMarshaller.java | 4 +-
.../mapping/engine/types/CustomTypeMarshaller.java | 18 +-
.../datastore/mapping/graph/GraphDatastore.java | 5 +-
.../engine/AbstractKeyValueEntityPersister.java | 17 +-
.../mapping/keyvalue/mapping/config/Family.groovy | 1 -
.../mapping/config/KeyValueMappingContext.java | 15 +-
.../mapping/config/KeyValuePersistentEntity.java | 14 +-
.../mapping/model/AbstractClassMapping.java | 1 +
.../mapping/model/AbstractMappingContext.java | 109 +-
.../mapping/model/AbstractPersistentEntity.java | 165 +-
.../mapping/model/AbstractPersistentProperty.java | 5 +-
.../datastore/mapping/model/ClassMapping.java | 1 +
.../model/DatastoreConfigurationException.java | 2 +-
.../mapping/model/EmbeddedPersistentEntity.java | 3 +-
.../model/MappingConfigurationStrategy.java | 13 +-
.../datastore/mapping/model/MappingContext.java | 32 +-
.../datastore/mapping/model/MappingFactory.java | 236 ++-
.../datastore/mapping/model/PersistentEntity.java | 20 +-
.../mapping/model/PersistentProperty.java | 14 +-
.../datastore/mapping/model/PropertyMapping.java | 2 +-
.../datastore/mapping/model/ValueGenerator.java | 1 -
.../config/GormMappingConfigurationStrategy.java | 302 +--
.../mapping/model/config/GormProperties.java | 1 +
.../config/JpaMappingConfigurationStrategy.java | 89 +-
.../mapping/model/lifecycle/Initializable.java | 1 -
.../datastore/mapping/model/types/Association.java | 73 +-
.../datastore/mapping/model/types/Basic.java | 32 +-
.../model/types/BasicTypeConverterRegistrar.java | 14 +-
.../datastore/mapping/model/types/Custom.java | 8 +-
.../datastore/mapping/model/types/Embedded.java | 4 +-
.../mapping/model/types/EmbeddedCollection.java | 4 +-
.../datastore/mapping/model/types/Identity.java | 6 +-
.../datastore/mapping/model/types/ManyToOne.java | 5 +-
.../datastore/mapping/model/types/OneToMany.java | 10 +-
.../datastore/mapping/model/types/OneToOne.java | 5 +-
.../datastore/mapping/model/types/Simple.java | 1 +
.../datastore/mapping/model/types/TenantId.java | 2 +-
.../datastore/mapping/model/types/ToMany.java | 3 +-
.../datastore/mapping/model/types/ToOne.java | 4 +-
.../conversion/ByteArrayToStringConverter.groovy | 2 +-
.../types/conversion/DefaultConversionService.java | 15 +-
.../types/conversion/DoubleToFloatConverter.groovy | 2 +-
.../IntArrayToIntegerArrayConverter.groovy | 2 +-
.../types/conversion/IntegerToByteConverter.groovy | 2 +-
.../conversion/IntegerToShortConverter.groovy | 2 +-
.../LongArrayToLongArrayConverter.groovy | 2 +-
.../conversion/StringToBigDecimalConverter.groovy | 2 +-
.../conversion/StringToBigIntegerConverter.groovy | 2 +-
.../conversion/StringToByteArrayConverter.groovy | 1 +
.../conversion/StringToCurrencyConverter.groovy | 2 +-
.../conversion/StringToLocaleConverter.groovy | 6 +-
.../types/conversion/StringToShortConverter.groovy | 2 +-
.../conversion/StringToTimeZoneConverter.groovy | 2 +-
.../types/conversion/StringToURLConverter.groovy | 2 +-
.../multitenancy/MultiTenancySettings.groovy | 10 +-
.../multitenancy/MultiTenantCapableDatastore.java | 5 +-
.../SchemaMultiTenantCapableDatastore.java | 1 -
.../multitenancy/TenantDataSourceConfig.java | 7 +-
.../multitenancy/exceptions/TenantException.groovy | 2 +-
.../exceptions/TenantNotFoundException.groovy | 2 +-
.../resolvers/FixedTenantResolver.groovy | 2 +-
.../multitenancy/resolvers/NoTenantResolver.groovy | 1 +
.../resolvers/SystemPropertyTenantResolver.groovy | 5 +-
.../proxy/AssociationQueryProxyHandler.java | 24 +-
.../datastore/mapping/proxy/EntityProxy.java | 2 +
.../mapping/proxy/EntityProxyMethodHandler.java | 20 +-
.../mapping/proxy/GroovyObjectMethodHandler.java | 47 +-
.../mapping/proxy/JavassistProxyFactory.java | 44 +-
.../datastore/mapping/proxy/ProxyFactory.java | 18 +-
.../datastore/mapping/proxy/ProxyHandler.java | 7 +
.../proxy/SessionEntityProxyMethodHandler.java | 28 +-
.../datastore/mapping/query/AssociationQuery.java | 4 +-
.../datastore/mapping/query/Projections.java | 6 +-
.../org/grails/datastore/mapping/query/Query.java | 260 ++-
.../datastore/mapping/query/QueryCreator.java | 2 +-
.../datastore/mapping/query/QueryException.java | 2 +
.../datastore/mapping/query/Restrictions.java | 51 +-
.../mapping/query/api/BuildableCriteria.java | 27 +-
.../datastore/mapping/query/api/Criteria.java | 184 +-
.../mapping/query/api/ProjectionList.java | 15 +-
.../mapping/query/api/QueryAliasAwareSession.java | 3 +-
.../mapping/query/api/QueryArgumentsAware.java | 27 +-
.../mapping/query/api/QueryableCriteria.java | 2 +
.../query/criteria/FunctionCallingCriterion.java | 2 +-
.../mapping/query/event/AbstractQueryEvent.java | 3 +-
.../mapping/query/event/PostQueryEvent.java | 3 +-
.../mapping/query/event/PreQueryEvent.java | 2 +-
.../mapping/query/event/QueryEventType.java | 1 -
.../mapping/query/jpa/JpaQueryBuilder.java | 334 ++--
.../datastore/mapping/query/jpa/JpaQueryInfo.java | 1 -
.../mapping/query/order/ManualEntityOrdering.java | 40 +-
.../query/projections/ManualProjections.java | 21 +-
.../mapping/rdbms/RelationalDatastore.java | 4 +-
.../mapping/reflect/AstAnnotationUtils.groovy | 30 +-
.../mapping/reflect/AstGenericsUtils.groovy | 7 +-
.../datastore/mapping/reflect/AstUtils.groovy | 97 +-
.../mapping/reflect/ClassPropertyFetcher.java | 197 +-
.../datastore/mapping/reflect/ClassUtils.java | 34 +-
.../mapping/reflect/ClosureToMapPopulator.java | 13 +-
.../datastore/mapping/reflect/EntityReflector.java | 20 +-
.../mapping/reflect/FieldEntityAccess.java | 112 +-
.../datastore/mapping/reflect/MetaClassUtils.java | 2 +-
.../datastore/mapping/reflect/NameUtils.java | 32 +-
.../datastore/mapping/reflect/ReflectionUtils.java | 99 +-
.../mapping/services/DefaultServiceDefinition.java | 5 +-
.../mapping/services/DefaultServiceRegistry.groovy | 25 +-
.../services/ServiceNotFoundException.groovy | 2 +-
.../mapping/services/SoftServiceLoader.java | 13 +-
.../CustomizableRollbackTransactionAttribute.java | 20 +-
.../transactions/DatastoreTransactionManager.java | 42 +-
.../mapping/transactions/SessionHolder.java | 8 +-
.../transactions/SessionOnlyTransaction.java | 9 +-
.../mapping/transactions/Transaction.java | 2 +
.../mapping/transactions/TransactionObject.java | 4 +-
.../mapping/transactions/TransactionUtils.java | 1 -
.../support/SpringSessionSynchronization.java | 7 +-
.../validation/BeanFactoryValidatorRegistry.java | 2 +-
.../mapping/validation/CascadeValidateType.java | 16 +-
.../mapping/validation/ValidationErrors.java | 4 +-
.../mapping/validation/ValidationException.java | 20 +-
.../mapping/validation/ValidatorRegistry.java | 1 -
grails-datastore-web/build.gradle | 1 +
.../multitenancy/web/CookieTenantResolver.groovy | 12 +-
.../web/HttpHeaderTenantResolver.groovy | 8 +-
.../multitenancy/web/SessionTenantResolver.groovy | 11 +-
.../web/SubDomainTenantResolver.groovy | 16 +-
.../web/support/OpenSessionInViewInterceptor.java | 4 +-
grails-doc/build.gradle | 2 +-
grails-domain-class/build.gradle | 1 +
.../main/groovy/grails/artefact/DomainClass.groovy | 2 +-
.../traits/DomainClassTraitInjector.groovy | 3 +-
.../plugins/domain/DomainClassGrailsPlugin.groovy | 32 +-
.../domain/support/ConstraintEvaluatorAdapter.java | 1 -
.../DefaultMappingContextFactoryBean.groovy | 13 +-
grails-encoder/build.gradle | 1 +
.../groovy/org/grails/buffer/CodecPrintWriter.java | 11 +-
.../org/grails/buffer/FastStringPrintWriter.java | 18 +-
.../grails/buffer/GrailsLazyProxyPrintWriter.java | 19 +-
.../org/grails/buffer/GrailsPrintWriter.java | 181 +-
.../grails/buffer/GrailsPrintWriterAdapter.java | 19 +-
.../grails/buffer/GrailsRoutablePrintWriter.java | 92 +-
.../org/grails/buffer/GrailsWrappedWriter.java | 9 +-
.../groovy/org/grails/buffer/StreamByteBuffer.java | 54 +-
.../groovy/org/grails/buffer/StreamCharBuffer.java | 1626 ++++++++--------
.../grails/buffer/StreamCharBufferMetaUtils.groovy | 1 +
.../org/grails/buffer/StringCharArrayAccessor.java | 90 +-
.../grails/charsequences/CharArrayAccessible.java | 38 +-
.../charsequences/CharArrayCharSequence.java | 30 +-
.../org/grails/charsequences/CharSequences.java | 123 +-
.../charsequences/SingleCharCharSequence.java | 31 +-
.../org/grails/charsequences/SubCharSequence.java | 30 +-
.../encoder/AbstractCharReplacementEncoder.java | 46 +-
.../grails/encoder/AbstractEncodedAppender.java | 85 +-
.../groovy/org/grails/encoder/ChainedDecoder.java | 7 +-
.../groovy/org/grails/encoder/ChainedEncoder.java | 97 +-
.../groovy/org/grails/encoder/ChainedEncoders.java | 62 +-
.../groovy/org/grails/encoder/CodecIdentifier.java | 3 +-
.../groovy/org/grails/encoder/CodecLookup.java | 6 +-
.../org/grails/encoder/CodecLookupHelper.java | 11 +-
.../grails/encoder/CodecMetaClassSupport.groovy | 51 +-
.../grails/encoder/CombinedCodecIdentifier.java | 17 +-
.../main/groovy/org/grails/encoder/Decoder.java | 3 +-
.../org/grails/encoder/DefaultCodecIdentifier.java | 32 +-
.../encoder/DefaultEncodingStateRegistry.java | 11 +-
.../main/groovy/org/grails/encoder/Encodeable.java | 3 +-
.../groovy/org/grails/encoder/EncodedAppender.java | 96 +-
.../org/grails/encoder/EncodedAppenderWriter.java | 22 +-
.../encoder/EncodedAppenderWriterFactory.java | 6 +-
.../groovy/org/grails/encoder/EncodesToWriter.java | 11 +-
.../org/grails/encoder/EncodesToWriterAdapter.java | 27 +-
.../groovy/org/grails/encoder/EncodingState.java | 2 +-
.../org/grails/encoder/EncodingStateImpl.java | 44 +-
.../org/grails/encoder/EncodingStateRegistry.java | 21 +-
.../encoder/EncodingStateRegistryLookupHolder.java | 5 +-
.../org/grails/encoder/StreamEncodeable.java | 9 +-
.../org/grails/encoder/StreamingEncoder.java | 21 +-
.../encoder/StreamingEncoderEncodedAppender.java | 9 +-
.../grails/encoder/StreamingEncoderWritable.java | 11 +-
.../org/grails/encoder/StreamingEncoderWriter.java | 17 +-
.../org/grails/encoder/WriterEncodedAppender.java | 3 +-
.../org/grails/encoder/impl/BasicCodecLookup.java | 78 +-
.../org/grails/encoder/impl/BasicJSONEncoder.java | 24 +-
.../org/grails/encoder/impl/BasicXMLEncoder.java | 73 +-
.../groovy/org/grails/encoder/impl/HTML4Codec.java | 1 +
.../org/grails/encoder/impl/HTML4Encoder.java | 29 +-
.../grails/encoder/impl/HTMLCodecFactory.groovy | 6 +-
.../org/grails/encoder/impl/HTMLEncoder.java | 7 +-
.../org/grails/encoder/impl/HTMLJSCodec.java | 8 +-
.../grails/encoder/impl/JSONCodecFactory.groovy | 8 +-
.../org/grails/encoder/impl/JavaScriptCodec.groovy | 6 +-
.../org/grails/encoder/impl/JavaScriptEncoder.java | 12 +-
.../org/grails/encoder/impl/NoneEncoder.java | 7 +-
.../groovy/org/grails/encoder/impl/RawCodec.java | 19 +-
.../encoder/impl/StandaloneCodecLookup.groovy | 22 +-
.../org/grails/encoder/impl/URLCodecFactory.groovy | 11 +-
.../org/grails/encoder/impl/XMLCodecFactory.java | 1 +
grails-events/compat/build.gradle | 1 +
.../src/main/groovy/grails/events/Events.groovy | 30 +-
.../compat/src/main/groovy/reactor/bus/Bus.java | 5 +-
.../compat/src/main/groovy/reactor/bus/Event.java | 8 +-
.../src/main/groovy/reactor/bus/EventBus.groovy | 5 +-
.../reactor/bus/registry/Registration.groovy | 2 +-
.../reactor/bus/registry/Subscription.groovy | 2 +-
.../main/groovy/reactor/bus/selector/Selector.java | 5 +-
.../src/main/groovy/reactor/fn/Consumer.java | 4 +-
grails-events/core/build.gradle | 1 +
.../src/main/groovy/grails/events/Event.groovy | 3 +-
.../groovy/grails/events/EventPublisher.groovy | 4 +-
.../groovy/grails/events/bus/EventBusAware.groovy | 2 +-
.../grails/events/bus/EventBusBuilder.groovy | 8 +-
.../grails/events/emitter/EventEmitter.groovy | 4 +-
.../events/subscriber/MethodEventSubscriber.groovy | 4 +-
.../events/subscriber/MethodSubscriber.groovy | 29 +-
.../org/grails/events/ClosureEventTrigger.groovy | 21 +-
.../grails/events/EventSubscriberTrigger.groovy | 5 +-
.../org/grails/events/bus/AbstractEventBus.groovy | 42 +-
.../org/grails/events/bus/ExecutorEventBus.groovy | 7 +-
.../grails/events/bus/SynchronousEventBus.groovy | 2 +-
.../events/bus/spring/EventBusFactoryBean.groovy | 6 +-
.../events/registry/ClosureSubscription.groovy | 2 +-
.../registry/EventSubscriberSubscription.groovy | 2 +-
grails-events/gpars/build.gradle | 1 +
.../org/grails/events/gpars/ActorEventBus.groovy | 5 +-
grails-events/plugin/build.gradle | 1 +
.../events/spring/SpringEventTranslator.groovy | 18 +-
.../plugins/events/EventBusGrailsPlugin.groovy | 4 +-
grails-events/rxjava/build.gradle | 1 +
.../org/grails/events/rxjava/RxEventBus.groovy | 22 +-
grails-events/rxjava2/build.gradle | 1 +
.../org/grails/events/rxjava2/RxEventBus.groovy | 26 +-
grails-events/rxjava3/build.gradle | 1 +
.../org/grails/events/rxjava3/RxEventBus.groovy | 26 +-
grails-events/spring/build.gradle | 1 +
.../org/grails/events/spring/SpringEventBus.groovy | 4 +-
grails-events/transforms/build.gradle | 1 +
.../groovy/org/grails/events/EventIdUtils.groovy | 3 +-
.../events/gorm/GormAnnotatedListener.groovy | 5 +-
.../events/gorm/GormDispatcherRegistrar.groovy | 27 +-
.../grails/events/gorm/GormEventDispatcher.groovy | 18 +-
.../events/transform/AnnotatedSubscriber.groovy | 20 +-
.../events/transform/PublisherTransform.groovy | 63 +-
.../events/transform/SubscriberTransform.groovy | 79 +-
grails-fields/build.gradle | 1 +
.../grails/plugin/formfields/Application.groovy | 2 +-
.../plugin/formfields/FormFieldsTagLib.groovy | 1887 +++++++++---------
.../formfields/BeanPropertyAccessorFactory.groovy | 50 +-
.../formfields/BeanPropertyAccessorImpl.groovy | 8 +-
.../plugin/formfields/PropertyPathAccessor.groovy | 2 +-
.../ScaffoldingBeanConfiguration.groovy | 7 +-
.../markup/ContextMarkupRenderer.groovy | 6 +-
.../markup/ContextMarkupRendererImpl.groovy | 23 +-
.../markup/DomainMarkupRendererImpl.groovy | 69 +-
.../markup/PropertyMarkupRendererImpl.groovy | 4 +-
.../scaffolding/model/DomainModelService.groovy | 3 +-
.../model/DomainModelServiceImpl.groovy | 16 +-
.../scaffolding/model/property/Constrained.groovy | 4 +-
.../model/property/DomainPropertyImpl.groovy | 12 +-
.../registry/DomainRendererRegisterer.groovy | 21 +-
.../registry/DomainRendererRegistry.groovy | 3 +-
.../registry/input/AssociationInputRenderer.groovy | 2 +-
.../input/BidirectionalToManyInputRenderer.groovy | 4 +-
.../registry/input/CurrencyInputRenderer.groovy | 3 +-
.../registry/input/LocaleInputRenderer.groovy | 3 +-
.../registry/input/MapToSelectInputRenderer.groovy | 4 +-
.../registry/input/NumberInputRenderer.groovy | 2 +-
.../registry/input/StringInputRenderer.groovy | 2 +-
.../registry/input/TimeZoneInputRenderer.groovy | 3 +-
.../DomainClassPropertyAccessorSpec.groovy | 8 +-
.../taglib/AbstractFormFieldsTagLibSpec.groovy | 6 +-
.../plugin/formfields/taglib/AllTagSpec.groovy | 6 +-
.../etc/config/checkstyle/suppressions.xml | 6 +-
.../gradle/style-enforcement-config.gradle | 3 +-
grails-geb/build.gradle | 1 +
.../grails/plugin/geb/GebGrailsPlugin.groovy | 1 +
.../src/main/scripts/CreateFunctionalTest.groovy | 12 +-
grails-gsp/core/build.gradle | 1 +
.../org/grails/gsp/CompileStaticGroovyPage.groovy | 1 +
.../src/main/groovy/org/grails/gsp/GroovyPage.java | 75 +-
.../groovy/org/grails/gsp/GroovyPageBinding.java | 13 +-
.../groovy/org/grails/gsp/GroovyPageMetaInfo.java | 102 +-
.../org/grails/gsp/GroovyPageResourceLoader.java | 4 +-
.../org/grails/gsp/GroovyPageSourceDecorator.java | 3 +-
.../groovy/org/grails/gsp/GroovyPageTemplate.java | 3 +-
.../groovy/org/grails/gsp/GroovyPageWritable.java | 68 +-
.../org/grails/gsp/GroovyPagesException.java | 6 +-
.../org/grails/gsp/GroovyPagesMetaUtils.groovy | 7 +-
.../org/grails/gsp/GroovyPagesTemplateEngine.java | 249 +--
.../org/grails/gsp/ModelRecordingGroovyPage.groovy | 4 +-
.../grails/gsp/ResourceAwareTemplateEngine.java | 24 +-
.../groovy/org/grails/gsp/compiler/GSPWriter.java | 21 +-
.../gsp/compiler/GrailsLayoutPreprocessor.java | 2 +-
.../grails/gsp/compiler/GroovyPageCompiler.groovy | 75 +-
.../gsp/compiler/GroovyPageExpressionParser.java | 52 +-
.../org/grails/gsp/compiler/GroovyPageParser.java | 242 ++-
.../org/grails/gsp/compiler/GroovyPageScanner.java | 45 +-
.../gsp/compiler/GroovyPageTypeCheckingConfig.java | 2 +-
.../GroovyPageTypeCheckingExtension.groovy | 3 +-
.../groovy/org/grails/gsp/compiler/Reverse.java | 3 +-
.../main/groovy/org/grails/gsp/compiler/Strip.java | 15 +-
.../groovy/org/grails/gsp/compiler/Tokens.java | 5 +-
.../org/grails/gsp/compiler/tags/GrailsTag.java | 3 +
.../gsp/compiler/tags/GrailsTagRegistry.java | 30 +-
.../grails/gsp/compiler/tags/GroovyCollectTag.java | 2 +
.../grails/gsp/compiler/tags/GroovyFindAllTag.java | 12 +-
.../grails/gsp/compiler/tags/GroovyGrepTag.java | 4 +-
.../org/grails/gsp/compiler/tags/GroovyIfTag.java | 1 +
.../grails/gsp/compiler/tags/GroovySyntaxTag.java | 32 +-
.../grails/gsp/compiler/tags/GroovyUnlessTag.java | 1 +
.../transform/GroovyPageBytecodeOptimizer.java | 2 +-
.../transform/GroovyPageInjectionOperation.java | 16 +-
.../transform/GroovyPageOptimizerVisitor.java | 28 +-
.../grails/gsp/compiler/transform/LineNumber.java | 4 +-
.../compiler/transform/LineNumberTransform.java | 85 +-
.../io/CachingGroovyPageStaticResourceLocator.java | 3 +-
.../grails/gsp/io/DefaultGroovyPageLocator.java | 60 +-
.../gsp/io/GroovyPageCompiledScriptSource.java | 5 +-
.../org/grails/gsp/io/GroovyPageLocator.java | 6 +-
.../gsp/io/GroovyPageResourceScriptSource.java | 5 +-
.../gsp/io/GroovyPageStaticResourceLocator.java | 11 +-
.../src/main/groovy/org/grails/gsp/jsp/JspTag.java | 11 +-
.../org/grails/gsp/jsp/TagLibraryResolver.java | 1 -
grails-gsp/grails-layout/build.gradle | 1 +
.../web/layout/EmbeddedGrailsLayoutView.java | 23 +-
.../layout/EmbeddedGrailsLayoutViewResolver.java | 7 +-
.../apache/grails/web/layout/FactoryHolder.java | 7 +-
.../grails/web/layout/GSPGrailsLayoutPage.java | 2 +-
.../web/layout/GrailsContentBufferingResponse.java | 14 +-
.../grails/web/layout/GrailsHTMLPageParser.java | 4 +-
.../web/layout/GrailsLayoutDecoratorMapper.java | 16 +-
.../apache/grails/web/layout/GrailsLayoutView.java | 10 +-
.../web/layout/GrailsLayoutViewResolver.java | 32 +-
.../grails/web/layout/GrailsNoDecorator.java | 5 +-
.../web/layout/GrailsPageResponseWrapper.java | 36 +-
.../web/layout/GrailsViewBufferingResponse.java | 21 +-
.../grails/web/layout/GroovyPageLayoutFinder.java | 55 +-
.../grails/web/layout/LayoutGrailsPlugin.groovy | 7 +-
.../apache/grails/web/layout/LayoutSelector.groovy | 2 +-
.../grails/web/layout/SpringMVCViewDecorator.java | 33 +-
.../web/layout/TokenizedHTMLPage2Content.java | 8 +-
.../plugins/web/taglib/GrailsLayoutTagLib.groovy | 2 +-
.../web/taglib/RenderGrailsLayoutTagLib.groovy | 8 +-
grails-gsp/grails-sitemesh3/build.gradle | 1 +
.../sitemesh3/GrailsLayoutHandlerMapping.java | 9 +-
.../plugins/sitemesh3/Sitemesh3GrailsPlugin.groovy | 14 +-
.../plugins/web/taglib/RenderSitemeshTagLib.groovy | 14 +-
.../plugins/web/taglib/SitemeshTagLib.groovy | 24 +-
grails-gsp/grails-taglib/build.gradle | 1 +
.../groovy/grails/core/gsp/GrailsTagLibClass.java | 1 +
.../core/artefact/gsp/TagLibArtefactHandler.java | 12 +-
.../grails/core/gsp/DefaultGrailsTagLibClass.java | 11 +-
.../taglib/AbstractTemplateVariableBinding.java | 18 +-
.../org/grails/taglib/GrailsTagException.java | 7 +-
.../org/grails/taglib/GroovyPageAttributes.java | 7 +-
.../grails/taglib/NamespacedTagDispatcher.groovy | 1 +
.../groovy/org/grails/taglib/TagBodyClosure.java | 28 +-
.../taglib/TagLibNamespaceMethodDispatcher.groovy | 1 +
.../groovy/org/grails/taglib/TagLibraryLookup.java | 39 +-
.../org/grails/taglib/TagLibraryMetaUtils.groovy | 72 +-
.../main/groovy/org/grails/taglib/TagOutput.java | 27 +-
.../taglib/TemplateNamespacedTagDispatcher.groovy | 24 +-
.../org/grails/taglib/TemplateVariableBinding.java | 31 +-
.../taglib/encoder/DefaultOutputContextLookup.java | 14 +-
.../org/grails/taglib/encoder/OutputContext.java | 6 +
.../grails/taglib/encoder/OutputContextLookup.java | 1 +
.../taglib/encoder/OutputContextLookupHelper.java | 20 +-
.../taglib/encoder/OutputEncodingSettings.groovy | 27 +-
.../grails/taglib/encoder/OutputEncodingStack.java | 319 +--
.../encoder/OutputEncodingStackAttributes.java | 48 +-
.../grails/taglib/encoder/WithCodecHelper.groovy | 33 +-
grails-gsp/grails-web-gsp-taglib/build.gradle | 1 +
.../grails/plugins/web/taglib/RenderTagLib.groovy | 2 +-
.../web/pages/StandaloneTagLibraryLookup.java | 34 +-
grails-gsp/grails-web-gsp/build.gradle | 1 +
.../src/main/groovy/grails/gsp/PageRenderer.groovy | 28 +-
.../web/gsp/GroovyPagesTemplateRenderer.java | 57 +-
.../CachingGrailsConventionGroovyPageLocator.java | 74 +-
.../gsp/io/GrailsConventionGroovyPageLocator.java | 77 +-
.../org/grails/web/pages/GSPResponseWriter.java | 70 +-
.../grails/web/pages/GroovyPageCompilerTask.groovy | 9 +-
.../org/grails/web/pages/GroovyPagesServlet.java | 35 +-
.../grails/web/servlet/view/GroovyPageView.java | 53 +-
.../web/servlet/view/GroovyPageViewResolver.java | 66 +-
grails-gsp/grails-web-jsp/build.gradle | 1 +
.../groovy/org/grails/gsp/jsp/BodyContentImpl.java | 13 +-
.../gsp/jsp/GroovyPagesJspApplicationContext.java | 40 +-
.../grails/gsp/jsp/GroovyPagesJspFactory.groovy | 4 +-
.../org/grails/gsp/jsp/GroovyPagesPageContext.java | 106 +-
.../groovy/org/grails/gsp/jsp/JspTagImpl.groovy | 79 +-
.../groovy/org/grails/gsp/jsp/JspTagLibImpl.groovy | 16 +-
.../org/grails/gsp/jsp/LocalEntityResolver.java | 82 +-
.../org/grails/gsp/jsp/PageContextFactory.groovy | 5 +-
.../grails/gsp/jsp/TagLibraryResolverImpl.groovy | 58 +-
.../groovy/org/grails/gsp/jsp/TldReader.groovy | 9 +-
.../grails/gsp/jsp/WebXmlTagLibraryReader.groovy | 3 +-
.../web/taglib/jsp/JspInvokeGrailsTagLibTag.java | 106 +-
grails-gsp/grails-web-taglib/build.gradle | 1 +
.../main/groovy/grails/artefact/TagLibrary.groovy | 28 +-
.../grails/artefact/gsp/TagLibraryInvoker.groovy | 15 +-
.../compiler/traits/TagLibraryTraitInjector.groovy | 4 +-
.../src/main/groovy/grails/gsp/TagLib.java | 5 +-
.../TagLibArtefactTypeAstTransformation.java | 7 +-
.../compiler/web/taglib/TagLibraryTransformer.java | 90 +-
.../org/grails/web/taglib/LayoutWriterStack.java | 5 +-
.../taglib/WebRequestTemplateVariableBinding.java | 20 +-
.../web/taglib/encoder/WebOutputContextLookup.java | 37 +-
.../taglib/encoder/WebRequestOutputContext.java | 1 +
grails-gsp/plugin/build.gradle | 1 +
.../plugins/web/DefaultGrailsTagDateHelper.groovy | 18 +-
.../plugins/web/taglib/ApplicationTagLib.groovy | 88 +-
.../grails/plugins/web/taglib/CountryTagLib.groovy | 491 ++---
.../grails/plugins/web/taglib/FormTagLib.groovy | 166 +-
.../grails/plugins/web/taglib/FormatTagLib.groovy | 69 +-
.../plugins/web/taglib/JavascriptTagLib.groovy | 19 +-
.../plugins/web/taglib/UrlMappingTagLib.groovy | 43 +-
.../plugins/web/taglib/ValidationTagLib.groovy | 4 +-
.../grails/web/pages/AliasedTagPropertySpec.groovy | 2 +-
grails-gsp/spring-boot/build.gradle | 1 +
.../java/grails/gsp/boot/GspAutoConfiguration.java | 111 +-
.../gsp/boot/StandaloneGrailsApplication.java | 22 +-
grails-i18n/build.gradle | 1 +
.../grails/plugins/i18n/I18nAutoConfiguration.java | 3 +-
grails-interceptors/build.gradle | 1 +
.../main/groovy/grails/artefact/Interceptor.groovy | 4 +-
...ailsInterceptorHandlerInterceptorAdapter.groovy | 31 +-
.../interceptors/InterceptorArtefactHandler.groovy | 16 +-
.../interceptors/InterceptorsGrailsPlugin.groovy | 19 +-
.../web/interceptors/UrlMappingMatcher.groovy | 67 +-
grails-logging/build.gradle | 1 +
.../compiler/logging/LoggingTransformer.java | 22 +-
grails-mimetypes/build.gradle | 1 +
.../plugins/web/api/MimeTypesApiSupport.groovy | 6 +-
.../org/grails/web/mime/DefaultMimeUtility.java | 2 +-
.../web/mime/HttpServletRequestExtension.groovy | 6 +-
.../web/mime/HttpServletResponseExtension.groovy | 8 +-
grails-rest-transforms/build.gradle | 1 +
.../artefact/controller/RestResponder.groovy | 47 +-
.../traits/RestResponderTraitInjector.groovy | 2 +-
.../src/main/groovy/grails/rest/Link.groovy | 6 +-
.../src/main/groovy/grails/rest/Linkable.groovy | 4 +-
.../src/main/groovy/grails/rest/Resource.groovy | 8 +-
.../groovy/grails/rest/RestfulController.groovy | 56 +-
.../render/AbstractIncludeExcludeRenderer.groovy | 4 +-
.../rest/render/AbstractRenderContext.groovy | 2 +-
.../grails/rest/render/AbstractRenderer.groovy | 4 +-
.../grails/rest/render/ContainerRenderer.groovy | 2 +-
.../groovy/grails/rest/render/RenderContext.groovy | 2 +-
.../grails/rest/render/RendererRegistry.groovy | 2 +-
.../rest/render/atom/AtomCollectionRenderer.groovy | 1 +
.../grails/rest/render/atom/AtomRenderer.groovy | 23 +-
.../render/errors/AbstractVndErrorRenderer.groovy | 7 +-
.../rest/render/errors/VndErrorJsonRenderer.groovy | 7 +-
.../rest/render/errors/VndErrorXmlRenderer.groovy | 19 +-
.../render/hal/HalJsonCollectionRenderer.groovy | 2 -
.../grails/rest/render/hal/HalJsonRenderer.groovy | 85 +-
.../render/hal/HalXmlCollectionRenderer.groovy | 2 +-
.../grails/rest/render/hal/HalXmlRenderer.groovy | 26 +-
.../rest/render/json/JsonCollectionRenderer.groovy | 6 +-
.../grails/rest/render/json/JsonRenderer.groovy | 29 +-
.../render/util/AbstractLinkingRenderer.groovy | 5 +-
.../rest/render/xml/XmlCollectionRenderer.groovy | 8 +-
.../grails/rest/render/xml/XmlRenderer.groovy | 21 +-
.../rest/plugin/RestResponderGrailsPlugin.groovy | 23 +-
.../web/rest/render/DefaultRendererRegistry.groovy | 46 +-
.../web/rest/render/ServletRenderContext.groovy | 18 +-
.../rest/render/html/DefaultHtmlRenderer.groovy | 26 +-
.../rest/render/json/DefaultJsonRenderer.groovy | 6 +-
.../web/rest/render/xml/DefaultXmlRenderer.groovy | 15 +-
.../web/rest/transform/LinkableTransform.groovy | 10 +-
.../web/rest/transform/ResourceTransform.groovy | 103 +-
grails-scaffolding/build.gradle | 1 +
.../commands/scaffolding/GenerateAllCommand.groovy | 2 +-
.../scaffolding/GenerateServiceCommand.groovy | 3 +-
.../scaffolding/GenerateViewsCommand.groovy | 3 +-
.../scaffolding/InstallTemplatesCommand.groovy | 4 +-
.../grails/plugin/scaffolding/Application.groovy | 1 +
.../scaffolding/ScaffoldingGrailsPlugin.groovy | 31 +-
.../scaffolding/ScaffoldingViewResolver.groovy | 20 +-
.../plugin/scaffolding/annotation/Scaffold.java | 4 +-
.../ScaffoldingControllerInjector.groovy | 8 +-
.../scaffolding/ScaffoldingServiceInjector.groovy | 8 +-
.../main/scripts/CreateScaffoldController.groovy | 16 +-
.../main/scripts/GenerateAsyncController.groovy | 58 +-
.../src/main/scripts/GenerateController.groovy | 74 +-
.../src/main/scripts/GenerateViews.groovy | 34 +-
.../src/main/scripts/InstallTemplates.groovy | 8 +-
grails-services/build.gradle | 1 +
.../services/ServiceBeanAliasPostProcessor.groovy | 4 +-
.../plugins/services/ServicesGrailsPlugin.groovy | 58 +-
grails-shell-cli/build.gradle | 1 +
.../main/groovy/org/grails/cli/GrailsCli.groovy | 14 +-
.../archive/PackagedSpringApplicationLauncher.java | 86 +-
...GrailsApplicationCompilerAutoConfiguration.java | 31 +-
.../cli/boot/GrailsDependencyVersions.groovy | 9 +-
.../GrailsTestCompilerAutoConfiguration.groovy | 14 +-
.../grails/cli/boot/SpringApplicationLauncher.java | 88 +-
...SpringApplicationWebApplicationInitializer.java | 89 +-
.../org/grails/cli/boot/SpringInvoker.groovy | 19 +-
.../org/grails/cli/command/AbstractCommand.java | 77 +-
.../groovy/org/grails/cli/command/Command.java | 93 +-
.../org/grails/cli/command/CommandException.java | 175 +-
.../org/grails/cli/command/CommandFactory.java | 14 +-
.../org/grails/cli/command/CommandRunner.java | 491 ++---
.../groovy/org/grails/cli/command/HelpExample.java | 35 +-
.../grails/cli/command/NoArgumentsException.java | 2 +-
.../command/NoHelpCommandArgumentsException.java | 8 +-
.../grails/cli/command/NoSuchCommandException.java | 8 +-
.../grails/cli/command/OptionParsingCommand.java | 49 +-
.../grails/cli/command/archive/ArchiveCommand.java | 519 +++--
.../org/grails/cli/command/archive/JarCommand.java | 31 +-
.../cli/command/archive/ResourceMatcher.java | 364 ++--
.../org/grails/cli/command/archive/WarCommand.java | 61 +-
.../org/grails/cli/command/grab/GrabCommand.java | 50 +-
.../cli/command/install/DependencyResolver.java | 17 +-
.../install/GroovyGrabDependencyResolver.java | 94 +-
.../grails/cli/command/install/InstallCommand.java | 57 +-
.../org/grails/cli/command/install/Installer.java | 234 ++-
.../cli/command/install/UninstallCommand.java | 83 +-
.../cli/command/options/CompilerOptionHandler.java | 64 +-
.../OptionSetGroovyCompilerConfiguration.java | 123 +-
.../grails/cli/command/options/SourceOptions.java | 216 +--
.../org/grails/cli/command/run/RunCommand.java | 216 ++-
.../cli/command/run/SpringApplicationRunner.java | 448 +++--
.../run/SpringApplicationRunnerConfiguration.java | 28 +-
.../compiler/AnnotatedNodeASTTransformation.java | 174 +-
.../groovy/org/grails/cli/compiler/AstUtils.java | 272 +--
.../cli/compiler/CompilerAutoConfiguration.java | 116 +-
.../DependencyAutoConfigurationTransformation.java | 67 +-
.../grails/cli/compiler/DependencyCustomizer.java | 412 ++--
.../DependencyManagementBomTransformation.java | 364 ++--
.../cli/compiler/ExtendedGroovyClassLoader.java | 401 ++--
.../cli/compiler/GenericBomAstTransformation.java | 144 +-
.../cli/compiler/GrailsBomAstTransformation.java | 3 +-
.../cli/compiler/GroovyBeansTransformation.java | 152 +-
.../org/grails/cli/compiler/GroovyCompiler.java | 505 +++--
.../cli/compiler/GroovyCompilerConfiguration.java | 93 +-
.../grails/cli/compiler/GroovyCompilerScope.java | 18 +-
.../compiler/RepositoryConfigurationFactory.java | 177 +-
...ResolveDependencyCoordinatesTransformation.java | 125 +-
.../grails/cli/compiler/SmartImportCustomizer.java | 40 +-
.../CachingCompilerAutoConfiguration.java | 27 +-
.../GrailsCompilerAutoConfiguration.java | 4 +-
.../GroovyTemplatesCompilerAutoConfiguration.java | 29 +-
.../JdbcCompilerAutoConfiguration.java | 29 +-
.../JmsCompilerAutoConfiguration.java | 31 +-
.../RabbitCompilerAutoConfiguration.java | 39 +-
.../SpringBatchCompilerAutoConfiguration.java | 51 +-
.../SpringBootCompilerAutoConfiguration.java | 95 +-
...SpringIntegrationCompilerAutoConfiguration.java | 47 +-
.../SpringMvcCompilerAutoConfiguration.java | 37 +-
.../SpringRetryCompilerAutoConfiguration.java | 27 +-
.../SpringSecurityCompilerAutoConfiguration.java | 43 +-
.../SpringTestCompilerAutoConfiguration.java | 57 +-
.../SpringWebsocketCompilerAutoConfiguration.java | 39 +-
...sactionManagementCompilerAutoConfiguration.java | 31 +-
.../dependencies/ArtifactCoordinatesResolver.java | 45 +-
.../CompositeDependencyManagement.java | 64 +-
.../cli/compiler/dependencies/Dependency.java | 342 ++--
.../dependencies/DependencyManagement.java | 35 +-
...dencyManagementArtifactCoordinatesResolver.java | 70 +-
.../MavenModelDependencyManagement.java | 73 +-
...SpringBootDependenciesDependencyManagement.java | 33 +-
.../cli/compiler/grape/AetherGrapeEngine.java | 17 +-
.../compiler/grape/AetherGrapeEngineFactory.java | 80 +-
.../cli/compiler/grape/CompositeProxySelector.java | 32 +-
...ltRepositorySystemSessionAutoConfiguration.java | 59 +-
.../grape/DependencyResolutionContext.java | 139 +-
.../grape/DependencyResolutionFailedException.java | 17 +-
.../compiler/grape/DetailedProgressReporter.java | 52 +-
.../cli/compiler/grape/GrapeEngineInstaller.java | 27 +-
...otRepositorySystemSessionAutoConfiguration.java | 35 +-
.../compiler/grape/MavenResolverGrapeEngine.java | 559 +++---
.../grape/MavenResolverGrapeEngineFactory.java | 82 +-
.../cli/compiler/grape/ProgressReporter.java | 8 +-
.../compiler/grape/RepositoryConfiguration.java | 126 +-
.../RepositorySystemSessionAutoConfiguration.java | 13 +-
...mlRepositorySystemSessionAutoConfiguration.java | 35 +-
.../compiler/grape/SummaryProgressReporter.java | 97 +-
.../grails/cli/compiler/maven/MavenSettings.java | 499 ++---
.../cli/compiler/maven/MavenSettingsReader.java | 81 +-
.../grails/cli/gradle/ClasspathBuildAction.groovy | 1 +
.../gradle/FetchAllTaskSelectorsBuildAction.java | 33 +-
.../grails/cli/gradle/GradleAsyncInvoker.groovy | 4 +-
.../org/grails/cli/gradle/GradleInvoker.groovy | 7 +-
.../groovy/org/grails/cli/gradle/GradleUtil.groovy | 9 +-
.../cli/gradle/cache/CachedGradleOperation.groovy | 5 +-
.../cache/ListReadingCachedGradleOperation.groovy | 5 +-
.../cache/MapReadingCachedGradleOperation.groovy | 16 +-
.../cli/gradle/commands/GradleCommand.groovy | 12 +-
.../commands/GradleTaskCommandAdapter.groovy | 7 +-
.../cli/gradle/commands/ReadGradleTasks.groovy | 8 +-
.../grails/cli/groovy/DependencyManagementBom.java | 19 +-
.../grails/cli/groovy/EnableGroovyTemplates.java | 4 +-
.../org/grails/cli/groovy/GroovyTemplate.java | 66 +-
.../completers/AllClassCompleter.groovy | 7 +-
.../completers/ClassNameCompleter.groovy | 107 +-
.../interactive/completers/ClosureCompleter.groovy | 3 +-
.../completers/DomainClassCompleter.groovy | 1 +
.../interactive/completers/RegexCompletor.groovy | 4 +-
.../completers/SimpleOrFileNameCompletor.groovy | 2 +-
.../completers/SortedAggregateCompleter.java | 27 +-
.../interactive/completers/StringsCompleter.java | 17 +-
.../interactive/completers/TestsCompleter.groovy | 5 +-
.../org/grails/cli/profile/AbstractProfile.groovy | 190 +-
.../org/grails/cli/profile/AbstractStep.groovy | 1 +
.../cli/profile/CommandCancellationListener.java | 3 +-
.../org/grails/cli/profile/CommandException.groovy | 2 +-
.../org/grails/cli/profile/DefaultFeature.groovy | 9 +-
.../grails/cli/profile/FileSystemProfile.groovy | 2 -
.../org/grails/cli/profile/MultiStepCommand.groovy | 6 +-
.../groovy/org/grails/cli/profile/Profile.java | 7 +-
.../org/grails/cli/profile/ProfileCommand.groovy | 2 +-
.../grails/cli/profile/ProfileRepoConfig.groovy | 1 +
.../cli/profile/ProfileRepositoryAware.groovy | 1 +
.../org/grails/cli/profile/ProjectContext.java | 3 +-
.../org/grails/cli/profile/ResourceProfile.groovy | 5 +-
.../commands/ArgumentCompletingCommand.groovy | 2 -
.../commands/ClosureExecutingCommand.groovy | 2 +-
.../cli/profile/commands/CommandCompleter.groovy | 11 +-
.../cli/profile/commands/CommandRegistry.groovy | 18 +-
.../cli/profile/commands/CreateAppCommand.groovy | 123 +-
.../profile/commands/CreatePluginCommand.groovy | 6 +-
.../profile/commands/CreateProfileCommand.groovy | 3 +-
.../profile/commands/CreateWebPluginCommand.groovy | 5 +-
.../commands/DefaultMultiStepCommand.groovy | 45 +-
.../grails/cli/profile/commands/HelpCommand.groovy | 46 +-
.../profile/commands/ListProfilesCommand.groovy | 3 +-
.../grails/cli/profile/commands/OpenCommand.groovy | 15 +-
.../cli/profile/commands/ProfileInfoCommand.groovy | 22 +-
.../profile/commands/events/CommandEvents.groovy | 5 +-
.../profile/commands/events/EventStorage.groovy | 6 +-
.../ApplicationContextCommandFactory.groovy | 3 +-
.../ClasspathCommandResourceResolver.groovy | 8 +-
.../profile/commands/factory/CommandFactory.groovy | 4 +-
.../FileSystemCommandResourceResolver.groovy | 7 +-
.../factory/GroovyScriptCommandFactory.groovy | 7 +-
.../factory/ResourceResolvingCommandFactory.groovy | 20 +-
.../commands/factory/ServiceCommandFactory.groovy | 3 +-
.../commands/factory/YamlCommandFactory.groovy | 13 +-
.../commands/io/FileSystemInteraction.groovy | 5 +-
.../commands/io/FileSystemInteractionImpl.groovy | 40 +-
.../profile/commands/io/GradleDependency.groovy | 8 +-
.../profile/commands/io/ServerInteraction.groovy | 5 +-
.../commands/script/GroovyScriptCommand.groovy | 33 +-
.../commands/templates/SimpleTemplate.groovy | 7 +-
.../commands/templates/TemplateException.groovy | 1 -
.../commands/templates/TemplateRendererImpl.groovy | 80 +-
.../repository/AbstractJarProfileRepository.groovy | 15 +-
.../repository/MavenProfileRepository.groovy | 30 +-
.../repository/StaticJarProfileRepository.groovy | 8 +-
.../cli/profile/steps/DefaultStepFactory.groovy | 8 +-
.../grails/cli/profile/steps/ExecuteStep.groovy | 13 +-
.../org/grails/cli/profile/steps/GradleStep.groovy | 30 +-
.../org/grails/cli/profile/steps/MkdirStep.groovy | 7 +-
.../org/grails/cli/profile/steps/RenderStep.groovy | 22 +-
.../grails/cli/profile/steps/StepRegistry.groovy | 8 +-
.../support/ArtefactVariableResolver.groovy | 8 +-
.../groovy/org/grails/cli/util/ResourceUtils.java | 262 ++-
grails-spring/build.gradle | 1 +
.../src/main/groovy/grails/spring/BeanBuilder.java | 419 ++--
.../grails/spring/DynamicElementReader.groovy | 23 +-
.../org/grails/spring/BeanConfiguration.java | 9 +-
.../grails/spring/DefaultBeanConfiguration.java | 186 +-
.../spring/DefaultRuntimeSpringConfiguration.java | 83 +-
.../grails/spring/GrailsApplicationContext.java | 16 +-
.../org/grails/spring/GrailsContextEvent.java | 3 +-
.../grails/spring/RuntimeSpringConfiguration.java | 31 +-
...TypeSpecifyableTransactionProxyFactoryBean.java | 4 +-
grails-test-core/build.gradle | 1 +
.../groovy/grails/test/AbstractClosureProxy.java | 9 +-
.../main/groovy/grails/test/MockClosureProxy.java | 13 +-
.../AbstractGrailsMockHttpServletResponse.groovy | 8 +-
.../testing/GrailsMockHttpServletRequest.groovy | 59 +-
.../testing/GrailsMockHttpServletResponse.java | 10 +-
.../plugins/testing/GrailsMockHttpSession.groovy | 3 +-
.../grails/test/io/MultiplexingOutputStream.groovy | 2 +-
.../grails/test/io/SystemOutAndErrSwapper.groovy | 13 +-
.../org/grails/test/report/junit/JUnitReports.java | 5 +-
.../test/report/junit/JUnitReportsFactory.java | 25 +-
.../grails/test/report/junit/PlainFormatter.java | 24 +-
.../org/grails/test/report/junit/XMLFormatter.java | 12 +-
.../IntegrationSpecConfigurerExtension.groovy | 10 +-
.../grails/test/support/GrailsTestAutowirer.groovy | 4 +-
.../test/support/GrailsTestInterceptor.groovy | 2 +-
.../org/grails/test/support/GrailsTestMode.groovy | 1 +
.../GrailsTestRequestEnvironmentInterceptor.groovy | 3 +-
.../GrailsTestTransactionInterceptor.groovy | 10 +-
.../test/support/TestStacktraceSanitizer.java | 6 +-
.../functionaltests/AsyncController.groovy | 2 +-
.../functionaltests/BookController.groovy | 5 +-
.../functionaltests/ErrorsController.groovy | 2 +-
.../functionaltests/MiscController.groovy | 4 +-
.../groovy/functionaltests/CustomException.groovy | 2 +-
.../controllers/pubsub/demo/TaskController.groovy | 2 +-
.../grails-app/init/com/demo/Application.groovy | 4 +-
.../datasources/grails-app/domain/ds2/Book.groovy | 2 +-
.../demo33/grails-app/init/demo/Application.groovy | 1 -
.../src/test/groovy/demo/DemoControllerTest.groovy | 2 -
.../src/test/groovy/demo/SimpleJunitTagSpec.groovy | 1 -
.../src/test/groovy/demo/SubControllerSpec.groovy | 3 +-
.../src/test/groovy/demo/TestControllerSpec.groovy | 3 +-
.../gorm/grails-app/domain/gorm/Book.groovy | 2 +-
.../groovy/gorm/AbstractParentSpec.groovy | 2 +-
.../views/gsp/layout/AbstractGrailsTagTests.groovy | 6 +-
.../example/ApplicationController.groovy | 3 +-
.../grails-app/init/example/Application.groovy | 1 -
.../controllers/example/BookController.groovy | 5 +-
.../src/main/groovy/another/Item.groovy | 3 +-
.../controllers/example/BookController.groovy | 5 +-
.../schemapertenant/BookController.groovy | 5 +-
.../init/multitenantcomposite/Application.groovy | 1 -
.../issueviews182/ApplicationController.groovy | 3 +-
.../functional/tests/BookController.groovy | 6 +-
.../mongodb/base/grails-app/init/BootStrap.groovy | 2 +-
.../examples/mongo/tenant/BookController.groovy | 8 +-
.../functional/tests/AuthorController.groovy | 10 +-
.../functional/tests/BookController.groovy | 9 +-
.../hibernate5/grails-app/init/BootStrap.groovy | 2 +-
.../src/main/groovy/example/BookController.groovy | 4 +-
.../example/ApplicationController.groovy | 3 +-
.../services/example/StudentService.groovy | 1 -
.../LoginAuthenticationSucessHandler.groovy | 3 +-
.../grails-app/init/issue11005/Application.groovy | 4 +-
.../issue11005/Issue11005GrailsPlugin.groovy | 21 +-
.../groovy/loadafter/LoadafterGrailsPlugin.groovy | 2 +-
.../groovy/loadfirst/LoadfirstGrailsPlugin.groovy | 2 +-
.../loadsecond/LoadsecondGrailsPlugin.groovy | 2 +-
.../functional/tests/CircularController.groovy | 4 +-
.../functional/tests/TeamController.groovy | 4 +-
.../grails-app/init/BootStrap.groovy | 2 +-
grails-test-suite-base/build.gradle | 1 +
.../grails/util/MockHttpServletResponse.java | 4 +-
.../grails/util/MockRequestDataValueProcessor.java | 8 +-
.../commons/test/AbstractGrailsMockTests.java | 18 +-
.../org/grails/support/MockApplicationContext.java | 101 +-
.../org/grails/web/servlet/mvc/HibernateProxy.java | 3 +-
.../grails/web/servlet/mvc/LazyInitializer.java | 4 +-
.../web/servlet/mvc/MockHibernateProxyHandler.java | 2 +-
grails-test-suite-persistence/build.gradle | 1 +
grails-test-suite-uber/build.gradle | 1 +
.../grails/test/mixin/AnotherController.groovy | 2 +-
grails-test-suite-web/build.gradle | 1 +
grails-testing-support-core/build.gradle | 1 +
.../testing/mixin/integration/Integration.groovy | 2 +-
.../grails/testing/services/ServiceUnitTest.groovy | 9 +-
.../IntegrationTestAstTransformation.groovy | 36 +-
.../grails/testing/GrailsApplicationBuilder.groovy | 10 +-
.../org/grails/testing/GrailsUnitTest.groovy | 20 +-
.../testing/ParameterizedGrailsUnitTest.groovy | 6 +-
.../context/junit4/GrailsTestConfiguration.java | 9 +-
.../testing/spock/AutowiredInterceptor.groovy | 2 +-
.../testing/spock/CleanupContextInterceptor.groovy | 2 +-
.../grails/testing/spock/RunOnceInterceptor.groovy | 3 +-
grails-testing-support-datamapping/build.gradle | 1 +
.../grails/testing/gorm/DomainUnitTest.groovy | 6 +-
.../gorm/MockCascadingDomainClassValidator.groovy | 1 +
.../gorm/spock/DataTestCleanupInterceptor.groovy | 2 +-
.../gorm/spock/DataTestSetupInterceptor.groovy | 2 +-
.../gorm/spock/DataTestSetupSpecInterceptor.groovy | 13 +-
grails-testing-support-mongodb/build.gradle | 1 +
.../mongo/AbstractMongoGrailsExtension.groovy | 1 +
.../testing/mongo/MongoContainerHolder.groovy | 5 +-
.../StartMongoGrailsIntegrationExtension.groovy | 10 +-
.../mongo/StartMongoGrailsUnitExtension.groovy | 1 +
grails-testing-support-views-gson/build.gradle | 1 +
.../grails/views/json/test/JsonViewUnitTest.groovy | 13 +-
.../test/spock/JsonViewSetupSpecInterceptor.groovy | 2 +-
grails-testing-support-web/build.gradle | 1 +
.../grails/testing/web/GrailsWebUnitTest.groovy | 13 +-
.../grails/testing/web/UrlMappingsUnitTest.groovy | 38 +-
.../web/controllers/ControllerUnitTest.groovy | 10 +-
.../web/interceptor/InterceptorUnitTest.groovy | 28 +-
.../testing/web/taglib/TagLibUnitTest.groovy | 8 +-
.../support/GroovyPageUnitTestResourceLoader.java | 11 +-
.../runtime/support/LazyTagLibraryLookup.java | 16 +-
.../spock/InterceptorSetupSpecInterceptor.groovy | 2 +-
.../spock/UrlMappingSetupSpecInterceptor.groovy | 2 +-
.../testing/spock/WebCleanupInterceptor.groovy | 2 +-
.../testing/spock/WebSetupInterceptor.groovy | 9 +-
.../testing/spock/WebSetupSpecInterceptor.groovy | 7 +-
grails-url-mappings/build.gradle | 1 +
.../web/mapping/UrlMappingsAutoConfiguration.java | 8 +-
.../web/mapping/UrlMappingsGrailsPlugin.groovy | 67 +-
.../web/mapping/factory/UrlMappingFactoryBean.java | 10 +-
grails-validation/build.gradle | 1 +
.../grails/validation/ASTValidateableHelper.java | 1 +
.../grails/validation/ConstrainedDelegate.groovy | 1 +
.../validation/DefaultASTValidateableHelper.java | 43 +-
.../groovy/grails/validation/Validateable.groovy | 7 +-
.../support/DefaultConstrainedDiscovery.groovy | 5 +-
.../web/plugins/support/ValidationSupport.groovy | 9 +-
grails-views-core/build.gradle | 1 +
.../views/AbstractGroovyTemplateCompiler.groovy | 56 +-
.../grails/views/AbstractWritableScript.groovy | 5 +-
.../grails/views/GenericViewConfiguration.groovy | 10 +-
.../groovy/grails/views/GrailsViewTemplate.groovy | 19 +-
.../views/ResolvableGroovyTemplateEngine.groovy | 87 +-
.../grails/views/ViewCompilationException.groovy | 11 +-
.../groovy/grails/views/ViewConfiguration.groovy | 1 +
.../main/groovy/grails/views/ViewException.groovy | 2 +-
.../groovy/grails/views/ViewRenderException.groovy | 9 +-
.../groovy/grails/views/ViewUriResolver.groovy | 1 +
.../groovy/grails/views/ViewsEnvironment.groovy | 1 +
.../grails/views/WritableScriptTemplate.groovy | 44 +-
.../main/groovy/grails/views/api/GrailsView.groovy | 2 +-
.../grails/views/api/GrailsViewHelper.groovy | 1 -
.../groovy/grails/views/api/http/Response.groovy | 4 +-
.../api/internal/DefaultGrailsViewHelper.groovy | 23 +-
.../views/api/internal/EmptyParameters.groovy | 1 +
.../compiler/BuilderTypeCheckingExtension.groovy | 25 +-
.../views/compiler/HalCodeVisitorSupport.groovy | 9 +-
.../grails/views/compiler/ViewsTransform.groovy | 67 +-
.../views/mvc/GenericGroovyTemplateView.groovy | 32 +-
.../mvc/GenericGroovyTemplateViewResolver.groovy | 5 +-
.../grails/views/mvc/SmartViewResolver.groovy | 24 +-
.../views/mvc/renderer/DefaultViewRenderer.groovy | 38 +-
.../resolve/GenericGroovyTemplateResolver.groovy | 10 +-
.../views/resolve/GenericViewUriResolver.groovy | 26 +-
.../resolve/PluginAwareTemplateResolver.groovy | 15 +-
.../groovy/grails/views/utils/ViewUtils.groovy | 18 +-
grails-views-gson/build.gradle | 1 +
.../plugin/json/builder/DefaultJsonGenerator.java | 32 +-
.../grails/plugin/json/builder/JsonGenerator.java | 32 +-
.../grails/plugin/json/builder/JsonOutput.java | 19 +-
.../plugin/json/builder/StreamingJsonBuilder.java | 188 +-
.../json/converters/InstantJsonConverter.groovy | 2 +-
.../json/converters/LocalDateJsonConverter.groovy | 2 +-
.../converters/LocalDateTimeJsonConverter.groovy | 2 +-
.../json/converters/LocalTimeJsonConverter.groovy | 2 +-
.../converters/OffsetDateTimeJsonConverter.groovy | 2 +-
.../json/converters/OffsetTimeJsonConverter.groovy | 2 +-
.../json/converters/PeriodJsonConverter.groovy | 2 +-
.../converters/ZonedDateTimeJsonConverter.groovy | 2 +-
.../AbstractJsonViewContainerRenderer.groovy | 19 +-
.../json/renderer/ErrorsJsonViewRenderer.groovy | 3 +-
.../json/renderer/JsonViewJsonRenderer.groovy | 1 -
.../plugin/json/view/JsonViewCompiler.groovy | 2 +-
.../plugin/json/view/JsonViewConfiguration.groovy | 2 +-
.../plugin/json/view/JsonViewGrailsPlugin.groovy | 11 +-
.../plugin/json/view/JsonViewTemplateEngine.groovy | 14 +-
.../plugin/json/view/JsonViewWritableScript.groovy | 49 +-
.../json/view/api/GrailsJsonViewHelper.groovy | 2 +-
.../plugin/json/view/api/HalViewHelper.groovy | 8 +-
.../grails/plugin/json/view/api/JsonView.groovy | 18 +-
.../internal/DefaultGrailsJsonViewHelper.groovy | 287 ++-
.../view/api/internal/DefaultHalViewHelper.groovy | 223 ++-
.../api/internal/DefaultJsonApiViewHelper.groovy | 26 +-
.../view/api/internal/DefaultJsonViewHelper.groovy | 1 +
.../json/view/api/internal/ParentInfo.groovy | 1 +
.../json/view/api/internal/TemplateRenderer.groovy | 40 +-
.../JsonTemplateTypeCheckingExtension.groovy | 16 +-
.../json/view/internal/JsonViewsTransform.groovy | 1 +
.../plugin/json/view/mvc/JsonViewResolver.groovy | 12 +-
.../json/view/template/JsonViewTemplate.groovy | 2 +-
.../plugin/json/view/test/JsonRenderResult.groovy | 1 +
.../plugin/json/view/test/JsonViewTest.groovy | 27 +-
.../plugin/json/view/test/TestLinkGenerator.groovy | 29 +-
.../json/view/test/TestRequestConfigurer.groovy | 8 +-
grails-views-markup/build.gradle | 1 +
.../plugin/markup/view/MarkupViewCompiler.groovy | 2 +-
.../markup/view/MarkupViewConfiguration.groovy | 4 +-
.../markup/view/MarkupViewGrailsPlugin.groovy | 22 +-
.../plugin/markup/view/MarkupViewTemplate.groovy | 4 +-
.../markup/view/MarkupViewTemplateEngine.groovy | 13 +-
.../view/MarkupViewWritableScriptTemplate.groovy | 5 +-
.../plugin/markup/view/api/MarkupView.groovy | 1 +
.../view/internal/MarkupViewsTransform.groovy | 1 +
.../markup/view/mvc/MarkupViewResolver.groovy | 9 +-
.../view/renderer/MarkupViewXmlRenderer.groovy | 1 +
grails-web-boot/build.gradle | 1 +
.../boot/BootInitializerClassInjector.groovy | 20 +-
grails-web-common/build.gradle | 1 +
.../groovy/grails/util/GrailsWebMockUtil.groovy | 29 +-
.../src/main/groovy/grails/util/GrailsWebUtil.java | 32 +-
.../main/groovy/grails/web/RequestParameter.java | 1 +
.../groovy/grails/web/api/ServletAttributes.groovy | 8 +-
.../groovy/grails/web/api/WebAttributes.groovy | 15 +-
.../grails/web/context/ServletContextHolder.java | 3 +-
.../web/context/WebRequestServletHolder.java | 5 +-
.../grails/web/controllers/ControllerMethod.java | 1 +
.../main/groovy/grails/web/mime/MimeType.groovy | 17 +-
.../groovy/grails/web/mime/MimeTypeResolver.groovy | 2 +-
.../groovy/grails/web/mime/MimeTypeUtils.groovy | 11 +-
.../grails/web/pages/GrailsLayoutSelector.java | 3 +-
.../grails/web/pages/GrailsRenderViewMutator.java | 1 +
.../grails/web/pages/GroovyPagesUriService.java | 4 +-
.../grails/web/servlet/mvc/GrailsHttpSession.java | 10 +-
.../grails/web/servlet/mvc/GrailsParameterMap.java | 113 +-
.../DataBindingSourceCreationException.java | 4 +-
.../bindingsource/DataBindingSourceCreator.groovy | 5 +-
.../web/beans/PropertyEditorRegistryUtils.groovy | 13 +-
.../org/grails/web/binding/CompositeEditor.java | 6 +-
.../grails/web/binding/StructuredDateEditor.java | 13 +-
.../web/binding/StructuredPropertyEditor.java | 5 +-
.../org/grails/web/config/http/GrailsFilters.java | 4 +-
...onmentGrailsApplicationDiscoveryStrategy.groovy | 19 +-
.../bindingsource/DataBindingSourceRegistry.groovy | 8 +-
.../web/errors/GrailsWrappedRuntimeException.java | 106 +-
.../i18n/ParamsAwareLocaleChangeInterceptor.groovy | 16 +-
.../main/groovy/org/grails/web/json/JSONArray.java | 83 +-
.../groovy/org/grails/web/json/JSONElement.java | 1 -
.../groovy/org/grails/web/json/JSONException.java | 4 +-
.../groovy/org/grails/web/json/JSONObject.java | 140 +-
.../groovy/org/grails/web/json/JSONTokener.java | 13 +-
.../groovy/org/grails/web/json/JSONWriter.java | 47 +-
.../web/json/PathCapturingJSONWriterWrapper.java | 106 +-
.../org/grails/web/json/PrettyPrintJSONWriter.java | 21 +-
.../org/grails/web/json/parser/JSONParser.java | 96 +-
.../web/json/parser/JsonParserConstants.java | 178 +-
.../web/json/parser/JsonParserTokenManager.java | 2023 ++++++++++----------
.../org/grails/web/json/parser/ParseException.java | 344 ++--
.../grails/web/json/parser/SimpleCharStream.java | 46 +-
.../grails/web/json/parser/StringUnmarshaller.java | 38 +-
.../org/grails/web/json/parser/TokenMgrError.java | 8 +-
.../web/pages/DefaultGroovyPagesUriService.java | 156 +-
.../FilteringCodecsByContentTypeSettings.java | 42 +-
.../grails/web/pages/GroovyPagesUriSupport.java | 93 +-
.../DefaultGrailsApplicationAttributes.java | 73 +-
.../org/grails/web/servlet/GrailsFlashScope.java | 43 +-
.../grails/web/servlet/GrailsRequestContext.java | 13 +-
.../WebRequestDelegatingRequestContext.java | 12 +-
.../grails/web/servlet/WrappedResponseHolder.java | 8 +-
.../mvc/DefaultRequestStateLookupStrategy.java | 5 +-
.../mvc/GrailsRequestStateLookupStrategy.java | 16 +-
.../grails/web/servlet/mvc/GrailsWebRequest.java | 127 +-
.../mvc/OutputAwareHttpServletResponse.groovy | 1 -
.../web/servlet/mvc/ParameterCreationListener.java | 4 +-
.../web/servlet/view/AbstractGrailsView.java | 51 +-
.../web/servlet/view/CompositeViewResolver.groovy | 4 +-
.../web/servlet/view/LayoutViewResolver.java | 1 +
.../util/BoundedCharsAsEncodedBytesCounter.java | 78 +-
.../web/util/ClassAndMimeTypeRegistry.groovy | 51 +-
.../web/util/GrailsApplicationAttributes.java | 27 +-
.../grails/web/util/IncludeResponseWrapper.java | 49 +-
.../org/grails/web/util/IncludedContent.java | 18 +-
.../main/groovy/org/grails/web/util/WebUtils.java | 114 +-
.../grails/web/xml/PrettyPrintXMLStreamWriter.java | 8 +-
.../org/grails/web/xml/StreamingMarkupWriter.java | 5 +-
.../groovy/org/grails/web/xml/XMLStreamWriter.java | 8 +-
grails-web-core/build.gradle | 1 +
.../servlet/bootstrap/GrailsBootstrapClass.java | 4 +-
.../context/GrailsWebApplicationContext.java | 13 +-
.../servlet/plugins/GrailsWebPluginManager.groovy | 13 +-
.../web/servlet/HttpServletRequestExtension.groovy | 30 +-
.../servlet/HttpServletResponseExtension.groovy | 5 +-
.../grails/web/servlet/HttpSessionExtension.groovy | 14 +-
.../web/servlet/ServletContextExtension.groovy | 2 +-
.../boostrap/DefaultGrailsBootstrapClass.java | 10 +-
.../web/servlet/context/GrailsConfigUtils.java | 24 +-
.../support/WebRuntimeSpringConfiguration.java | 12 +-
grails-web-databinding/build.gradle | 1 +
.../traits/WebDataBindingTraitInjector.groovy | 2 +-
.../grails/web/databinding/DataBinder.groovy | 6 +-
.../grails/web/databinding/DataBindingUtils.java | 104 +-
.../web/databinding/GrailsWebDataBinder.groovy | 163 +-
.../grails/web/databinding/WebDataBinding.groovy | 4 +-
.../web/databinding/ASTDatabindingHelper.java | 1 +
.../DataBindingEventMulticastListener.groovy | 16 +-
.../DataBindingLazyMetaPropertyMap.java | 10 +-
.../databinding/DefaultASTDatabindingHelper.java | 51 +-
.../GrailsWebDataBindingListener.groovy | 18 +-
.../SpringConversionServiceAdapter.groovy | 2 +-
...tractRequestBodyDataBindingSourceCreator.groovy | 45 +-
.../DefaultDataBindingSourceCreator.groovy | 25 +-
.../DefaultDataBindingSourceRegistry.groovy | 9 +-
.../bindingsource/HalGPathResultMap.groovy | 13 +-
.../HalJsonDataBindingSourceCreator.groovy | 19 +-
.../HalXmlDataBindingSourceCreator.groovy | 7 +-
.../bindingsource/InvalidRequestBodyException.java | 5 +-
.../JsonApiDataBindingSourceCreator.groovy | 15 +-
.../JsonDataBindingSourceCreator.groovy | 46 +-
.../XmlDataBindingSourceCreator.groovy | 28 +-
.../AbstractStructuredBindingEditor.groovy | 24 +-
.../ByteArrayMultipartFileValueConverter.groovy | 29 +-
...tRequestBodyDataBindingSourceCreatorSpec.groovy | 5 +-
grails-web-mvc/build.gradle | 1 +
.../grails/web/errors/GrailsExceptionResolver.java | 77 +-
.../grails/web/filters/HiddenHttpMethodFilter.java | 17 +-
.../grails/web/servlet/GrailsUrlPathHelper.java | 3 +-
.../servlet/mvc/AbstractTokenResponseHandler.java | 5 +-
.../web/servlet/mvc/GrailsDispatcherServlet.groovy | 23 +-
.../web/servlet/mvc/GrailsWebRequestFilter.java | 25 +-
.../servlet/mvc/SynchronizerTokensHolder.groovy | 9 +-
.../TokenResponseActionResultTransformer.groovy | 6 +-
.../web/servlet/mvc/TokenResponseHandler.java | 2 +
grails-web-url-mappings/build.gradle | 1 +
.../groovy/grails/web/mapping/LinkGenerator.java | 78 +-
.../grails/web/mapping/LinkGeneratorFactory.groovy | 2 +-
.../grails/web/mapping/ResponseRedirector.groovy | 18 +-
.../main/groovy/grails/web/mapping/UrlCreator.java | 96 +-
.../main/groovy/grails/web/mapping/UrlMapping.java | 13 +-
.../groovy/grails/web/mapping/UrlMappingData.java | 5 +-
.../grails/web/mapping/UrlMappingEvaluator.java | 4 +-
.../groovy/grails/web/mapping/UrlMappingInfo.java | 8 +-
.../groovy/grails/web/mapping/UrlMappings.java | 1 -
.../grails/web/mapping/UrlMappingsFactory.groovy | 2 +-
.../grails/web/mapping/UrlMappingsHolder.java | 65 +-
.../mapping/cors/GrailsCorsConfiguration.groovy | 5 +-
.../web/mapping/cors/GrailsCorsFilter.groovy | 4 +-
.../mapping/cors/GrailsDefaultCorsMapping.groovy | 2 +-
.../mapping/exceptions/UrlMappingException.java | 2 +-
.../mvc/exceptions/CannotRedirectException.java | 6 +-
.../mapping/reporting/UrlMappingsRenderer.groovy | 2 +-
.../org/grails/web/mapping/AbstractUrlMapping.java | 52 +-
.../grails/web/mapping/AbstractUrlMappingInfo.java | 31 +-
.../grails/web/mapping/CachingLinkGenerator.java | 28 +-
.../grails/web/mapping/DefaultLinkGenerator.groovy | 108 +-
.../org/grails/web/mapping/DefaultUrlCreator.java | 67 +-
.../grails/web/mapping/DefaultUrlMappingData.java | 51 +-
.../web/mapping/DefaultUrlMappingEvaluator.java | 198 +-
.../grails/web/mapping/DefaultUrlMappingInfo.java | 101 +-
.../web/mapping/DefaultUrlMappingParser.java | 4 +-
.../grails/web/mapping/DefaultUrlMappings.groovy | 7 +-
.../web/mapping/DefaultUrlMappingsHolder.java | 301 +--
.../web/mapping/ForwardUrlMappingInfo.groovy | 11 +-
.../org/grails/web/mapping/MetaMappingInfo.groovy | 5 +-
.../org/grails/web/mapping/RegexUrlMapping.java | 301 ++-
.../web/mapping/ResponseCodeMappingData.java | 5 +-
.../grails/web/mapping/ResponseCodeUrlMapping.java | 5 +-
.../mapping/ResponseCodeUrlMappingVisitor.groovy | 4 +-
.../org/grails/web/mapping/UrlCreatorCache.java | 93 +-
.../org/grails/web/mapping/UrlMappingUtils.java | 108 +-
.../web/mapping/UrlMappingsHolderFactoryBean.java | 17 +-
.../mvc/AbstractGrailsControllerUrlMappings.groovy | 27 +-
.../mvc/GrailsControllerUrlMappingInfo.groovy | 5 +-
.../mapping/mvc/GrailsControllerUrlMappings.java | 12 +-
.../mapping/mvc/UrlMappingsHandlerMapping.groovy | 62 +-
.../mvc/UrlMappingsInfoHandlerAdapter.groovy | 66 +-
.../AnsiConsoleUrlMappingsRenderer.groovy | 50 +-
.../servlet/UrlMappingsErrorPageCustomizer.groovy | 2 +-
.../AnsiConsoleUrlMappingsRendererSpec.groovy | 2 +-
grails-wrapper/build.gradle | 1 +
.../java/grails/init/FindLastSnapshotHandler.java | 30 +-
.../main/java/grails/init/GrailsReleaseType.java | 26 +-
.../src/main/java/grails/init/GrailsUpdater.java | 31 +-
.../src/main/java/grails/init/GrailsVersion.java | 45 +-
.../main/java/grails/init/GrailsWrapperHome.java | 62 +-
.../main/java/grails/init/GrailsWrapperRepo.java | 35 +-
.../main/java/grails/init/RootMetadataHandler.java | 32 +-
.../src/main/java/grails/init/Start.java | 42 +-
.../proxy/SystemPropertiesAuthenticator.java | 30 +-
.../groovy/grails/init/GrailsVersionSpec.groovy | 8 +-
2142 files changed, 35775 insertions(+), 35121 deletions(-)
diff --git a/etc/config/checkstyle/checkstyle.xml b/etc/config/checkstyle/checkstyle.xml
index 128659ad6c..3002c30d4d 100644
--- a/etc/config/checkstyle/checkstyle.xml
+++ b/etc/config/checkstyle/checkstyle.xml
@@ -97,12 +97,13 @@
<module name="SuppressWarningsFilter"/>
<!-- See http://checkstyle.sourceforge.net/config_filters.html#SuppressionFilter -->
-<!-- <module name="SuppressionFilter">-->
-<!-- <property name="file" value="${config_loc}/suppressions.xml"/>-->
-<!-- <property name="optional" value="false"/>-->
-<!-- </module>-->
+ <module name="SuppressionFilter">
+ <property name="file" value="${config_loc}/suppressions.xml"/>
+ <property name="optional" value="false"/>
+ </module>
<module name="TreeWalker">
+ <module name="AvoidStarImport"/>
<!-- Needed for SuppressWarningsFilter -->
<module name="SuppressWarningsHolder"/>
@@ -177,7 +178,9 @@
<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<module name="AvoidNestedBlocks"/>
- <module name="EmptyBlock"/>
+ <module name="EmptyBlock">
+ <property name="option" value="text"/>
+ </module>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>
@@ -228,6 +231,8 @@
<module name="TodoComment">
<property name="severity" value="warning"/>
</module>
+
+ <module name="SuppressionCommentFilter"/>
</module>
</module>
diff --git a/etc/config/checkstyle/suppressions.xml b/etc/config/checkstyle/suppressions.xml
new file mode 100644
index 0000000000..5da56d946f
--- /dev/null
+++ b/etc/config/checkstyle/suppressions.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ https://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<!DOCTYPE suppressions PUBLIC
+ "-//Puppy Crawl//DTD Suppressions 1.1//EN"
+ "http://checkstyle.sourceforge.net/dtds/suppressions_1_1.dtd">
+<suppressions>
+ <suppress checks="FileLength"
+ files="GrailsDomainBinder.java|AbstractHibernateCriteriaBuilder.java|StreamCharBuffer.java"/>
+ <!-- Ignore until we decide what to do with these files -->
+ <!-- maybe replace with https://github.com/openjson/openjson -->
+ <suppress files=".*[\\/]grails-web-common[\\/]src[\\/]main[\\/]groovy[\\/]org[\\/]grails[\\/]web[\\/]json[\\/].*" checks=".*"/>
+ <suppress files=".*[\\/]grails-wrapper[\\/]src[\\/]main[\\/]java[\\/]grails[\\/]init[\\/]GrailsVersion.*" checks=".*"/>
+ <suppress files=".*[\\/]grails-wrapper[\\/]src[\\/]main[\\/]java[\\/]grails[\\/]init[\\/]GrailsWrapperHome.*" checks=".*"/>
+</suppressions>
diff --git a/gradle/style-enforcement-config.gradle b/gradle/style-enforcement-config.gradle
index e0a5d895a9..2010e2e726 100644
--- a/gradle/style-enforcement-config.gradle
+++ b/gradle/style-enforcement-config.gradle
@@ -24,11 +24,11 @@ apply plugin: 'io.spring.nohttp' // enforce https everywhere
spotless {
java {
licenseHeaderFile(rootProject.file("etc/config/spotless/license.java"))
- target('src/main/java/**/*.java')
+ target('src/main/java/**/*.java', 'src/main/groovy/**.java', 'grails-app/**.java')
}
groovy {
licenseHeaderFile(rootProject.file("etc/config/spotless/license.java"))
- target('src/main/groovy/**.groovy', 'src/main/groovy/**.java')
+ target('src/main/groovy/**.groovy', 'grails-app/**.groovy')
}
format 'javaMisc', {
target('src/main/**/package-info.java', 'src/main/**/module-info.java')
@@ -37,7 +37,8 @@ spotless {
}
checkstyle {
- configFile = project.rootProject.file('etc/config/checkstyle/checkstyle.xml')
+ configFile = project.rootProject.layout.projectDirectory.file('etc/config/checkstyle/checkstyle.xml').asFile
+ configDirectory = project.rootProject.layout.projectDirectory.dir('etc/config/checkstyle').asFile
// Per submodule
maxErrors = 1
diff --git a/grails-async/core/build.gradle b/grails-async/core/build.gradle
index 6a4f2b9679..bdeb790cb0 100644
--- a/grails-async/core/build.gradle
+++ b/grails-async/core/build.gradle
@@ -50,4 +50,5 @@ apply {
from rootProject.layout.projectDirectory.file('gradle/docs-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/publish-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/test-config.gradle')
+ from rootProject.layout.projectDirectory.file('gradle/style-enforcement-config.gradle')
}
\ No newline at end of file
diff --git a/grails-async/core/src/main/groovy/grails/async/DelegateAsync.groovy b/grails-async/core/src/main/groovy/grails/async/DelegateAsync.groovy
index 7fb5615fbe..8ec49fdc53 100644
--- a/grails-async/core/src/main/groovy/grails/async/DelegateAsync.groovy
+++ b/grails-async/core/src/main/groovy/grails/async/DelegateAsync.groovy
@@ -18,14 +18,14 @@
*/
package grails.async
+import org.codehaus.groovy.transform.GroovyASTTransformationClass
+
import java.lang.annotation.Documented
import java.lang.annotation.ElementType
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy
import java.lang.annotation.Target
-import org.codehaus.groovy.transform.GroovyASTTransformationClass
-
/**
* An AST transformation that takes each method in the given class and adds a delegate method that returns a {@link grails.async.Promise} and executes the method asynchronously.
* For example given the following class:
@@ -39,7 +39,7 @@ import org.codehaus.groovy.transform.GroovyASTTransformationClass
* If the annotation is applied to a new class:
*
* <pre><code>
- * @DelegateAsync(BookApi)
+ * @DelegateAsync (BookApi)
* class AsyncBookApi {}
* </code></pre>
*
@@ -65,5 +65,6 @@ import org.codehaus.groovy.transform.GroovyASTTransformationClass
@Target([ElementType.TYPE, ElementType.FIELD])
@GroovyASTTransformationClass("org.grails.async.transform.internal.DelegateAsyncTransformation")
@interface DelegateAsync {
+
Class value() default DelegateAsync
}
diff --git a/grails-async/core/src/main/groovy/grails/async/PromiseFactory.groovy b/grails-async/core/src/main/groovy/grails/async/PromiseFactory.groovy
index c6691ef95c..1e1dcb4bca 100644
--- a/grails-async/core/src/main/groovy/grails/async/PromiseFactory.groovy
+++ b/grails-async/core/src/main/groovy/grails/async/PromiseFactory.groovy
@@ -50,7 +50,7 @@ interface PromiseFactory {
/**
* Creates a promise with a value pre-bound to it
* @param value The value
- * @param <T> The type of the value
+ * @param <T> The type of the value
* @return A Promise
*/
<T> Promise<T> createBoundPromise(T value)
@@ -58,7 +58,7 @@ interface PromiseFactory {
/**
* Creates an unfulfilled promise that returns the given type
* @param returnType The return type
- * @param <T> The type of the class
+ * @param <T> The type of the class
* @return The unfulfilled promise
*/
<T> Promise<T> createPromise(Class<T> returnType)
@@ -76,7 +76,7 @@ interface PromiseFactory {
* @param map The map
* @return A promise
*/
- <K,V> Promise<Map<K,V>> createPromise(Map<K, V> map)
+ <K, V> Promise<Map<K, V>> createPromise(Map<K, V> map)
/**
* Creates a promise from the given map where the values of the map are either closures or Promise instances
@@ -84,7 +84,7 @@ interface PromiseFactory {
* @param map The map
* @return A promise
*/
- <K,V> Promise<Map<K,V>> createPromise(Map<K, V> map, List<PromiseDecorator> decorators)
+ <K, V> Promise<Map<K, V>> createPromise(Map<K, V> map, List<PromiseDecorator> decorators)
/**
* Creates a promise from one or more other promises
@@ -92,7 +92,7 @@ interface PromiseFactory {
* @param promises The promises
* @return The promise
*/
- <T> Promise<List<T>> createPromise(Promise<T>...promises)
+ <T> Promise<List<T>> createPromise(Promise<T>... promises)
/**
* Creates a promise from one or many closures
@@ -132,7 +132,7 @@ interface PromiseFactory {
* @param promises The promises
* @return The list of bound values
*/
- <T> List<T> waitAll(Promise<T>...promises)
+ <T> List<T> waitAll(Promise<T>... promises)
/**
* Synchronously waits for all promises to complete returning a list of values
*
diff --git a/grails-async/core/src/main/groovy/grails/async/PromiseList.groovy b/grails-async/core/src/main/groovy/grails/async/PromiseList.groovy
index b19b1b2f8f..8db692eefa 100644
--- a/grails-async/core/src/main/groovy/grails/async/PromiseList.groovy
+++ b/grails-async/core/src/main/groovy/grails/async/PromiseList.groovy
@@ -138,7 +138,7 @@ class PromiseList<T> implements Promise<List<T>> {
@Override
boolean isDone() {
- return promises.every {promise -> promise.isDone() }
+ return promises.every { promise -> promise.isDone() }
}
@Override
diff --git a/grails-async/core/src/main/groovy/grails/async/PromiseMap.groovy b/grails-async/core/src/main/groovy/grails/async/PromiseMap.groovy
index f367d96128..9bd07cb910 100644
--- a/grails-async/core/src/main/groovy/grails/async/PromiseMap.groovy
+++ b/grails-async/core/src/main/groovy/grails/async/PromiseMap.groovy
@@ -32,14 +32,14 @@ import java.util.concurrent.TimeUnit
*/
@AutoFinal
@CompileStatic
-class PromiseMap<K,V> implements Promise<Map<K,V>> {
+class PromiseMap<K, V> implements Promise<Map<K, V>> {
protected LinkedHashMap<K, Promise<V>> promises = [:]
protected LinkedHashMap<Promise<V>, K> promisesKeys = [:]
PromiseMap() {}
- PromiseMap(Map<K,V> values) {
+ PromiseMap(Map<K, V> values) {
accept(values)
}
@@ -55,11 +55,11 @@ class PromiseMap<K,V> implements Promise<Map<K,V>> {
@Override
boolean isDone() {
- return promisesKeys.keySet().every {it.isDone() }
+ return promisesKeys.keySet().every { it.isDone() }
}
@Override
- Promise<Map<K,V>> accept(Map<K,V> values) {
+ Promise<Map<K, V>> accept(Map<K, V> values) {
values.each { K key, Object value ->
if (value instanceof Promise) {
put(key, value as Promise<V>)
@@ -210,10 +210,10 @@ class PromiseMap<K,V> implements Promise<Map<K,V>> {
*
* @return A map where the values are obtained from the promises
*/
- Map<K,V> get() throws Throwable {
+ Map<K, V> get() throws Throwable {
def promises = promises.values()
- Map<K,V> resultMap = [:]
- for(Promise<V> promise : promises) {
+ Map<K, V> resultMap = [:]
+ for (Promise<V> promise : promises) {
V value = promise.get()
resultMap.put(promisesKeys.get(promise), value)
}
@@ -224,15 +224,15 @@ class PromiseMap<K,V> implements Promise<Map<K,V>> {
* Synchronously return the populated map with all values obtained from promises used
* inside the populated map
*
- * @param timeout The timeout period
+ * @param timeout The timeout period
* @param units The timeout units
* @return A map where the values are obtained from the promises
*/
- Map<K,V> get(long timeout, TimeUnit units) throws Throwable {
+ Map<K, V> get(long timeout, TimeUnit units) throws Throwable {
List<Promise<V>> promises = new ArrayList<Promise<V>>(promises.values())
Promises.waitAll(promises, timeout, units)
- Map<K,V> resultMap = [:]
- for(Promise<V> promise : promises) {
+ Map<K, V> resultMap = [:]
+ for (Promise<V> promise : promises) {
V value = promise.get()
resultMap.put(promisesKeys.get(promise), value)
}
@@ -240,12 +240,12 @@ class PromiseMap<K,V> implements Promise<Map<K,V>> {
}
@Override
- Promise<Map<K,V>> onComplete(Closure<Map<K,V>> callable) {
+ Promise<Map<K, V>> onComplete(Closure<Map<K, V>> callable) {
List<Promise<V>> promises = new ArrayList<Promise<V>>(promises.values())
Promises.onComplete(promises) { List<V> values ->
- Map<K,V> resultMap = [:]
+ Map<K, V> resultMap = [:]
int i = 0
- for(V value in values) {
+ for (V value in values) {
Promise<V> promise = promises[i]
K key = promisesKeys.get(promise)
resultMap.put(key, value)
@@ -258,13 +258,13 @@ class PromiseMap<K,V> implements Promise<Map<K,V>> {
}
@Override
- Promise<Map<K,V>> onError(Closure<Map<K,V>> callable) {
+ Promise<Map<K, V>> onError(Closure<Map<K, V>> callable) {
Promises.onError(new ArrayList<Promise<V>>(promises.values()), callable)
return this
}
@Override
- Promise<Map<K, V>> then(Closure<Map<K,V>> callable) {
+ Promise<Map<K, V>> then(Closure<Map<K, V>> callable) {
return onComplete(callable)
}
diff --git a/grails-async/core/src/main/groovy/grails/async/Promises.groovy b/grails-async/core/src/main/groovy/grails/async/Promises.groovy
index 6b3c209bf8..d5f125c68c 100644
--- a/grails-async/core/src/main/groovy/grails/async/Promises.groovy
+++ b/grails-async/core/src/main/groovy/grails/async/Promises.groovy
@@ -51,79 +51,79 @@ class Promises {
}
/**
- * @see PromiseFactory#waitAll(grails.async.Promise[])
+ * @see PromiseFactory#waitAll(grails.async.Promise [ ])
*/
- static<T> List<T> waitAll(Promise<T>... promises) {
+ static <T> List<T> waitAll(Promise<T>... promises) {
return getPromiseFactory().waitAll(promises)
}
/**
* @see PromiseFactory#waitAll(java.util.List)
*/
- static<T> List<T> waitAll(List<Promise<T>> promises) {
+ static <T> List<T> waitAll(List<Promise<T>> promises) {
return getPromiseFactory().waitAll(promises)
}
/**
* @see PromiseFactory#waitAll(java.util.List)
*/
- static<T> List<T> waitAll(List<Promise<T>> promises, long timeout, TimeUnit units) {
+ static <T> List<T> waitAll(List<Promise<T>> promises, long timeout, TimeUnit units) {
return getPromiseFactory().waitAll(promises, timeout, units)
}
/**
* @see PromiseFactory#onComplete(java.util.List, groovy.lang.Closure)
*/
- static<T> Promise<List<T>> onComplete(List<Promise<T>> promises, Closure<T> callable) {
+ static <T> Promise<List<T>> onComplete(List<Promise<T>> promises, Closure<T> callable) {
return getPromiseFactory().onComplete(promises, callable)
}
/**
* @see PromiseFactory#onError(java.util.List, groovy.lang.Closure)
*/
- static<T> Promise<List<T>> onError(List<Promise<T>> promises, Closure<?> callable) {
+ static <T> Promise<List<T>> onError(List<Promise<T>> promises, Closure<?> callable) {
return getPromiseFactory().onError(promises, callable)
}
/**
* @see PromiseFactory#createPromise(java.util.Map)
*/
- static<K,V> Promise<Map<K,V>> createPromise(Map<K, V> map) {
+ static <K, V> Promise<Map<K, V>> createPromise(Map<K, V> map) {
return getPromiseFactory().createPromise(map)
}
/**
* @see PromiseFactory#createPromise(java.util.Map)
*/
- static<K,V> Promise<Map<K,V>> createPromise(Map<K, V> map, List<PromiseDecorator> decorators) {
+ static <K, V> Promise<Map<K, V>> createPromise(Map<K, V> map, List<PromiseDecorator> decorators) {
return getPromiseFactory().createPromise(map, decorators)
}
/**
- * @see PromiseFactory#createPromise(groovy.lang.Closure[])
+ * @see PromiseFactory#createPromise(groovy.lang.Closure [ ])
*/
- static<T> Promise<T> createPromise(Closure<T>... closures) {
+ static <T> Promise<T> createPromise(Closure<T>... closures) {
return getPromiseFactory().createPromise(closures)
}
/**
* @see PromiseFactory#createPromise(java.util.Map)
*/
- static<K,V> Promise<Map<K,V>> tasks(Map<K, V> map) {
+ static <K, V> Promise<Map<K, V>> tasks(Map<K, V> map) {
return getPromiseFactory().createPromise(map)
}
/**
- * @see PromiseFactory#createPromise(groovy.lang.Closure[])
+ * @see PromiseFactory#createPromise(groovy.lang.Closure [ ])
*/
- static<T> Promise<T> task(Closure<T> closure) {
+ static <T> Promise<T> task(Closure<T> closure) {
return getPromiseFactory().createPromise(closure)
}
/**
- * @see PromiseFactory#createPromise(groovy.lang.Closure[])
+ * @see PromiseFactory#createPromise(groovy.lang.Closure [ ])
*/
- static<T> Promise<T> tasks(Closure<T>... closures) {
+ static <T> Promise<T> tasks(Closure<T>... closures) {
return getPromiseFactory().createPromise(closures)
}
/**
- * @see PromiseFactory#createPromise(groovy.lang.Closure[])
+ * @see PromiseFactory#createPromise(groovy.lang.Closure [ ])
*/
- static<T> Promise<List<T>> tasks(List<Closure<T>> closures) {
+ static <T> Promise<List<T>> tasks(List<Closure<T>> closures) {
return getPromiseFactory().createPromise(closures)
}
@@ -137,33 +137,33 @@ class Promises {
/**
* @see grails.async.PromiseFactory#createPromise(Class)
*/
- static<T> Promise<T> createPromise(Class<T> returnType) {
+ static <T> Promise<T> createPromise(Class<T> returnType) {
return getPromiseFactory().createPromise(returnType)
}
/**
* @see PromiseFactory#createPromise(groovy.lang.Closure, java.util.List)
*/
- static<T> Promise<T> createPromise(Closure<T> closure, List<PromiseDecorator> decorators) {
+ static <T> Promise<T> createPromise(Closure<T> closure, List<PromiseDecorator> decorators) {
return getPromiseFactory().createPromise(closure, decorators)
}
/**
* @see PromiseFactory#createPromise(java.util.List, java.util.List)
*/
- static<T> Promise<List<T>> createPromise(List<Closure<T>> closures, List<PromiseDecorator> decorators) {
+ static <T> Promise<List<T>> createPromise(List<Closure<T>> closures, List<PromiseDecorator> decorators) {
return getPromiseFactory().createPromise(closures, decorators)
}
/**
- * @see PromiseFactory#createPromise(grails.async.Promise[])
+ * @see PromiseFactory#createPromise(grails.async.Promise [ ])
*/
- static <T> Promise<List<T>> createPromise(Promise<T>...promises) {
+ static <T> Promise<List<T>> createPromise(Promise<T>... promises) {
return getPromiseFactory().createPromise(promises)
}
/**
* @see PromiseFactory#createBoundPromise(java.lang.Object)
*/
- static<T> Promise<T> createBoundPromise(T value) {
- return getPromiseFactory().createBoundPromise(value)
+ static <T> Promise<T> createBoundPromise(T value) {
+ return getPromiseFactory().createBoundPromise(value)
}
}
diff --git a/grails-async/core/src/main/groovy/grails/async/factory/AbstractPromiseFactory.groovy b/grails-async/core/src/main/groovy/grails/async/factory/AbstractPromiseFactory.groovy
index bbd488348c..9b897b7941 100644
--- a/grails-async/core/src/main/groovy/grails/async/factory/AbstractPromiseFactory.groovy
+++ b/grails-async/core/src/main/groovy/grails/async/factory/AbstractPromiseFactory.groovy
@@ -59,13 +59,13 @@ abstract class AbstractPromiseFactory implements PromiseFactory {
}
<T> Closure<T> applyDecorators(Closure<T> closure, List<PromiseDecorator> decorators) {
- List<PromiseDecorator> allDecorators = decorators != null ? new ArrayList<PromiseDecorator>(decorators): new ArrayList<PromiseDecorator>()
+ List<PromiseDecorator> allDecorators = decorators != null ? new ArrayList<PromiseDecorator>(decorators) : new ArrayList<PromiseDecorator>()
for (PromiseDecoratorLookupStrategy lookupStrategy : lookupStrategies) {
allDecorators.addAll(lookupStrategy.findDecorators())
}
def decoratedClosure = closure
if (!allDecorators.empty) {
- for(PromiseDecorator decorator : allDecorators) {
+ for (PromiseDecorator decorator : allDecorators) {
decoratedClosure = decorator.decorate(decoratedClosure)
}
}
@@ -76,7 +76,7 @@ abstract class AbstractPromiseFactory implements PromiseFactory {
* @see PromiseFactory#createPromise(java.util.List)
*/
<T> Promise<List<T>> createPromise(List<Closure<T>> closures) {
- return createPromise(closures,null)
+ return createPromise(closures, null)
}
/**
@@ -95,11 +95,11 @@ abstract class AbstractPromiseFactory implements PromiseFactory {
}
/**
- * @see PromiseFactory#createPromise(grails.async.Promise[])
+ * @see PromiseFactory#createPromise(grails.async.Promise [ ])
*/
<T> Promise<List<T>> createPromise(Promise<T>... promises) {
PromiseList<T> promiseList = new PromiseList<>()
- for(Promise<T> promise : promises) {
+ for (Promise<T> promise : promises) {
promiseList.add(promise)
}
return promiseList
@@ -107,17 +107,15 @@ abstract class AbstractPromiseFactory implements PromiseFactory {
@Override
<K, V> Promise<Map<K, V>> createPromise(Map<K, V> map, List<PromiseDecorator> decorators) {
- PromiseMap<K,V> promiseMap = new PromiseMap<>()
+ PromiseMap<K, V> promiseMap = new PromiseMap<>()
map.forEach((K key, V value) -> {
if (value instanceof Promise) {
promiseMap.put(key, value as Promise<V>)
- }
- else if (value instanceof Closure) {
+ } else if (value instanceof Closure) {
Closure<V> closure = value as Closure<V>
applyDecorators(closure, decorators)
promiseMap.put(key, createPromiseInternal(closure))
- }
- else {
+ } else {
promiseMap.put(key, new BoundPromise<V>(value))
}
@@ -129,15 +127,15 @@ abstract class AbstractPromiseFactory implements PromiseFactory {
* @see PromiseFactory#createPromise(java.util.Map)
*/
<K, V> Promise<Map<K, V>> createPromise(Map<K, V> map) {
- return createPromise(map, Collections.<PromiseDecorator>emptyList())
+ return createPromise(map, Collections.<PromiseDecorator> emptyList())
}
protected <T> Promise<T> createPromiseInternal(Closure<T> closure) {
- return createPromise(closure)
+ return createPromise(closure)
}
/**
- * @see PromiseFactory#waitAll(grails.async.Promise[])
+ * @see PromiseFactory#waitAll(grails.async.Promise [ ])
*/
<T> List<T> waitAll(Promise<T>... promises) {
return waitAll(Arrays.asList(promises))
diff --git a/grails-async/core/src/main/groovy/org/grails/async/factory/BoundPromise.groovy b/grails-async/core/src/main/groovy/org/grails/async/factory/BoundPromise.groovy
index e693655567..6759d6e9be 100644
--- a/grails-async/core/src/main/groovy/org/grails/async/factory/BoundPromise.groovy
+++ b/grails-async/core/src/main/groovy/org/grails/async/factory/BoundPromise.groovy
@@ -91,8 +91,7 @@ class BoundPromise<T> implements Promise<T> {
} catch (Throwable e) {
return new BoundPromise(e)
}
- }
- else {
+ } else {
return this
}
}
diff --git a/grails-async/core/src/main/groovy/org/grails/async/factory/PromiseFactoryBuilder.groovy b/grails-async/core/src/main/groovy/org/grails/async/factory/PromiseFactoryBuilder.groovy
index 3ca1066012..d3fd2c69a7 100644
--- a/grails-async/core/src/main/groovy/org/grails/async/factory/PromiseFactoryBuilder.groovy
+++ b/grails-async/core/src/main/groovy/org/grails/async/factory/PromiseFactoryBuilder.groovy
@@ -16,11 +16,9 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.async.factory
import grails.async.PromiseFactory
-import grails.async.Promises
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import org.grails.async.factory.future.CachedThreadPoolPromiseFactory
@@ -43,11 +41,10 @@ class PromiseFactoryBuilder {
List<PromiseFactory> promiseFactories = ServiceLoader.load(PromiseFactory).toList()
PromiseFactory promiseFactory
- if(promiseFactories.isEmpty()) {
+ if (promiseFactories.isEmpty()) {
log.debug 'No PromiseFactory implementation found. Using default ExecutorService promise factory.'
promiseFactory = new CachedThreadPoolPromiseFactory()
- }
- else {
+ } else {
promiseFactory = promiseFactories.first()
log.debug 'Found PromiseFactory implementation to use [{}]', promiseFactory
}
diff --git a/grails-async/core/src/main/groovy/org/grails/async/factory/SynchronousPromise.groovy b/grails-async/core/src/main/groovy/org/grails/async/factory/SynchronousPromise.groovy
index fe1dd1a989..714fe0be40 100644
--- a/grails-async/core/src/main/groovy/org/grails/async/factory/SynchronousPromise.groovy
+++ b/grails-async/core/src/main/groovy/org/grails/async/factory/SynchronousPromise.groovy
@@ -58,8 +58,12 @@ class SynchronousPromise<T> implements Promise<T> {
T get() throws Throwable {
if (!executed) {
executed = true
- try { value = callable.call() }
- catch (e) { value = e }
+ try {
+ value = callable.call()
+ }
+ catch (e) {
+ value = e
+ }
}
if (value instanceof Throwable) {
throw value
@@ -78,14 +82,21 @@ class SynchronousPromise<T> implements Promise<T> {
}
Promise<T> onComplete(Closure<T> callable) {
- try { callable.call(get()) }
- catch (Throwable ignored) {}
+ try {
+ callable.call(get())
+ }
+ catch (Throwable ignored) {
+ }
return this
}
Promise<T> onError(Closure<T> callable) {
- try { get() }
- catch (Throwable e) { callable.call(e) }
+ try {
+ get()
+ }
+ catch (Throwable e) {
+ callable.call(e)
+ }
return this
}
diff --git a/grails-async/core/src/main/groovy/org/grails/async/factory/SynchronousPromiseFactory.groovy b/grails-async/core/src/main/groovy/org/grails/async/factory/SynchronousPromiseFactory.groovy
index fe4d94e9ab..cc15554db1 100644
--- a/grails-async/core/src/main/groovy/org/grails/async/factory/SynchronousPromiseFactory.groovy
+++ b/grails-async/core/src/main/groovy/org/grails/async/factory/SynchronousPromiseFactory.groovy
@@ -54,14 +54,17 @@ class SynchronousPromiseFactory extends AbstractPromiseFactory {
promise = new SynchronousPromise<T>(closures[0])
} else {
def promiseList = new PromiseList()
- for(p in closures) {
+ for (p in closures) {
promiseList << p
}
promise = promiseList
}
- try { promise.get() }
- catch (Throwable ignored) {}
+ try {
+ promise.get()
+ }
+ catch (Throwable ignored) {
+ }
return promise
}
diff --git a/grails-async/core/src/main/groovy/org/grails/async/factory/future/CachedThreadPoolPromiseFactory.groovy b/grails-async/core/src/main/groovy/org/grails/async/factory/future/CachedThreadPoolPromiseFactory.groovy
index affba64fb2..81fd1feb32 100644
--- a/grails-async/core/src/main/groovy/org/grails/async/factory/future/CachedThreadPoolPromiseFactory.groovy
+++ b/grails-async/core/src/main/groovy/org/grails/async/factory/future/CachedThreadPoolPromiseFactory.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.async.factory.future
import grails.async.Promise
@@ -24,10 +23,15 @@ import grails.async.PromiseList
import grails.async.factory.AbstractPromiseFactory
import groovy.transform.AutoFinal
import groovy.transform.CompileStatic
+import jakarta.annotation.PreDestroy
import org.grails.async.factory.BoundPromise
-import jakarta.annotation.PreDestroy
-import java.util.concurrent.*
+import java.util.concurrent.Callable
+import java.util.concurrent.ExecutorService
+import java.util.concurrent.RunnableFuture
+import java.util.concurrent.SynchronousQueue
+import java.util.concurrent.ThreadPoolExecutor
+import java.util.concurrent.TimeUnit
/**
* A promise factory that uses an ExecutorService by default
@@ -39,15 +43,18 @@ import java.util.concurrent.*
@CompileStatic
class CachedThreadPoolPromiseFactory extends AbstractPromiseFactory implements Closeable, ExecutorPromiseFactory {
- final @Delegate ExecutorService executorService
+ @Delegate
+ final ExecutorService executorService
CachedThreadPoolPromiseFactory(int maxPoolSize = Integer.MAX_VALUE, long timeout = 60L, TimeUnit unit = TimeUnit.SECONDS) {
CachedThreadPoolPromiseFactory pf = this
this.executorService = new ThreadPoolExecutor(0, maxPoolSize, timeout, unit, new SynchronousQueue<Runnable>()) {
+
@Override
protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable) {
return new FutureTaskPromise<T>(pf, callable)
}
+
@Override
protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value) {
return new FutureTaskPromise<T>(pf, runnable, value)
@@ -71,8 +78,7 @@ class CachedThreadPoolPromiseFactory extends AbstractPromiseFactory implements C
def callable = closures[0]
def decoratedCallable = applyDecorators(callable, null)
return executorService.submit(decoratedCallable as Callable) as Promise<T>
- }
- else {
+ } else {
PromiseList<T> list = new PromiseList<>()
for (Closure<T> closure : closures) {
list.add(closure)
@@ -108,7 +114,11 @@ class CachedThreadPoolPromiseFactory extends AbstractPromiseFactory implements C
while (promises.every { Promise promise -> !promise.isDone() }) {
// wait (is this hogging the cpu?)
}
- try { for (Promise<T> promise : promises) { promise.get() } }
+ try {
+ for (Promise<T> promise : promises) {
+ promise.get()
+ }
+ }
catch (Throwable e) {
callable.call(e)
return e
diff --git a/grails-async/core/src/main/groovy/org/grails/async/factory/future/ExecutorPromiseFactory.groovy b/grails-async/core/src/main/groovy/org/grails/async/factory/future/ExecutorPromiseFactory.groovy
index 7167d9e4ea..4172ada0f9 100644
--- a/grails-async/core/src/main/groovy/org/grails/async/factory/future/ExecutorPromiseFactory.groovy
+++ b/grails-async/core/src/main/groovy/org/grails/async/factory/future/ExecutorPromiseFactory.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.async.factory.future
import grails.async.PromiseFactory
diff --git a/grails-async/core/src/main/groovy/org/grails/async/factory/future/FutureTaskChildPromise.groovy b/grails-async/core/src/main/groovy/org/grails/async/factory/future/FutureTaskChildPromise.groovy
index d0ce580e97..2d7b9b5e1c 100644
--- a/grails-async/core/src/main/groovy/org/grails/async/factory/future/FutureTaskChildPromise.groovy
+++ b/grails-async/core/src/main/groovy/org/grails/async/factory/future/FutureTaskChildPromise.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.async.factory.future
import grails.async.Promise
@@ -30,7 +29,6 @@ import java.util.concurrent.ConcurrentLinkedQueue
import java.util.concurrent.ExecutionException
import java.util.concurrent.TimeUnit
import java.util.concurrent.TimeoutException
-import java.util.concurrent.locks.ReentrantLock
/**
* A child promise of a {@link FutureTaskPromise}
@@ -54,7 +52,7 @@ class FutureTaskChildPromise<T> implements Promise<T> {
FutureTaskChildPromise(PromiseFactory promiseFactory, Promise<T> parent, Closure<T> callable) {
this.parent = parent
- this.callable = promiseFactory.applyDecorators(callable,null)
+ this.callable = promiseFactory.applyDecorators(callable, null)
this.promiseFactory = promiseFactory
}
@@ -113,8 +111,7 @@ class FutureTaskChildPromise<T> implements Promise<T> {
T get() throws InterruptedException, ExecutionException {
if (bound != null) {
return bound.get()
- }
- else {
+ } else {
if (parent instanceof FutureTaskPromise) {
def value = parent.get()
if (bound == null) {
@@ -122,8 +119,7 @@ class FutureTaskChildPromise<T> implements Promise<T> {
bound = new BoundPromise<>(v)
}
return bound.get()
- }
- else {
+ } else {
def v = callable.call(parent.get())
bound = new BoundPromise<>(v)
return v
@@ -135,8 +131,7 @@ class FutureTaskChildPromise<T> implements Promise<T> {
T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
if (bound != null) {
return bound.get()
- }
- else {
+ } else {
if (parent instanceof FutureTaskPromise) {
def value = parent.get(timeout, unit)
if (bound == null) {
@@ -144,8 +139,7 @@ class FutureTaskChildPromise<T> implements Promise<T> {
bound = new BoundPromise<>(v)
}
return bound.get()
- }
- else {
+ } else {
def v = callable.call(parent.get(timeout, unit))
bound = new BoundPromise<>(v)
return v
diff --git a/grails-async/core/src/main/groovy/org/grails/async/factory/future/FutureTaskPromise.groovy b/grails-async/core/src/main/groovy/org/grails/async/factory/future/FutureTaskPromise.groovy
index 90cde68202..466fad6e00 100644
--- a/grails-async/core/src/main/groovy/org/grails/async/factory/future/FutureTaskPromise.groovy
+++ b/grails-async/core/src/main/groovy/org/grails/async/factory/future/FutureTaskPromise.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.async.factory.future
import grails.async.Promise
@@ -110,8 +109,7 @@ class FutureTaskPromise<T> extends FutureTask<T> implements Promise<T> {
} catch (Throwable ignored) {
return this
}
- }
- else {
+ } else {
Promise<T> newPromise = new FutureTaskChildPromise(promiseFactory, this as Promise<T>, callable)
successCallbacks.add(newPromise)
return newPromise
@@ -129,8 +127,7 @@ class FutureTaskPromise<T> extends FutureTask<T> implements Promise<T> {
} catch (Throwable e) {
return new BoundPromise(callable.call(e))
}
- }
- else {
+ } else {
Promise<T> newPromise = new FutureTaskChildPromise(promiseFactory, this as Promise<T>, callable)
failureCallbacks.add(newPromise)
return newPromise
diff --git a/grails-async/core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncTransactionalMethodTransformer.java b/grails-async/core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncTransactionalMethodTransformer.java
index 63c9e10419..f01caf4057 100644
--- a/grails-async/core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncTransactionalMethodTransformer.java
+++ b/grails-async/core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncTransactionalMethodTransformer.java
@@ -29,5 +29,6 @@ import org.codehaus.groovy.ast.expr.ListExpression;
* @since 2.3
*/
public interface DelegateAsyncTransactionalMethodTransformer {
+
void transformTransactionalMethod(ClassNode classNode, ClassNode delegateClassNode, MethodNode methodNode, ListExpression promiseDecoratorLookupArguments);
}
diff --git a/grails-async/core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncTransformation.java b/grails-async/core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncTransformation.java
index 74fd98d37d..eec34eb86a 100644
--- a/grails-async/core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncTransformation.java
+++ b/grails-async/core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncTransformation.java
@@ -22,14 +22,6 @@ import grails.async.Promise;
import grails.async.Promises;
import groovy.lang.Closure;
import groovy.lang.GroovyObjectSupport;
-
-import java.beans.Introspector;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
import org.apache.grails.common.compiler.GroovyTransformOrder;
import org.codehaus.groovy.GroovyBugError;
import org.codehaus.groovy.ast.ASTNode;
@@ -59,6 +51,13 @@ import org.codehaus.groovy.transform.GroovyASTTransformation;
import org.codehaus.groovy.transform.TransformWithPriority;
import org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport;
+import java.beans.Introspector;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
/**
* Implementation of {@link grails.async.DelegateAsync} transformation
*
@@ -67,10 +66,11 @@ import org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport;
*/
@GroovyASTTransformation
public class DelegateAsyncTransformation implements ASTTransformation, TransformWithPriority {
- private static final ArgumentListExpression NO_ARGS = new ArgumentListExpression();
- private static final String VOID = "void";
+
public static final ClassNode GROOVY_OBJECT_CLASS_NODE = new ClassNode(GroovyObjectSupport.class);
public static final ClassNode OBJECT_CLASS_NODE = new ClassNode(Object.class);
+ private static final ArgumentListExpression NO_ARGS = new ArgumentListExpression();
+ private static final String VOID = "void";
public void visit(ASTNode[] nodes, SourceUnit source) {
if (nodes.length != 2 || !(nodes[0] instanceof AnnotationNode) || !(nodes[1] instanceof AnnotatedNode)) {
@@ -84,7 +84,7 @@ public class DelegateAsyncTransformation implements ASTTransformation, Transform
Expression value = annotationNode.getMember("value");
if (value instanceof ClassExpression) {
ClassNode targetApi = value.getType().getPlainNodeReference();
- ClassNode classNode = (ClassNode)parent;
+ ClassNode classNode = (ClassNode) parent;
final String fieldName = '$' + Introspector.decapitalize(targetApi.getNameWithoutPackage());
FieldNode fieldNode = classNode.getField(fieldName);
@@ -95,9 +95,8 @@ public class DelegateAsyncTransformation implements ASTTransformation, Transform
applyDelegateAsyncTransform(classNode, targetApi, fieldName);
}
- }
- else if(parent instanceof FieldNode) {
- FieldNode fieldNode = (FieldNode)parent;
+ } else if (parent instanceof FieldNode) {
+ FieldNode fieldNode = (FieldNode) parent;
ClassNode targetApi = fieldNode.getType().getPlainNodeReference();
ClassNode classNode = fieldNode.getOwner();
applyDelegateAsyncTransform(classNode, targetApi, fieldNode.getName());
@@ -112,27 +111,26 @@ public class DelegateAsyncTransformation implements ASTTransformation, Transform
MethodNode createPromiseMethodTargetWithDecorators = promisesClass.getDeclaredMethod("createPromise", new Parameter[]{new Parameter(new ClassNode(Closure.class), "c"), new Parameter(new ClassNode(List.class), "c")});
DelegateAsyncTransactionalMethodTransformer delegateAsyncTransactionalMethodTransformer = lookupAsyncTransactionalMethodTransformer();
- for(MethodNode m : methods) {
+ for (MethodNode m : methods) {
if (isCandidateMethod(m)) {
MethodNode existingMethod = classNode.getMethod(m.getName(), m.getParameters());
if (existingMethod == null) {
ClassNode promiseNode = ClassHelper.make(Promise.class).getPlainNodeReference();
ClassNode originalReturnType = m.getReturnType();
- if(!originalReturnType.getNameWithoutPackage().equals(VOID)) {
+ if (!originalReturnType.getNameWithoutPackage().equals(VOID)) {
ClassNode returnType;
- if(ClassHelper.isPrimitiveType(originalReturnType.redirect())) {
+ if (ClassHelper.isPrimitiveType(originalReturnType.redirect())) {
returnType = ClassHelper.getWrapper(originalReturnType.redirect());
} else {
returnType = alignReturnType(classNode, originalReturnType);
}
- if(!OBJECT_CLASS_NODE.equals(returnType)) {
+ if (!OBJECT_CLASS_NODE.equals(returnType)) {
promiseNode.setGenericsTypes(new GenericsType[]{new GenericsType(returnType)});
}
}
final BlockStatement methodBody = new BlockStatement();
final BlockStatement promiseBody = new BlockStatement();
-
final ClosureExpression closureExpression = new ClosureExpression(new Parameter[0], promiseBody);
VariableScope variableScope = new VariableScope();
closureExpression.setVariableScope(variableScope);
@@ -147,8 +145,8 @@ public class DelegateAsyncTransformation implements ASTTransformation, Transform
MethodCallExpression getDecoratorsMethodCall = new MethodCallExpression(new ClassExpression(delegateAsyncUtilsClassNode), "getPromiseDecorators", getPromiseDecoratorsArguments);
getDecoratorsMethodCall.setMethodTarget(getPromiseDecoratorsMethodNode);
- MethodCallExpression createPromiseWithDecorators = new MethodCallExpression(new ClassExpression(promisesClass), "createPromise",new ArgumentListExpression( closureExpression, getDecoratorsMethodCall));
- if(createPromiseMethodTargetWithDecorators != null) {
+ MethodCallExpression createPromiseWithDecorators = new MethodCallExpression(new ClassExpression(promisesClass), "createPromise", new ArgumentListExpression(closureExpression, getDecoratorsMethodCall));
+ if (createPromiseMethodTargetWithDecorators != null) {
createPromiseWithDecorators.setMethodTarget(createPromiseMethodTargetWithDecorators);
}
methodBody.addStatement(new ExpressionStatement(createPromiseWithDecorators));
@@ -156,7 +154,7 @@ public class DelegateAsyncTransformation implements ASTTransformation, Transform
final ArgumentListExpression arguments = new ArgumentListExpression();
Parameter[] parameters = copyParameters(StaticTypeCheckingSupport.parameterizeArguments(classNode, m));
- for(Parameter p : parameters) {
+ for (Parameter p : parameters) {
p.setClosureSharedVariable(true);
variableScope.putReferencedLocalVariable(p);
VariableExpression ve = new VariableExpression(p);
@@ -165,7 +163,7 @@ public class DelegateAsyncTransformation implements ASTTransformation, Transform
}
MethodCallExpression delegateMethodCall = new MethodCallExpression(new VariableExpression(fieldName), m.getName(), arguments);
promiseBody.addStatement(new ExpressionStatement(delegateMethodCall));
- MethodNode newMethodNode = new MethodNode(m.getName(), Modifier.PUBLIC,promiseNode, parameters,null, methodBody);
+ MethodNode newMethodNode = new MethodNode(m.getName(), Modifier.PUBLIC, promiseNode, parameters, null, methodBody);
classNode.addMethod(newMethodNode);
}
}
@@ -183,7 +181,7 @@ public class DelegateAsyncTransformation implements ASTTransformation, Transform
GenericsType[] redirectReceiverTypes = redirectTypes.toArray(new GenericsType[0]);
GenericsType[] receiverParameterizedTypes = receiver.getGenericsTypes();
- if (receiverParameterizedTypes==null) {
+ if (receiverParameterizedTypes == null) {
receiverParameterizedTypes = redirectReceiverTypes;
}
@@ -210,9 +208,9 @@ public class DelegateAsyncTransformation implements ASTTransformation, Transform
private static boolean isCandidateMethod(MethodNode declaredMethod) {
String methodName = declaredMethod.getName();
return !declaredMethod.isSynthetic() &&
- !methodName.contains("$") &&
- Modifier.isPublic(declaredMethod.getModifiers()) &&
- !GROOVY_OBJECT_CLASS_NODE.hasMethod(declaredMethod.getName(), declaredMethod.getParameters());
+ !methodName.contains("$") &&
+ Modifier.isPublic(declaredMethod.getModifiers()) &&
+ !GROOVY_OBJECT_CLASS_NODE.hasMethod(declaredMethod.getName(), declaredMethod.getParameters());
}
private static Parameter[] copyParameters(Parameter[] parameterTypes) {
@@ -221,7 +219,7 @@ public class DelegateAsyncTransformation implements ASTTransformation, Transform
Parameter parameterType = parameterTypes[i];
ClassNode parameterTypeCN = parameterType.getType();
ClassNode newParameterTypeCN = parameterTypeCN.getPlainNodeReference();
- if(parameterTypeCN.isUsingGenerics() && !parameterTypeCN.isGenericsPlaceHolder()) {
+ if (parameterTypeCN.isUsingGenerics() && !parameterTypeCN.isGenericsPlaceHolder()) {
newParameterTypeCN.setGenericsTypes(parameterTypeCN.getGenericsTypes());
}
Parameter newParameter = new Parameter(newParameterTypeCN, parameterType.getName(), parameterType.getInitialExpression());
@@ -237,7 +235,8 @@ public class DelegateAsyncTransformation implements ASTTransformation, Transform
}
private static class NoopDelegateAsyncTransactionalMethodTransformer implements DelegateAsyncTransactionalMethodTransformer {
- public void transformTransactionalMethod(ClassNode classNode,ClassNode delegateClassNode, MethodNode methodNode, ListExpression promiseDecoratorLookupArguments) {
+
+ public void transformTransactionalMethod(ClassNode classNode, ClassNode delegateClassNode, MethodNode methodNode, ListExpression promiseDecoratorLookupArguments) {
// noop
}
}
diff --git a/grails-async/core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncUtils.groovy b/grails-async/core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncUtils.groovy
index 7041c066f1..17c0af8ed9 100644
--- a/grails-async/core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncUtils.groovy
+++ b/grails-async/core/src/main/groovy/org/grails/async/transform/internal/DelegateAsyncUtils.groovy
@@ -18,9 +18,9 @@
*/
package org.grails.async.transform.internal
-import groovy.transform.CompileStatic
import grails.async.decorator.PromiseDecorator
import grails.async.decorator.PromiseDecoratorProvider
+import groovy.transform.CompileStatic
/**
* Helps looking up the decorators
@@ -37,10 +37,10 @@ class DelegateAsyncUtils {
* @param additional The additional
* @return The additional promise decorators
*/
- static Collection<PromiseDecorator> getPromiseDecorators(Object target, Collection<PromiseDecorator> additional ) {
+ static Collection<PromiseDecorator> getPromiseDecorators(Object target, Collection<PromiseDecorator> additional) {
Collection<PromiseDecorator> decorators = []
if (target instanceof PromiseDecoratorProvider) {
- decorators.addAll(((PromiseDecoratorProvider)target).getDecorators())
+ decorators.addAll(((PromiseDecoratorProvider) target).getDecorators())
}
if (additional) {
decorators.addAll(additional)
diff --git a/grails-async/gpars/build.gradle b/grails-async/gpars/build.gradle
index ab599f3da3..335871bda0 100644
--- a/grails-async/gpars/build.gradle
+++ b/grails-async/gpars/build.gradle
@@ -50,4 +50,5 @@ apply {
from rootProject.layout.projectDirectory.file('gradle/docs-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/publish-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/test-config.gradle')
+ from rootProject.layout.projectDirectory.file('gradle/style-enforcement-config.gradle')
}
\ No newline at end of file
diff --git a/grails-async/gpars/src/main/groovy/org/grails/async/factory/gpars/GparsPromise.groovy b/grails-async/gpars/src/main/groovy/org/grails/async/factory/gpars/GparsPromise.groovy
index ed1731ea11..9d02d2e1b4 100644
--- a/grails-async/gpars/src/main/groovy/org/grails/async/factory/gpars/GparsPromise.groovy
+++ b/grails-async/gpars/src/main/groovy/org/grails/async/factory/gpars/GparsPromise.groovy
@@ -51,7 +51,7 @@ class GparsPromise<T> implements Promise<T> {
@Override
boolean cancel(boolean mayInterruptIfRunning) {
- if(isDone()) return false
+ if (isDone()) return false
throw new UnsupportedOperationException('Cancellation not supported')
}
@@ -77,7 +77,7 @@ class GparsPromise<T> implements Promise<T> {
@Override
Promise<T> accept(T value) {
- internalPromise = Dataflow.task({value})
+ internalPromise = Dataflow.task({ value })
return this
}
@@ -87,7 +87,7 @@ class GparsPromise<T> implements Promise<T> {
@Override
Promise<T> onComplete(Closure<T> callable) {
- def decoratedCallable= promiseFactory.applyDecorators(callable, null)
+ def decoratedCallable = promiseFactory.applyDecorators(callable, null)
internalPromise.whenBound { T value ->
if (!(value instanceof Throwable)) {
return decoratedCallable.call(value)
diff --git a/grails-async/gpars/src/main/groovy/org/grails/async/factory/gpars/GparsPromiseFactory.groovy b/grails-async/gpars/src/main/groovy/org/grails/async/factory/gpars/GparsPromiseFactory.groovy
index 1782c75948..915d389d87 100644
--- a/grails-async/gpars/src/main/groovy/org/grails/async/factory/gpars/GparsPromiseFactory.groovy
+++ b/grails-async/gpars/src/main/groovy/org/grails/async/factory/gpars/GparsPromiseFactory.groovy
@@ -20,14 +20,13 @@ package org.grails.async.factory.gpars
import grails.async.Promise
import grails.async.PromiseList
+import grails.async.factory.AbstractPromiseFactory
import groovy.transform.AutoFinal
import groovy.transform.CompileStatic
import groovyx.gpars.GParsConfig
import groovyx.gpars.dataflow.Dataflow
import groovyx.gpars.dataflow.DataflowVariable
-import grails.async.factory.AbstractPromiseFactory
-
import java.util.concurrent.TimeUnit
/**
@@ -42,16 +41,24 @@ class GparsPromiseFactory extends AbstractPromiseFactory {
static final boolean GPARS_PRESENT
static {
- try { GPARS_PRESENT = Thread.currentThread().contextClassLoader.loadClass('groovyx.gpars.GParsConfig') }
- catch (Throwable ignore) { GPARS_PRESENT = false }
+ try {
+ GPARS_PRESENT = Thread.currentThread().contextClassLoader.loadClass('groovyx.gpars.GParsConfig')
+ }
+ catch (Throwable ignore) {
+ GPARS_PRESENT = false
+ }
}
+
static boolean isGparsAvailable() { GPARS_PRESENT }
private static final Closure<List<?>> originalValuesClosure = { List<?> values -> values } as Closure<List<?>>
GparsPromiseFactory() {
- try { GParsConfig.setPoolFactory(new LoggingPoolFactory()) }
- catch (IllegalArgumentException ignore) {}
+ try {
+ GParsConfig.setPoolFactory(new LoggingPoolFactory())
+ }
+ catch (IllegalArgumentException ignore) {
+ }
}
@Override
@@ -75,7 +82,7 @@ class GparsPromiseFactory extends AbstractPromiseFactory {
<T> Promise<T> createPromise(Closure<T>... closures) {
if (closures.length == 1) {
def callable = closures[0]
- return new GparsPromise(this, applyDecorators(callable,null))
+ return new GparsPromise(this, applyDecorators(callable, null))
}
PromiseList<T> promiseList = new PromiseList<>()
for (c in closures) {
@@ -105,16 +112,16 @@ class GparsPromiseFactory extends AbstractPromiseFactory {
@Override
<T> Promise<T> onComplete(List<Promise<T>> promises, Closure<T> callable) {
return new GparsPromise<T>(
- this,
- Dataflow.whenAllBound(toGparsPromises(promises), callable as Closure)
+ this,
+ Dataflow.whenAllBound(toGparsPromises(promises), callable as Closure)
)
}
@Override
<T> Promise<List<T>> onError(List<Promise<T>> promises, Closure<?> callable) {
return new GparsPromise<List<T>>(
- this,
- Dataflow.whenAllBound(toGparsPromises(promises), {} as Closure<T>, callable as Closure<T>)
+ this,
+ Dataflow.whenAllBound(toGparsPromises(promises), {} as Closure<T>, callable as Closure<T>)
)
}
}
diff --git a/grails-async/gpars/src/main/groovy/org/grails/async/factory/gpars/LoggingPoolFactory.groovy b/grails-async/gpars/src/main/groovy/org/grails/async/factory/gpars/LoggingPoolFactory.groovy
index c97b8cdc55..9058ba4b89 100644
--- a/grails-async/gpars/src/main/groovy/org/grails/async/factory/gpars/LoggingPoolFactory.groovy
+++ b/grails-async/gpars/src/main/groovy/org/grails/async/factory/gpars/LoggingPoolFactory.groovy
@@ -28,7 +28,11 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory
import java.lang.reflect.Method
-import java.util.concurrent.*
+import java.util.concurrent.RejectedExecutionHandler
+import java.util.concurrent.SynchronousQueue
+import java.util.concurrent.ThreadFactory
+import java.util.concurrent.ThreadPoolExecutor
+import java.util.concurrent.TimeUnit
/**
* A pool factory that logs error instead of printing them to standard err as is the default in GPars
@@ -74,18 +78,20 @@ class LoggingPoolFactory implements PoolFactory {
* Creates a fixed-thread pool of given size. Each thread will have the uncaught exception handler set
* to print the unhandled exception to standard error output.
*
- * @param daemon Sets the daemon flag of threads in the pool.
+ * @param daemon Sets the daemon flag of threads in the pool.
* @param poolSize The required pool size @return The created thread pool
* @return The newly created thread pool
*/
private static ThreadPoolExecutor createResizeablePool(boolean daemon, int poolSize) {
assert poolSize > 0;
return new ThreadPoolExecutor(poolSize, 1000, KEEP_ALIVE_TIME, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), new ThreadFactory() {
+
@Override
Thread newThread(Runnable r) {
Thread thread = new Thread(r, createThreadNameMethod.invoke(DefaultPool).toString())
thread.daemon = daemon
thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
+
@Override
void uncaughtException(Thread t, Throwable e) {
LOG.error("Async execution error: ${e.message}", e)
@@ -94,11 +100,12 @@ class LoggingPoolFactory implements PoolFactory {
return thread
}
}, new RejectedExecutionHandler() {
+
@Override
void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
throw new IllegalStateException("The thread pool executor cannot run the task. " +
- "The upper limit of the thread pool size has probably been reached. " +
- "Current pool size: $executor.poolSize Maximum pool size: $executor.maximumPoolSize")
+ "The upper limit of the thread pool size has probably been reached. " +
+ "Current pool size: $executor.poolSize Maximum pool size: $executor.maximumPoolSize")
}
})
}
diff --git a/grails-async/plugin/build.gradle b/grails-async/plugin/build.gradle
index f8ff94c033..aaa17fcb75 100644
--- a/grails-async/plugin/build.gradle
+++ b/grails-async/plugin/build.gradle
@@ -60,4 +60,5 @@ apply {
from rootProject.layout.projectDirectory.file('gradle/docs-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/publish-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/test-config.gradle')
+ from rootProject.layout.projectDirectory.file('gradle/style-enforcement-config.gradle')
}
\ No newline at end of file
diff --git a/grails-async/plugin/src/main/groovy/grails/async/services/PersistenceContextPromiseDecorator.groovy b/grails-async/plugin/src/main/groovy/grails/async/services/PersistenceContextPromiseDecorator.groovy
index abbc3a8e65..47d1fe88f2 100644
--- a/grails-async/plugin/src/main/groovy/grails/async/services/PersistenceContextPromiseDecorator.groovy
+++ b/grails-async/plugin/src/main/groovy/grails/async/services/PersistenceContextPromiseDecorator.groovy
@@ -18,9 +18,9 @@
*/
package grails.async.services
-import groovy.transform.CompileStatic
-import grails.persistence.support.PersistenceContextInterceptorExecutor
import grails.async.decorator.PromiseDecorator
+import grails.persistence.support.PersistenceContextInterceptorExecutor
+import groovy.transform.CompileStatic
/**
* A {@link PromiseDecorator} that wraps a promise execution in a persistence context (example Hibernate session)
@@ -29,7 +29,8 @@ import grails.async.decorator.PromiseDecorator
* @since 2.3
*/
@CompileStatic
-class PersistenceContextPromiseDecorator implements PromiseDecorator{
+class PersistenceContextPromiseDecorator implements PromiseDecorator {
+
PersistenceContextInterceptorExecutor persistenceContextInterceptorExecutor
PersistenceContextPromiseDecorator(PersistenceContextInterceptorExecutor persistenceContextInterceptorExecutor) {
diff --git a/grails-async/plugin/src/main/groovy/grails/async/services/TransactionalPromiseDecorator.groovy b/grails-async/plugin/src/main/groovy/grails/async/services/TransactionalPromiseDecorator.groovy
index 7032c4a247..bcea7608fa 100644
--- a/grails-async/plugin/src/main/groovy/grails/async/services/TransactionalPromiseDecorator.groovy
+++ b/grails-async/plugin/src/main/groovy/grails/async/services/TransactionalPromiseDecorator.groovy
@@ -18,9 +18,9 @@
*/
package grails.async.services
+import grails.async.decorator.PromiseDecorator
import groovy.transform.AutoFinal
import groovy.transform.CompileStatic
-import grails.async.decorator.PromiseDecorator
import org.springframework.beans.BeanWrapper
import org.springframework.beans.PropertyAccessorFactory
import org.springframework.transaction.PlatformTransactionManager
@@ -45,7 +45,8 @@ import java.lang.reflect.Method
class TransactionalPromiseDecorator implements PromiseDecorator, TransactionDefinition {
PlatformTransactionManager transactionManager
- @Delegate DefaultTransactionDefinition transactionDefinition = new DefaultTransactionDefinition()
+ @Delegate
+ DefaultTransactionDefinition transactionDefinition = new DefaultTransactionDefinition()
TransactionalPromiseDecorator(PlatformTransactionManager transactionManager) {
this.transactionManager = transactionManager
@@ -78,7 +79,7 @@ class TransactionalPromiseDecorator implements PromiseDecorator, TransactionDefi
@Override
<D> Closure<D> decorate(Closure<D> original) {
if (transactionManager != null) {
- return (Closure<D>){ args ->
+ return (Closure<D>) { args ->
def transactionTemplate = transactionDefinition != null ? new TransactionTemplate(transactionManager, transactionDefinition) : new TransactionTemplate(transactionManager)
transactionTemplate.execute({
original.call(args)
diff --git a/grails-async/plugin/src/main/groovy/grails/async/web/AsyncController.groovy b/grails-async/plugin/src/main/groovy/grails/async/web/AsyncController.groovy
index be3bbe2b0b..6c7b94db76 100644
--- a/grails-async/plugin/src/main/groovy/grails/async/web/AsyncController.groovy
+++ b/grails-async/plugin/src/main/groovy/grails/async/web/AsyncController.groovy
@@ -16,10 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package grails.async.web
import groovy.transform.CompileStatic
+import jakarta.servlet.AsyncContext
+import jakarta.servlet.http.HttpServletRequest
import org.grails.plugins.web.async.GrailsAsyncContext
import org.grails.web.servlet.mvc.GrailsWebRequest
import org.grails.web.util.GrailsApplicationAttributes
@@ -28,9 +29,6 @@ import org.springframework.web.context.request.async.AsyncWebRequest
import org.springframework.web.context.request.async.WebAsyncManager
import org.springframework.web.context.request.async.WebAsyncUtils
-import jakarta.servlet.AsyncContext
-import jakarta.servlet.http.HttpServletRequest
-
/**
* Exposes a startAsync() method for access to the Servlet 3.x API
*
@@ -45,7 +43,7 @@ trait AsyncController {
* @return a new {@link javax.servlet.AsyncContext}
*/
AsyncContext startAsync() {
- GrailsWebRequest webRequest = (GrailsWebRequest)RequestContextHolder.currentRequestAttributes()
+ GrailsWebRequest webRequest = (GrailsWebRequest) RequestContextHolder.currentRequestAttributes()
HttpServletRequest request = webRequest.currentRequest
WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request)
diff --git a/grails-async/plugin/src/main/groovy/grails/async/web/AsyncGrailsWebRequest.groovy b/grails-async/plugin/src/main/groovy/grails/async/web/AsyncGrailsWebRequest.groovy
index 7266d21403..c74c2876d4 100644
--- a/grails-async/plugin/src/main/groovy/grails/async/web/AsyncGrailsWebRequest.groovy
+++ b/grails-async/plugin/src/main/groovy/grails/async/web/AsyncGrailsWebRequest.groovy
@@ -16,22 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package grails.async.web
import groovy.transform.CompileStatic
-import org.grails.web.util.GrailsApplicationAttributes
-import org.grails.web.servlet.mvc.GrailsWebRequest
-import org.springframework.context.ApplicationContext
-import org.springframework.util.Assert
-import org.springframework.web.context.request.async.AsyncWebRequest
-
import jakarta.servlet.AsyncContext
import jakarta.servlet.AsyncEvent
import jakarta.servlet.AsyncListener
import jakarta.servlet.ServletContext
import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse
+import org.grails.web.servlet.mvc.GrailsWebRequest
+import org.grails.web.util.GrailsApplicationAttributes
+import org.springframework.context.ApplicationContext
+import org.springframework.util.Assert
+import org.springframework.web.context.request.async.AsyncWebRequest
+
import java.util.concurrent.atomic.AtomicBoolean
import java.util.function.Consumer
@@ -42,7 +41,8 @@ import java.util.function.Consumer
* @since 3.0
*/
@CompileStatic
-class AsyncGrailsWebRequest extends GrailsWebRequest implements AsyncWebRequest, AsyncListener{
+class AsyncGrailsWebRequest extends GrailsWebRequest implements AsyncWebRequest, AsyncListener {
+
static final String WEB_REQUEST = "org.grails.ASYNC_WEB_REQUEST"
Long timeout
@@ -97,7 +97,7 @@ class AsyncGrailsWebRequest extends GrailsWebRequest implements AsyncWebRequest,
@Override
void startAsync() {
Assert.state(request.asyncSupported, "The current request does not support Async processing")
- if(!isAsyncStarted()) {
+ if (!isAsyncStarted()) {
asyncContext = request.startAsync(request, response)
asyncContext.addListener(this)
}
@@ -110,8 +110,8 @@ class AsyncGrailsWebRequest extends GrailsWebRequest implements AsyncWebRequest,
@Override
void dispatch() {
- Assert.notNull this.asyncContext, "Cannot dispatch without an AsyncContext"
- asyncContext.dispatch()
+ Assert.notNull this.asyncContext, "Cannot dispatch without an AsyncContext"
+ asyncContext.dispatch()
}
@Override
@@ -121,7 +121,7 @@ class AsyncGrailsWebRequest extends GrailsWebRequest implements AsyncWebRequest,
@Override
void onComplete(AsyncEvent event) throws IOException {
- for(handler in completionHandlers) {
+ for (handler in completionHandlers) {
handler.run()
}
asyncContext = null
@@ -130,7 +130,7 @@ class AsyncGrailsWebRequest extends GrailsWebRequest implements AsyncWebRequest,
@Override
void onTimeout(AsyncEvent event) throws IOException {
- for(handler in timeoutHandlers) {
+ for (handler in timeoutHandlers) {
handler.run()
}
}
diff --git a/grails-async/plugin/src/main/groovy/grails/async/web/WebPromises.groovy b/grails-async/plugin/src/main/groovy/grails/async/web/WebPromises.groovy
index 7a923d03d1..4b19afa345 100644
--- a/grails-async/plugin/src/main/groovy/grails/async/web/WebPromises.groovy
+++ b/grails-async/plugin/src/main/groovy/grails/async/web/WebPromises.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package grails.async.web
import grails.async.Promise
@@ -32,7 +31,7 @@ import java.util.concurrent.TimeUnit
* A specific promises factory class designed for use in controllers and other web contexts
*
* @since 3.2.7
- * @author Graeme Rocher
+ * @author Graeme Rocher
*/
@CompileStatic
class WebPromises {
@@ -57,73 +56,73 @@ class WebPromises {
private WebPromises() {}
/**
- * @see grails.async.PromiseFactory#waitAll(grails.async.Promise[])
+ * @see grails.async.PromiseFactory#waitAll(grails.async.Promise [ ])
*/
- static<T> List<T> waitAll(Promise<T>...promises) {
+ static <T> List<T> waitAll(Promise<T>... promises) {
return getPromiseFactory().waitAll(promises)
}
/**
* @see grails.async.PromiseFactory#waitAll(java.util.List)
*/
- static<T> List<T> waitAll(List<Promise<T>> promises) {
+ static <T> List<T> waitAll(List<Promise<T>> promises) {
return getPromiseFactory().waitAll(promises)
}
/**
* @see grails.async.PromiseFactory#waitAll(java.util.List)
*/
- static<T> List<T> waitAll(List<Promise<T>> promises, final long timeout, final TimeUnit units) {
+ static <T> List<T> waitAll(List<Promise<T>> promises, final long timeout, final TimeUnit units) {
return getPromiseFactory().waitAll(promises, timeout, units)
}
/**
* @see grails.async.PromiseFactory#onComplete(java.util.List, groovy.lang.Closure)
*/
- static<T> Promise<List<T>> onComplete(List<Promise<T>> promises, Closure<T> callable) {
+ static <T> Promise<List<T>> onComplete(List<Promise<T>> promises, Closure<T> callable) {
return getPromiseFactory().onComplete(promises, callable)
}
/**
* @see grails.async.PromiseFactory#onError(java.util.List, groovy.lang.Closure)
*/
- static<T> Promise<List<T>> onError(List<Promise<T>> promises, Closure<?> callable) {
+ static <T> Promise<List<T>> onError(List<Promise<T>> promises, Closure<?> callable) {
return getPromiseFactory().onError(promises, callable)
}
/**
* @see grails.async.PromiseFactory#createPromise(java.util.Map)
*/
- static<K,V> Promise<Map<K,V>> createPromise(Map<K, V> map) {
+ static <K, V> Promise<Map<K, V>> createPromise(Map<K, V> map) {
return getPromiseFactory().createPromise(map, DECORATOR_LOOKUP.findDecorators())
}
/**
- * @see grails.async.PromiseFactory#createPromise(groovy.lang.Closure[])
+ * @see grails.async.PromiseFactory#createPromise(groovy.lang.Closure [ ])
*/
- static<T> Promise<List<T>> createPromise(Closure<T>... c) {
+ static <T> Promise<List<T>> createPromise(Closure<T>... c) {
return getPromiseFactory().createPromise(Arrays.asList(c), DECORATOR_LOOKUP.findDecorators())
}
/**
* @see grails.async.PromiseFactory#createPromise(java.util.Map)
*/
- static<K,V> Promise<Map<K,V>> tasks(Map<K, V> map) {
+ static <K, V> Promise<Map<K, V>> tasks(Map<K, V> map) {
return createPromise(map)
}
/**
- * @see grails.async.PromiseFactory#createPromise(groovy.lang.Closure[])
+ * @see grails.async.PromiseFactory#createPromise(groovy.lang.Closure [ ])
*/
- static<T> Promise<T> task(Closure<T> c) {
+ static <T> Promise<T> task(Closure<T> c) {
return getPromiseFactory().createPromise(c, DECORATOR_LOOKUP.findDecorators())
}
/**
- * @see grails.async.PromiseFactory#createPromise(groovy.lang.Closure[])
+ * @see grails.async.PromiseFactory#createPromise(groovy.lang.Closure [ ])
*/
- static<T> Promise<List<T>> tasks(Closure<T>... c) {
+ static <T> Promise<List<T>> tasks(Closure<T>... c) {
return createPromise(c)
}
/**
- * @see grails.async.PromiseFactory#createPromise(groovy.lang.Closure[])
+ * @see grails.async.PromiseFactory#createPromise(groovy.lang.Closure [ ])
*/
- static<T> Promise<List<T>> tasks(List<Closure<T>> closures) {
+ static <T> Promise<List<T>> tasks(List<Closure<T>> closures) {
return getPromiseFactory().createPromise(closures, DECORATOR_LOOKUP.findDecorators())
}
@@ -137,33 +136,33 @@ class WebPromises {
/**
* @see grails.async.PromiseFactory#createPromise(Class)
*/
- static<T> Promise<T> createPromise(Class<T> returnType) {
+ static <T> Promise<T> createPromise(Class<T> returnType) {
return getPromiseFactory().createPromise(returnType)
}
/**
* @see grails.async.PromiseFactory#createPromise(groovy.lang.Closure, java.util.List)
*/
- static<T> Promise<T> createPromise(Closure<T> c, List<PromiseDecorator> decorators) {
+ static <T> Promise<T> createPromise(Closure<T> c, List<PromiseDecorator> decorators) {
return getPromiseFactory().createPromise(c, DECORATOR_LOOKUP.findDecorators())
}
/**
* @see grails.async.PromiseFactory#createPromise(java.util.List, java.util.List)
*/
- static<T> Promise<List<T>> createPromise(List<Closure<T>> closures, List<PromiseDecorator> decorators) {
+ static <T> Promise<List<T>> createPromise(List<Closure<T>> closures, List<PromiseDecorator> decorators) {
return getPromiseFactory().createPromise(closures, DECORATOR_LOOKUP.findDecorators())
}
/**
- * @see grails.async.PromiseFactory#createPromise(grails.async.Promise[])
+ * @see grails.async.PromiseFactory#createPromise(grails.async.Promise [ ])
*/
- static <T> Promise<List<T>> createPromise(Promise<T>...promises) {
+ static <T> Promise<List<T>> createPromise(Promise<T>... promises) {
return getPromiseFactory().createPromise(promises)
}
/**
* @see grails.async.PromiseFactory#createBoundPromise(java.lang.Object)
*/
- static<T> Promise<T> createBoundPromise(T value) {
+ static <T> Promise<T> createBoundPromise(T value) {
return getPromiseFactory().createBoundPromise(value)
}
}
diff --git a/grails-async/plugin/src/main/groovy/org/grails/async/transform/internal/DefaultDelegateAsyncTransactionalMethodTransformer.groovy b/grails-async/plugin/src/main/groovy/org/grails/async/transform/internal/DefaultDelegateAsyncTransactionalMethodTransformer.groovy
index 2630bc9599..f95dcf6826 100644
--- a/grails-async/plugin/src/main/groovy/org/grails/async/transform/internal/DefaultDelegateAsyncTransactionalMethodTransformer.groovy
+++ b/grails-async/plugin/src/main/groovy/org/grails/async/transform/internal/DefaultDelegateAsyncTransactionalMethodTransformer.groovy
@@ -18,6 +18,7 @@
*/
package org.grails.async.transform.internal
+import grails.transaction.TransactionManagerAware
import groovy.transform.CompileStatic
import org.codehaus.groovy.ast.ClassHelper
import org.codehaus.groovy.ast.ClassNode
@@ -36,11 +37,10 @@ import org.codehaus.groovy.ast.expr.PropertyExpression
import org.codehaus.groovy.ast.expr.VariableExpression
import org.codehaus.groovy.ast.stmt.BlockStatement
import org.codehaus.groovy.ast.stmt.ExpressionStatement
-import org.grails.compiler.injection.GrailsASTUtils
-import org.grails.compiler.web.async.TransactionalAsyncTransformUtils
-import grails.transaction.TransactionManagerAware
import org.codehaus.groovy.syntax.Token
import org.codehaus.groovy.syntax.Types
+import org.grails.compiler.injection.GrailsASTUtils
+import org.grails.compiler.web.async.TransactionalAsyncTransformUtils
import org.springframework.transaction.PlatformTransactionManager
import org.springframework.transaction.annotation.Transactional
@@ -65,7 +65,7 @@ class DefaultDelegateAsyncTransactionalMethodTransformer implements DelegateAsyn
private static final ClassNode CLASS_NODE_MAP = new ClassNode(Map.class).getPlainNodeReference()
private static final String METHOD_NAME_SET_TRANSACTION_MANAGER = "setTransactionManager"
private static final VariableExpression EXPRESSION_THIS = new VariableExpression("this")
- private static final Token OPERATOR_ASSIGNMENT = new Token(Types.EQUAL,"=", -1,-1)
+ private static final Token OPERATOR_ASSIGNMENT = new Token(Types.EQUAL, "=", -1, -1)
private static final String VARIABLE_TRANSACTION_MANAGER = "txMgr"
private FieldNode transactionalField
private boolean isTransactional = false
@@ -73,14 +73,14 @@ class DefaultDelegateAsyncTransactionalMethodTransformer implements DelegateAsyn
private int promiseDecoratorCount = 0
@Override
- void transformTransactionalMethod(ClassNode classNode,ClassNode delegateClassNode, MethodNode methodNode, ListExpression promiseDecorators) {
+ void transformTransactionalMethod(ClassNode classNode, ClassNode delegateClassNode, MethodNode methodNode, ListExpression promiseDecorators) {
if (transactionalField == null) {
transactionalField = delegateClassNode.getField(TRANSACTIONAL_FIELD)
isTransactional = false
- if(transactionalField) {
+ if (transactionalField) {
def ie = transactionalField.getInitialExpression()
- if(ie instanceof ConstantExpression) {
+ if (ie instanceof ConstantExpression) {
isTransactional = ie.isTrueExpression()
}
}
@@ -92,30 +92,29 @@ class DefaultDelegateAsyncTransactionalMethodTransformer implements DelegateAsyn
int currentIndex = promiseDecoratorCount++
-
final methodLookupArguments = new ArgumentListExpression(new ConstantExpression(methodNode.getName()))
- for(Parameter p in methodNode.getParameters()) {
+ for (Parameter p in methodNode.getParameters()) {
methodLookupArguments.addExpression(new ClassExpression(p.getType().getPlainNodeReference()))
}
final promiseLookupExpression = new BinaryExpression(new PropertyExpression(EXPRESSION_THIS, FIELD_NAME_PROMISE_DECORATORS), Token.newSymbol(Types.LEFT_SQUARE_BRACKET, -1, -1), new ConstantExpression(currentIndex))
setTransactionManagerMethodBody.addStatement(
- new ExpressionStatement(
- new BinaryExpression(
- promiseLookupExpression,
- OPERATOR_ASSIGNMENT,
- new MethodCallExpression(
- new ClassExpression(new ClassNode(TransactionalAsyncTransformUtils).getPlainNodeReference()),
- "createTransactionalPromiseDecorator",
- new ArgumentListExpression(new VariableExpression(VARIABLE_TRANSACTION_MANAGER),
- new MethodCallExpression(
+ new ExpressionStatement(
+ new BinaryExpression(
+ promiseLookupExpression,
+ OPERATOR_ASSIGNMENT,
+ new MethodCallExpression(
+ new ClassExpression(new ClassNode(TransactionalAsyncTransformUtils).getPlainNodeReference()),
+ "createTransactionalPromiseDecorator",
+ new ArgumentListExpression(new VariableExpression(VARIABLE_TRANSACTION_MANAGER),
+ new MethodCallExpression(
new ClassExpression(delegateClassNode),
"getDeclaredMethod", methodLookupArguments
- )
- )
- )
+ )
+ )
+ )
+ )
)
- )
)
promiseDecorators.addExpression(promiseLookupExpression)
@@ -137,7 +136,7 @@ class DefaultDelegateAsyncTransactionalMethodTransformer implements DelegateAsyn
classNode.addField(new FieldNode(FIELD_NAME_TRANSACTION_MANAGER, Modifier.PRIVATE, INTERFACE_TRANSACTION_MANAGER, classNode, GrailsASTUtils.NULL_EXPRESSION))
}
final promiseDecoratorsField = classNode.getField(FIELD_NAME_PROMISE_DECORATORS)
- if(promiseDecoratorsField == null) {
+ if (promiseDecoratorsField == null) {
classNode.addField(new FieldNode(FIELD_NAME_PROMISE_DECORATORS, Modifier.PRIVATE, CLASS_NODE_MAP, classNode, new MapExpression()))
}
@@ -146,28 +145,28 @@ class DefaultDelegateAsyncTransactionalMethodTransformer implements DelegateAsyn
def parameters = [transactionManagerParameter] as Parameter[]
final txMgrParam = new VariableExpression(transactionManagerParameter)
methodBody.addStatement(
- new ExpressionStatement(
- new BinaryExpression(
- new PropertyExpression(EXPRESSION_THIS, FIELD_NAME_TRANSACTION_MANAGER),
- OPERATOR_ASSIGNMENT,
- txMgrParam
+ new ExpressionStatement(
+ new BinaryExpression(
+ new PropertyExpression(EXPRESSION_THIS, FIELD_NAME_TRANSACTION_MANAGER),
+ OPERATOR_ASSIGNMENT,
+ txMgrParam
+ )
)
- )
)
methodBody.addStatement(
- new ExpressionStatement(
- new DeclarationExpression(
- new VariableExpression(VARIABLE_TRANSACTION_MANAGER, INTERFACE_TRANSACTION_MANAGER),
- OPERATOR_ASSIGNMENT,
- txMgrParam
+ new ExpressionStatement(
+ new DeclarationExpression(
+ new VariableExpression(VARIABLE_TRANSACTION_MANAGER, INTERFACE_TRANSACTION_MANAGER),
+ OPERATOR_ASSIGNMENT,
+ txMgrParam
+ )
)
- )
)
method = new MethodNode(METHOD_NAME_SET_TRANSACTION_MANAGER, Modifier.PUBLIC, ClassHelper.VOID_TYPE, parameters, [] as ClassNode[], methodBody)
classNode.addMethod(method)
}
- return (BlockStatement)method.getCode()
+ return (BlockStatement) method.getCode()
}
}
diff --git a/grails-async/plugin/src/main/groovy/org/grails/compiler/web/async/TransactionalAsyncTransformUtils.groovy b/grails-async/plugin/src/main/groovy/org/grails/compiler/web/async/TransactionalAsyncTransformUtils.groovy
index 7b2a25157e..832981009e 100644
--- a/grails-async/plugin/src/main/groovy/org/grails/compiler/web/async/TransactionalAsyncTransformUtils.groovy
+++ b/grails-async/plugin/src/main/groovy/org/grails/compiler/web/async/TransactionalAsyncTransformUtils.groovy
@@ -34,7 +34,6 @@ import java.lang.reflect.Method
@CompileStatic
class TransactionalAsyncTransformUtils {
-
/**
* Creates a {@link TransactionalPromiseDecorator} for the given transactionManager and method to be invoked
*
diff --git a/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/AsyncWebRequestPromiseDecorator.groovy b/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/AsyncWebRequestPromiseDecorator.groovy
index c63d86fd14..eb16ff01f5 100644
--- a/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/AsyncWebRequestPromiseDecorator.groovy
+++ b/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/AsyncWebRequestPromiseDecorator.groovy
@@ -16,22 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.plugins.web.async
+import grails.async.decorator.PromiseDecorator
import grails.async.web.AsyncGrailsWebRequest
import groovy.transform.CompileStatic
import groovy.transform.TypeCheckingMode
+import jakarta.servlet.AsyncContext
+import jakarta.servlet.http.HttpServletRequest
+import jakarta.servlet.http.HttpServletResponse
import org.grails.web.servlet.mvc.GrailsWebRequest
import org.grails.web.util.WebUtils
-import grails.async.decorator.PromiseDecorator
import org.springframework.web.context.request.RequestContextHolder
import org.springframework.web.context.request.async.WebAsyncManager
import org.springframework.web.context.request.async.WebAsyncUtils
-import jakarta.servlet.AsyncContext
-import jakarta.servlet.http.HttpServletRequest
-import jakarta.servlet.http.HttpServletResponse
import java.util.concurrent.TimeoutException
/**
@@ -42,6 +41,7 @@ import java.util.concurrent.TimeoutException
*/
@CompileStatic
class AsyncWebRequestPromiseDecorator implements PromiseDecorator {
+
GrailsWebRequest webRequest
final AsyncGrailsWebRequest asyncRequest
final AsyncContext asyncContext
@@ -52,15 +52,14 @@ class AsyncWebRequestPromiseDecorator implements PromiseDecorator {
HttpServletRequest currentServletRequest = webRequest.currentRequest
WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(currentServletRequest)
AsyncGrailsWebRequest newWebRequest
- if(asyncManager.isConcurrentHandlingStarted()) {
+ if (asyncManager.isConcurrentHandlingStarted()) {
newWebRequest = AsyncGrailsWebRequest.lookup(currentServletRequest)
asyncContext = newWebRequest.asyncContext
- if( newWebRequest == null || newWebRequest.isAsyncComplete() ) {
+ if (newWebRequest == null || newWebRequest.isAsyncComplete()) {
throw new IllegalStateException("Cannot start a task once asynchronous request processing has completed")
}
- }
- else {
- newWebRequest = new AsyncGrailsWebRequest(currentServletRequest, webRequest.currentResponse, webRequest.servletContext,webRequest.applicationContext)
+ } else {
+ newWebRequest = new AsyncGrailsWebRequest(currentServletRequest, webRequest.currentResponse, webRequest.servletContext, webRequest.applicationContext)
asyncManager.setAsyncWebRequest(newWebRequest)
newWebRequest.startAsync()
asyncContext = newWebRequest.asyncContext
@@ -74,22 +73,21 @@ class AsyncWebRequestPromiseDecorator implements PromiseDecorator {
@Override
def <D> Closure<D> decorate(Closure<D> c) {
- return (Closure<D>) { args ->
- if(timeoutReached) {
+ return (Closure<D>) { args ->
+ if (timeoutReached) {
throw new TimeoutException("Asynchronous request processing timeout reached")
}
HttpServletRequest request = (HttpServletRequest) asyncContext.request
- if(request.isAsyncStarted()) {
+ if (request.isAsyncStarted()) {
- WebUtils.storeGrailsWebRequest(new GrailsWebRequest(request, (HttpServletResponse)asyncContext.response, webRequest.attributes))
+ WebUtils.storeGrailsWebRequest(new GrailsWebRequest(request, (HttpServletResponse) asyncContext.response, webRequest.attributes))
try {
return invokeClosure(c, args)
}
finally {
RequestContextHolder.resetRequestAttributes()
}
- }
- else {
+ } else {
throw new IllegalStateException("Asynchronous request already terminated. Likely timeout reached")
}
}
@@ -99,14 +97,11 @@ class AsyncWebRequestPromiseDecorator implements PromiseDecorator {
def invokeClosure(Closure c, args) {
if (args == null) {
c.call(null)
- }
- else if(args && args.getClass().isArray()) {
+ } else if (args && args.getClass().isArray()) {
c.call(*args)
- }
- else if (args instanceof List) {
+ } else if (args instanceof List) {
c.call(*args)
- }
- else {
+ } else {
c.call(args)
}
}
diff --git a/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/AsyncWebRequestPromiseDecoratorLookupStrategy.groovy b/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/AsyncWebRequestPromiseDecoratorLookupStrategy.groovy
index f43bc1ab06..42dea101da 100644
--- a/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/AsyncWebRequestPromiseDecoratorLookupStrategy.groovy
+++ b/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/AsyncWebRequestPromiseDecoratorLookupStrategy.groovy
@@ -18,10 +18,10 @@
*/
package org.grails.plugins.web.async
-import groovy.transform.CompileStatic
-import org.grails.web.servlet.mvc.GrailsWebRequest
import grails.async.decorator.PromiseDecorator
import grails.async.decorator.PromiseDecoratorLookupStrategy
+import groovy.transform.CompileStatic
+import org.grails.web.servlet.mvc.GrailsWebRequest
/**
* A promise decorated lookup strategy that binds a WebRequest to the promise thread
@@ -31,6 +31,7 @@ import grails.async.decorator.PromiseDecoratorLookupStrategy
*/
@CompileStatic
class AsyncWebRequestPromiseDecoratorLookupStrategy implements PromiseDecoratorLookupStrategy {
+
@Override
List<PromiseDecorator> findDecorators() {
final webRequest = GrailsWebRequest.lookup()
diff --git a/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/ControllersAsyncGrailsPlugin.groovy b/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/ControllersAsyncGrailsPlugin.groovy
index f6b20c9850..e004b64520 100644
--- a/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/ControllersAsyncGrailsPlugin.groovy
+++ b/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/ControllersAsyncGrailsPlugin.groovy
@@ -30,10 +30,14 @@ import org.grails.plugins.web.async.spring.PromiseFactoryBean
* @since 2.0
*/
class ControllersAsyncGrailsPlugin extends Plugin {
+
def grailsVersion = "7.0.0 > *"
def loadAfter = ['controllers']
- Closure doWithSpring() {{->
- asyncPromiseResponseActionResultTransformer(AsyncActionResultTransformer)
- grailsPromiseFactory(PromiseFactoryBean)
- }}
+
+ Closure doWithSpring() {
+ { ->
+ asyncPromiseResponseActionResultTransformer(AsyncActionResultTransformer)
+ grailsPromiseFactory(PromiseFactoryBean)
+ }
+ }
}
diff --git a/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/GrailsAsyncContext.groovy b/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/GrailsAsyncContext.groovy
index ebba8346d9..fb6d403e85 100644
--- a/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/GrailsAsyncContext.groovy
+++ b/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/GrailsAsyncContext.groovy
@@ -37,7 +37,8 @@ class GrailsAsyncContext implements AsyncContext {
private static final String PERSISTENCE_INTERCEPTORS = 'org.codehaus.groovy.grails.PERSISTENCE_INTERCEPTORS'
- final @Delegate AsyncContext delegate
+ final @Delegate
+ AsyncContext delegate
final GrailsWebRequest originalWebRequest
final AsyncGrailsWebRequest asyncGrailsWebRequest
@@ -53,7 +54,7 @@ class GrailsAsyncContext implements AsyncContext {
void start(Runnable runnable) {
delegate.start {
- GrailsWebRequest webRequest = asyncGrailsWebRequest ?: new GrailsWebRequest((HttpServletRequest)request, (HttpServletResponse)response, request.getServletContext())
+ GrailsWebRequest webRequest = asyncGrailsWebRequest ?: new GrailsWebRequest((HttpServletRequest) request, (HttpServletResponse) response, request.getServletContext())
WebUtils.storeGrailsWebRequest(webRequest)
def interceptors = getPersistenceInterceptors(webRequest)
@@ -74,11 +75,11 @@ class GrailsAsyncContext implements AsyncContext {
void complete() {
delegate.complete()
- }
+ }
protected Collection<PersistenceContextInterceptor> getPersistenceInterceptors(GrailsWebRequest webRequest) {
def servletContext = webRequest.servletContext
- Collection<PersistenceContextInterceptor> interceptors = (Collection<PersistenceContextInterceptor>)servletContext?.getAttribute(PERSISTENCE_INTERCEPTORS)
+ Collection<PersistenceContextInterceptor> interceptors = (Collection<PersistenceContextInterceptor>) servletContext?.getAttribute(PERSISTENCE_INTERCEPTORS)
if (interceptors == null) {
interceptors = webRequest.applicationContext?.getBeansOfType(PersistenceContextInterceptor)?.values() ?: []
servletContext.setAttribute(PERSISTENCE_INTERCEPTORS, interceptors)
diff --git a/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/mvc/AsyncActionResultTransformer.groovy b/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/mvc/AsyncActionResultTransformer.groovy
index df069f4285..4233150f8e 100644
--- a/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/mvc/AsyncActionResultTransformer.groovy
+++ b/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/mvc/AsyncActionResultTransformer.groovy
@@ -22,19 +22,18 @@ import grails.async.Promise
import grails.async.PromiseList
import grails.async.web.AsyncGrailsWebRequest
import groovy.transform.CompileStatic
+import jakarta.servlet.AsyncContext
+import jakarta.servlet.http.HttpServletRequest
+import jakarta.servlet.http.HttpServletResponse
import org.grails.plugins.web.async.GrailsAsyncContext
import org.grails.web.errors.GrailsExceptionResolver
-import org.grails.web.util.GrailsApplicationAttributes
import org.grails.web.servlet.mvc.ActionResultTransformer
import org.grails.web.servlet.mvc.GrailsWebRequest
+import org.grails.web.util.GrailsApplicationAttributes
import org.springframework.web.context.request.async.WebAsyncManager
import org.springframework.web.context.request.async.WebAsyncUtils
import org.springframework.web.servlet.ModelAndView
-import jakarta.servlet.AsyncContext
-import jakarta.servlet.http.HttpServletRequest
-import jakarta.servlet.http.HttpServletResponse
-
/**
* Handles an Async response from a controller
*
@@ -55,13 +54,12 @@ class AsyncActionResultTransformer implements ActionResultTransformer {
final response = webRequest.getResponse()
AsyncGrailsWebRequest asyncWebRequest
- if(asyncManager.isConcurrentHandlingStarted()) {
+ if (asyncManager.isConcurrentHandlingStarted()) {
asyncWebRequest = AsyncGrailsWebRequest.lookup(request)
- if(asyncWebRequest == null) {
+ if (asyncWebRequest == null) {
throw new IllegalStateException("Concurrency handling already started by another process")
}
- }
- else {
+ } else {
asyncWebRequest = new AsyncGrailsWebRequest(request, response, webRequest.servletContext)
asyncManager.setAsyncWebRequest(asyncWebRequest)
asyncWebRequest.startAsync()
@@ -101,8 +99,7 @@ class AsyncActionResultTransformer implements ActionResultTransformer {
def modelAndView = exceptionResolver.resolveException(request, response, this, (Exception) t)
asyncContext.getRequest().setAttribute(GrailsApplicationAttributes.MODEL_AND_VIEW, modelAndView)
asyncContext.dispatch()
- }
- else {
+ } else {
asyncContext.complete()
}
}
diff --git a/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/spring/PromiseFactoryBean.groovy b/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/spring/PromiseFactoryBean.groovy
index 6bce2a5788..639548ffbf 100644
--- a/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/spring/PromiseFactoryBean.groovy
+++ b/grails-async/plugin/src/main/groovy/org/grails/plugins/web/async/spring/PromiseFactoryBean.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.plugins.web.async.spring
import grails.async.PromiseFactory
@@ -33,6 +32,7 @@ import org.springframework.beans.factory.FactoryBean
*/
@CompileStatic
class PromiseFactoryBean extends PromiseFactoryBuilder implements FactoryBean<PromiseFactory> {
+
@Override
PromiseFactory getObject() throws Exception {
PromiseFactory promiseFactory = build()
diff --git a/grails-async/rxjava/build.gradle b/grails-async/rxjava/build.gradle
index b15111a395..363846c1ce 100644
--- a/grails-async/rxjava/build.gradle
+++ b/grails-async/rxjava/build.gradle
@@ -46,4 +46,5 @@ apply {
from rootProject.layout.projectDirectory.file('gradle/docs-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/publish-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/test-config.gradle')
+ from rootProject.layout.projectDirectory.file('gradle/style-enforcement-config.gradle')
}
\ No newline at end of file
diff --git a/grails-async/rxjava/src/main/groovy/org/grails/async/factory/rxjava/RxPromise.groovy b/grails-async/rxjava/src/main/groovy/org/grails/async/factory/rxjava/RxPromise.groovy
index f44de3fab5..71358ca0b2 100644
--- a/grails-async/rxjava/src/main/groovy/org/grails/async/factory/rxjava/RxPromise.groovy
+++ b/grails-async/rxjava/src/main/groovy/org/grails/async/factory/rxjava/RxPromise.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.async.factory.rxjava
import grails.async.Promise
@@ -47,21 +46,21 @@ import java.util.concurrent.TimeoutException
@AutoFinal
@CompileStatic
@PackageScope
-class RxPromise<T> implements Promise<T> {
+class RxPromise<T> implements Promise<T> {
- final Subject<T,T> subject
+ final Subject<T, T> subject
final RxPromiseFactory promiseFactory
protected Subscription subscription
RxPromise(RxPromiseFactory promiseFactory, Closure callable, Scheduler scheduler) {
- this(promiseFactory, Single.create( { SingleSubscriber<? super T> singleSubscriber ->
+ this(promiseFactory, Single.create({ SingleSubscriber<? super T> singleSubscriber ->
try {
- singleSubscriber.onSuccess((T)callable.call())
+ singleSubscriber.onSuccess((T) callable.call())
} catch (Throwable t) {
singleSubscriber.onError(t)
}
} as Single.OnSubscribe<T>)
- .subscribeOn(scheduler))
+ .subscribeOn(scheduler))
}
RxPromise(RxPromiseFactory promiseFactory, Observable single) {
@@ -78,7 +77,7 @@ class RxPromise<T> implements Promise<T> {
this.subject = subject
}
- RxPromise(RxPromiseFactory promiseFactory,Observable observable, Subject subject) {
+ RxPromise(RxPromiseFactory promiseFactory, Observable observable, Subject subject) {
this.promiseFactory = promiseFactory
this.subscription = observable.subscribe(subject)
this.subject = subject
@@ -92,13 +91,13 @@ class RxPromise<T> implements Promise<T> {
@Override
Promise<T> onComplete(Closure callable) {
def decoratedCallable = promiseFactory.applyDecorators(callable, null)
- return new RxPromise<T>(promiseFactory,subject.map(decoratedCallable as Func1<T, T>))
+ return new RxPromise<T>(promiseFactory, subject.map(decoratedCallable as Func1<T, T>))
}
@Override
Promise<T> onError(Closure callable) {
def decoratedCallable = promiseFactory.applyDecorators(callable, null)
- return new RxPromise<T>(promiseFactory,subject.doOnError(decoratedCallable as Action1<Throwable>))
+ return new RxPromise<T>(promiseFactory, subject.doOnError(decoratedCallable as Action1<Throwable>))
}
@Override
@@ -108,7 +107,7 @@ class RxPromise<T> implements Promise<T> {
@Override
boolean cancel(boolean mayInterruptIfRunning) {
- if(subscription != null) {
+ if (subscription != null) {
subscription.unsubscribe()
return subscription.isUnsubscribed()
}
@@ -117,10 +116,9 @@ class RxPromise<T> implements Promise<T> {
@Override
boolean isCancelled() {
- if(subscription == null) {
+ if (subscription == null) {
return false
- }
- else {
+ } else {
return subscription.isUnsubscribed()
}
}
@@ -140,10 +138,9 @@ class RxPromise<T> implements Promise<T> {
try {
return subject.timeout(timeout, unit).toBlocking().first()
} catch (Throwable e) {
- if(e.cause instanceof TimeoutException) {
+ if (e.cause instanceof TimeoutException) {
throw e.cause
- }
- else {
+ } else {
throw e
}
}
diff --git a/grails-async/rxjava/src/main/groovy/org/grails/async/factory/rxjava/RxPromiseFactory.groovy b/grails-async/rxjava/src/main/groovy/org/grails/async/factory/rxjava/RxPromiseFactory.groovy
index 6248acc299..0785de57a1 100644
--- a/grails-async/rxjava/src/main/groovy/org/grails/async/factory/rxjava/RxPromiseFactory.groovy
+++ b/grails-async/rxjava/src/main/groovy/org/grails/async/factory/rxjava/RxPromiseFactory.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.async.factory.rxjava
import grails.async.Promise
@@ -53,10 +52,9 @@ class RxPromiseFactory extends AbstractPromiseFactory {
@Override
<T> Promise<T> createPromise(Closure<T>[] closures) {
- if(closures.length == 1) {
- return new RxPromise<T>(this,closures[0], Schedulers.io())
- }
- else {
+ if (closures.length == 1) {
+ return new RxPromise<T>(this, closures[0], Schedulers.io())
+ } else {
def promiseList = new PromiseList()
for (Closure closure : closures) {
promiseList.add(closure)
@@ -79,22 +77,21 @@ class RxPromiseFactory extends AbstractPromiseFactory {
<T> Promise<T> onComplete(List<Promise<T>> promises, Closure<T> callable) {
new RxPromise<T>(this, Observable.concat(
promises.collect() { Promise p ->
- if(p instanceof BoundPromise) {
- return Observable.just(((BoundPromise)p).value)
- }
- else {
- return ((RxPromise)p).subject as Observable<T>
+ if (p instanceof BoundPromise) {
+ return Observable.just(((BoundPromise) p).value)
+ } else {
+ return ((RxPromise) p).subject as Observable<T>
}
}
).toList())
- .onComplete(callable)
+ .onComplete(callable)
}
@Override
<T> Promise<T> onError(List<Promise<T>> promises, Closure<?> callable) {
new RxPromise<T>(this, Observable.concat(
- promises.collect() { Promise p -> ((RxPromise)p).subject as Observable<T> }
+ promises.collect() { Promise p -> ((RxPromise) p).subject as Observable<T> }
).toList())
- .onError(callable)
+ .onError(callable)
}
}
diff --git a/grails-async/rxjava/src/test/groovy/org/grails/async/factory/rxjava/RxJavaPromiseListSpec.groovy b/grails-async/rxjava/src/test/groovy/org/grails/async/factory/rxjava/RxJavaPromiseListSpec.groovy
index 91409810b1..0fba6d90af 100644
--- a/grails-async/rxjava/src/test/groovy/org/grails/async/factory/rxjava/RxJavaPromiseListSpec.groovy
+++ b/grails-async/rxjava/src/test/groovy/org/grails/async/factory/rxjava/RxJavaPromiseListSpec.groovy
@@ -27,7 +27,6 @@ import spock.util.concurrent.PollingConditions
*/
class RxJavaPromiseListSpec extends Specification{
-
void 'Test promise list handling'() {
when: 'a list of promises is created'
diff --git a/grails-async/rxjava/src/test/groovy/org/grails/async/factory/rxjava/RxJavaPromiseMapSpec.groovy b/grails-async/rxjava/src/test/groovy/org/grails/async/factory/rxjava/RxJavaPromiseMapSpec.groovy
index 894c70ae33..7a94076761 100644
--- a/grails-async/rxjava/src/test/groovy/org/grails/async/factory/rxjava/RxJavaPromiseMapSpec.groovy
+++ b/grails-async/rxjava/src/test/groovy/org/grails/async/factory/rxjava/RxJavaPromiseMapSpec.groovy
@@ -82,7 +82,6 @@ class RxJavaPromiseMapSpec extends Specification{
}
}
-
void 'Test that a PromiseMap triggers onError for an exception and ignores onComplete'() {
when: 'a promise map is used with an onComplete handler'
diff --git a/grails-async/rxjava/src/test/groovy/org/grails/async/factory/rxjava/RxJavaPromiseSpec.groovy b/grails-async/rxjava/src/test/groovy/org/grails/async/factory/rxjava/RxJavaPromiseSpec.groovy
index 7108caafa8..f8f3f2a62f 100644
--- a/grails-async/rxjava/src/test/groovy/org/grails/async/factory/rxjava/RxJavaPromiseSpec.groovy
+++ b/grails-async/rxjava/src/test/groovy/org/grails/async/factory/rxjava/RxJavaPromiseSpec.groovy
@@ -153,4 +153,3 @@ class RxJavaPromiseSpec extends Specification {
}
}
-
diff --git a/grails-async/rxjava2/build.gradle b/grails-async/rxjava2/build.gradle
index 41732df8d9..cb6afbeebf 100644
--- a/grails-async/rxjava2/build.gradle
+++ b/grails-async/rxjava2/build.gradle
@@ -46,4 +46,5 @@ apply {
from rootProject.layout.projectDirectory.file('gradle/docs-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/publish-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/test-config.gradle')
+ from rootProject.layout.projectDirectory.file('gradle/style-enforcement-config.gradle')
}
\ No newline at end of file
diff --git a/grails-async/rxjava2/src/main/groovy/org/grails/async/factory/rxjava2/RxPromise.groovy b/grails-async/rxjava2/src/main/groovy/org/grails/async/factory/rxjava2/RxPromise.groovy
index a0f1bdf324..f573973c9a 100644
--- a/grails-async/rxjava2/src/main/groovy/org/grails/async/factory/rxjava2/RxPromise.groovy
+++ b/grails-async/rxjava2/src/main/groovy/org/grails/async/factory/rxjava2/RxPromise.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.async.factory.rxjava2
import grails.async.Promise
@@ -28,7 +27,6 @@ import io.reactivex.Observer
import io.reactivex.Scheduler
import io.reactivex.Single
import io.reactivex.SingleEmitter
-import io.reactivex.SingleObserver
import io.reactivex.SingleOnSubscribe
import io.reactivex.disposables.Disposable
import io.reactivex.functions.Consumer
@@ -50,7 +48,7 @@ import java.util.concurrent.TimeoutException
@AutoFinal
@CompileStatic
@PackageScope
-class RxPromise<T> implements Promise<T> {
+class RxPromise<T> implements Promise<T> {
protected final Subject<T> subject
protected final RxPromiseFactory promiseFactory
@@ -61,9 +59,9 @@ class RxPromise<T> implements Promise<T> {
RxPromise(RxPromiseFactory promiseFactory, Closure callable, Scheduler scheduler) {
- this(promiseFactory, Single.create( { SingleEmitter<? super T> singleSubscriber ->
+ this(promiseFactory, Single.create({ SingleEmitter<? super T> singleSubscriber ->
try {
- singleSubscriber.onSuccess((T)runCallable(callable))
+ singleSubscriber.onSuccess((T) runCallable(callable))
} catch (Throwable t) {
singleSubscriber.onError(t)
}
@@ -87,6 +85,7 @@ class RxPromise<T> implements Promise<T> {
this.observable = observable
this.promiseFactory = promiseFactory
observable.subscribe(new Observer<T>() {
+
@Override
void onSubscribe(Disposable d) {
subscription = d
@@ -138,7 +137,7 @@ class RxPromise<T> implements Promise<T> {
@Override
boolean cancel(boolean mayInterruptIfRunning) {
- if(subscription != null) {
+ if (subscription != null) {
subscription.dispose()
return subscription.isDisposed()
}
@@ -147,10 +146,9 @@ class RxPromise<T> implements Promise<T> {
@Override
boolean isCancelled() {
- if(subscription == null) {
+ if (subscription == null) {
return false
- }
- else {
+ } else {
return subscription.isDisposed()
}
}
@@ -170,10 +168,9 @@ class RxPromise<T> implements Promise<T> {
try {
return subject.timeout(timeout, unit).blockingFirst()
} catch (Throwable e) {
- if(e.cause instanceof TimeoutException) {
+ if (e.cause instanceof TimeoutException) {
throw e.cause
- }
- else {
+ } else {
throw e
}
}
@@ -181,7 +178,7 @@ class RxPromise<T> implements Promise<T> {
static Object runCallable(Closure callable) {
Object rtn = callable.call()
- if(rtn == null) {
+ if (rtn == null) {
return Void
} else {
return rtn
diff --git a/grails-async/rxjava2/src/main/groovy/org/grails/async/factory/rxjava2/RxPromiseFactory.groovy b/grails-async/rxjava2/src/main/groovy/org/grails/async/factory/rxjava2/RxPromiseFactory.groovy
index c527d26d2b..2ec3611516 100644
--- a/grails-async/rxjava2/src/main/groovy/org/grails/async/factory/rxjava2/RxPromiseFactory.groovy
+++ b/grails-async/rxjava2/src/main/groovy/org/grails/async/factory/rxjava2/RxPromiseFactory.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.async.factory.rxjava2
import grails.async.Promise
@@ -53,10 +52,9 @@ class RxPromiseFactory extends AbstractPromiseFactory {
@Override
<T> Promise<T> createPromise(Closure<T>[] closures) {
- if(closures.length == 1) {
+ if (closures.length == 1) {
return new RxPromise<T>(this, closures[0], Schedulers.io())
- }
- else {
+ } else {
def promiseList = new PromiseList()
for (Closure closure : closures) {
promiseList.add(closure)
@@ -78,23 +76,22 @@ class RxPromiseFactory extends AbstractPromiseFactory {
@Override
<T> Promise<T> onComplete(List<Promise<T>> promises, Closure<T> callable) {
new RxPromise<T>(this, Observable.concat(
- promises.collect { Promise p ->
- if(p instanceof BoundPromise) {
- return Observable.just(((BoundPromise)p).value) as Observable<T>
+ promises.collect { Promise p ->
+ if (p instanceof BoundPromise) {
+ return Observable.just(((BoundPromise) p).value) as Observable<T>
+ } else {
+ return ((RxPromise) p).toObservable() as Observable<T>
+ }
}
- else {
- return ((RxPromise)p).toObservable() as Observable<T>
- }
- }
).toList())
- .onComplete(callable)
+ .onComplete(callable)
}
@Override
<T> Promise<List<T>> onError(List<Promise<T>> promises, Closure<?> callable) {
new RxPromise(this, Observable.concat(
- promises.collect { ((RxPromise<T>)it).toObservable() }
+ promises.collect { ((RxPromise<T>) it).toObservable() }
).toList())
- .onError(callable) as Promise<List<T>>
+ .onError(callable) as Promise<List<T>>
}
}
diff --git a/grails-async/rxjava2/src/test/groovy/org/grails/async/factory/rxjava2/RxPromiseSpec.groovy b/grails-async/rxjava2/src/test/groovy/org/grails/async/factory/rxjava2/RxPromiseSpec.groovy
index 30b3c3bfd2..6d9f31f72c 100644
--- a/grails-async/rxjava2/src/test/groovy/org/grails/async/factory/rxjava2/RxPromiseSpec.groovy
+++ b/grails-async/rxjava2/src/test/groovy/org/grails/async/factory/rxjava2/RxPromiseSpec.groovy
@@ -167,4 +167,3 @@ class RxPromiseSpec extends Specification {
}
}
-
diff --git a/grails-async/rxjava3/build.gradle b/grails-async/rxjava3/build.gradle
index 3c62cff0dd..5c647a42b2 100644
--- a/grails-async/rxjava3/build.gradle
+++ b/grails-async/rxjava3/build.gradle
@@ -46,4 +46,5 @@ apply {
from rootProject.layout.projectDirectory.file('gradle/docs-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/publish-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/test-config.gradle')
+ from rootProject.layout.projectDirectory.file('gradle/style-enforcement-config.gradle')
}
\ No newline at end of file
diff --git a/grails-async/rxjava3/src/main/groovy/org/grails/async/factory/rxjava3/RxPromise.groovy b/grails-async/rxjava3/src/main/groovy/org/grails/async/factory/rxjava3/RxPromise.groovy
index 187da07410..f21cc7c4ae 100644
--- a/grails-async/rxjava3/src/main/groovy/org/grails/async/factory/rxjava3/RxPromise.groovy
+++ b/grails-async/rxjava3/src/main/groovy/org/grails/async/factory/rxjava3/RxPromise.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.async.factory.rxjava3
import grails.async.Promise
@@ -48,7 +47,7 @@ import java.util.concurrent.TimeoutException
@AutoFinal
@CompileStatic
@PackageScope
-class RxPromise<T> implements Promise<T> {
+class RxPromise<T> implements Promise<T> {
protected final Subject<T> subject
protected final RxPromiseFactory promiseFactory
@@ -58,9 +57,9 @@ class RxPromise<T> implements Promise<T> {
protected boolean finished = false
RxPromise(RxPromiseFactory promiseFactory, Closure callable, Scheduler scheduler) {
- this(promiseFactory, Single.create( { SingleEmitter<? super T> singleSubscriber ->
+ this(promiseFactory, Single.create({ SingleEmitter<? super T> singleSubscriber ->
try {
- singleSubscriber.onSuccess((T)runCallable(callable))
+ singleSubscriber.onSuccess((T) runCallable(callable))
} catch (Throwable t) {
singleSubscriber.onError(t)
}
@@ -84,6 +83,7 @@ class RxPromise<T> implements Promise<T> {
this.observable = observable
this.promiseFactory = promiseFactory
observable.subscribe(new Observer<T>() {
+
@Override
void onSubscribe(Disposable d) {
subscription = d
@@ -135,7 +135,7 @@ class RxPromise<T> implements Promise<T> {
@Override
boolean cancel(boolean mayInterruptIfRunning) {
- if(subscription != null) {
+ if (subscription != null) {
subscription.dispose()
return subscription.isDisposed()
}
@@ -144,10 +144,9 @@ class RxPromise<T> implements Promise<T> {
@Override
boolean isCancelled() {
- if(subscription == null) {
+ if (subscription == null) {
return false
- }
- else {
+ } else {
return subscription.isDisposed()
}
}
@@ -167,10 +166,9 @@ class RxPromise<T> implements Promise<T> {
try {
return subject.timeout(timeout, unit).blockingFirst()
} catch (Throwable e) {
- if(e.cause instanceof TimeoutException) {
+ if (e.cause instanceof TimeoutException) {
throw e.cause
- }
- else {
+ } else {
throw e
}
}
@@ -178,7 +176,7 @@ class RxPromise<T> implements Promise<T> {
static Object runCallable(Closure callable) {
Object rtn = callable.call()
- if(rtn == null) {
+ if (rtn == null) {
return Void
} else {
return rtn
diff --git a/grails-async/rxjava3/src/main/groovy/org/grails/async/factory/rxjava3/RxPromiseFactory.groovy b/grails-async/rxjava3/src/main/groovy/org/grails/async/factory/rxjava3/RxPromiseFactory.groovy
index f93dab1925..1512b46852 100644
--- a/grails-async/rxjava3/src/main/groovy/org/grails/async/factory/rxjava3/RxPromiseFactory.groovy
+++ b/grails-async/rxjava3/src/main/groovy/org/grails/async/factory/rxjava3/RxPromiseFactory.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.async.factory.rxjava3
import grails.async.Promise
@@ -50,10 +49,9 @@ class RxPromiseFactory extends AbstractPromiseFactory {
@Override
<T> Promise<T> createPromise(Closure<T>[] closures) {
- if(closures.length == 1) {
+ if (closures.length == 1) {
return new RxPromise<T>(this, closures[0], Schedulers.io())
- }
- else {
+ } else {
def promiseList = new PromiseList()
for (Closure closure : closures) {
promiseList.add(closure)
@@ -75,23 +73,22 @@ class RxPromiseFactory extends AbstractPromiseFactory {
@Override
<T> Promise<T> onComplete(List<Promise<T>> promises, Closure<T> callable) {
new RxPromise<T>(this, Observable.concat(
- promises.collect { Promise p ->
- if(p instanceof BoundPromise) {
- return Observable.just(((BoundPromise)p).value) as Observable<T>
+ promises.collect { Promise p ->
+ if (p instanceof BoundPromise) {
+ return Observable.just(((BoundPromise) p).value) as Observable<T>
+ } else {
+ return ((RxPromise) p).toObservable() as Observable<T>
+ }
}
- else {
- return ((RxPromise)p).toObservable() as Observable<T>
- }
- }
).toList())
- .onComplete(callable)
+ .onComplete(callable)
}
@Override
<T> Promise<List<T>> onError(List<Promise<T>> promises, Closure<?> callable) {
new RxPromise(this, Observable.concat(
- promises.collect { ((RxPromise<T>)it).toObservable() }
+ promises.collect { ((RxPromise<T>) it).toObservable() }
).toList())
- .onError(callable) as Promise<List<T>>
+ .onError(callable) as Promise<List<T>>
}
}
diff --git a/grails-async/rxjava3/src/test/groovy/org/grails/async/factory/rxjava3/RxPromiseSpec.groovy b/grails-async/rxjava3/src/test/groovy/org/grails/async/factory/rxjava3/RxPromiseSpec.groovy
index 77cfd92dfa..8e42cee870 100644
--- a/grails-async/rxjava3/src/test/groovy/org/grails/async/factory/rxjava3/RxPromiseSpec.groovy
+++ b/grails-async/rxjava3/src/test/groovy/org/grails/async/factory/rxjava3/RxPromiseSpec.groovy
@@ -164,4 +164,3 @@ class RxPromiseSpec extends Specification {
}
}
-
diff --git a/grails-bom/build.gradle b/grails-bom/build.gradle
index 7d23c61449..99c6261b33 100644
--- a/grails-bom/build.gradle
+++ b/grails-bom/build.gradle
@@ -200,4 +200,5 @@ ext {
apply {
from rootProject.layout.projectDirectory.file('gradle/publish-config.gradle')
+ from rootProject.layout.projectDirectory.file('gradle/style-enforcement-config.gradle')
}
diff --git a/grails-bootstrap/build.gradle b/grails-bootstrap/build.gradle
index b42df191c8..d8ac8a4b04 100644
--- a/grails-bootstrap/build.gradle
+++ b/grails-bootstrap/build.gradle
@@ -84,4 +84,5 @@ apply {
from rootProject.layout.projectDirectory.file('gradle/docs-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/publish-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/test-config.gradle')
+ from rootProject.layout.projectDirectory.file('gradle/style-enforcement-config.gradle')
}
\ No newline at end of file
diff --git a/grails-bootstrap/src/main/groovy/grails/build/logging/ConsoleLogger.java b/grails-bootstrap/src/main/groovy/grails/build/logging/ConsoleLogger.java
index b83f5b9540..1cb417e3aa 100644
--- a/grails-bootstrap/src/main/groovy/grails/build/logging/ConsoleLogger.java
+++ b/grails-bootstrap/src/main/groovy/grails/build/logging/ConsoleLogger.java
@@ -25,6 +25,7 @@ package grails.build.logging;
* @since 3.0
*/
public interface ConsoleLogger {
+
/**
* Indicates progress with the default progress indicator
*/
@@ -91,7 +92,7 @@ public interface ConsoleLogger {
/**
* Use to log an error
*
- * @param msg The message
+ * @param msg The message
* @param error The error
*/
void error(String msg, Throwable error);
@@ -99,7 +100,7 @@ public interface ConsoleLogger {
/**
* Log an error with a specific error label
*
- * @param label The label
+ * @param label The label
* @param message The message
*/
void error(String label, String message);
@@ -127,9 +128,9 @@ public interface ConsoleLogger {
/**
* Outputs a verbose message
+ *
* @param msg The message
*/
void verbose(String msg);
-
}
diff --git a/grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java b/grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java
index fe3de1607e..1aa0ebe5c8 100644
--- a/grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java
+++ b/grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java
@@ -40,12 +40,21 @@ import org.grails.build.interactive.CandidateListCompletionHandler;
import org.grails.build.logging.GrailsConsoleErrorPrintStream;
import org.grails.build.logging.GrailsConsolePrintStream;
-import java.io.*;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.Flushable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.util.Collection;
import java.util.List;
import java.util.Stack;
-import static org.fusesource.jansi.Ansi.Color.*;
+import static org.fusesource.jansi.Ansi.Color.DEFAULT;
+import static org.fusesource.jansi.Ansi.Color.RED;
+import static org.fusesource.jansi.Ansi.Color.YELLOW;
import static org.fusesource.jansi.Ansi.Erase.FORWARD;
import static org.fusesource.jansi.Ansi.ansi;
@@ -57,8 +66,6 @@ import static org.fusesource.jansi.Ansi.ansi;
*/
public class GrailsConsole implements ConsoleLogger {
- private static GrailsConsole instance;
-
public static final String ENABLE_TERMINAL = "grails.console.enable.terminal";
public static final String ENABLE_INTERACTIVE = "grails.console.enable.interactive";
public static final String LINE_SEPARATOR = System.getProperty("line.separator");
@@ -71,24 +78,8 @@ public class GrailsConsole implements ConsoleLogger {
public static final String STACKTRACE_FILTERED_MESSAGE = " (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)";
public static final String STACKTRACE_MESSAGE = " (Use --stacktrace to see the full trace)";
public static final Character SECURE_MASK_CHAR = Character.valueOf('*');
- private PrintStream originalSystemOut;
- private PrintStream originalSystemErr;
- private StringBuilder maxIndicatorString;
- private int cursorMove;
- private Thread shutdownHookThread;
- private Character defaultInputMask = null;
-
- /**
- * Whether to enable verbose mode
- */
- private boolean verbose = Boolean.getBoolean("grails.verbose");
-
- /**
- * Whether to show stack traces
- */
- private boolean stacktrace = Boolean.getBoolean("grails.show.stacktrace");
- private boolean progressIndicatorActive = false;
+ private static GrailsConsole instance;
/**
* The progress indicator to use
@@ -119,11 +110,32 @@ public class GrailsConsole implements ConsoleLogger {
Stack<String> category = new Stack<String>() {
@Override
public String toString() {
- if (size() == 1) return peek() + CATEGORY_SEPARATOR;
- return DefaultGroovyMethods.join((Iterable) this, CATEGORY_SEPARATOR) + CATEGORY_SEPARATOR;
+ if (size() == 1) {
+ return peek() + CATEGORY_SEPARATOR;
+ }
+ return DefaultGroovyMethods.join(this, CATEGORY_SEPARATOR) + CATEGORY_SEPARATOR;
}
};
+ private PrintStream originalSystemOut;
+ private PrintStream originalSystemErr;
+ private StringBuilder maxIndicatorString;
+ private int cursorMove;
+ private Thread shutdownHookThread;
+ private Character defaultInputMask = null;
+
+ /**
+ * Whether to enable verbose mode
+ */
+ private boolean verbose = Boolean.getBoolean("grails.verbose");
+
+ /**
+ * Whether to show stack traces
+ */
+ private boolean stacktrace = Boolean.getBoolean("grails.show.stacktrace");
+
+ private boolean progressIndicatorActive = false;
+
/**
* Whether ANSI should be enabled for output
*/
@@ -134,6 +146,23 @@ public class GrailsConsole implements ConsoleLogger {
*/
private boolean userInputActive;
+ /**
+ * Logs a message below the current status message
+ *
+ * @param msg The message to log
+ */
+ private boolean appendCalled = false;
+
+ protected GrailsConsole() throws IOException {
+ cursorMove = 1;
+
+ initialize(System.in, System.out, System.err);
+
+ // bit of a WTF this, but see no other way to allow a customization indicator
+ maxIndicatorString = new StringBuilder(indicator).append(indicator).append(indicator).append(indicator).append(indicator);
+
+ }
+
public void addShutdownHook() {
if (!Environment.isFork()) {
shutdownHookThread = new Thread(new Runnable() {
@@ -152,17 +181,6 @@ public class GrailsConsole implements ConsoleLogger {
}
}
-
- protected GrailsConsole() throws IOException {
- cursorMove = 1;
-
- initialize(System.in, System.out, System.err);
-
- // bit of a WTF this, but see no other way to allow a customization indicator
- maxIndicatorString = new StringBuilder(indicator).append(indicator).append(indicator).append(indicator).append(indicator);
-
- }
-
/**
* Use in testing when System.out, System.err or System.in change
*
@@ -571,7 +589,9 @@ public class GrailsConsole implements ConsoleLogger {
private void outputMessage(String msg, int replaceCount) {
verifySystemOut();
- if (msg == null || msg.trim().length() == 0) return;
+ if (msg == null || msg.trim().length() == 0) {
+ return;
+ }
try {
if (isAnsiEnabled()) {
if (replaceCount > 0) {
@@ -584,7 +604,9 @@ public class GrailsConsole implements ConsoleLogger {
cursorMove = replaceCount;
}
} else {
- if (lastMessage != null && lastMessage.equals(msg)) return;
+ if (lastMessage != null && lastMessage.equals(msg)) {
+ return;
+ }
if (progressIndicatorActive) {
out.println();
@@ -745,13 +767,6 @@ public class GrailsConsole implements ConsoleLogger {
.eraseLine(Ansi.Erase.BACKWARD).cursorLeft(PROMPT.length()));
}
- /**
- * Logs a message below the current status message
- *
- * @param msg The message to log
- */
- private boolean appendCalled = false;
-
public void append(String msg) {
verifySystemOut();
PrintStream printStream = out;
@@ -956,7 +971,9 @@ public class GrailsConsole implements ConsoleLogger {
private Ansi erasePreviousLine(String categoryName) {
int cursorMove = this.cursorMove;
- if (userInputActive) cursorMove++;
+ if (userInputActive) {
+ cursorMove++;
+ }
if (cursorMove > 0) {
int moveLeftLength = categoryName.length() + lastMessage.length();
if (userInputActive) {
diff --git a/grails-bootstrap/src/main/groovy/grails/build/logging/GrailsEclipseConsole.java b/grails-bootstrap/src/main/groovy/grails/build/logging/GrailsEclipseConsole.java
index 72153378ae..9bcddd72e8 100644
--- a/grails-bootstrap/src/main/groovy/grails/build/logging/GrailsEclipseConsole.java
+++ b/grails-bootstrap/src/main/groovy/grails/build/logging/GrailsEclipseConsole.java
@@ -36,7 +36,6 @@ import java.io.IOException;
* anticipated needs.
*
* @author Kris De Volder
- *
* @since 2.0.0.M2
*/
public class GrailsEclipseConsole extends GrailsConsole {
@@ -65,7 +64,7 @@ public class GrailsEclipseConsole extends GrailsConsole {
private static Boolean boolProp(String propName) {
try {
- String prop = System.getProperty(propName);
+ String prop = System.getProperty(propName);
return prop != null && Boolean.valueOf(prop);
} catch (Exception e) {
return false;
diff --git a/grails-bootstrap/src/main/groovy/grails/build/proxy/SystemPropertiesAuthenticator.groovy b/grails-bootstrap/src/main/groovy/grails/build/proxy/SystemPropertiesAuthenticator.groovy
index 9fac0165c1..d005afe410 100644
--- a/grails-bootstrap/src/main/groovy/grails/build/proxy/SystemPropertiesAuthenticator.groovy
+++ b/grails-bootstrap/src/main/groovy/grails/build/proxy/SystemPropertiesAuthenticator.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package grails.build.proxy
import grails.util.BuildSettings
@@ -33,7 +32,7 @@ class SystemPropertiesAuthenticator extends Authenticator {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
- if(getRequestorType() == RequestorType.PROXY) {
+ if (getRequestorType() == RequestorType.PROXY) {
return new PasswordAuthentication(
System.getProperty(BuildSettings.PROXY_HTTP_USER, ""),
System.getProperty(BuildSettings.PROXY_HTTP_PASSWORD, "").toCharArray());
diff --git a/grails-bootstrap/src/main/groovy/grails/build/support/MetaClassRegistryCleaner.java b/grails-bootstrap/src/main/groovy/grails/build/support/MetaClassRegistryCleaner.java
index bedb635726..91923f5f76 100644
--- a/grails-bootstrap/src/main/groovy/grails/build/support/MetaClassRegistryCleaner.java
+++ b/grails-bootstrap/src/main/groovy/grails/build/support/MetaClassRegistryCleaner.java
@@ -18,11 +18,20 @@
*/
package grails.build.support;
-import groovy.lang.*;
+import groovy.lang.ExpandoMetaClass;
+import groovy.lang.GroovySystem;
+import groovy.lang.MetaClass;
+import groovy.lang.MetaClassRegistry;
+import groovy.lang.MetaClassRegistryChangeEvent;
+import groovy.lang.MetaClassRegistryChangeEventListener;
import org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl;
import java.lang.ref.WeakReference;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
/**
@@ -32,13 +41,13 @@ import java.util.concurrent.ConcurrentHashMap;
* @since 2.0
*/
@SuppressWarnings("rawtypes")
-public class MetaClassRegistryCleaner implements MetaClassRegistryChangeEventListener {
+public final class MetaClassRegistryCleaner implements MetaClassRegistryChangeEventListener {
- private Map<Class, Object> alteredClasses = new ConcurrentHashMap<Class, Object> ();
- private Map<IdentityWeakReference, Object> alteredInstances = new ConcurrentHashMap<IdentityWeakReference, Object>();
private static final Object NO_CUSTOM_METACLASS = new Object();
- private static boolean cleaning;
private static final MetaClassRegistryCleaner INSTANCE = new MetaClassRegistryCleaner();
+ private static boolean cleaning;
+ private Map<Class, Object> alteredClasses = new ConcurrentHashMap<Class, Object>();
+ private Map<IdentityWeakReference, Object> alteredInstances = new ConcurrentHashMap<IdentityWeakReference, Object>();
private MetaClassRegistryCleaner() {
}
@@ -50,7 +59,8 @@ public class MetaClassRegistryCleaner implements MetaClassRegistryChangeEventLis
boolean registered = false;
for (MetaClassRegistryChangeEventListener listener : listeners) {
if (listener == INSTANCE) {
- registered = true;break;
+ registered = true;
+ break;
}
}
if (!registered) {
@@ -96,11 +106,10 @@ public class MetaClassRegistryCleaner implements MetaClassRegistryChangeEventLis
private void updateMetaClassOfClass(MetaClass oldMetaClass, Class classToUpdate) {
if (oldMetaClass != null && !(oldMetaClass.getClass().getName().equals("groovy.mock.interceptor.MockProxyMetaClass"))) {
Object current = alteredClasses.get(classToUpdate);
- if (current == null ) {
+ if (current == null) {
alteredClasses.put(classToUpdate, oldMetaClass);
}
- }
- else {
+ } else {
alteredClasses.put(classToUpdate, NO_CUSTOM_METACLASS);
}
}
@@ -137,8 +146,7 @@ public class MetaClassRegistryCleaner implements MetaClassRegistryChangeEventLis
Object alteredMetaClass = alteredClasses.get(aClass);
if (alteredMetaClass == NO_CUSTOM_METACLASS) {
registry.removeMetaClass(aClass);
- }
- else {
+ } else {
registry.setMetaClass(aClass, (MetaClass) alteredMetaClass);
}
}
@@ -164,7 +172,7 @@ public class MetaClassRegistryCleaner implements MetaClassRegistryChangeEventLis
if (this == obj) {
return true;
}
- return get() == ((IdentityWeakReference)obj).get();
+ return get() == ((IdentityWeakReference) obj).get();
}
}
}
diff --git a/grails-bootstrap/src/main/groovy/grails/codegen/model/Model.groovy b/grails-bootstrap/src/main/groovy/grails/codegen/model/Model.groovy
index 7f68ac8a88..cea898d179 100644
--- a/grails-bootstrap/src/main/groovy/grails/codegen/model/Model.groovy
+++ b/grails-bootstrap/src/main/groovy/grails/codegen/model/Model.groovy
@@ -58,7 +58,6 @@ interface Model {
*/
String getPropertyName()
-
/**
* A property name version of the class name. For example 'FooBar' becomes 'fooBar'
*
diff --git a/grails-bootstrap/src/main/groovy/grails/codegen/model/ModelBuilder.groovy b/grails-bootstrap/src/main/groovy/grails/codegen/model/ModelBuilder.groovy
index 31c023aac2..6d941c9596 100644
--- a/grails-bootstrap/src/main/groovy/grails/codegen/model/ModelBuilder.groovy
+++ b/grails-bootstrap/src/main/groovy/grails/codegen/model/ModelBuilder.groovy
@@ -52,10 +52,9 @@ trait ModelBuilder {
* @return The {@link Model} instance
*/
Model model(String className) {
- if(defaultPackage && !className.contains('.')) {
+ if (defaultPackage && !className.contains('.')) {
return new ModelImpl("${defaultPackage}.$className")
- }
- else {
+ } else {
return new ModelImpl(className)
}
}
@@ -83,6 +82,7 @@ trait ModelBuilder {
@CompileStatic
private static class ModelImpl implements Model {
+
final String className
final String fullName
final String propertyName
@@ -114,13 +114,13 @@ trait ModelBuilder {
@Override
Map<String, Object> asMap() {
- [className: className,
- fullName: fullName,
+ [className : className,
+ fullName : fullName,
propertyName: propertyName,
- modelName: propertyName,
+ modelName : propertyName,
packageName: packageName,
packagePath: packagePath,
- simpleName: simpleName,
+ simpleName : simpleName,
lowerCaseName: lowerCaseName] as Map<String, Object>
}
}
diff --git a/grails-bootstrap/src/main/groovy/grails/io/ResourceUtils.groovy b/grails-bootstrap/src/main/groovy/grails/io/ResourceUtils.groovy
index b8e7dcd398..202ef56c5f 100644
--- a/grails-bootstrap/src/main/groovy/grails/io/ResourceUtils.groovy
+++ b/grails-bootstrap/src/main/groovy/grails/io/ResourceUtils.groovy
@@ -23,7 +23,6 @@ import groovy.transform.CompileStatic
import groovy.transform.Memoized
import org.grails.io.support.GrailsResourceUtils
-
/**
* Utility methods for interacting with resources
*
@@ -52,7 +51,7 @@ class ResourceUtils extends GrailsResourceUtils {
def dirName = dir.name
if (!dir.hidden && !dirName.startsWith('.') && !['conf', 'i18n', 'assets', 'views', 'migrations'].contains(dirName)) {
File[] files = dir.listFiles()
- populatePackages(dir,files, packageNames, "")
+ populatePackages(dir, files, packageNames, "")
}
}
}
@@ -62,28 +61,26 @@ class ResourceUtils extends GrailsResourceUtils {
protected static populatePackages(File rootDir, File[] files, Collection<String> packageNames, String prefix) {
- if(files != null) {
- for(dir in files ) {
- if(dir.isDirectory()) {
+ if (files != null) {
+ for (dir in files) {
+ if (dir.isDirectory()) {
String dirName = dir.name
if (!dir.hidden && !dirName.startsWith('.')) {
def dirFiles = dir.listFiles()
- if(dirFiles != null) {
+ if (dirFiles != null) {
boolean hasGroovySources = dirFiles?.find() { File f -> f.name.endsWith('.groovy') }
- if(hasGroovySources) {
+ if (hasGroovySources) {
// if there are Groovy sources stop here, no need to add child packages
packageNames.add "${prefix}${dirName}".toString()
- }
- else {
+ } else {
// otherwise recurse into a child package
populatePackages(dir, dirFiles, packageNames, "${prefix}${dirName}.")
}
}
}
- }
- else {
- if(dir.name.endsWith('.groovy') && prefix == "") {
+ } else {
+ if (dir.name.endsWith('.groovy') && prefix == "") {
packageNames.add("")
}
}
diff --git a/grails-bootstrap/src/main/groovy/grails/io/support/SystemOutErrCapturer.groovy b/grails-bootstrap/src/main/groovy/grails/io/support/SystemOutErrCapturer.groovy
index 4cec2bb564..af3da1a91c 100644
--- a/grails-bootstrap/src/main/groovy/grails/io/support/SystemOutErrCapturer.groovy
+++ b/grails-bootstrap/src/main/groovy/grails/io/support/SystemOutErrCapturer.groovy
@@ -25,17 +25,18 @@ import groovy.transform.CompileStatic
*/
@CompileStatic
class SystemOutErrCapturer {
+
ByteArrayOutputStream out
ByteArrayOutputStream err
SystemStreamsRedirector previousState
-
+
SystemOutErrCapturer capture() {
out = new ByteArrayOutputStream()
err = new ByteArrayOutputStream()
previousState = SystemStreamsRedirector.create(null, new PrintStream(out, true), new PrintStream(err, true)).redirect()
this
}
-
+
SystemOutErrCapturer redirectToNull() {
out = null
err = null
@@ -43,14 +44,14 @@ class SystemOutErrCapturer {
previousState = SystemStreamsRedirector.create(null, new PrintStream(nullStream, true), new PrintStream(nullStream, true)).redirect()
this
}
-
+
void close() {
- if(previousState != null) {
+ if (previousState != null) {
previousState.redirect()
previousState = null
}
}
-
+
public static <T> T withCapturedOutput(Closure<T> closure) {
SystemOutErrCapturer capturer = new SystemOutErrCapturer().capture()
try {
@@ -59,7 +60,7 @@ class SystemOutErrCapturer {
capturer.close()
}
}
-
+
public static <T> T withNullOutput(Closure<T> closure) {
SystemOutErrCapturer capturer = new SystemOutErrCapturer().redirectToNull()
try {
@@ -68,22 +69,23 @@ class SystemOutErrCapturer {
capturer.close()
}
}
-
+
@CompileStatic
public static class NullOutputStream extends OutputStream {
+
@Override
public void write(byte[] b) throws IOException {
-
- }
-
+
+ }
+
@Override
public void write(int b) throws IOException {
-
+
}
-
+
@Override
public void write(byte[] b, int off, int len) throws IOException {
-
+
}
}
}
diff --git a/grails-bootstrap/src/main/groovy/grails/io/support/SystemStreamsRedirector.groovy b/grails-bootstrap/src/main/groovy/grails/io/support/SystemStreamsRedirector.groovy
index 6bdbd8b7a3..322b90af15 100644
--- a/grails-bootstrap/src/main/groovy/grails/io/support/SystemStreamsRedirector.groovy
+++ b/grails-bootstrap/src/main/groovy/grails/io/support/SystemStreamsRedirector.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package grails.io.support
import groovy.transform.CompileStatic
@@ -25,33 +24,34 @@ import groovy.transform.ToString
@ToString
@CompileStatic
class SystemStreamsRedirector {
+
private static final SystemStreamsRedirector original = current()
final InputStream input
final PrintStream out
final PrintStream err
-
+
private SystemStreamsRedirector(InputStream input, PrintStream out, PrintStream err) {
this.input = input
this.out = out
this.err = err
}
-
+
static SystemStreamsRedirector create(InputStream input, PrintStream out, PrintStream err) {
new SystemStreamsRedirector(input, out, err)
}
-
+
static SystemStreamsRedirector current() {
create(System.in, System.out, System.err)
}
-
+
static SystemStreamsRedirector original() {
original
}
-
+
static <T> T withOriginalIO(Closure<T> closure) {
original().withRedirectedIO(closure)
}
-
+
public <T> T withRedirectedIO(Closure<T> closure) {
SystemStreamsRedirector previous = redirect()
try {
@@ -60,27 +60,26 @@ class SystemStreamsRedirector {
previous.redirect()
}
}
-
-
+
SystemStreamsRedirector redirect() {
InputStream prevInput = null
PrintStream prevOut = null
PrintStream prevErr = null
- if(input != null) {
+ if (input != null) {
prevInput = System.in
- if(!(prevInput.is(input))) {
+ if (!(prevInput.is(input))) {
System.setIn(input)
}
}
- if(out != null) {
+ if (out != null) {
prevOut = System.out
- if(!(prevOut.is(out))) {
+ if (!(prevOut.is(out))) {
System.setOut(out)
}
}
- if(err != null) {
+ if (err != null) {
prevErr = System.err
- if(!(prevErr.is(err))) {
+ if (!(prevErr.is(err))) {
System.setErr(err)
}
}
diff --git a/grails-bootstrap/src/main/groovy/grails/plugins/GrailsPluginInfo.java b/grails-bootstrap/src/main/groovy/grails/plugins/GrailsPluginInfo.java
index 40b87beb3e..2e7967c3cc 100644
--- a/grails-bootstrap/src/main/groovy/grails/plugins/GrailsPluginInfo.java
+++ b/grails-bootstrap/src/main/groovy/grails/plugins/GrailsPluginInfo.java
@@ -18,12 +18,13 @@
*/
package grails.plugins;
-import java.util.Map;
-
import org.grails.io.support.Resource;
+import java.util.Map;
+
/**
* Base interface that just contains information about a particular plugin.
+ *
* @author Graeme Rocher
* @since 1.3
*/
@@ -61,6 +62,7 @@ public interface GrailsPluginInfo {
/**
* Returns the location of the Resource that represents the plugin descriptor (the *GrailsPlugin.groovy file)
+ *
* @return The resource
*/
Resource getDescriptor();
@@ -72,6 +74,7 @@ public interface GrailsPluginInfo {
/**
* Gets the properties of the plugin as a map
+ *
* @return A map of the properties
*/
@SuppressWarnings("rawtypes")
diff --git a/grails-bootstrap/src/main/groovy/grails/plugins/GrailsVersionUtils.groovy b/grails-bootstrap/src/main/groovy/grails/plugins/GrailsVersionUtils.groovy
index f09d6616f8..3538ed87f5 100644
--- a/grails-bootstrap/src/main/groovy/grails/plugins/GrailsVersionUtils.groovy
+++ b/grails-bootstrap/src/main/groovy/grails/plugins/GrailsVersionUtils.groovy
@@ -18,8 +18,8 @@
*/
package grails.plugins
-import groovy.transform.CompileStatic
import grails.plugins.metadata.GrailsPlugin
+import groovy.transform.CompileStatic
@CompileStatic
class GrailsVersionUtils {
@@ -53,7 +53,7 @@ class GrailsVersionUtils {
def vc = new VersionComparator()
pluginVersion = trimTag(pluginVersion)
- if (requiredVersion.indexOf('>') >- 1) {
+ if (requiredVersion.indexOf('>') > -1) {
def tokens = requiredVersion.split(">")*.trim()
tokens = tokens.stream().collect({ String it -> trimTag(it) })
tokens << pluginVersion
@@ -62,8 +62,7 @@ class GrailsVersionUtils {
if (tokens[1] == pluginVersion) {
return true
}
- }
- else if (pluginVersion.equals(trimTag(requiredVersion))) {
+ } else if (pluginVersion.equals(trimTag(requiredVersion))) {
return true
}
@@ -112,13 +111,12 @@ class GrailsVersionUtils {
private static String trimTag(String pluginVersion) {
def i = pluginVersion.indexOf('-')
- if (i >- 1) {
- pluginVersion = pluginVersion[0..i-1]
+ if (i > -1) {
+ pluginVersion = pluginVersion[0..i - 1]
}
def tokens = pluginVersion.split(/\./)
- return tokens.findAll { String it -> it ==~ /\d+/ || it =='*'}.join(".")
+ return tokens.findAll { String it -> it ==~ /\d+/ || it == '*' }.join(".")
}
}
-
diff --git a/grails-bootstrap/src/main/groovy/grails/plugins/VersionComparator.groovy b/grails-bootstrap/src/main/groovy/grails/plugins/VersionComparator.groovy
index fcec1cc82a..2f2886a621 100644
--- a/grails-bootstrap/src/main/groovy/grails/plugins/VersionComparator.groovy
+++ b/grails-bootstrap/src/main/groovy/grails/plugins/VersionComparator.groovy
@@ -32,11 +32,9 @@ class VersionComparator implements Comparator<String> {
int result = 0
if (o1 == '*') {
result = 1
- }
- else if (o2 == '*') {
+ } else if (o2 == '*') {
result = -1
- }
- else {
+ } else {
def nums1
try {
def tokens = deSnapshot(o1).split(/\./)
@@ -63,12 +61,11 @@ class VersionComparator implements Comparator<String> {
if (result != 0) {
break
}
- if (i == (nums1.size()-1) && bigRight) {
- if (nums2[i+1] != 0)
+ if (i == (nums1.size() - 1) && bigRight) {
+ if (nums2[i + 1] != 0)
result = -1; break
}
- }
- else if (bigLeft) {
+ } else if (bigLeft) {
if (nums1[i] != 0)
result = 1; break
}
diff --git a/grails-bootstrap/src/main/groovy/grails/plugins/metadata/GrailsPlugin.java b/grails-bootstrap/src/main/groovy/grails/plugins/metadata/GrailsPlugin.java
index c5b0258c0e..fec5205f3d 100644
--- a/grails-bootstrap/src/main/groovy/grails/plugins/metadata/GrailsPlugin.java
+++ b/grails-bootstrap/src/main/groovy/grails/plugins/metadata/GrailsPlugin.java
@@ -18,10 +18,10 @@
*/
package grails.plugins.metadata;
+import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
/**
* Annotation that appears on classes of a particular plugin.
@@ -32,6 +32,8 @@ import java.lang.annotation.ElementType;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
public @interface GrailsPlugin {
+
String name();
+
String version();
}
diff --git a/grails-bootstrap/src/main/groovy/grails/plugins/metadata/PluginSource.java b/grails-bootstrap/src/main/groovy/grails/plugins/metadata/PluginSource.java
index 202ed16d84..5e0a5e0691 100644
--- a/grails-bootstrap/src/main/groovy/grails/plugins/metadata/PluginSource.java
+++ b/grails-bootstrap/src/main/groovy/grails/plugins/metadata/PluginSource.java
@@ -32,4 +32,5 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.SOURCE)
@Target({ElementType.TYPE})
public @interface PluginSource {
+
}
diff --git a/grails-bootstrap/src/main/groovy/grails/util/CosineSimilarity.groovy b/grails-bootstrap/src/main/groovy/grails/util/CosineSimilarity.groovy
index 96721ebf5b..1152796795 100644
--- a/grails-bootstrap/src/main/groovy/grails/util/CosineSimilarity.groovy
+++ b/grails-bootstrap/src/main/groovy/grails/util/CosineSimilarity.groovy
@@ -20,7 +20,6 @@ package grails.util
/**
* Uses cosine similarity to find matches from a candidate set for a specified input.
- * Based on code from http://www.nearinfinity.com/blogs/seth_schroeder/groovy_cosine_similarity_in_grails.html
*
* @author Burt Beckwith
*/
@@ -28,9 +27,9 @@ class CosineSimilarity {
/**
* Sort the candidates by their similarity to the specified input.
- * @param pattern the input string
- * @param candidates the possible matches
- * @return the ordered candidates
+ * @param pattern the input string
+ * @param candidates the possible matches
+ * @return the ordered candidates
*/
static List<String> mostSimilar(String pattern, candidates, double threshold = 0) {
SortedMap<Double, String> sorted = new TreeMap<Double, String>()
diff --git a/grails-bootstrap/src/main/groovy/grails/util/Described.groovy b/grails-bootstrap/src/main/groovy/grails/util/Described.groovy
index d7febf70d2..a0311669fe 100644
--- a/grails-bootstrap/src/main/groovy/grails/util/Described.groovy
+++ b/grails-bootstrap/src/main/groovy/grails/util/Described.groovy
@@ -16,10 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package grails.util
-
/**
* Interface for classes that are described
*
diff --git a/grails-bootstrap/src/main/groovy/org/grails/build/interactive/CandidateListCompletionHandler.java b/grails-bootstrap/src/main/groovy/org/grails/build/interactive/CandidateListCompletionHandler.java
index e09740b679..831fcad2bf 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/build/interactive/CandidateListCompletionHandler.java
+++ b/grails-bootstrap/src/main/groovy/org/grails/build/interactive/CandidateListCompletionHandler.java
@@ -18,7 +18,6 @@
*/
package org.grails.build.interactive;
-
import jline.console.ConsoleReader;
import jline.console.CursorBuffer;
import jline.console.completer.CompletionHandler;
@@ -82,7 +81,7 @@ public class CandidateListCompletionHandler implements CompletionHandler {
* <i>foobar</i>, <i>foobaz</i>, <i>foobuz</i>, the
* method will return <i>foob</i>.
*/
- private final String getUnambiguousCompletions(final List<?> candidates) {
+ private String getUnambiguousCompletions(final List<?> candidates) {
if (candidates == null || candidates.isEmpty()) {
return null;
}
@@ -106,9 +105,9 @@ public class CandidateListCompletionHandler implements CompletionHandler {
/**
* @return true is all the elements of <i>candidates</i>
- * start with <i>starts</i>
+ * start with <i>starts</i>
*/
- private final boolean startsWith(final String starts, final String[] candidates) {
+ private boolean startsWith(final String starts, final String[] candidates) {
for (int i = 0; i < candidates.length; i++) {
if (!candidates[i].startsWith(starts)) {
return false;
diff --git a/grails-bootstrap/src/main/groovy/org/grails/build/logging/GrailsConsoleAntBuilder.java b/grails-bootstrap/src/main/groovy/org/grails/build/logging/GrailsConsoleAntBuilder.java
index 63d4f70c3b..681281c1fd 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/build/logging/GrailsConsoleAntBuilder.java
+++ b/grails-bootstrap/src/main/groovy/org/grails/build/logging/GrailsConsoleAntBuilder.java
@@ -20,7 +20,12 @@ package org.grails.build.logging;
import grails.build.logging.GrailsConsole;
import groovy.ant.AntBuilder;
-import org.apache.tools.ant.*;
+import org.apache.tools.ant.BuildEvent;
+import org.apache.tools.ant.BuildLogger;
+import org.apache.tools.ant.DefaultLogger;
+import org.apache.tools.ant.MagicNames;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectHelper;
import org.apache.tools.ant.types.LogLevel;
import org.apache.tools.ant.util.StringUtils;
@@ -73,13 +78,14 @@ public class GrailsConsoleAntBuilder extends AntBuilder {
if (!instance.isVerbose()) {
for (Object buildListener : project.getBuildListeners()) {
if (buildListener instanceof BuildLogger) {
- ((BuildLogger)buildListener).setMessageOutputLevel(LogLevel.ERR.getLevel());
+ ((BuildLogger) buildListener).setMessageOutputLevel(LogLevel.ERR.getLevel());
}
}
}
}
private static class GrailsConsoleLogger extends DefaultLogger {
+
/**
* Name of the current target, if it should
* be displayed on the next message. This is
diff --git a/grails-bootstrap/src/main/groovy/org/grails/build/logging/GrailsConsoleBuildListener.java b/grails-bootstrap/src/main/groovy/org/grails/build/logging/GrailsConsoleBuildListener.java
index f507539101..4a2d2fd5a2 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/build/logging/GrailsConsoleBuildListener.java
+++ b/grails-bootstrap/src/main/groovy/org/grails/build/logging/GrailsConsoleBuildListener.java
@@ -53,8 +53,7 @@ public class GrailsConsoleBuildListener implements BuildListener {
* will still be fired if an error occurred during the build.</p>
*
* @param finish An event with any relevant extra information.
- * Must not be <code>null</code>.
- *
+ * Must not be <code>null</code>.
* @see BuildEvent#getException()
*/
public final void buildFinished(final BuildEvent finish) {
@@ -66,7 +65,6 @@ public class GrailsConsoleBuildListener implements BuildListener {
*
* @param start An event with any relevant extra information.
* Must not be <code>null</code>.
- *
* @see BuildEvent#getTarget()
*/
public final void targetStarted(final BuildEvent start) {
@@ -78,8 +76,7 @@ public class GrailsConsoleBuildListener implements BuildListener {
* still be fired if an error occurred during the build.</p>
*
* @param finish An event with any relevant extra information.
- * Must not be <code>null</code>.
- *
+ * Must not be <code>null</code>.
* @see BuildEvent#getException()
*/
public final void targetFinished(final BuildEvent finish) {
@@ -91,7 +88,6 @@ public class GrailsConsoleBuildListener implements BuildListener {
*
* @param start An event with any relevant extra information.
* Must not be <code>null</code>.
- *
* @see BuildEvent#getTask()
*/
public final void taskStarted(final BuildEvent start) {
@@ -103,18 +99,18 @@ public class GrailsConsoleBuildListener implements BuildListener {
* be fired if an error occurred during the build.</p>
*
* @param finish An event with any relevant extra information.
- * Must not be <code>null</code>.
- *
+ * Must not be <code>null</code>.
* @see BuildEvent#getException()
*/
public final void taskFinished(final BuildEvent finish) {
ui.indicateProgress();
}
- /** <p>When a message is sent to this logger, Ant calls this method.</p>
+ /**
+ * <p>When a message is sent to this logger, Ant calls this method.</p>
+ *
* @param event An event with any relevant extra information.
* Must not be <code>null</code>.
- *
* @see BuildEvent#getMessage()
* @see BuildEvent#getPriority()
*/
diff --git a/grails-bootstrap/src/main/groovy/org/grails/build/logging/GrailsConsoleErrorPrintStream.java b/grails-bootstrap/src/main/groovy/org/grails/build/logging/GrailsConsoleErrorPrintStream.java
index 20400d3986..377aa39631 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/build/logging/GrailsConsoleErrorPrintStream.java
+++ b/grails-bootstrap/src/main/groovy/org/grails/build/logging/GrailsConsoleErrorPrintStream.java
@@ -35,7 +35,7 @@ public class GrailsConsoleErrorPrintStream extends PrintStream {
}
public PrintStream getTargetOut() {
- return (PrintStream)out;
+ return (PrintStream) out;
}
@Override
diff --git a/grails-bootstrap/src/main/groovy/org/grails/build/logging/GrailsConsolePrintStream.java b/grails-bootstrap/src/main/groovy/org/grails/build/logging/GrailsConsolePrintStream.java
index 69ab0972af..e7c10e57ce 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/build/logging/GrailsConsolePrintStream.java
+++ b/grails-bootstrap/src/main/groovy/org/grails/build/logging/GrailsConsolePrintStream.java
@@ -35,7 +35,7 @@ public class GrailsConsolePrintStream extends PrintStream {
}
public PrintStream getTargetOut() {
- return (PrintStream)out;
+ return (PrintStream) out;
}
@Override
diff --git a/grails-bootstrap/src/main/groovy/org/grails/build/parsing/ScriptNameResolver.groovy b/grails-bootstrap/src/main/groovy/org/grails/build/parsing/ScriptNameResolver.groovy
index 872e3452c2..f055dad705 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/build/parsing/ScriptNameResolver.groovy
+++ b/grails-bootstrap/src/main/groovy/org/grails/build/parsing/ScriptNameResolver.groovy
@@ -33,7 +33,7 @@ class ScriptNameResolver {
* The following scriptNames match FooBar: FB, FoB, FBa
*/
static boolean resolvesTo(String scriptName, String scriptFileName) {
- def scriptFileNameTokens = GrailsNameUtils.getNameFromScript( scriptFileName ).findAll(/[A-Z][a-z]+/)
+ def scriptFileNameTokens = GrailsNameUtils.getNameFromScript(scriptFileName).findAll(/[A-Z][a-z]+/)
def scriptNameTokens = GrailsNameUtils.getNameFromScript(scriptName).findAll(/[A-Z][a-z]*/)
if (scriptFileNameTokens.size() != scriptNameTokens.size()) return false
diff --git a/grails-bootstrap/src/main/groovy/org/grails/config/CodeGenConfig.groovy b/grails-bootstrap/src/main/groovy/org/grails/config/CodeGenConfig.groovy
index 232717bf77..5de2bbbfc2 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/config/CodeGenConfig.groovy
+++ b/grails-bootstrap/src/main/groovy/org/grails/config/CodeGenConfig.groovy
@@ -40,6 +40,7 @@ import org.yaml.snakeyaml.constructor.SafeConstructor
@CompileStatic
@Canonical
class CodeGenConfig implements Cloneable, ConfigMap {
+
final NavigableMap configMap
GroovyClassLoader groovyClassLoader = new GroovyClassLoader(CodeGenConfig.getClassLoader())
@@ -125,7 +126,7 @@ class CodeGenConfig implements Cloneable, ConfigMap {
@Override
def <T> T getRequiredProperty(String key, Class<T> targetType) throws IllegalStateException {
def value = getProperty(key, targetType)
- if(value == null) {
+ if (value == null) {
throw new IllegalStateException("Property [$key] not found")
}
return value
@@ -138,15 +139,15 @@ class CodeGenConfig implements Cloneable, ConfigMap {
def envName = Environment.current.name
def environmentSpecific = getProperty("environments.${envName}", Map.class)
- if(environmentSpecific != null) {
- if(!environmentSpecific.isEmpty()) {
+ if (environmentSpecific != null) {
+ if (!environmentSpecific.isEmpty()) {
mergeMap(environmentSpecific, false)
}
}
}
void loadGroovy(File groovyConfig) {
- if(groovyConfig.exists()) {
+ if (groovyConfig.exists()) {
def envName = Environment.current.name
def configSlurper = new ConfigSlurper(envName)
configSlurper.classLoader = groovyClassLoader
@@ -155,68 +156,68 @@ class CodeGenConfig implements Cloneable, ConfigMap {
}
}
- @CompileDynamic // fails with CompileStatic!
+ @CompileDynamic
+ // fails with CompileStatic!
void loadYml(InputStream input) {
Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions()))
- for(Object yamlObject : yaml.loadAll(input)) {
- if(yamlObject instanceof Map) { // problem here with CompileStatic
- mergeMap((Map)yamlObject)
+ for (Object yamlObject : yaml.loadAll(input)) {
+ if (yamlObject instanceof Map) { // problem here with CompileStatic
+ mergeMap((Map) yamlObject)
}
}
}
-
- void mergeMap(Map sourceMap, boolean parseFlatKeys =false) {
+
+ void mergeMap(Map sourceMap, boolean parseFlatKeys = false) {
configMap.merge(sourceMap, parseFlatKeys)
}
-
+
public <T> T navigate(Class<T> requiredType, String... path) {
Object result = configMap.navigate(path)
- if(result == null) {
+ if (result == null) {
return null
}
return convertToType(result, requiredType)
}
-
+
protected <T> T convertToType(Object value, Class<T> requiredType) {
- if(value == null || value instanceof NavigableMap.NullSafeNavigator) {
+ if (value == null || value instanceof NavigableMap.NullSafeNavigator) {
return null
+ } else if (requiredType.isInstance(value)) {
+ return (T) value
}
- else if(requiredType.isInstance(value)) {
- return (T)value
- }
- if(requiredType==String.class) {
+ if (requiredType == String.class) {
return String.valueOf(value)
- } else if(requiredType==Boolean.class) {
+ } else if (requiredType == Boolean.class) {
Boolean booleanObject = toBooleanObject(String.valueOf(value))
return booleanObject != null ? booleanObject : Boolean.FALSE
- } else if (requiredType==boolean) {
+ } else if (requiredType == boolean) {
Boolean booleanObject = toBooleanObject(String.valueOf(value))
return booleanObject != null ? booleanObject.booleanValue() : Boolean.FALSE.booleanValue()
- } else if(requiredType==Integer.class) {
- if(value instanceof Number) {
- return Integer.valueOf(((Number)value).intValue())
+ } else if (requiredType == Integer.class) {
+ if (value instanceof Number) {
+ return Integer.valueOf(((Number) value).intValue())
} else {
return Integer.valueOf(String.valueOf(value))
}
- } else if(requiredType==Long.class) {
- if(value instanceof Number) {
- return Long.valueOf(((Number)value).longValue())
+ } else if (requiredType == Long.class) {
+ if (value instanceof Number) {
+ return Long.valueOf(((Number) value).longValue())
} else {
return Long.valueOf(String.valueOf(value))
}
- } else if(requiredType==Double.class) {
- if(value instanceof Number) {
- return Double.valueOf(((Number)value).doubleValue())
+ } else if (requiredType == Double.class) {
+ if (value instanceof Number) {
+ return Double.valueOf(((Number) value).doubleValue())
} else {
return Double.valueOf(String.valueOf(value))
}
- } else if(requiredType==BigDecimal.class) {
+ } else if (requiredType == BigDecimal.class) {
return new BigDecimal(String.valueOf(value))
} else {
return convertToOtherTypes(value, requiredType)
}
}
-
+
protected <T> T convertToOtherTypes(Object value, Class<T> requiredType) {
throw new RuntimeException("conversion of $value to $requiredType.name not implemented")
}
@@ -224,33 +225,33 @@ class CodeGenConfig implements Cloneable, ConfigMap {
public Object navigate(String... path) {
return navigate(Object, path)
}
-
+
public boolean asBoolean() {
return !configMap.isEmpty()
}
public Object asType(Class type) {
- if(type==Boolean || type==boolean) {
+ if (type == Boolean || type == boolean) {
return asBoolean()
- } else if (type==String) {
+ } else if (type == String) {
return toString()
- } else if (type==Map) {
+ } else if (type == Map) {
return this
- } else if (type==CodeGenConfig) {
+ } else if (type == CodeGenConfig) {
return new CodeGenConfig(this)
} else {
throw new GroovyCastException(this, type)
}
}
-
+
public Object getAt(Object key) {
getProperty(String.valueOf(key))
}
-
+
public void setAt(Object key, Object value) {
setProperty(String.valueOf(key), value)
}
-
+
public Object getProperty(String name) {
if ("configMap".equals(name))
return this.configMap
@@ -269,13 +270,13 @@ class CodeGenConfig implements Cloneable, ConfigMap {
}
public <T> T getProperty(String name, Class<T> requiredType) {
- return convertToType( configMap.get(name), requiredType )
+ return convertToType(configMap.get(name), requiredType)
}
@Override
def <T> T getProperty(String key, Class<T> targetType, T defaultValue) {
def v = getProperty(key, targetType)
- if(v == null) {
+ if (v == null) {
return defaultValue
}
return v
@@ -284,8 +285,7 @@ class CodeGenConfig implements Cloneable, ConfigMap {
public void setProperty(String name, Object value) {
configMap.setProperty(name, value)
}
-
-
+
/**
* toBooleanObject method ported from org.apache.commons.lang.BooleanUtils.toBooleanObject to Groovy code
* @param str
@@ -299,27 +299,27 @@ class CodeGenConfig implements Cloneable, ConfigMap {
return null
}
int strlen = str.length()
- if (strlen==0) {
+ if (strlen == 0) {
return null
} else if (strlen == 1) {
char ch0 = str.charAt(0)
if ((ch0 == 'y' || ch0 == 'Y') ||
- (ch0 == 't' || ch0 == 'T')) {
+ (ch0 == 't' || ch0 == 'T')) {
return Boolean.TRUE
}
if ((ch0 == 'n' || ch0 == 'N') ||
- (ch0 == 'f' || ch0 == 'F')) {
+ (ch0 == 'f' || ch0 == 'F')) {
return Boolean.FALSE
}
} else if (strlen == 2) {
char ch0 = str.charAt(0)
char ch1 = str.charAt(1)
if ((ch0 == 'o' || ch0 == 'O') &&
- (ch1 == 'n' || ch1 == 'N') ) {
+ (ch1 == 'n' || ch1 == 'N')) {
return Boolean.TRUE
}
if ((ch0 == 'n' || ch0 == 'N') &&
- (ch1 == 'o' || ch1 == 'O') ) {
+ (ch1 == 'o' || ch1 == 'O')) {
return Boolean.FALSE
}
} else if (strlen == 3) {
@@ -327,13 +327,13 @@ class CodeGenConfig implements Cloneable, ConfigMap {
char ch1 = str.charAt(1)
char ch2 = str.charAt(2)
if ((ch0 == 'y' || ch0 == 'Y') &&
- (ch1 == 'e' || ch1 == 'E') &&
- (ch2 == 's' || ch2 == 'S') ) {
+ (ch1 == 'e' || ch1 == 'E') &&
+ (ch2 == 's' || ch2 == 'S')) {
return Boolean.TRUE
}
if ((ch0 == 'o' || ch0 == 'O') &&
- (ch1 == 'f' || ch1 == 'F') &&
- (ch2 == 'f' || ch2 == 'F') ) {
+ (ch1 == 'f' || ch1 == 'F') &&
+ (ch2 == 'f' || ch2 == 'F')) {
return Boolean.FALSE
}
} else if (strlen == 4) {
@@ -342,9 +342,9 @@ class CodeGenConfig implements Cloneable, ConfigMap {
char ch2 = str.charAt(2)
char ch3 = str.charAt(3)
if ((ch0 == 't' || ch0 == 'T') &&
- (ch1 == 'r' || ch1 == 'R') &&
- (ch2 == 'u' || ch2 == 'U') &&
- (ch3 == 'e' || ch3 == 'E') ) {
+ (ch1 == 'r' || ch1 == 'R') &&
+ (ch2 == 'u' || ch2 == 'U') &&
+ (ch3 == 'e' || ch3 == 'E')) {
return Boolean.TRUE
}
} else if (strlen == 5) {
@@ -354,10 +354,10 @@ class CodeGenConfig implements Cloneable, ConfigMap {
char ch3 = str.charAt(3)
char ch4 = str.charAt(4)
if ((ch0 == 'f' || ch0 == 'F') &&
- (ch1 == 'a' || ch1 == 'A') &&
- (ch2 == 'l' || ch2 == 'L') &&
- (ch3 == 's' || ch3 == 'S') &&
- (ch4 == 'e' || ch4 == 'E') ) {
+ (ch1 == 'a' || ch1 == 'A') &&
+ (ch2 == 'l' || ch2 == 'L') &&
+ (ch3 == 's' || ch3 == 'S') &&
+ (ch4 == 'e' || ch4 == 'E')) {
return Boolean.FALSE
}
}
diff --git a/grails-bootstrap/src/main/groovy/org/grails/config/NavigableMap.groovy b/grails-bootstrap/src/main/groovy/org/grails/config/NavigableMap.groovy
index 94a2a9c352..fde5adc061 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/config/NavigableMap.groovy
+++ b/grails-bootstrap/src/main/groovy/org/grails/config/NavigableMap.groovy
@@ -70,7 +70,7 @@ class NavigableMap implements Map<String, Object>, Cloneable {
this.rootConfig = rootConfig
this.path = path
dottedPath = path.join('.')
- this.delegateMap= delegateMap
+ this.delegateMap = delegateMap
}
@Override
@@ -148,7 +148,7 @@ class NavigableMap implements Map<String, Object>, Cloneable {
delegateMap.entrySet()
}
- void merge(Map sourceMap, boolean parseFlatKeys=false) {
+ void merge(Map sourceMap, boolean parseFlatKeys = false) {
mergeMaps(this, "", this, sourceMap, parseFlatKeys)
}
@@ -158,7 +158,7 @@ class NavigableMap implements Map<String, Object>, Cloneable {
Map sourceMap,
boolean parseFlatKeys) {
- if(springProfileExclude(sourceMap, path)) {
+ if (springProfileExclude(sourceMap, path)) {
return
}
@@ -189,7 +189,7 @@ class NavigableMap implements Map<String, Object>, Cloneable {
def activeSpringProfile = System.getProperty(SPRING_PROFILES)
// Is there a 'spring.config.activate.on-profile' property defined in the source map?
- def sourceMapProfile1 = ((Map)((Map)((Map)sourceMap?.get(SPRING))?.get(CONFIG))?.get(ACTIVATE))?.get(ON_PROFILE)
+ def sourceMapProfile1 = ((Map) ((Map) ((Map) sourceMap?.get(SPRING))?.get(CONFIG))?.get(ACTIVATE))?.get(ON_PROFILE)
if (!sourceMapProfile1 && path == "$SPRING.$CONFIG.$ACTIVATE") {
sourceMapProfile1 = sourceMap?.get(ON_PROFILE)
}
@@ -206,7 +206,7 @@ class NavigableMap implements Map<String, Object>, Cloneable {
}
// Is there a 'spring.profiles' property defined in the source map? (Old way of Spring profiles activation)
- def sourceMapProfile2 = ((Map)sourceMap?.get(SPRING))?.get(PROFILES)
+ def sourceMapProfile2 = ((Map) sourceMap?.get(SPRING))?.get(PROFILES)
if (!sourceMapProfile2 && path == SPRING) {
sourceMapProfile2 = sourceMap?.get(PROFILES)
}
@@ -235,106 +235,105 @@ class NavigableMap implements Map<String, Object>, Cloneable {
int subscriptStart = sourceKey.indexOf('[')
int subscriptEnd = sourceKey.indexOf(']')
if (subscriptEnd > subscriptStart) {
- if(subscriptStart > -1) {
- String k = sourceKey[0..<subscriptStart]
- String index = sourceKey[subscriptStart+1..<subscriptEnd]
- String remainder = subscriptEnd != sourceKey.length() -1 ? sourceKey[subscriptEnd+2..-1] : null
- if (remainder) {
-
- boolean isNumber = index.isNumber()
- if (isNumber) {
- int i = index.toInteger()
- def currentValue = targetMap.get(k)
- List list = currentValue instanceof List ? currentValue : []
- if (list.size() > i) {
- def v = list.get(i)
- if (v instanceof Map) {
- ((Map)v).put(remainder, sourceValue)
- } else {
- Map newMap = [:]
- newMap.put(remainder, sourceValue)
- fill(list, i, null)
- list.set(i, newMap)
- }
- } else {
- Map newMap = [:]
- newMap.put(remainder, sourceValue)
- fill(list, i, null)
- list.set(i, newMap)
- }
- targetMap.put(k, list)
- } else {
- def currentValue = targetMap.get(k)
- Map nestedMap = currentValue instanceof Map ? currentValue : [:]
- targetMap.put(k, nestedMap)
-
- def v = nestedMap.get(index)
- if (v instanceof Map) {
- ((Map)v).put(remainder, sourceValue)
- } else {
- Map newMap = [:]
- newMap.put(remainder, sourceValue)
- nestedMap.put(index, newMap)
- }
- }
- } else {
- def currentValue = targetMap.get(k)
- if (index.isNumber()) {
- List list = currentValue instanceof List ? currentValue : []
- int i = index.toInteger()
- fill(list, i, null)
- list.set(i, sourceValue)
- targetMap.put(k, list)
- } else {
- Map nestedMap = currentValue instanceof Map ? currentValue : [:]
- targetMap.put(k, nestedMap)
- nestedMap.put(index, sourceValue)
- }
- targetMap.put(sourceKey, sourceValue)
- }
-
- }
+ if (subscriptStart > -1) {
+ String k = sourceKey[0..<subscriptStart]
+ String index = sourceKey[subscriptStart + 1..<subscriptEnd]
+ String remainder = subscriptEnd != sourceKey.length() - 1 ? sourceKey[subscriptEnd + 2..-1] : null
+ if (remainder) {
+
+ boolean isNumber = index.isNumber()
+ if (isNumber) {
+ int i = index.toInteger()
+ def currentValue = targetMap.get(k)
+ List list = currentValue instanceof List ? currentValue : []
+ if (list.size() > i) {
+ def v = list.get(i)
+ if (v instanceof Map) {
+ ((Map) v).put(remainder, sourceValue)
+ } else {
+ Map newMap = [:]
+ newMap.put(remainder, sourceValue)
+ fill(list, i, null)
+ list.set(i, newMap)
+ }
+ } else {
+ Map newMap = [:]
+ newMap.put(remainder, sourceValue)
+ fill(list, i, null)
+ list.set(i, newMap)
+ }
+ targetMap.put(k, list)
+ } else {
+ def currentValue = targetMap.get(k)
+ Map nestedMap = currentValue instanceof Map ? currentValue : [:]
+ targetMap.put(k, nestedMap)
+
+ def v = nestedMap.get(index)
+ if (v instanceof Map) {
+ ((Map) v).put(remainder, sourceValue)
+ } else {
+ Map newMap = [:]
+ newMap.put(remainder, sourceValue)
+ nestedMap.put(index, newMap)
+ }
+ }
+ } else {
+ def currentValue = targetMap.get(k)
+ if (index.isNumber()) {
+ List list = currentValue instanceof List ? currentValue : []
+ int i = index.toInteger()
+ fill(list, i, null)
+ list.set(i, sourceValue)
+ targetMap.put(k, list)
+ } else {
+ Map nestedMap = currentValue instanceof Map ? currentValue : [:]
+ targetMap.put(k, nestedMap)
+ nestedMap.put(index, sourceValue)
+ }
+ targetMap.put(sourceKey, sourceValue)
+ }
+
+ }
} else {
Object currentValue = targetMap.containsKey(sourceKey) ? targetMap.get(sourceKey) : null
Object newValue
- if(sourceValue instanceof Map) {
+ if (sourceValue instanceof Map) {
List<String> newPathList = []
- newPathList.addAll( targetMap.getPath() )
+ newPathList.addAll(targetMap.getPath())
newPathList.add(sourceKey)
NavigableMap subMap
- if(currentValue instanceof NavigableMap) {
- subMap = (NavigableMap)currentValue
- }
- else {
+ if (currentValue instanceof NavigableMap) {
+ subMap = (NavigableMap) currentValue
+ } else {
subMap = new NavigableMap(targetMap.getRootConfig(), newPathList.asImmutable())
- if(currentValue instanceof Map) {
- subMap.putAll((Map)currentValue)
+ if (currentValue instanceof Map) {
+ subMap.putAll((Map) currentValue)
}
}
String newPath = path ? "${path}.${sourceKey}" : sourceKey
- mergeMaps(rootMap, newPath , subMap, (Map)sourceValue, parseFlatKeys)
+ mergeMaps(rootMap, newPath, subMap, (Map) sourceValue, parseFlatKeys)
newValue = subMap
} else {
newValue = sourceValue
}
if (isNestedSet && newValue == null) {
- if(path) {
+ if (path) {
def subMap = rootMap.get(path)
- if(subMap instanceof Map) {
+ if (subMap instanceof Map) {
subMap.remove(sourceKey)
}
def keysToRemove = rootMap.keySet().findAll() { String key ->
key.startsWith("${path}.")
}
- for(key in keysToRemove) {
+ for (key in keysToRemove) {
rootMap.remove(key)
}
}
targetMap.remove(sourceKey)
} else {
- if(path) {
- rootMap.put( "${path}.${sourceKey}".toString(), newValue )
+ if (path) {
+ rootMap.put("${path}.${sourceKey}".toString(), newValue)
}
mergeMapEntry(targetMap, sourceKey, newValue)
}
@@ -373,16 +372,16 @@ class NavigableMap implements Map<String, Object>, Cloneable {
Object navigate(String... path) {
return navigateMap(this, path)
}
-
+
private Object navigateMap(Map<String, Object> map, String... path) {
- if(map==null || path == null) return null
- if(path.length == 0) {
+ if (map == null || path == null) return null
+ if (path.length == 0) {
return map
} else if (path.length == 1) {
return map.get(path[0])
} else {
def submap = map.get(path[0])
- if(submap instanceof Map) {
+ if (submap instanceof Map) {
return navigateMap((Map<String, Object>) submap, path.tail())
}
return submap
@@ -402,28 +401,27 @@ class NavigableMap implements Map<String, Object>, Cloneable {
NavigableMap currentMap = this
StringBuilder accumulatedPath = new StringBuilder()
boolean isFirst = true
- for(String pathElement : path) {
- if(!isFirst) {
+ for (String pathElement : path) {
+ if (!isFirst) {
accumulatedPath.append(".").append(pathElement)
- }
- else {
+ } else {
isFirst = false
accumulatedPath.append(pathElement)
}
- Object currentItem = currentMap.get(pathElement)
- if(currentItem instanceof NavigableMap) {
- currentMap = (NavigableMap)currentItem
+ Object currentItem = currentMap.get(pathElement)
+ if (currentItem instanceof NavigableMap) {
+ currentMap = (NavigableMap) currentItem
} else if (createMissing) {
List<String> newPathList = []
- newPathList.addAll( currentMap.getPath() )
+ newPathList.addAll(currentMap.getPath())
newPathList.add(pathElement)
Map<String, Object> newMap = new NavigableMap(currentMap.getRootConfig(), newPathList.asImmutable())
currentMap.put(pathElement, newMap)
def fullPath = accumulatedPath.toString()
- if(!rootMap.containsKey(fullPath)) {
+ if (!rootMap.containsKey(fullPath)) {
rootMap.put(fullPath, newMap)
}
currentMap = newMap
@@ -433,44 +431,44 @@ class NavigableMap implements Map<String, Object>, Cloneable {
}
currentMap
}
-
+
Map<String, Object> toFlatConfig() {
Map<String, Object> flatConfig = [:]
flattenKeys(flatConfig, this, [], false)
flatConfig
}
-
+
Properties toProperties() {
Properties properties = new Properties()
flattenKeys((Map<Object, Object>) properties, this, [], true)
properties
}
-
+
private void flattenKeys(Map<? extends Object, Object> flatConfig, Map currentMap, List<String> path, boolean forceStrings) {
currentMap.each { key, value ->
String stringKey = String.valueOf(key)
- if(value != null) {
- if(value instanceof Map) {
+ if (value != null) {
+ if (value instanceof Map) {
List<String> newPathList = []
- newPathList.addAll( path )
- newPathList.add( stringKey )
+ newPathList.addAll(path)
+ newPathList.add(stringKey)
- flattenKeys(flatConfig, (Map)value, newPathList.asImmutable(), forceStrings)
+ flattenKeys(flatConfig, (Map) value, newPathList.asImmutable(), forceStrings)
} else {
String fullKey
- if(path) {
+ if (path) {
fullKey = path.join('.') + '.' + stringKey
} else {
fullKey = stringKey
}
- if(value instanceof Collection) {
- if(forceStrings) {
- flatConfig.put(fullKey, ((Collection)value).join(","))
+ if (value instanceof Collection) {
+ if (forceStrings) {
+ flatConfig.put(fullKey, ((Collection) value).join(","))
} else {
flatConfig.put(fullKey, value)
}
int index = 0
- for(Object item: (Collection)value) {
+ for (Object item : (Collection) value) {
String collectionKey = "${fullKey}[${index}]".toString()
flatConfig.put(collectionKey, forceStrings ? String.valueOf(item) : item)
index++
@@ -480,7 +478,7 @@ class NavigableMap implements Map<String, Object>, Cloneable {
}
}
}
- }
+ }
}
@Override
@@ -498,7 +496,8 @@ class NavigableMap implements Map<String, Object>, Cloneable {
*/
@Deprecated
@CompileStatic
- static class NullSafeNavigator implements Map<String, Object>{
+ static class NullSafeNavigator implements Map<String, Object> {
+
final NavigableMap parent
final List<String> path
@@ -521,7 +520,7 @@ class NavigableMap implements Map<String, Object>, Cloneable {
@Override
int size() {
NavigableMap parentMap = parent.navigateSubMap(path, false)
- if(parentMap != null) {
+ if (parentMap != null) {
return parentMap.size()
}
return 0
@@ -530,7 +529,7 @@ class NavigableMap implements Map<String, Object>, Cloneable {
@Override
boolean isEmpty() {
NavigableMap parentMap = parent.navigateSubMap(path, false)
- if(parentMap != null) {
+ if (parentMap != null) {
return parentMap.isEmpty()
}
return true
@@ -538,7 +537,7 @@ class NavigableMap implements Map<String, Object>, Cloneable {
boolean containsKey(Object key) {
NavigableMap parentMap = parent.navigateSubMap(path, false)
- if(parentMap == null) return false
+ if (parentMap == null) return false
else {
return parentMap.containsKey(key)
}
@@ -547,7 +546,7 @@ class NavigableMap implements Map<String, Object>, Cloneable {
@Override
boolean containsValue(Object value) {
NavigableMap parentMap = parent.navigateSubMap(path, false)
- if(parentMap != null) {
+ if (parentMap != null) {
return parentMap.containsValue(value)
}
return false
@@ -581,7 +580,7 @@ class NavigableMap implements Map<String, Object>, Cloneable {
@Override
Set<String> keySet() {
NavigableMap parentMap = parent.navigateSubMap(path, false)
- if(parentMap != null) {
+ if (parentMap != null) {
return parentMap.keySet()
}
return Collections.emptySet()
@@ -590,7 +589,7 @@ class NavigableMap implements Map<String, Object>, Cloneable {
@Override
Collection<Object> values() {
NavigableMap parentMap = parent.navigateSubMap(path, false)
- if(parentMap != null) {
+ if (parentMap != null) {
return parentMap.values()
}
return Collections.emptySet()
@@ -599,7 +598,7 @@ class NavigableMap implements Map<String, Object>, Cloneable {
@Override
Set<Entry<String, Object>> entrySet() {
NavigableMap parentMap = parent.navigateSubMap(path, false)
- if(parentMap != null) {
+ if (parentMap != null) {
return parentMap.entrySet()
}
return Collections.emptySet()
@@ -607,7 +606,7 @@ class NavigableMap implements Map<String, Object>, Cloneable {
Object getProperty(String name) {
NavigableMap parentMap = parent.navigateSubMap(path, false)
- if(parentMap == null) {
+ if (parentMap == null) {
return new NullSafeNavigator(parent, ((path + [name]) as List<String>).asImmutable())
} else {
return parentMap.get(name)
@@ -648,7 +647,7 @@ class NavigableMap implements Map<String, Object>, Cloneable {
}
Object asType(Class c) {
- if(c==Boolean || c==boolean) return false
+ if (c == Boolean || c == boolean) return false
return null
}
diff --git a/grails-bootstrap/src/main/groovy/org/grails/exceptions/ExceptionUtils.groovy b/grails-bootstrap/src/main/groovy/org/grails/exceptions/ExceptionUtils.groovy
index 6e733ffd51..815418617c 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/exceptions/ExceptionUtils.groovy
+++ b/grails-bootstrap/src/main/groovy/org/grails/exceptions/ExceptionUtils.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.exceptions
import groovy.transform.CompileStatic
@@ -35,7 +34,6 @@ class ExceptionUtils {
public static final String EXCEPTION_ATTRIBUTE = "exception";
-
static RuntimeException getFirstRuntimeException(Throwable e) {
if (e instanceof RuntimeException) return (RuntimeException) e
@@ -61,10 +59,10 @@ class ExceptionUtils {
static int extractLineNumber(CompilationFailedException e) {
int lineNumber = -1
if (e instanceof MultipleCompilationErrorsException) {
- MultipleCompilationErrorsException mcee = (MultipleCompilationErrorsException)e
+ MultipleCompilationErrorsException mcee = (MultipleCompilationErrorsException) e
Object message = mcee.errorCollector.errors.iterator().next()
if (message instanceof SyntaxErrorMessage) {
- SyntaxErrorMessage sem = (SyntaxErrorMessage)message
+ SyntaxErrorMessage sem = (SyntaxErrorMessage) message
lineNumber = sem.cause.line
}
}
diff --git a/grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/DefaultStackTraceFilterer.java b/grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/DefaultStackTraceFilterer.java
index 95215b5e82..05b994d94b 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/DefaultStackTraceFilterer.java
+++ b/grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/DefaultStackTraceFilterer.java
@@ -28,31 +28,32 @@ import java.util.List;
/**
* Default implementation of StackTraceFilterer.
*
- * @since 2.0
* @author Graeme Rocher
+ * @since 2.0
*/
public class DefaultStackTraceFilterer implements StackTraceFilterer {
+
public static final String STACK_LOG_NAME = "StackTrace";
public static final Log STACK_LOG = LogFactory.getLog(STACK_LOG_NAME);
- private static final String[] DEFAULT_INTERNAL_PACKAGES = new String[] {
- "org.codehaus.groovy.runtime.",
- "org.codehaus.groovy.reflection.",
- "org.codehaus.groovy.ast.",
- "org.springframework.web.filter",
- "org.springframework.boot.actuate",
- "org.mortbay.",
- "groovy.lang.",
- "org.apache.catalina.",
- "org.apache.coyote.",
- "org.apache.tomcat.",
- "net.sf.cglib.proxy.",
- "sun.",
- "java.lang.reflect.",
- "org.springframework.boot.devtools.",
- "org.springsource.loaded.",
- "com.opensymphony.",
- "jakarta.servlet."
+ private static final String[] DEFAULT_INTERNAL_PACKAGES = new String[]{
+ "org.codehaus.groovy.runtime.",
+ "org.codehaus.groovy.reflection.",
+ "org.codehaus.groovy.ast.",
+ "org.springframework.web.filter",
+ "org.springframework.boot.actuate",
+ "org.mortbay.",
+ "groovy.lang.",
+ "org.apache.catalina.",
+ "org.apache.coyote.",
+ "org.apache.tomcat.",
+ "net.sf.cglib.proxy.",
+ "sun.",
+ "java.lang.reflect.",
+ "org.springframework.boot.devtools.",
+ "org.springsource.loaded.",
+ "com.opensymphony.",
+ "jakarta.servlet."
};
private List<String> packagesToFilter = new ArrayList<String>();
@@ -69,7 +70,9 @@ public class DefaultStackTraceFilterer implements StackTraceFilterer {
}
public void addInternalPackage(String name) {
- if (name == null) throw new IllegalArgumentException("Package name cannot be null");
+ if (name == null) {
+ throw new IllegalArgumentException("Package name cannot be null");
+ }
packagesToFilter.add(name);
}
@@ -120,7 +123,9 @@ public class DefaultStackTraceFilterer implements StackTraceFilterer {
if (!foundGroovy && fileName != null && fileName.endsWith(".groovy")) {
foundGroovy = true;
}
- if (endPackage != null && className.startsWith(endPackage) && foundGroovy) break;
+ if (endPackage != null && className.startsWith(endPackage) && foundGroovy) {
+ break;
+ }
if (isApplicationClass(className)) {
if (stackTraceElement.getLineNumber() > -1) {
newTrace.add(stackTraceElement);
@@ -132,12 +137,15 @@ public class DefaultStackTraceFilterer implements StackTraceFilterer {
/**
* Whether the given class name is an internal class and should be filtered
+ *
* @param className The class name
* @return true if is internal
*/
protected boolean isApplicationClass(String className) {
for (String packageName : packagesToFilter) {
- if (className.startsWith(packageName)) return false;
+ if (className.startsWith(packageName)) {
+ return false;
+ }
}
return true;
}
diff --git a/grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/DefaultStackTracePrinter.groovy b/grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/DefaultStackTracePrinter.groovy
index 1673bc7d60..b80dfa606c 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/DefaultStackTracePrinter.groovy
+++ b/grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/DefaultStackTracePrinter.groovy
@@ -62,23 +62,21 @@ class DefaultStackTracePrinter implements StackTracePrinter {
printCausedByMessage(sb, e)
}
if (e instanceof MultipleCompilationErrorsException) break
- if(last > 0) {
+ if (last > 0) {
stackTrace[0..-1].eachWithIndex { te, idx ->
def fileName = getFileName(te)
def lineNumber
if (e instanceof SourceCodeAware) {
if (e.lineNumber && e.lineNumber > -1) {
lineNumber = e.lineNumber.toString().padLeft(lineNumWidth)
- }
- else {
+ } else {
lineNumber = te.lineNumber.toString().padLeft(lineNumWidth)
}
if (e.fileName) {
fileName = e.fileName
fileName = makeRelativeIfPossible(fileName)
}
- }
- else {
+ } else {
lineNumber = te.lineNumber.toString().padLeft(lineNumWidth)
}
diff --git a/grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/SourceCodeAware.java b/grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/SourceCodeAware.java
index a826fd04f2..10abd7b27a 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/SourceCodeAware.java
+++ b/grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/SourceCodeAware.java
@@ -27,6 +27,7 @@ import java.io.Serializable;
* @since 1.0
*/
public interface SourceCodeAware extends Serializable {
+
String getFileName();
int getLineNumber();
diff --git a/grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/StackTraceFilterer.java b/grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/StackTraceFilterer.java
index ff0d9b6786..cb6e61c0b5 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/StackTraceFilterer.java
+++ b/grails-bootstrap/src/main/groovy/org/grails/exceptions/reporting/StackTraceFilterer.java
@@ -21,8 +21,8 @@ package org.grails.exceptions.reporting;
/**
* Improves the output of stack traces produced by exceptions in a Grails application.
*
- * @since 2.0
* @author Graeme Rocher
+ * @since 2.0
*/
public interface StackTraceFilterer {
@@ -38,6 +38,7 @@ public interface StackTraceFilterer {
/**
* Sets the package where the stack trace should end
+ *
* @param cutOffPackage The cut off package
*/
void setCutOffPackage(String cutOffPackage);
@@ -45,7 +46,8 @@ public interface StackTraceFilterer {
/**
* <p>Remove all apparently Grails-internal trace entries from the exception instance<p>
* <p>This modifies the original instance and returns it, it does not clone</p>
- * @param source The source exception
+ *
+ * @param source The source exception
* @param recursive Whether to recursively filter the cause
* @return The exception passed in, after cleaning the stack trace
*/
@@ -54,6 +56,7 @@ public interface StackTraceFilterer {
/**
* <p>Remove all apparently Grails-internal trace entries from the exception instance<p>
* <p>This modifies the original instance and returns it, it does not clone</p>
+ *
* @param source The source exception
* @return The exception passed in, after cleaning the stack trace
*/
diff --git a/grails-bootstrap/src/main/groovy/org/grails/io/support/AntPathMatcher.java b/grails-bootstrap/src/main/groovy/org/grails/io/support/AntPathMatcher.java
index d92fcccb0f..54242897cf 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/io/support/AntPathMatcher.java
+++ b/grails-bootstrap/src/main/groovy/org/grails/io/support/AntPathMatcher.java
@@ -18,6 +18,8 @@
*/
package org.grails.io.support;
+import org.codehaus.groovy.runtime.StringGroovyMethods;
+
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
@@ -26,12 +28,10 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.codehaus.groovy.runtime.StringGroovyMethods;
-
/**
* PathMatcher implementation for Ant-style path patterns. Examples are provided below.
*
- * <p>Part of this mapping code has been kindly borrowed from <a href="http://ant.apache.org">Apache Ant</a>.
+ * <p>Part of this mapping code has been kindly borrowed from <a href="https://ant.apache.org">Apache Ant</a>.
*
* <p>The mapping matches URLs using the following rules:<br> <ul> <li>? matches one character</li> <li>* matches zero
* or more characters</li> <li>** matches zero or more 'directories' in a path</li> </ul>
@@ -50,16 +50,20 @@ import org.codehaus.groovy.runtime.StringGroovyMethods;
* @author Arjen Poutsma
* @since 16.07.2003
*/
-public class AntPathMatcher {
-
- private static final Pattern VARIABLE_PATTERN = Pattern.compile("\\{[^/]+?\\}");
+public final class AntPathMatcher {
- /** Default path separator: "/" */
+ /**
+ * Default path separator: "/"
+ */
public static final String DEFAULT_PATH_SEPARATOR = "/";
+ private static final Pattern VARIABLE_PATTERN = Pattern.compile("\\{[^/]+?\\}");
+
private String pathSeparator = DEFAULT_PATH_SEPARATOR;
- /** Set the path separator to use for pattern parsing. Default is "/", as in Ant. */
+ /**
+ * Set the path separator to use for pattern parsing. Default is "/", as in Ant.
+ */
public void setPathSeparator(String pathSeparator) {
this.pathSeparator = pathSeparator == null ? DEFAULT_PATH_SEPARATOR : pathSeparator;
}
@@ -78,10 +82,11 @@ public class AntPathMatcher {
/**
* Actually match the given <code>path</code> against the given <code>pattern</code>.
- * @param pattern the pattern to match against
- * @param path the path String to test
+ *
+ * @param pattern the pattern to match against
+ * @param path the path String to test
* @param fullMatch whether a full pattern match is required (else a pattern match
- * as far as the given base path goes is sufficient)
+ * as far as the given base path goes is sufficient)
* @return <code>true</code> if the supplied <code>path</code> matched, <code>false</code> if it didn't
*/
protected boolean doMatch(String pattern, String path, boolean fullMatch,
@@ -130,12 +135,10 @@ public class AntPathMatcher {
}
}
return true;
- }
- else if (pattIdxStart > pattIdxEnd) {
+ } else if (pattIdxStart > pattIdxEnd) {
// String not exhausted, but pattern is. Failure.
return false;
- }
- else if (!fullMatch && "**".equals(pattDirs[pattIdxStart])) {
+ } else if (!fullMatch && "**".equals(pattDirs[pattIdxStart])) {
// Path start definitely matches due to "**" part in pattern.
return true;
}
@@ -212,15 +215,16 @@ public class AntPathMatcher {
}
private String[] tokenize(String pattern) {
- List<String> list = StringGroovyMethods.tokenize((CharSequence)pattern, (CharSequence)pathSeparator);
+ List<String> list = StringGroovyMethods.tokenize((CharSequence) pattern, (CharSequence) pathSeparator);
return list.toArray(new String[list.size()]);
}
/**
* Tests whether or not a string matches against a pattern. The pattern may contain two special characters:<br> '*'
* means zero or more characters<br> '?' means one and only one character
+ *
* @param pattern pattern to match against. Must not be <code>null</code>.
- * @param str string which must be matched against the pattern. Must not be <code>null</code>.
+ * @param str string which must be matched against the pattern. Must not be <code>null</code>.
* @return <code>true</code> if the string matches against the pattern, or <code>false</code> otherwise.
*/
private boolean matchStrings(String pattern, String str, Map<String, String> uriTemplateVariables) {
@@ -273,7 +277,8 @@ public class AntPathMatcher {
public Map<String, String> extractUriTemplateVariables(String pattern, String path) {
Map<String, String> variables = new LinkedHashMap<String, String>();
- /*boolean result =*/ doMatch(pattern, path, true, variables);
+ /*boolean result =*/
+ doMatch(pattern, path, true, variables);
return variables;
}
@@ -291,6 +296,7 @@ public class AntPathMatcher {
* <tr><td>/hotels/**</td><td>{hotel}</td><td>/hotels/**/{hotel}</td></tr>
* <tr><td>/*.html</td><td>/hotels.html</td><td>/hotels.html</td></tr> <tr><td>/*.html</td><td>/hotels</td><td>/hotels.html</td></tr>
* <tr><td>/*.html</td><td>/*.txt</td><td>IllegalArgumentException</td></tr> </table>
+ *
* @param pattern1 the first pattern
* @param pattern2 the second pattern
* @return the combination of the two patterns
@@ -341,8 +347,7 @@ public class AntPathMatcher {
if (dotPos2 != -1) {
fileName2 = pattern2.substring(0, dotPos2);
extension2 = pattern2.substring(dotPos2);
- }
- else {
+ } else {
fileName2 = pattern2;
extension2 = "";
}
@@ -353,7 +358,7 @@ public class AntPathMatcher {
}
private boolean hasText(String txt) {
- return txt != null && txt.length()>0;
+ return txt != null && txt.length() > 0;
}
/**
@@ -365,6 +370,7 @@ public class AntPathMatcher {
* list so that the order will be as indicated.
* <p>The full path given as parameter is used to test for exact matches. So when the given path is {@code /hotels/2},
* the pattern {@code /hotels/2} will be sorted before {@code /hotels/1}.
+ *
* @param path the full path to use for comparison
* @return a comparator capable of sorting patterns in order of explicitness
*/
@@ -372,86 +378,24 @@ public class AntPathMatcher {
return new AntPatternComparator(path);
}
- private static class AntPatternComparator implements Comparator<String> {
-
- private final String path;
-
- private AntPatternComparator(String path) {
- this.path = path;
- }
-
- public int compare(String pattern1, String pattern2) {
- if (pattern1 == null && pattern2 == null) {
- return 0;
- }
- else if (pattern1 == null) {
- return 1;
- }
- else if (pattern2 == null) {
- return -1;
- }
- boolean pattern1EqualsPath = pattern1.equals(path);
- boolean pattern2EqualsPath = pattern2.equals(path);
- if (pattern1EqualsPath && pattern2EqualsPath) {
- return 0;
- }
- else if (pattern1EqualsPath) {
- return -1;
- }
- else if (pattern2EqualsPath) {
- return 1;
- }
- int wildCardCount1 = getWildCardCount(pattern1);
- int wildCardCount2 = getWildCardCount(pattern2);
-
- int bracketCount1 = countOccurrencesOf(pattern1, "{");
- int bracketCount2 = countOccurrencesOf(pattern2, "{");
-
- int totalCount1 = wildCardCount1 + bracketCount1;
- int totalCount2 = wildCardCount2 + bracketCount2;
-
- if (totalCount1 != totalCount2) {
- return totalCount1 - totalCount2;
- }
-
- int pattern1Length = getPatternLength(pattern1);
- int pattern2Length = getPatternLength(pattern2);
-
- if (pattern1Length != pattern2Length) {
- return pattern2Length - pattern1Length;
- }
-
- if (wildCardCount1 < wildCardCount2) {
- return -1;
- }
- else if (wildCardCount2 < wildCardCount1) {
- return 1;
- }
-
- if (bracketCount1 < bracketCount2) {
- return -1;
- }
- else if (bracketCount2 < bracketCount1) {
- return 1;
- }
-
+ /**
+ * Count the occurrences of the substring in string s.
+ *
+ * @param str string to search in. Return 0 if this is null.
+ * @param sub string to search for. Return 0 if this is null.
+ */
+ public static int countOccurrencesOf(String str, String sub) {
+ if (str == null || sub == null || str.length() == 0 || sub.length() == 0) {
return 0;
}
-
- private int getWildCardCount(String pattern) {
- if (pattern.endsWith(".*")) {
- pattern = pattern.substring(0, pattern.length() - 2);
- }
- return countOccurrencesOf(pattern, "*");
- }
-
- /**
- * Returns the length of the given pattern, where template variables are considered to be 1 long.
- */
- private int getPatternLength(String pattern) {
- Matcher m = VARIABLE_PATTERN.matcher(pattern);
- return m.replaceAll("#").length();
+ int count = 0;
+ int pos = 0;
+ int idx;
+ while ((idx = str.indexOf(sub, pos)) != -1) {
+ ++count;
+ pos = idx + sub.length();
}
+ return count;
}
/**
@@ -465,7 +409,7 @@ public class AntPathMatcher {
* @author Rossen Stoyanchev
* @since 3.0
*/
- static class AntPathStringMatcher {
+ static class AntPathStringMatcher {
private static final Pattern GLOB_PATTERN = Pattern.compile("\\?|\\*|\\{((?:\\{[^/]+?\\}|[^/{}]|\\\\[{}])+?)\\}");
@@ -479,7 +423,9 @@ public class AntPathMatcher {
private final Map<String, String> uriTemplateVariables;
- /** Construct a new instance of the <code>AntPatchStringMatcher</code>. */
+ /**
+ * Construct a new instance of the <code>AntPatchStringMatcher</code>.
+ */
AntPathStringMatcher(String pattern, String str, Map<String, String> uriTemplateVariables) {
this.str = str;
this.uriTemplateVariables = uriTemplateVariables;
@@ -495,17 +441,14 @@ public class AntPathMatcher {
String match = m.group();
if ("?".equals(match)) {
patternBuilder.append('.');
- }
- else if ("*".equals(match)) {
+ } else if ("*".equals(match)) {
patternBuilder.append(".*");
- }
- else if (match.startsWith("{") && match.endsWith("}")) {
+ } else if (match.startsWith("{") && match.endsWith("}")) {
int colonIdx = match.indexOf(':');
if (colonIdx == -1) {
patternBuilder.append(DEFAULT_VARIABLE_PATTERN);
variableNames.add(m.group(1));
- }
- else {
+ } else {
String variablePattern = match.substring(colonIdx + 1, match.length() - 1);
patternBuilder.append('(');
patternBuilder.append(variablePattern);
@@ -548,22 +491,79 @@ public class AntPathMatcher {
}
}
- /**
- * Count the occurrences of the substring in string s.
- * @param str string to search in. Return 0 if this is null.
- * @param sub string to search for. Return 0 if this is null.
- */
- public static int countOccurrencesOf(String str, String sub) {
- if (str == null || sub == null || str.length() == 0 || sub.length() == 0) {
+ private static final class AntPatternComparator implements Comparator<String> {
+
+ private final String path;
+
+ private AntPatternComparator(String path) {
+ this.path = path;
+ }
+
+ public int compare(String pattern1, String pattern2) {
+ if (pattern1 == null && pattern2 == null) {
+ return 0;
+ } else if (pattern1 == null) {
+ return 1;
+ } else if (pattern2 == null) {
+ return -1;
+ }
+ boolean pattern1EqualsPath = pattern1.equals(path);
+ boolean pattern2EqualsPath = pattern2.equals(path);
+ if (pattern1EqualsPath && pattern2EqualsPath) {
+ return 0;
+ } else if (pattern1EqualsPath) {
+ return -1;
+ } else if (pattern2EqualsPath) {
+ return 1;
+ }
+ int wildCardCount1 = getWildCardCount(pattern1);
+ int wildCardCount2 = getWildCardCount(pattern2);
+
+ int bracketCount1 = countOccurrencesOf(pattern1, "{");
+ int bracketCount2 = countOccurrencesOf(pattern2, "{");
+
+ int totalCount1 = wildCardCount1 + bracketCount1;
+ int totalCount2 = wildCardCount2 + bracketCount2;
+
+ if (totalCount1 != totalCount2) {
+ return totalCount1 - totalCount2;
+ }
+
+ int pattern1Length = getPatternLength(pattern1);
+ int pattern2Length = getPatternLength(pattern2);
+
+ if (pattern1Length != pattern2Length) {
+ return pattern2Length - pattern1Length;
+ }
+
+ if (wildCardCount1 < wildCardCount2) {
+ return -1;
+ } else if (wildCardCount2 < wildCardCount1) {
+ return 1;
+ }
+
+ if (bracketCount1 < bracketCount2) {
+ return -1;
+ } else if (bracketCount2 < bracketCount1) {
+ return 1;
+ }
+
return 0;
}
- int count = 0;
- int pos = 0;
- int idx;
- while ((idx = str.indexOf(sub, pos)) != -1) {
- ++count;
- pos = idx + sub.length();
+
+ private int getWildCardCount(String pattern) {
+ if (pattern.endsWith(".*")) {
+ pattern = pattern.substring(0, pattern.length() - 2);
+ }
+ return countOccurrencesOf(pattern, "*");
+ }
+
+ /**
+ * Returns the length of the given pattern, where template variables are considered to be 1 long.
+ */
+ private int getPatternLength(String pattern) {
+ Matcher m = VARIABLE_PATTERN.matcher(pattern);
+ return m.replaceAll("#").length();
}
- return count;
}
}
diff --git a/grails-bootstrap/src/main/groovy/org/grails/io/support/DevNullPrintStream.groovy b/grails-bootstrap/src/main/groovy/org/grails/io/support/DevNullPrintStream.groovy
index 3017de89a7..fdd05df47b 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/io/support/DevNullPrintStream.groovy
+++ b/grails-bootstrap/src/main/groovy/org/grails/io/support/DevNullPrintStream.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.io.support
import groovy.transform.CompileStatic
diff --git a/grails-bootstrap/src/main/groovy/org/grails/io/support/FileSystemResourceLoader.java b/grails-bootstrap/src/main/groovy/org/grails/io/support/FileSystemResourceLoader.java
index 6b791c3e63..c3e0b3c488 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/io/support/FileSystemResourceLoader.java
+++ b/grails-bootstrap/src/main/groovy/org/grails/io/support/FileSystemResourceLoader.java
@@ -27,13 +27,13 @@ package org.grails.io.support;
* to the current VM working directory, even if they start with a slash.
* (This is consistent with the semantics in a Servlet container.)
* <b>Use an explicit "file:" prefix to enforce an absolute file path.</b>
- *
+ * <p>
* is a full-fledged ApplicationContext implementation that provides
* the same resource path resolution strategy.
*
* @author Juergen Hoeller
- * @since 1.1.3
* @see DefaultResourceLoader
+ * @since 1.1.3
*/
public class FileSystemResourceLoader extends DefaultResourceLoader {
@@ -41,6 +41,7 @@ public class FileSystemResourceLoader extends DefaultResourceLoader {
* Resolve resource paths as file system paths.
* <p>Note: Even if a given path starts with a slash, it will get
* interpreted as relative to the current VM working directory.
+ *
* @param path the path to the resource
* @return the corresponding Resource handle
* @see FileSystemResource
diff --git a/grails-bootstrap/src/main/groovy/org/grails/io/support/PathMatchingResourcePatternResolver.java b/grails-bootstrap/src/main/groovy/org/grails/io/support/PathMatchingResourcePatternResolver.java
index 7205754f75..744db9b3df 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/io/support/PathMatchingResourcePatternResolver.java
+++ b/grails-bootstrap/src/main/groovy/org/grails/io/support/PathMatchingResourcePatternResolver.java
@@ -31,7 +31,6 @@ import java.util.Set;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
-
/**
* A ResourcePatternResolver implementation that is able to resolve a
* specified resource location path into one or more matching Resources.
@@ -142,14 +141,13 @@ import java.util.jar.JarFile;
* @author Colin Sampaleanu
* @author Marius Bogoevici
* @author Costin Leau
- * @since 1.0.2
* @see java.lang.ClassLoader#getResources(String)
+ * @since 1.0.2
*/
public class PathMatchingResourcePatternResolver {
private static final String CLASSPATH_ALL_URL_PREFIX = "classpath*:";
-
private final ResourceLoader resourceLoader;
private AntPathMatcher pathMatcher = new AntPathMatcher();
@@ -164,9 +162,10 @@ public class PathMatchingResourcePatternResolver {
/**
* Create a new PathMatchingResourcePatternResolver with a DefaultResourceLoader.
+ *
* @param classLoader the ClassLoader to load classpath resources with,
- * or <code>null</code> for using the thread context class loader
- * at the time of actual resource access
+ * or <code>null</code> for using the thread context class loader
+ * at the time of actual resource access
*/
public PathMatchingResourcePatternResolver(ClassLoader classLoader) {
resourceLoader = new DefaultResourceLoader(classLoader);
@@ -175,8 +174,9 @@ public class PathMatchingResourcePatternResolver {
/**
* Create a new PathMatchingResourcePatternResolver.
* <p>ClassLoader access will happen via the thread context class loader.
+ *
* @param resourceLoader the ResourceLoader to load root directories and
- * actual resources with
+ * actual resources with
*/
public PathMatchingResourcePatternResolver(ResourceLoader resourceLoader) {
this.resourceLoader = resourceLoader;
@@ -234,11 +234,12 @@ public class PathMatchingResourcePatternResolver {
return findPathMatchingResources(locationPattern);
}
// a single resource with the given name
- return new Resource[] {getResourceLoader().getResource(locationPattern)};
+ return new Resource[]{getResourceLoader().getResource(locationPattern)};
}
/**
* Find all class location resources with the given location via the ClassLoader.
+ *
* @param location the absolute path within the classpath
* @return the result as Resource array
* @throws IOException in case of I/O errors
@@ -262,6 +263,7 @@ public class PathMatchingResourcePatternResolver {
/**
* Convert the given URL as returned from the ClassLoader into a Resource object.
* <p>The default implementation simply creates a UrlResource instance.
+ *
* @param url a URL as returned from the ClassLoader
* @return the corresponding Resource object
* @see java.lang.ClassLoader#getResources
@@ -274,6 +276,7 @@ public class PathMatchingResourcePatternResolver {
* Find all resources that match the given location pattern via the
* Ant-style PathMatcher. Supports resources in jar files and zip files
* and in the file system.
+ *
* @param locationPattern the location pattern to match
* @return the result as Resource array
* @throws IOException in case of I/O errors
@@ -289,8 +292,7 @@ public class PathMatchingResourcePatternResolver {
rootDirResource = resolveRootDirResource(rootDirResource);
if (isJarResource(rootDirResource)) {
result.addAll(doFindPathMatchingJarResources(rootDirResource, subPattern));
- }
- else {
+ } else {
result.addAll(doFindPathMatchingFileResources(rootDirResource, subPattern));
}
}
@@ -305,6 +307,7 @@ public class PathMatchingResourcePatternResolver {
* remainder of the location as pattern.
* <p>Will return "/WEB-INF/" for the pattern "/WEB-INF/*.xml",
* for example.
+ *
* @param location the location to check
* @return the part of the location that denotes the root directory
* @see #retrieveMatchingFiles
@@ -326,6 +329,7 @@ public class PathMatchingResourcePatternResolver {
* <p>The default implementation detects an Equinox OSGi "bundleresource:"
* / "bundleentry:" URL and resolves it into a standard jar file URL that
* can be traversed using Spring's standard jar file traversal algorithm.
+ *
* @param original the resource to resolve
* @return the resolved resource (may be identical to the passed-in resource)
* @throws IOException in case of resolution failure
@@ -340,8 +344,9 @@ public class PathMatchingResourcePatternResolver {
* <p>The default implementation checks against the URL protocols
* "jar", "zip" and "wsjar" (the latter are used by BEA WebLogic Server
* and IBM WebSphere, respectively, but can be treated like jar files).
+ *
* @param resource the resource handle to check
- * (usually the root directory to start path matching from)
+ * (usually the root directory to start path matching from)
* @see #doFindPathMatchingJarResources
*/
protected boolean isJarResource(Resource resource) throws IOException {
@@ -351,8 +356,9 @@ public class PathMatchingResourcePatternResolver {
/**
* Find all resources in jar files that match the given location pattern
* via the Ant-style PathMatcher.
+ *
* @param rootDirResource the root directory as Resource
- * @param subPattern the sub pattern to match (below the root directory)
+ * @param subPattern the sub pattern to match (below the root directory)
* @return the Set of matching Resource instances
* @throws IOException in case of I/O errors
* @see java.net.JarURLConnection
@@ -374,8 +380,7 @@ public class PathMatchingResourcePatternResolver {
jarFileUrl = jarCon.getJarFileURL().toExternalForm();
JarEntry jarEntry = jarCon.getJarEntry();
rootEntryPath = (jarEntry != null ? jarEntry.getName() : "");
- }
- else {
+ } else {
// No JarURLConnection -> need to resort to URL file parsing.
// We'll assume URLs of the format "jar:path!/entry", with the protocol
// being arbitrary as long as following the entry format.
@@ -386,8 +391,7 @@ public class PathMatchingResourcePatternResolver {
jarFileUrl = urlFile.substring(0, separatorIndex);
rootEntryPath = urlFile.substring(separatorIndex + GrailsResourceUtils.JAR_URL_SEPARATOR.length());
jarFile = getJarFile(jarFileUrl);
- }
- else {
+ } else {
jarFile = new JarFile(urlFile);
jarFileUrl = urlFile;
rootEntryPath = "";
@@ -402,7 +406,7 @@ public class PathMatchingResourcePatternResolver {
rootEntryPath = rootEntryPath + "/";
}
Set<Resource> result = new LinkedHashSet<Resource>(8);
- for (Enumeration<JarEntry> entries = jarFile.entries(); entries.hasMoreElements();) {
+ for (Enumeration<JarEntry> entries = jarFile.entries(); entries.hasMoreElements(); ) {
JarEntry entry = entries.nextElement();
String entryPath = entry.getName();
if (entryPath.startsWith(rootEntryPath)) {
@@ -413,8 +417,7 @@ public class PathMatchingResourcePatternResolver {
}
}
return result;
- }
- finally {
+ } finally {
// Close jar file, but only if freshly obtained -
// not from JarURLConnection, which might cache the file reference.
if (newJarFile) {
@@ -430,8 +433,7 @@ public class PathMatchingResourcePatternResolver {
if (jarFileUrl.startsWith(GrailsResourceUtils.FILE_URL_PREFIX)) {
try {
return new JarFile(GrailsResourceUtils.toURI(jarFileUrl).getSchemeSpecificPart());
- }
- catch (URISyntaxException ex) {
+ } catch (URISyntaxException ex) {
// Fallback for URLs that are not valid URIs (should hardly ever happen).
return new JarFile(jarFileUrl.substring(GrailsResourceUtils.FILE_URL_PREFIX.length()));
}
@@ -442,8 +444,9 @@ public class PathMatchingResourcePatternResolver {
/**
* Find all resources in the file system that match the given location pattern
* via the Ant-style PathMatcher.
+ *
* @param rootDirResource the root directory as Resource
- * @param subPattern the sub pattern to match (below the root directory)
+ * @param subPattern the sub pattern to match (below the root directory)
* @return the Set of matching Resource instances
* @throws IOException in case of I/O errors
* @see #retrieveMatchingFiles
@@ -454,8 +457,7 @@ public class PathMatchingResourcePatternResolver {
File rootDir;
try {
rootDir = rootDirResource.getFile().getAbsoluteFile();
- }
- catch (IOException ex) {
+ } catch (IOException ex) {
return Collections.emptySet();
}
return doFindMatchingFileSystemResources(rootDir, subPattern);
@@ -464,7 +466,8 @@ public class PathMatchingResourcePatternResolver {
/**
* Find all resources in the file system that match the given location pattern
* via the Ant-style PathMatcher.
- * @param rootDir the root directory in the file system
+ *
+ * @param rootDir the root directory in the file system
* @param subPattern the sub pattern to match (below the root directory)
* @return the Set of matching Resource instances
* @throws IOException in case of I/O errors
@@ -482,9 +485,10 @@ public class PathMatchingResourcePatternResolver {
/**
* Retrieve files that match the given path pattern,
* checking the given directory and its subdirectories.
+ *
* @param rootDir the directory to start from
* @param pattern the pattern to match against,
- * relative to the root directory
+ * relative to the root directory
* @return the Set of matching File instances
* @throws IOException if directory contents could not be retrieved
*/
@@ -500,7 +504,7 @@ public class PathMatchingResourcePatternResolver {
if (!rootDir.canRead()) {
return Collections.emptySet();
}
- String fullPattern = rootDir.getAbsolutePath().replace( File.separator, "/");
+ String fullPattern = rootDir.getAbsolutePath().replace(File.separator, "/");
if (!pattern.startsWith("/")) {
fullPattern += "/";
}
@@ -513,10 +517,11 @@ public class PathMatchingResourcePatternResolver {
/**
* Recursively retrieve files that match the given pattern,
* adding them to the given result list.
+ *
* @param fullPattern the pattern to match against,
- * with prepended root directory path
- * @param dir the current directory
- * @param result the Set of matching File instances to add to
+ * with prepended root directory path
+ * @param dir the current directory
+ * @param result the Set of matching File instances to add to
* @throws IOException if directory contents could not be retrieved
*/
protected void doRetrieveMatchingFiles(String fullPattern, File dir, Set<File> result) throws IOException {
@@ -525,7 +530,7 @@ public class PathMatchingResourcePatternResolver {
return;
}
for (File content : dirContents) {
- String currPath = content.getAbsolutePath().replace( File.separator, "/");
+ String currPath = content.getAbsolutePath().replace(File.separator, "/");
if (content.isDirectory() && getPathMatcher().matchStart(fullPattern, currPath + "/")) {
if (content.canRead()) {
doRetrieveMatchingFiles(fullPattern, content, result);
diff --git a/grails-bootstrap/src/main/groovy/org/grails/io/support/ResourceLocator.java b/grails-bootstrap/src/main/groovy/org/grails/io/support/ResourceLocator.java
index cc753ad658..6b3e4267cc 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/io/support/ResourceLocator.java
+++ b/grails-bootstrap/src/main/groovy/org/grails/io/support/ResourceLocator.java
@@ -36,6 +36,7 @@ import java.util.concurrent.ConcurrentHashMap;
* @since 3.0
*/
public class ResourceLocator {
+
public static final String WILDCARD = "*";
public static final String FILE_SEPARATOR = File.separator;
public static final String CLOSURE_MARKER = "$";
@@ -48,7 +49,7 @@ public class ResourceLocator {
protected List<String> resourceSearchDirectories = new ArrayList<String>();
protected Map<String, Resource> classNameToResourceCache = new ConcurrentHashMap<String, Resource>();
protected Map<String, Resource> uriToResourceCache = new ConcurrentHashMap<String, Resource>();
- protected ResourceLoader defaultResourceLoader = new FileSystemResourceLoader();
+ protected ResourceLoader defaultResourceLoader = new FileSystemResourceLoader();
protected boolean warDeployed = Environment.isWarDeployed();
public void setSearchLocation(String searchLocation) {
@@ -100,16 +101,14 @@ public class ResourceLocator {
if (defaultResource != null && defaultResource.exists()) {
resource = defaultResource;
}
- }
- else {
+ } else {
String uriWebAppRelative = WEB_APP_DIR + uri;
for (String resourceSearchDirectory : resourceSearchDirectories) {
Resource res = resolveExceptionSafe(resourceSearchDirectory + uriWebAppRelative);
if (res.exists()) {
resource = res;
- }
- else if (!warDeployed) {
+ } else if (!warDeployed) {
Resource dir = resolveExceptionSafe(resourceSearchDirectory);
if (dir.exists() && info != null) {
String filename = dir.getFilename();
@@ -124,7 +123,6 @@ public class ResourceLocator {
}
}
-
if (resource == null || !resource.exists()) {
Resource tmp = defaultResourceLoader != null ? defaultResourceLoader.getResource(uri) : null;
if (tmp != null && tmp.exists()) {
@@ -134,15 +132,13 @@ public class ResourceLocator {
if (resource != null) {
uriToResourceCache.put(uri, resource);
- }
- else if (warDeployed) {
+ } else if (warDeployed) {
uriToResourceCache.put(uri, NULL_RESOURCE);
}
}
return resource == NULL_RESOURCE ? null : resource;
}
-
private PluginResourceInfo inferPluginNameFromURI(String uri) {
if (uri.startsWith("/plugins/")) {
String withoutPluginsPath = uri.substring("/plugins/".length(), uri.length());
@@ -173,7 +169,7 @@ public class ResourceLocator {
}
}
if (resource == null || !resource.exists()) {
- for(String ext : new String[]{".groovy", ".java"}) {
+ for (String ext : new String[]{".groovy", ".java"}) {
resource = resolveExceptionSafe(GrailsResourceUtils.DOMAIN_DIR_PATH + "**/" + className + ext);
if (resource != null && resource.exists()) {
classNameToResourceCache.put(className, resource);
@@ -214,8 +210,8 @@ public class ResourceLocator {
defaultResourceLoader = resourceLoader;
}
-
class PluginResourceInfo {
+
String pluginName;
String uri;
}
diff --git a/grails-bootstrap/src/main/groovy/org/grails/io/support/StaticResourceLoader.java b/grails-bootstrap/src/main/groovy/org/grails/io/support/StaticResourceLoader.java
index 08630df935..39f9e19ae3 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/io/support/StaticResourceLoader.java
+++ b/grails-bootstrap/src/main/groovy/org/grails/io/support/StaticResourceLoader.java
@@ -18,7 +18,6 @@
*/
package org.grails.io.support;
-
/**
* Loads relative to a static base resource
*
diff --git a/grails-bootstrap/src/main/groovy/org/grails/io/watch/AbstractDirectoryWatcher.java b/grails-bootstrap/src/main/groovy/org/grails/io/watch/AbstractDirectoryWatcher.java
index 83ff54b689..e6b57acde8 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/io/watch/AbstractDirectoryWatcher.java
+++ b/grails-bootstrap/src/main/groovy/org/grails/io/watch/AbstractDirectoryWatcher.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.io.watch;
import java.io.File;
@@ -24,19 +23,20 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-
/**
* Backend for {@link DirectoryWatcher}
+ *
* @author Craig Andrews
- * @since 2.4
* @see WatchServiceDirectoryWatcher
* @see PollingDirectoryWatcher
* @see DirectoryWatcher
+ * @since 2.4
*/
abstract class AbstractDirectoryWatcher implements Runnable {
- private List<DirectoryWatcher.FileChangeListener> listeners = new ArrayList<DirectoryWatcher.FileChangeListener>();
- volatile protected boolean active = true; //must be volatile as it's read by multiple threads and the value should be reflected in all of them
+
protected long sleepTime = 1000;
+ protected volatile boolean active = true; //must be volatile as it's read by multiple threads and the value should be reflected in all of them
+ private List<DirectoryWatcher.FileChangeListener> listeners = new ArrayList<DirectoryWatcher.FileChangeListener>();
/**
* Sets whether to stop the directory watcher
@@ -44,7 +44,7 @@ abstract class AbstractDirectoryWatcher implements Runnable {
* @param active False if you want to stop watching
*/
public void setActive(boolean active) {
- this.active = active;
+ this.active = active;
}
/**
@@ -85,7 +85,7 @@ abstract class AbstractDirectoryWatcher implements Runnable {
* Adds a directory to watch for the given file and extensions.
* No String in the fileExtensions list can start with a dot (DirectoryWatcher guarantees that)
*
- * @param dir The directory
+ * @param dir The directory
* @param fileExtensions The extensions
*/
public abstract void addWatchDirectory(File dir, List<String> fileExtensions);
@@ -102,8 +102,8 @@ abstract class AbstractDirectoryWatcher implements Runnable {
}
}
- protected boolean isValidDirectoryToMonitor(File file){
- return file.isDirectory() && ! file.isHidden() && !file.getName().startsWith(".");
+ protected boolean isValidDirectoryToMonitor(File file) {
+ return file.isDirectory() && !file.isHidden() && !file.getName().startsWith(".");
}
protected boolean isValidFileToMonitor(File file, Collection<String> fileExtensions) {
@@ -111,7 +111,7 @@ abstract class AbstractDirectoryWatcher implements Runnable {
String path = file.getAbsolutePath();
boolean isSvnFile = path.indexOf(File.separator + DirectoryWatcher.SVN_DIR_NAME + File.separator) > 0;
return !isSvnFile &&
- !file.isDirectory() &&
+ !file.isDirectory() &&
!file.isHidden() &&
!file.getName().startsWith(".") &&
(fileExtensions.contains("*") || fileExtensions.contains(getFilenameExtension(name)));
@@ -120,6 +120,7 @@ abstract class AbstractDirectoryWatcher implements Runnable {
/**
* Extract the filename extension from the given path,
* e.g. "mypath/myfile.txt" -> "txt".
+ *
* @param path the file path (may be {@code null})
* @return the extracted filename extension, or {@code null} if none
*/
diff --git a/grails-bootstrap/src/main/groovy/org/grails/io/watch/DirectoryWatcher.java b/grails-bootstrap/src/main/groovy/org/grails/io/watch/DirectoryWatcher.java
index 52a56dfd8d..6fc68d4459 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/io/watch/DirectoryWatcher.java
+++ b/grails-bootstrap/src/main/groovy/org/grails/io/watch/DirectoryWatcher.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.io.watch;
import org.slf4j.Logger;
@@ -34,11 +33,9 @@ import java.util.List;
*/
public class DirectoryWatcher extends Thread {
- private static final Logger LOG = LoggerFactory.getLogger(DirectoryWatcher.class);
-
- private final AbstractDirectoryWatcher directoryWatcherDelegate;
-
public static final String SVN_DIR_NAME = ".svn";
+ private static final Logger LOG = LoggerFactory.getLogger(DirectoryWatcher.class);
+ private final AbstractDirectoryWatcher directoryWatcherDelegate;
/**
* Constructor. Automatically selects the best means of watching for file system changes.
@@ -47,29 +44,29 @@ public class DirectoryWatcher extends Thread {
setDaemon(true);
AbstractDirectoryWatcher directoryWatcherDelegate;
try {
- if(System.getProperty("os.name").equals("Mac OS X")) {
+ if (System.getProperty("os.name").equals("Mac OS X")) {
Boolean jnaAvailable = false;
try {
- Class.forName( "com.sun.jna.Pointer" );
+ Class.forName("com.sun.jna.Pointer");
jnaAvailable = true;
- } catch( ClassNotFoundException e ) {
- if(LOG.isWarnEnabled()) {
- LOG.warn("Error Initializing Native OS X File Event Watcher. Add JNA to classpath for Faster File Watching performance.");
+ } catch (ClassNotFoundException e) {
+ if (LOG.isWarnEnabled()) {
+ LOG.warn("Error Initializing Native OS X File Event Watcher. Add JNA to classpath for Faster File Watching performance.");
}
-
+
}
- if(jnaAvailable) {
+ if (jnaAvailable) {
directoryWatcherDelegate = (AbstractDirectoryWatcher) Class.forName("org.grails.io.watch.MacOsWatchServiceDirectoryWatcher").newInstance();
} else {
- directoryWatcherDelegate = (AbstractDirectoryWatcher) Class.forName("org.grails.io.watch.WatchServiceDirectoryWatcher").newInstance();
+ directoryWatcherDelegate = (AbstractDirectoryWatcher) Class.forName("org.grails.io.watch.WatchServiceDirectoryWatcher").newInstance();
}
} else {
- directoryWatcherDelegate = (AbstractDirectoryWatcher) Class.forName("org.grails.io.watch.WatchServiceDirectoryWatcher").newInstance();
+ directoryWatcherDelegate = (AbstractDirectoryWatcher) Class.forName("org.grails.io.watch.WatchServiceDirectoryWatcher").newInstance();
}
- } catch (Throwable e) {
- LOG.info("Exception while trying to load WatchServiceDirectoryWatcher (this is probably Java 6 and WatchService isn't available). Falling back to PollingDirectoryWatcher.", e);
- directoryWatcherDelegate = new PollingDirectoryWatcher();
- }
+ } catch (Throwable e) {
+ LOG.info("Exception while trying to load WatchServiceDirectoryWatcher (this is probably Java 6 and WatchService isn't available). Falling back to PollingDirectoryWatcher.", e);
+ directoryWatcherDelegate = new PollingDirectoryWatcher();
+ }
this.directoryWatcherDelegate = directoryWatcherDelegate;
}
@@ -79,7 +76,7 @@ public class DirectoryWatcher extends Thread {
* @param active False if you want to stop watching
*/
public void setActive(boolean active) {
- directoryWatcherDelegate.setActive(active);
+ directoryWatcherDelegate.setActive(active);
}
/**
@@ -88,7 +85,7 @@ public class DirectoryWatcher extends Thread {
* @param sleepTime The sleep time
*/
public void setSleepTime(long sleepTime) {
- directoryWatcherDelegate.setSleepTime(sleepTime);
+ directoryWatcherDelegate.setSleepTime(sleepTime);
}
/**
@@ -97,7 +94,7 @@ public class DirectoryWatcher extends Thread {
* @param listener The file listener
*/
public void addListener(FileChangeListener listener) {
- directoryWatcherDelegate.addListener(listener);
+ directoryWatcherDelegate.addListener(listener);
}
/**
@@ -115,36 +112,36 @@ public class DirectoryWatcher extends Thread {
* @param fileToWatch The file to watch
*/
public void addWatchFile(File fileToWatch) {
- directoryWatcherDelegate.addWatchFile(fileToWatch);
+ directoryWatcherDelegate.addWatchFile(fileToWatch);
}
/**
* Adds a directory to watch for the given file and extensions.
*
- * @param dir The directory
+ * @param dir The directory
* @param fileExtensions The extensions
*/
public void addWatchDirectory(File dir, List<String> fileExtensions) {
- List<String> fileExtensionsWithoutDot = new ArrayList<String>(fileExtensions.size());
- for(String fileExtension : fileExtensions){
- fileExtensionsWithoutDot.add(removeStartingDotIfPresent(fileExtension));
- }
- directoryWatcherDelegate.addWatchDirectory(dir, fileExtensions);
+ List<String> fileExtensionsWithoutDot = new ArrayList<String>(fileExtensions.size());
+ for (String fileExtension : fileExtensions) {
+ fileExtensionsWithoutDot.add(removeStartingDotIfPresent(fileExtension));
+ }
+ directoryWatcherDelegate.addWatchDirectory(dir, fileExtensions);
}
/**
- * Adds a directory to watch for the given file. All files and subdirectories in the directory will be watched.
+ * Adds a directory to watch for the given file. All files and subdirectories in the directory will be watched.
*
* @param dir The directory
*/
public void addWatchDirectory(File dir) {
- addWatchDirectory(dir, "*");
+ addWatchDirectory(dir, "*");
}
/**
* Adds a directory to watch for the given file and extensions.
*
- * @param dir The directory
+ * @param dir The directory
* @param extension The extension
*/
public void addWatchDirectory(File dir, String extension) {
@@ -152,21 +149,33 @@ public class DirectoryWatcher extends Thread {
List<String> fileExtensions = new ArrayList<String>();
if (extension != null && extension.length() > 0) {
int i = extension.lastIndexOf('.');
- if(i > -1) {
+ if (i > -1) {
extension = extension.substring(i + 1);
}
fileExtensions.add(extension);
- }
- else {
+ } else {
fileExtensions.add("*");
}
addWatchDirectory(dir, fileExtensions);
}
+ @Override
+ public void run() {
+ directoryWatcherDelegate.run();
+ }
+
+ private String removeStartingDotIfPresent(String extension) {
+ if (extension.startsWith(".")) {
+ extension = extension.substring(1);
+ }
+ return extension;
+ }
+
/**
* Interface for FileChangeListeners
*/
public static interface FileChangeListener {
+
/**
* Fired when a file changes
*
@@ -181,16 +190,4 @@ public class DirectoryWatcher extends Thread {
*/
void onNew(File file);
}
-
- @Override
- public void run() {
- directoryWatcherDelegate.run();
- }
-
- private String removeStartingDotIfPresent(String extension) {
- if (extension.startsWith(".")) {
- extension = extension.substring(1);
- }
- return extension;
- }
}
diff --git a/grails-bootstrap/src/main/groovy/org/grails/io/watch/FileExtensionFileChangeListener.groovy b/grails-bootstrap/src/main/groovy/org/grails/io/watch/FileExtensionFileChangeListener.groovy
index 8e38c2cadf..47ad0fe301 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/io/watch/FileExtensionFileChangeListener.groovy
+++ b/grails-bootstrap/src/main/groovy/org/grails/io/watch/FileExtensionFileChangeListener.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.io.watch
import groovy.transform.CompileStatic
@@ -38,7 +37,7 @@ abstract class FileExtensionFileChangeListener implements DirectoryWatcher.FileC
@Override
final void onChange(File file) {
- if(file && extensions.any() { String ext -> file.name.endsWith( ext ) } ) {
+ if (file && extensions.any() { String ext -> file.name.endsWith(ext) }) {
onChange(file, extensions)
}
}
@@ -47,7 +46,7 @@ abstract class FileExtensionFileChangeListener implements DirectoryWatcher.FileC
@Override
final void onNew(File file) {
- if(file && extensions.any() { String ext -> file.name.endsWith( ext ) } ) {
+ if (file && extensions.any() { String ext -> file.name.endsWith(ext) }) {
onNew(file, extensions)
}
}
diff --git a/grails-bootstrap/src/main/groovy/org/grails/io/watch/MacOsWatchServiceDirectoryWatcher.java b/grails-bootstrap/src/main/groovy/org/grails/io/watch/MacOsWatchServiceDirectoryWatcher.java
index 9120c534c5..963cf194cb 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/io/watch/MacOsWatchServiceDirectoryWatcher.java
+++ b/grails-bootstrap/src/main/groovy/org/grails/io/watch/MacOsWatchServiceDirectoryWatcher.java
@@ -16,55 +16,68 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.io.watch;
-import java.nio.file.WatchEvent.Kind;
import io.methvin.watchservice.MacOSXListeningWatchService;
import io.methvin.watchservice.WatchablePath;
-import static io.methvin.watcher.DirectoryChangeEvent.EventType.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+
import java.io.File;
import java.io.IOException;
-import java.nio.file.*;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.StandardWatchEventKinds;
+import java.nio.file.WatchEvent;
+import java.nio.file.WatchEvent.Kind;
+import java.nio.file.WatchKey;
+import java.nio.file.WatchService;
import java.nio.file.attribute.BasicFileAttributes;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
/**
* Implementation of a {@link AbstractDirectoryWatcher} that uses {@link java.nio.WatchService}.
* This implementation is used for Java 7 and later.
+ *
* @author Eric Helgeson
* @author David Estes
- * @since 3.2
* @see DirectoryWatcher
+ * @since 3.2
*/
class MacOsWatchServiceDirectoryWatcher extends AbstractDirectoryWatcher {
- private static final Logger LOG = LoggerFactory.getLogger(MacOsWatchServiceDirectoryWatcher.class);
+ private static final Logger LOG = LoggerFactory.getLogger(MacOsWatchServiceDirectoryWatcher.class);
private Map<WatchKey, List<String>> watchKeyToExtensionsMap = new ConcurrentHashMap<WatchKey, List<String>>();
private Set<Path> individualWatchedFiles = new HashSet<Path>();
- private final WatchService watchService;
+ private final WatchService watchService;
+
+ public MacOsWatchServiceDirectoryWatcher() {
+ try {
+ watchService = new MacOSXListeningWatchService();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
@SuppressWarnings("unchecked")
private static <T> WatchEvent<T> cast(WatchEvent<?> event) {
- return (WatchEvent<T>)event;
+ return (WatchEvent<T>) event;
}
- public MacOsWatchServiceDirectoryWatcher(){
- try {
- watchService = new MacOSXListeningWatchService();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public void run() {
+ @Override
+ public void run() {
while (active) {
- try {
+ try {
WatchKey watchKey;
try {
watchKey = watchService.take();
@@ -81,17 +94,16 @@ class MacOsWatchServiceDirectoryWatcher extends AbstractDirectoryWatcher {
WatchEvent<Path> pathWatchEvent = cast(watchEvent);
Path child = pathWatchEvent.context();
File childFile = child.toFile();
- if(individualWatchedFiles.contains(child) || individualWatchedFiles.contains(child.normalize())){
- if(kind == StandardWatchEventKinds.ENTRY_CREATE){
+ if (individualWatchedFiles.contains(child) || individualWatchedFiles.contains(child.normalize())) {
+ if (kind == StandardWatchEventKinds.ENTRY_CREATE) {
fireOnNew(childFile);
- }else if(kind == StandardWatchEventKinds.ENTRY_MODIFY){
+ } else if (kind == StandardWatchEventKinds.ENTRY_MODIFY) {
fireOnChange(childFile);
- }else if(kind == StandardWatchEventKinds.ENTRY_DELETE){
- // do nothing... there's no way to communicate deletions
- }
- }else{
+ } // else if (kind == StandardWatchEventKinds.ENTRY_DELETE)
+ // do nothing... there's no way to communicate deletions
+ } else {
List<String> fileExtensions = watchKeyToExtensionsMap.get(watchKey);
- if(fileExtensions==null){
+ if (fileExtensions == null) {
// this event didn't match a file in individualWatchedFiles so it's a not an individual file we're interested in
// this event also didn't match a directory that we're interested in (if it did, fileExtentions wouldn't be null)
// so it must be event for a file we're not interested in. An example of how this can happen is:
@@ -102,98 +114,100 @@ class MacOsWatchServiceDirectoryWatcher extends AbstractDirectoryWatcher {
// Now, /images/b.png is changed. Because java.nio.file.WatchService watches directories, it gets a WatchEvent
// for /images/b.png. But we aren't interested in that.
LOG.debug("WatchService received an event for a file/directory that it's not interested in.");
- }else{
- if(kind==StandardWatchEventKinds.ENTRY_CREATE){
+ } else {
+ if (kind == StandardWatchEventKinds.ENTRY_CREATE) {
// new directory created, so watch its contents
- addWatchDirectory(child,fileExtensions);
- if(childFile.isDirectory() && childFile.exists()) {
+ addWatchDirectory(child, fileExtensions);
+ if (childFile.isDirectory() && childFile.exists()) {
final File[] files = childFile.listFiles();
- if(files != null) {
+ if (files != null) {
for (File newFile : files) {
- if(isValidFileToMonitor(newFile, fileExtensions)) {
+ if (isValidFileToMonitor(newFile, fileExtensions)) {
fireOnNew(newFile);
}
}
}
}
}
- if(isValidFileToMonitor(childFile,fileExtensions)){
- if(kind == StandardWatchEventKinds.ENTRY_CREATE){
+ if (isValidFileToMonitor(childFile, fileExtensions)) {
+ if (kind == StandardWatchEventKinds.ENTRY_CREATE) {
fireOnNew(childFile);
- }else if(kind == StandardWatchEventKinds.ENTRY_MODIFY){
+ } else if (kind == StandardWatchEventKinds.ENTRY_MODIFY) {
fireOnChange(childFile);
- }else if(kind == StandardWatchEventKinds.ENTRY_DELETE){
- // do nothing... there's no way to communicate deletions
- }
+ } // else if (kind == StandardWatchEventKinds.ENTRY_DELETE)
+ // do nothing... there's no way to communicate deletions
}
}
}
}
watchKey.reset();
- } catch (Exception e) {
+ } catch (Exception e) {
LOG.error(e.toString());
// ignore
- }
+ }
}
try {
- watchService.close();
- } catch (IOException e) {
- LOG.debug("Exception while closing watchService", e);
- }
- }
+ watchService.close();
+ } catch (IOException e) {
+ LOG.debug("Exception while closing watchService", e);
+ }
+ }
- @Override
- public void addWatchFile(File fileToWatch) {
- if(!isValidFileToMonitor(fileToWatch, Arrays.asList("*"))) return;
- try {
- if(!fileToWatch.exists()) return;
- Path pathToWatch = fileToWatch.toPath().toAbsolutePath();
- individualWatchedFiles.add(pathToWatch);
+ @Override
+ public void addWatchFile(File fileToWatch) {
+ if (!isValidFileToMonitor(fileToWatch, Arrays.asList("*"))) {
+ return;
+ }
+ try {
+ if (!fileToWatch.exists()) {
+ return;
+ }
+ Path pathToWatch = fileToWatch.toPath().toAbsolutePath();
+ individualWatchedFiles.add(pathToWatch);
WatchablePath watchPath = new WatchablePath(pathToWatch);
- Kind[] events = new Kind[] { StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY };
- watchPath.register(watchService, events);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
+ Kind[] events = new Kind[]{StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY};
+ watchPath.register(watchService, events);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
- @Override
- public void addWatchDirectory(File dir, final List<String> fileExtensions) {
- Path dirPath = dir.toPath();
- addWatchDirectory(dirPath, fileExtensions);
- }
+ @Override
+ public void addWatchDirectory(File dir, final List<String> fileExtensions) {
+ Path dirPath = dir.toPath();
+ addWatchDirectory(dirPath, fileExtensions);
+ }
- private void addWatchDirectory(Path dir, final List<String> fileExtensions) {
- if(!isValidDirectoryToMonitor(dir.toFile())){
- return;
- }
- try {
- //add the subdirectories too
- Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
- @Override
- public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
- throws IOException
- {
- if(!isValidDirectoryToMonitor(dir.toFile())){
- return FileVisitResult.SKIP_SUBTREE;
- }
+ private void addWatchDirectory(Path dir, final List<String> fileExtensions) {
+ if (!isValidDirectoryToMonitor(dir.toFile())) {
+ return;
+ }
+ try {
+ //add the subdirectories too
+ Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
+ @Override
+ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
+ throws IOException {
+ if (!isValidDirectoryToMonitor(dir.toFile())) {
+ return FileVisitResult.SKIP_SUBTREE;
+ }
WatchablePath watchPath = new WatchablePath(dir);
- Kind[] events = new Kind[] { StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY };
- WatchKey watchKey = watchPath.register(watchService, events);
- final List<String> originalFileExtensions = watchKeyToExtensionsMap.get(watchKey);
- if(originalFileExtensions==null){
- watchKeyToExtensionsMap.put(watchKey, fileExtensions);
- }else{
- final HashSet<String> newFileExtensions = new HashSet<String>(originalFileExtensions);
- newFileExtensions.addAll(fileExtensions);
- watchKeyToExtensionsMap.put(watchKey, Collections.unmodifiableList(new ArrayList(newFileExtensions)));
- }
- return FileVisitResult.CONTINUE;
- }
- });
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
+ Kind[] events = new Kind[]{StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY};
+ WatchKey watchKey = watchPath.register(watchService, events);
+ final List<String> originalFileExtensions = watchKeyToExtensionsMap.get(watchKey);
+ if (originalFileExtensions == null) {
+ watchKeyToExtensionsMap.put(watchKey, fileExtensions);
+ } else {
+ final HashSet<String> newFileExtensions = new HashSet<String>(originalFileExtensions);
+ newFileExtensions.addAll(fileExtensions);
+ watchKeyToExtensionsMap.put(watchKey, Collections.unmodifiableList(new ArrayList(newFileExtensions)));
+ }
+ return FileVisitResult.CONTINUE;
+ }
+ });
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
}
diff --git a/grails-bootstrap/src/main/groovy/org/grails/io/watch/PollingDirectoryWatcher.java b/grails-bootstrap/src/main/groovy/org/grails/io/watch/PollingDirectoryWatcher.java
index 94090900f8..bb169aa709 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/io/watch/PollingDirectoryWatcher.java
+++ b/grails-bootstrap/src/main/groovy/org/grails/io/watch/PollingDirectoryWatcher.java
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.io.watch;
import java.io.File;
@@ -31,10 +30,11 @@ import java.util.concurrent.ConcurrentLinkedQueue;
/**
* Implementation of a {@link AbstractDirectoryWatcher} that uses polling.
* This implementation is used where {@link java.nio.WatchService} isn't available (pre Java 7).
+ *
* @author Craig Andrews
- * @since 2.4
* @see WatchServiceDirectoryWatcher
* @see DirectoryWatcher
+ * @since 2.4
*/
class PollingDirectoryWatcher extends AbstractDirectoryWatcher {
@@ -44,8 +44,8 @@ class PollingDirectoryWatcher extends AbstractDirectoryWatcher {
private Map<File, Collection<String>> directoryToExtensionsMap = new ConcurrentHashMap<File, Collection<String>>();
private Map<File, Long> directoryWatch = new ConcurrentHashMap<File, Long>();
- @Override
- public void run() {
+ @Override
+ public void run() {
int count = 0;
while (active) {
Set<File> files = lastModifiedMap.keySet();
@@ -68,28 +68,27 @@ class PollingDirectoryWatcher extends AbstractDirectoryWatcher {
// ignore
}
}
- }
+ }
- @Override
- public void addWatchFile(File fileToWatch) {
+ @Override
+ public void addWatchFile(File fileToWatch) {
lastModifiedMap.put(fileToWatch, fileToWatch.lastModified());
- }
+ }
- @Override
- public void addWatchDirectory(File dir, List<String> fileExtensions) {
- if(!isValidDirectoryToMonitor(dir)){
- return;
- }
+ @Override
+ public void addWatchDirectory(File dir, List<String> fileExtensions) {
+ if (!isValidDirectoryToMonitor(dir)) {
+ return;
+ }
trackDirectoryExtensions(dir, fileExtensions);
cacheFilesForDirectory(dir, fileExtensions, false);
- }
+ }
private void trackDirectoryExtensions(File dir, List<String> fileExtensions) {
Collection<String> existingExtensions = directoryToExtensionsMap.get(dir);
- if(existingExtensions == null) {
+ if (existingExtensions == null) {
directoryToExtensionsMap.put(dir, new ArrayList<String>(fileExtensions));
- }
- else {
+ } else {
existingExtensions.addAll(fileExtensions);
}
}
@@ -100,7 +99,7 @@ class PollingDirectoryWatcher extends AbstractDirectoryWatcher {
if (currentTimestamp < directory.lastModified()) {
Collection<String> extensions = directoryToExtensionsMap.get(directory);
- if(extensions == null) {
+ if (extensions == null) {
extensions = this.extensions;
}
cacheFilesForDirectory(directory, extensions, true);
@@ -118,10 +117,9 @@ class PollingDirectoryWatcher extends AbstractDirectoryWatcher {
}
for (File file : files) {
- if(isValidDirectoryToMonitor(file)) {
+ if (isValidDirectoryToMonitor(file)) {
cacheFilesForDirectory(file, fileExtensions, fireEvent);
- }
- else if (isValidFileToMonitor(file, fileExtensions)) {
+ } else if (isValidFileToMonitor(file, fileExtensions)) {
if (!lastModifiedMap.containsKey(file) && fireEvent) {
fireOnNew(file);
}
diff --git a/grails-bootstrap/src/main/groovy/org/grails/io/watch/WatchServiceDirectoryWatcher.java b/grails-bootstrap/src/main/groovy/org/grails/io/watch/WatchServiceDirectoryWatcher.java
index 60dc0bb8b9..072dcdec41 100644
--- a/grails-bootstrap/src/main/groovy/org/grails/io/watch/WatchServiceDirectoryWatcher.java
+++ b/grails-bootstrap/src/main/groovy/org/grails/io/watch/WatchServiceDirectoryWatcher.java
@@ -16,9 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package org.grails.io.watch;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.io.File;
import java.io.IOException;
import java.nio.file.FileSystems;
@@ -31,8 +33,8 @@ import java.nio.file.WatchEvent;
import java.nio.file.WatchKey;
import java.nio.file.WatchService;
import java.nio.file.attribute.BasicFileAttributes;
-import java.util.Arrays;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -41,166 +43,165 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
* Implementation of a {@link AbstractDirectoryWatcher} that uses {@link java.nio.WatchService}.
* This implementation is used for Java 7 and later.
+ *
* @author Craig Andrews
- * @since 2.4
* @see WatchServiceDirectoryWatcher
* @see DirectoryWatcher
+ * @since 2.4
*/
class WatchServiceDirectoryWatcher extends AbstractDirectoryWatcher {
- private static final Logger LOG = LoggerFactory.getLogger(WatchServiceDirectoryWatcher.class);
+ private static final Logger LOG = LoggerFactory.getLogger(WatchServiceDirectoryWatcher.class);
private Map<WatchKey, List<String>> watchKeyToExtensionsMap = new ConcurrentHashMap<WatchKey, List<String>>();
private Set<Path> individualWatchedFiles = new HashSet<Path>();
- private final WatchService watchService;
+ private final WatchService watchService;
+
+ public WatchServiceDirectoryWatcher() {
+ try {
+ watchService = FileSystems.getDefault().newWatchService();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
@SuppressWarnings("unchecked")
private static <T> WatchEvent<T> cast(WatchEvent<?> event) {
- return (WatchEvent<T>)event;
+ return (WatchEvent<T>) event;
}
- public WatchServiceDirectoryWatcher(){
- try {
- watchService = FileSystems.getDefault().newWatchService();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public void run() {
+ @Override
+ public void run() {
while (active) {
- try {
- WatchKey watchKey = watchService.poll(sleepTime, TimeUnit.MILLISECONDS);
- if(watchKey!=null){
- List<WatchEvent<?>> watchEvents = watchKey.pollEvents();
- for(WatchEvent<?> watchEvent : watchEvents){
- WatchEvent.Kind<?> kind = watchEvent.kind();
- if (kind == StandardWatchEventKinds.OVERFLOW) {
- // TODO how is this supposed to be handled? I think the best thing to do is ignore it, but I'm not positive
- LOG.warn("WatchService Overflow occurred");
- continue;
- }
- WatchEvent<Path> pathWatchEvent = cast(watchEvent);
- Path name = pathWatchEvent.context();
- Path dir = (Path) watchKey.watchable();
- Path child = dir.resolve(name).toAbsolutePath();
- File childFile = child.toFile();
- if(individualWatchedFiles.contains(child) || individualWatchedFiles.contains(child.normalize())){
- if(kind == StandardWatchEventKinds.ENTRY_CREATE){
- fireOnNew(childFile);
- }else if(kind == StandardWatchEventKinds.ENTRY_MODIFY){
- fireOnChange(childFile);
- }else if(kind == StandardWatchEventKinds.ENTRY_DELETE){
- // do nothing... there's no way to communicate deletions
- }
- }else{
- List<String> fileExtensions = watchKeyToExtensionsMap.get(watchKey);
- if(fileExtensions==null){
- // this event didn't match a file in individualWatchedFiles so it's a not an individual file we're interested in
- // this event also didn't match a directory that we're interested in (if it did, fileExtentions wouldn't be null)
- // so it must be event for a file we're not interested in. An example of how this can happen is:
- // there's a directory with files in it like this:
- // /images/a.png
- // /images/b.png
- // by using the addWatchFile method, /images/a.png is watched.
- // Now, /images/b.png is changed. Because java.nio.file.WatchService watches directories, it gets a WatchEvent
- // for /images/b.png. But we aren't interested in that.
- LOG.debug("WatchService received an event for a file/directory that it's not interested in.");
- }else{
- if(kind==StandardWatchEventKinds.ENTRY_CREATE){
- // new directory created, so watch its contents
- addWatchDirectory(child,fileExtensions);
- if(childFile.isDirectory() && childFile.exists()) {
- final File[] files = childFile.listFiles();
- if(files != null) {
- for (File newFile : files) {
- if(isValidFileToMonitor(newFile, fileExtensions)) {
- fireOnNew(newFile);
- }
- }
- }
- }
- }
- if(isValidFileToMonitor(childFile,fileExtensions)){
- if(kind == StandardWatchEventKinds.ENTRY_CREATE){
- fireOnNew(childFile);
- }else if(kind == StandardWatchEventKinds.ENTRY_MODIFY){
- fireOnChange(childFile);
- }else if(kind == StandardWatchEventKinds.ENTRY_DELETE){
- // do nothing... there's no way to communicate deletions
- }
- }
- }
- }
- }
- watchKey.reset();
- }
- } catch (InterruptedException e) {
- // ignore
- }
+ try {
+ WatchKey watchKey = watchService.poll(sleepTime, TimeUnit.MILLISECONDS);
+ if (watchKey != null) {
+ List<WatchEvent<?>> watchEvents = watchKey.pollEvents();
+ for (WatchEvent<?> watchEvent : watchEvents) {
+ WatchEvent.Kind<?> kind = watchEvent.kind();
+ if (kind == StandardWatchEventKinds.OVERFLOW) {
+ // TODO how is this supposed to be handled? I think the best thing to do is ignore it, but I'm not positive
+ LOG.warn("WatchService Overflow occurred");
+ continue;
+ }
+ WatchEvent<Path> pathWatchEvent = cast(watchEvent);
+ Path name = pathWatchEvent.context();
+ Path dir = (Path) watchKey.watchable();
+ Path child = dir.resolve(name).toAbsolutePath();
+ File childFile = child.toFile();
+ if (individualWatchedFiles.contains(child) || individualWatchedFiles.contains(child.normalize())) {
+ if (kind == StandardWatchEventKinds.ENTRY_CREATE) {
+ fireOnNew(childFile);
+ } else if (kind == StandardWatchEventKinds.ENTRY_MODIFY) {
+ fireOnChange(childFile);
+ } // else if (kind == StandardWatchEventKinds.ENTRY_DELETE) {
+ // do nothing... there's no way to communicate deletions
+ } else {
+ List<String> fileExtensions = watchKeyToExtensionsMap.get(watchKey);
+ if (fileExtensions == null) {
+ // this event didn't match a file in individualWatchedFiles so it's a not an individual file we're interested in
+ // this event also didn't match a directory that we're interested in (if it did, fileExtentions wouldn't be null)
+ // so it must be event for a file we're not interested in. An example of how this can happen is:
+ // there's a directory with files in it like this:
+ // /images/a.png
+ // /images/b.png
+ // by using the addWatchFile method, /images/a.png is watched.
+ // Now, /images/b.png is changed. Because java.nio.file.WatchService watches directories, it gets a WatchEvent
+ // for /images/b.png. But we aren't interested in that.
+ LOG.debug("WatchService received an event for a file/directory that it's not interested in.");
+ } else {
+ if (kind == StandardWatchEventKinds.ENTRY_CREATE) {
+ // new directory created, so watch its contents
+ addWatchDirectory(child, fileExtensions);
+ if (childFile.isDirectory() && childFile.exists()) {
+ final File[] files = childFile.listFiles();
+ if (files != null) {
+ for (File newFile : files) {
+ if (isValidFileToMonitor(newFile, fileExtensions)) {
+ fireOnNew(newFile);
+ }
+ }
+ }
+ }
+ }
+ if (isValidFileToMonitor(childFile, fileExtensions)) {
+ if (kind == StandardWatchEventKinds.ENTRY_CREATE) {
+ fireOnNew(childFile);
+ } else if (kind == StandardWatchEventKinds.ENTRY_MODIFY) {
+ fireOnChange(childFile);
+ } // else if (kind == StandardWatchEventKinds.ENTRY_DELETE) {
+ // do nothing... there's no way to communicate deletions
+ }
+ }
+ }
+ }
+ watchKey.reset();
+ }
+ } catch (InterruptedException e) {
+ // ignore
+ }
}
try {
- watchService.close();
- } catch (IOException e) {
- LOG.debug("Exception while closing watchService", e);
- }
- }
+ watchService.close();
+ } catch (IOException e) {
+ LOG.debug("Exception while closing watchService", e);
+ }
+ }
- @Override
- public void addWatchFile(File fileToWatch) {
- if(!isValidFileToMonitor(fileToWatch, Arrays.asList("*"))) return;
- try {
- if(!fileToWatch.exists()) return;
- Path pathToWatch = fileToWatch.toPath().toAbsolutePath();
- individualWatchedFiles.add(pathToWatch);
- pathToWatch.getParent().register(watchService, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
+ @Override
+ public void addWatchFile(File fileToWatch) {
+ if (!isValidFileToMonitor(fileToWatch, Arrays.asList("*"))) {
+ return;
+ }
+ try {
+ if (!fileToWatch.exists()) {
+ return;
+ }
+ Path pathToWatch = fileToWatch.toPath().toAbsolutePath();
+ individualWatchedFiles.add(pathToWatch);
+ pathToWatch.getParent().register(watchService, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
- @Override
- public void addWatchDirectory(File dir, final List<String> fileExtensions) {
- Path dirPath = dir.toPath();
- addWatchDirectory(dirPath, fileExtensions);
- }
+ @Override
+ public void addWatchDirectory(File dir, final List<String> fileExtensions) {
+ Path dirPath = dir.toPath();
+ addWatchDirectory(dirPath, fileExtensions);
+ }
- private void addWatchDirectory(Path dir, final List<String> fileExtensions) {
- if(!isValidDirectoryToMonitor(dir.toFile())){
- return;
- }
- try {
- //add the subdirectories too
- Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
- @Override
- public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
- throws IOException
- {
- if(!isValidDirectoryToMonitor(dir.toFile())){
- return FileVisitResult.SKIP_SUBTREE;
- }
- WatchKey watchKey = dir.register(watchService, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY);
- final List<String> originalFileExtensions = watchKeyToExtensionsMap.get(watchKey);
- if(originalFileExtensions==null){
- watchKeyToExtensionsMap.put(watchKey, fileExtensions);
- }else{
- final HashSet<String> newFileExtensions = new HashSet<String>(originalFileExtensions);
- newFileExtensions.addAll(fileExtensions);
- watchKeyToExtensionsMap.put(watchKey, Collections.unmodifiableList(new ArrayList(newFileExtensions)));
- }
- return FileVisitResult.CONTINUE;
- }
- });
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
+ private void addWatchDirectory(Path dir, final List<String> fileExtensions) {
+ if (!isValidDirectoryToMonitor(dir.toFile())) {
+ return;
+ }
+ try {
+ //add the subdirectories too
+ Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
+ @Override
+ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
+ throws IOException {
+ if (!isValidDirectoryToMonitor(dir.toFile())) {
+ return FileVisitResult.SKIP_SUBTREE;
+ }
+ WatchKey watchKey = dir.register(watchService, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY);
+ final List<String> originalFileExtensions = watchKeyToExtensionsMap.get(watchKey);
+ if (originalFileExtensions == null) {
+ watchKeyToExtensionsMap.put(watchKey, fileExtensions);
+ } else {
+ final HashSet<String> newFileExtensions = new HashSet<String>(originalFileExtensions);
+ newFileExtensions.addAll(fileExtensions);
+ watchKeyToExtensionsMap.put(watchKey, Collections.unmodifiableList(new ArrayList(newFileExtensions)));
+ }
+ return FileVisitResult.CONTINUE;
+ }
+ });
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
}
diff --git a/grails-cache/build.gradle b/grails-cache/build.gradle
index 2575e34f18..e4fa085e69 100644
--- a/grails-cache/build.gradle
+++ b/grails-cache/build.gradle
@@ -64,4 +64,5 @@ apply {
from rootProject.layout.projectDirectory.file('gradle/publish-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/test-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/grails-extension-gradle-config.gradle')
+ from rootProject.layout.projectDirectory.file('gradle/style-enforcement-config.gradle')
}
diff --git a/grails-cache/grails-app/taglib/grails/plugin/cache/CacheTagLib.groovy b/grails-cache/grails-app/taglib/grails/plugin/cache/CacheTagLib.groovy
index 6d57ea3b3d..37310a2460 100644
--- a/grails-cache/grails-app/taglib/grails/plugin/cache/CacheTagLib.groovy
+++ b/grails-cache/grails-app/taglib/grails/plugin/cache/CacheTagLib.groovy
@@ -31,7 +31,6 @@ import org.springframework.web.context.request.RequestContextHolder
@Slf4j
class CacheTagLib {
-
static namespace = 'cache'
GrailsCacheManager grailsCacheManager
diff --git a/grails-cache/src/ast/groovy/grails/plugin/cache/CacheEvict.java b/grails-cache/src/ast/groovy/grails/plugin/cache/CacheEvict.java
index 4d289f41fe..bf3fd379c9 100644
--- a/grails-cache/src/ast/groovy/grails/plugin/cache/CacheEvict.java
+++ b/grails-cache/src/ast/groovy/grails/plugin/cache/CacheEvict.java
@@ -20,7 +20,12 @@ package grails.plugin.cache;
import org.codehaus.groovy.transform.GroovyASTTransformationClass;
-import java.lang.annotation.*;
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
* Indicates that a method (or all methods on a class) trigger(s)
@@ -36,30 +41,30 @@ import java.lang.annotation.*;
@GroovyASTTransformationClass("org.grails.plugin.cache.compiler.CacheEvictTransformation")
public @interface CacheEvict {
- /**
- * Qualifier value for the specified cached operation.
- * <p>May be used to determine the target cache (or caches), matching the qualifier
- * value.
- */
- String[] value();
+ /**
+ * Qualifier value for the specified cached operation.
+ * <p>May be used to determine the target cache (or caches), matching the qualifier
+ * value.
+ */
+ String[] value();
- /**
- * A closure for computing the key dynamically.
- * <p>Default is null, meaning all method parameters are considered as a key.
- */
- Class[] key() default {};
+ /**
+ * A closure for computing the key dynamically.
+ * <p>Default is null, meaning all method parameters are considered as a key.
+ */
+ Class[] key() default {};
- /**
- * A closure used for conditioning the method caching.
- * <p>Default is null, meaning the method is always cached.
- */
- Class[] condition() default {};
+ /**
+ * A closure used for conditioning the method caching.
+ * <p>Default is null, meaning the method is always cached.
+ */
+ Class[] condition() default {};
- /**
- * Whether or not all the entries inside the cache(s) are removed or not. By
- * default, only the value under the associated key is removed.
- * <p>Note that specifying setting this parameter to true and specifying a
- * CacheKey is not allowed.
- */
- boolean allEntries() default false;
+ /**
+ * Whether or not all the entries inside the cache(s) are removed or not. By
+ * default, only the value under the associated key is removed.
+ * <p>Note that specifying setting this parameter to true and specifying a
+ * CacheKey is not allowed.
+ */
+ boolean allEntries() default false;
}
diff --git a/grails-cache/src/ast/groovy/grails/plugin/cache/CachePut.java b/grails-cache/src/ast/groovy/grails/plugin/cache/CachePut.java
index 4be40c5273..c053ca2dca 100644
--- a/grails-cache/src/ast/groovy/grails/plugin/cache/CachePut.java
+++ b/grails-cache/src/ast/groovy/grails/plugin/cache/CachePut.java
@@ -20,7 +20,12 @@ package grails.plugin.cache;
import org.codehaus.groovy.transform.GroovyASTTransformationClass;
-import java.lang.annotation.*;
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
/**
* Indicates that a method (or all methods on a class) trigger(s)
@@ -31,23 +36,23 @@ import java.lang.annotation.*;
* @author Jeff Brown
* @author Graeme Rocher
*/
-@Target({ ElementType.METHOD, ElementType.TYPE })
+@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
@GroovyASTTransformationClass("org.grails.plugin.cache.compiler.CachePutTransformation")
public @interface CachePut {
- /**
- * Name of the caches in which the update takes place.
- * <p>May be used to determine the target cache (or caches), matching the
- * qualifier value.
- */
- String[] value();
+ /**
+ * Name of the caches in which the update takes place.
+ * <p>May be used to determine the target cache (or caches), matching the
+ * qualifier value.
+ */
+ String[] value();
- /**
- * A closure for computing the key dynamically.
- * <p>Default is null, meaning all method parameters are considered as a key.
- */
- Class[] key() default {};
+ /**
+ * A closure for computing the key dynamically.
+ * <p>Default is null, meaning all method parameters are considered as a key.
+ */
+ Class[] key() default {};
}
diff --git a/grails-cache/src/ast/groovy/grails/plugin/cache/Cacheable.java b/grails-cache/src/ast/groovy/grails/plugin/cache/Cacheable.java
index a6b1454727..74bbd8c03c 100644
--- a/grails-cache/src/ast/groovy/grails/plugin/cache/Cacheable.java
+++ b/grails-cache/src/ast/groovy/grails/plugin/cache/Cacheable.java
@@ -18,6 +18,8 @@
*/
package grails.plugin.cache;
+import org.codehaus.groovy.transform.GroovyASTTransformationClass;
+
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
@@ -25,8 +27,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import org.codehaus.groovy.transform.GroovyASTTransformationClass;
-
/**
* Indicates that a method (or all the methods on a class) can be cached.
*
diff --git a/grails-cache/src/ast/groovy/grails/plugin/cache/CustomCacheKeyGenerator.groovy b/grails-cache/src/ast/groovy/grails/plugin/cache/CustomCacheKeyGenerator.groovy
index e67226f8b3..a301fca14e 100644
--- a/grails-cache/src/ast/groovy/grails/plugin/cache/CustomCacheKeyGenerator.groovy
+++ b/grails-cache/src/ast/groovy/grails/plugin/cache/CustomCacheKeyGenerator.groovy
@@ -125,7 +125,6 @@ class CustomCacheKeyGenerator implements KeyGenerator, GrailsCacheKeyGenerator {
return new TemporaryGrailsCacheKey(className, methodName, objHashCode, simpleKey)
}
-
@CompileStatic
private static class TemporaryGrailsCacheKey implements Serializable {
final String targetClassName
diff --git a/grails-cache/src/ast/groovy/org/grails/plugin/cache/GrailsCacheManager.java b/grails-cache/src/ast/groovy/org/grails/plugin/cache/GrailsCacheManager.java
index 0b5a4fa000..116b4eb7cd 100644
--- a/grails-cache/src/ast/groovy/org/grails/plugin/cache/GrailsCacheManager.java
+++ b/grails-cache/src/ast/groovy/org/grails/plugin/cache/GrailsCacheManager.java
@@ -25,18 +25,19 @@ import org.springframework.cache.CacheManager;
*/
public interface GrailsCacheManager extends CacheManager {
- /**
- * Whether the cache for the given name exits
- *
- * @param name The name of the cache
- * @return True if it does
- */
- boolean cacheExists(String name);
+ /**
+ * Whether the cache for the given name exits
+ *
+ * @param name The name of the cache
+ * @return True if it does
+ */
+ boolean cacheExists(String name);
- /**
- * Destroys the given named cache
- * @param name The name of the cache
- * @return True if it was destroyed
- */
- boolean destroyCache(String name);
+ /**
+ * Destroys the given named cache
+ *
+ * @param name The name of the cache
+ * @return True if it was destroyed
+ */
+ boolean destroyCache(String name);
}
diff --git a/grails-cache/src/ast/groovy/org/grails/plugin/cache/compiler/AbstractCacheTransformation.groovy b/grails-cache/src/ast/groovy/org/grails/plugin/cache/compiler/AbstractCacheTransformation.groovy
index 09fd88b450..73f15ce7a5 100644
--- a/grails-cache/src/ast/groovy/org/grails/plugin/cache/compiler/AbstractCacheTransformation.groovy
+++ b/grails-cache/src/ast/groovy/org/grails/plugin/cache/compiler/AbstractCacheTransformation.groovy
@@ -22,8 +22,21 @@ package org.grails.plugin.cache.compiler
import grails.gorm.multitenancy.Tenants
import grails.plugin.cache.GrailsCacheKeyGenerator
import groovy.transform.CompileStatic
-import org.codehaus.groovy.ast.*
-import org.codehaus.groovy.ast.expr.*
+import org.codehaus.groovy.ast.AnnotationNode
+import org.codehaus.groovy.ast.ClassCodeExpressionTransformer
+import org.codehaus.groovy.ast.ClassNode
+import org.codehaus.groovy.ast.DynamicVariable
+import org.codehaus.groovy.ast.MethodNode
+import org.codehaus.groovy.ast.Parameter
+import org.codehaus.groovy.ast.Variable
+import org.codehaus.groovy.ast.VariableScope
+import org.codehaus.groovy.ast.expr.ArgumentListExpression
+import org.codehaus.groovy.ast.expr.ClosureExpression
+import org.codehaus.groovy.ast.expr.ConstantExpression
+import org.codehaus.groovy.ast.expr.Expression
+import org.codehaus.groovy.ast.expr.MapExpression
+import org.codehaus.groovy.ast.expr.MethodCallExpression
+import org.codehaus.groovy.ast.expr.VariableExpression
import org.codehaus.groovy.ast.stmt.BlockStatement
import org.codehaus.groovy.ast.stmt.ExpressionStatement
import org.codehaus.groovy.ast.stmt.Statement
@@ -37,9 +50,24 @@ import org.grails.plugin.cache.GrailsCacheManagerAware
import org.springframework.cache.Cache
import org.springframework.cache.CacheManager
-import static org.codehaus.groovy.ast.ClassHelper.*
-import static org.codehaus.groovy.ast.tools.GeneralUtils.*
-import static org.grails.datastore.gorm.transform.AstMethodDispatchUtils.*
+import static org.codehaus.groovy.ast.ClassHelper.CLOSURE_TYPE
+import static org.codehaus.groovy.ast.ClassHelper.MAP_TYPE
+import static org.codehaus.groovy.ast.ClassHelper.OBJECT_TYPE
+import static org.codehaus.groovy.ast.ClassHelper.STRING_TYPE
+import static org.codehaus.groovy.ast.ClassHelper.int_TYPE
+import static org.codehaus.groovy.ast.ClassHelper.make
+import static org.codehaus.groovy.ast.tools.GeneralUtils.args
+import static org.codehaus.groovy.ast.tools.GeneralUtils.callX
+import static org.codehaus.groovy.ast.tools.GeneralUtils.classX
+import static org.codehaus.groovy.ast.tools.GeneralUtils.constX
+import static org.codehaus.groovy.ast.tools.GeneralUtils.declS
+import static org.codehaus.groovy.ast.tools.GeneralUtils.ifS
+import static org.codehaus.groovy.ast.tools.GeneralUtils.notX
+import static org.codehaus.groovy.ast.tools.GeneralUtils.param
+import static org.codehaus.groovy.ast.tools.GeneralUtils.params
+import static org.codehaus.groovy.ast.tools.GeneralUtils.returnS
+import static org.codehaus.groovy.ast.tools.GeneralUtils.varX
+import static org.grails.datastore.gorm.transform.AstMethodDispatchUtils.callD
/**
* Abstract implementation for implementers of cache annotations
@@ -175,7 +203,6 @@ abstract class AbstractCacheTransformation extends AbstractMethodDecoratingTrans
return cacheKeyVariableExpression
}
-
@Override
protected Object getAppliedMarker() {
return APPLIED_MARKER
diff --git a/grails-cache/src/ast/groovy/org/grails/plugin/cache/compiler/CachePutTransformation.groovy b/grails-cache/src/ast/groovy/org/grails/plugin/cache/compiler/CachePutTransformation.groovy
index 40aa18c3ac..54e416eedd 100644
--- a/grails-cache/src/ast/groovy/org/grails/plugin/cache/compiler/CachePutTransformation.groovy
+++ b/grails-cache/src/ast/groovy/org/grails/plugin/cache/compiler/CachePutTransformation.groovy
@@ -33,7 +33,14 @@ import org.codehaus.groovy.control.SourceUnit
import org.codehaus.groovy.transform.GroovyASTTransformation
import static org.codehaus.groovy.ast.ClassHelper.make
-import static org.codehaus.groovy.ast.tools.GeneralUtils.*
+import static org.codehaus.groovy.ast.tools.GeneralUtils.args
+import static org.codehaus.groovy.ast.tools.GeneralUtils.block
+import static org.codehaus.groovy.ast.tools.GeneralUtils.declS
+import static org.codehaus.groovy.ast.tools.GeneralUtils.ifS
+import static org.codehaus.groovy.ast.tools.GeneralUtils.notNullX
+import static org.codehaus.groovy.ast.tools.GeneralUtils.returnS
+import static org.codehaus.groovy.ast.tools.GeneralUtils.stmt
+import static org.codehaus.groovy.ast.tools.GeneralUtils.varX
import static org.grails.datastore.gorm.transform.AstMethodDispatchUtils.callD
/**
@@ -54,7 +61,6 @@ class CachePutTransformation extends AbstractCacheTransformation {
VariableExpression cacheManagerVariableExpression = varX(GRAILS_CACHE_MANAGER_PROPERTY_NAME)
BlockStatement cachingBlock = block()
-
// Cache $_cache_cacheVariable = this.grailsCacheManager.getCache("...");
VariableExpression cacheDeclaration = declareCache(annotationNode, cacheManagerVariableExpression, cachingBlock)
diff --git a/grails-cache/src/ast/groovy/org/grails/plugin/cache/compiler/CacheableTransformation.groovy b/grails-cache/src/ast/groovy/org/grails/plugin/cache/compiler/CacheableTransformation.groovy
index 9f98c7c2a0..bd851abb00 100644
--- a/grails-cache/src/ast/groovy/org/grails/plugin/cache/compiler/CacheableTransformation.groovy
+++ b/grails-cache/src/ast/groovy/org/grails/plugin/cache/compiler/CacheableTransformation.groovy
@@ -35,8 +35,17 @@ import org.codehaus.groovy.transform.GroovyASTTransformation
import org.grails.core.artefact.ControllerArtefactHandler
import org.springframework.cache.Cache
-import static org.codehaus.groovy.ast.ClassHelper.*
-import static org.grails.datastore.gorm.transform.AstMethodDispatchUtils.*
+import static org.codehaus.groovy.ast.ClassHelper.make
+import static org.codehaus.groovy.ast.tools.GeneralUtils.args
+import static org.codehaus.groovy.ast.tools.GeneralUtils.block
+import static org.codehaus.groovy.ast.tools.GeneralUtils.declS
+import static org.codehaus.groovy.ast.tools.GeneralUtils.ifElseS
+import static org.codehaus.groovy.ast.tools.GeneralUtils.ifS
+import static org.codehaus.groovy.ast.tools.GeneralUtils.notNullX
+import static org.codehaus.groovy.ast.tools.GeneralUtils.returnS
+import static org.codehaus.groovy.ast.tools.GeneralUtils.stmt
+import static org.codehaus.groovy.ast.tools.GeneralUtils.varX
+import static org.grails.datastore.gorm.transform.AstMethodDispatchUtils.callD
/**
* @since 4.0.0
@@ -81,7 +90,6 @@ class CacheableTransformation extends AbstractCacheTransformation {
// def $_cache_cacheKey = customCacheKeyGenerator.generate(className, methodName, hashCode, $_method_parameter_map)
VariableExpression cacheKeyDeclaration = declareCacheKey(sourceUnit, annotationNode, classNode, methodNode , cachingBlock)
-
// ValueWrapper $_cache_valueWrapper = $_cache_cacheVariable.get($_cache_cacheKey);
VariableExpression cacheValueWrapper = varX(CACHE_VALUE_WRAPPER_LOCAL_VARIABLE_NAME, make(Cache.ValueWrapper))
cachingBlock.addStatement(
diff --git a/grails-cache/src/main/groovy/grails/plugin/cache/CacheException.groovy b/grails-cache/src/main/groovy/grails/plugin/cache/CacheException.groovy
index b17b721b55..b3c0a8e6ec 100644
--- a/grails-cache/src/main/groovy/grails/plugin/cache/CacheException.groovy
+++ b/grails-cache/src/main/groovy/grails/plugin/cache/CacheException.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package grails.plugin.cache
import groovy.transform.CompileStatic
diff --git a/grails-cache/src/main/groovy/grails/plugin/cache/CacheGrailsPlugin.groovy b/grails-cache/src/main/groovy/grails/plugin/cache/CacheGrailsPlugin.groovy
index 86d57e2029..b2d4a17a61 100644
--- a/grails-cache/src/main/groovy/grails/plugin/cache/CacheGrailsPlugin.groovy
+++ b/grails-cache/src/main/groovy/grails/plugin/cache/CacheGrailsPlugin.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package grails.plugin.cache
import grails.plugins.Plugin
@@ -53,7 +52,6 @@ class CacheGrailsPlugin extends Plugin {
customCacheKeyGenerator(CustomCacheKeyGenerator)
-
Class<? extends GrailsCacheManager> cacheClazz = GrailsConcurrentMapCacheManager
// Selects cache manager from config
if (config.getProperty("grails.cache.cacheManager", String, null) == "GrailsConcurrentLinkedMapCacheManager") {
diff --git a/grails-cache/src/main/groovy/grails/plugin/cache/CachePluginConfiguration.groovy b/grails-cache/src/main/groovy/grails/plugin/cache/CachePluginConfiguration.groovy
index 87e800d16d..e9b632f9a8 100644
--- a/grails-cache/src/main/groovy/grails/plugin/cache/CachePluginConfiguration.groovy
+++ b/grails-cache/src/main/groovy/grails/plugin/cache/CachePluginConfiguration.groovy
@@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/
-
package grails.plugin.cache
import groovy.transform.CompileStatic
diff --git a/grails-cache/src/main/groovy/grails/plugin/cache/GrailsCache.java b/grails-cache/src/main/groovy/grails/plugin/cache/GrailsCache.java
index da62b521c7..d19389f516 100644
--- a/grails-cache/src/main/groovy/grails/plugin/cache/GrailsCache.java
+++ b/grails-cache/src/main/groovy/grails/plugin/cache/GrailsCache.java
@@ -18,15 +18,15 @@
*/
package grails.plugin.cache;
-import java.util.Collection;
-
import org.springframework.cache.Cache;
+import java.util.Collection;
+
/**
* @author Burt Beckwith
* @since 1.0
*/
public interface GrailsCache extends Cache {
- Collection<Object> getAllKeys();
+ Collection<Object> getAllKeys();
}
diff --git a/grails-cache/src/main/groovy/grails/plugin/cache/GrailsCacheAdminService.groovy b/grails-cache/src/main/groovy/grails/plugin/cache/GrailsCacheAdminService.groovy
index e0cb95104b..7587008e42 100644
--- a/grails-cache/src/main/groovy/grails/plugin/cache/GrailsCacheAdminService.groovy
+++ b/grails-cache/src/main/groovy/grails/plugin/cache/GrailsCacheAdminService.groovy
@@ -24,20 +24,20 @@ import org.grails.plugin.cache.GrailsCacheManagerAware
@CompileStatic
class GrailsCacheAdminService implements GrailsCacheManagerAware {
- @CacheEvict(value="grailsBlocksCache", allEntries = true)
+ @CacheEvict(value = "grailsBlocksCache", allEntries = true)
void clearBlocksCache() {}
- @CacheEvict(value="grailsTemplatesCache", allEntries = true)
+ @CacheEvict(value = "grailsTemplatesCache", allEntries = true)
void clearTemplatesCache() {}
void clearCache(CharSequence cacheName) {
- if(cacheName) {
+ if (cacheName) {
grailsCacheManager.getCache(cacheName.toString())?.clear()
}
}
void clearAllCaches() {
- for(CharSequence cacheName in grailsCacheManager.cacheNames) {
+ for (CharSequence cacheName in grailsCacheManager.cacheNames) {
clearCache(cacheName)
}
}
diff --git a/grails-cache/src/main/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCache.java b/grails-cache/src/main/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCache.java
index f7530e86f0..897902bf8f 100644
--- a/grails-cache/src/main/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCache.java
+++ b/grails-cache/src/main/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCache.java
@@ -31,76 +31,78 @@ import java.util.concurrent.ConcurrentMap;
*/
public class GrailsConcurrentLinkedMapCache implements GrailsCache {
- private static final Object NULL_HOLDER = new NullHolder();
- private String name;
- private long capacity;
- private final ConcurrentLinkedHashMap<Object, Object> store;
- private final boolean allowNullValues;
-
- /**
- * Create a new GrailsConcurrentLinkedMapCache with the specified name
- * and capacity
- * @param name the name of the cache
- * @param capacity of the map
- * @param allowNullValues null values (default is true)
- */
- public GrailsConcurrentLinkedMapCache(String name, long capacity, boolean allowNullValues) {
- this.name = name;
- this.capacity = capacity;
- this.allowNullValues = allowNullValues;
- // Workaround: using explicit type arguments to prevent groovydoc error (#53)
- // Replace with diamond operator once a fix for GROOVY-8628 is included in groovy dependency
- this.store = new ConcurrentLinkedHashMap.Builder<Object, Object>()
- .maximumWeightedCapacity(capacity)
- .build();
- }
-
- /**
- * Create a new GrailsConcurrentLinkedMapCache with the specified name
- * and capacity
- * @param name the name of the cache
- * @param capacity of the map
- */
- public GrailsConcurrentLinkedMapCache(String name, long capacity) {
- this(name, capacity, true);
- }
-
- public final long getCapacity() {
- return this.store.capacity();
- }
-
- @Override
- public final String getName() {
- return this.name;
- }
-
- @Override
- public final ConcurrentMap<Object, Object> getNativeCache() {
- return this.store;
- }
-
- public final int getSize() {
- return this.store.size();
- }
-
- public final boolean isAllowNullValues() {
- return this.allowNullValues;
- }
-
- @Override
- public GrailsValueWrapper get(Object key) {
- Object value = getNativeCache().get(key);
- return value == null ? null : new GrailsValueWrapper(fromStoreValue(value), null);
- }
-
- @Override
- public <T> T get(Object key, Class<T> type) {
- Object value = getNativeCache().get(key);
- if (value != null && type != null && !type.isInstance(value)) {
- throw new IllegalStateException("Cached value is not of required type [" + type.getName() + "]: " + value);
- }
- return (T) value;
- }
+ private static final Object NULL_HOLDER = new NullHolder();
+ private String name;
+ private long capacity;
+ private final ConcurrentLinkedHashMap<Object, Object> store;
+ private final boolean allowNullValues;
+
+ /**
+ * Create a new GrailsConcurrentLinkedMapCache with the specified name
+ * and capacity
+ *
+ * @param name the name of the cache
+ * @param capacity of the map
+ * @param allowNullValues null values (default is true)
+ */
+ public GrailsConcurrentLinkedMapCache(String name, long capacity, boolean allowNullValues) {
+ this.name = name;
+ this.capacity = capacity;
+ this.allowNullValues = allowNullValues;
+ // Workaround: using explicit type arguments to prevent groovydoc error (#53)
+ // Replace with diamond operator once a fix for GROOVY-8628 is included in groovy dependency
+ this.store = new ConcurrentLinkedHashMap.Builder<Object, Object>()
+ .maximumWeightedCapacity(capacity)
+ .build();
+ }
+
+ /**
+ * Create a new GrailsConcurrentLinkedMapCache with the specified name
+ * and capacity
+ *
+ * @param name the name of the cache
+ * @param capacity of the map
+ */
+ public GrailsConcurrentLinkedMapCache(String name, long capacity) {
+ this(name, capacity, true);
+ }
+
+ public final long getCapacity() {
+ return this.store.capacity();
+ }
+
+ @Override
+ public final String getName() {
+ return this.name;
+ }
+
+ @Override
+ public final ConcurrentMap<Object, Object> getNativeCache() {
+ return this.store;
+ }
+
+ public final int getSize() {
+ return this.store.size();
+ }
+
+ public final boolean isAllowNullValues() {
+ return this.allowNullValues;
+ }
+
+ @Override
+ public GrailsValueWrapper get(Object key) {
+ Object value = getNativeCache().get(key);
+ return value == null ? null : new GrailsValueWrapper(fromStoreValue(value), null);
+ }
+
+ @Override
+ public <T> T get(Object key, Class<T> type) {
+ Object value = getNativeCache().get(key);
+ if (value != null && type != null && !type.isInstance(value)) {
+ throw new IllegalStateException("Cached value is not of required type [" + type.getName() + "]: " + value);
+ }
+ return (T) value;
+ }
@Override
public <T> T get(Object key, Callable<T> valueLoader) {
@@ -108,66 +110,69 @@ public class GrailsConcurrentLinkedMapCache implements GrailsCache {
}
@SuppressWarnings("unchecked")
- public Collection<Object> getAllKeys() {
- return getNativeCache().keySet();
- }
-
- public Collection<Object> getHottestKeys() {
- return this.store.descendingKeySet();
- }
-
- @Override
- public void put(Object key, Object value) {
- this.store.put(key, toStoreValue(value));
- }
-
- public ValueWrapper putIfAbsent(Object key, Object value) {
- Object existing = this.store.putIfAbsent(key, value);
- return toWrapper(existing);
- }
-
- @Override
- public void evict(Object key) {
- this.store.remove(key);
- }
-
- @Override
- public void clear() {
- this.store.clear();
- }
-
- /**
- * Convert the given value from the internal store to a user value
- * returned from the get method (adapting {@code null}).
- * @param storeValue the store value
- * @return the value to return to the user
- */
- protected Object fromStoreValue(Object storeValue) {
- if (this.allowNullValues && storeValue == NULL_HOLDER) {
- return null;
- }
- return storeValue;
- }
-
- /**
- * Convert the given user value, as passed into the put method,
- * to a value in the internal store (adapting {@code null}).
- * @param userValue the given user value
- * @return the value to store
- */
- protected Object toStoreValue(Object userValue) {
- if (this.allowNullValues && userValue == null) {
- return NULL_HOLDER;
- }
- return userValue;
- }
-
- private ValueWrapper toWrapper(Object value) {
- return (value != null ? new SimpleValueWrapper(fromStoreValue(value)) : null);
- }
-
- @SuppressWarnings("serial")
-
- private static class NullHolder implements Serializable {
- }
+ public Collection<Object> getAllKeys() {
+ return getNativeCache().keySet();
+ }
+
+ public Collection<Object> getHottestKeys() {
+ return this.store.descendingKeySet();
+ }
+
+ @Override
+ public void put(Object key, Object value) {
+ this.store.put(key, toStoreValue(value));
+ }
+
+ public ValueWrapper putIfAbsent(Object key, Object value) {
+ Object existing = this.store.putIfAbsent(key, value);
+ return toWrapper(existing);
+ }
+
+ @Override
+ public void evict(Object key) {
+ this.store.remove(key);
+ }
+
+ @Override
+ public void clear() {
+ this.store.clear();
+ }
+
+ /**
+ * Convert the given value from the internal store to a user value
+ * returned from the get method (adapting {@code null}).
+ *
+ * @param storeValue the store value
+ * @return the value to return to the user
+ */
+ protected Object fromStoreValue(Object storeValue) {
+ if (this.allowNullValues && storeValue == NULL_HOLDER) {
+ return null;
+ }
+ return storeValue;
+ }
+
+ /**
+ * Convert the given user value, as passed into the put method,
+ * to a value in the internal store (adapting {@code null}).
+ *
+ * @param userValue the given user value
+ * @return the value to store
+ */
+ protected Object toStoreValue(Object userValue) {
+ if (this.allowNullValues && userValue == null) {
+ return NULL_HOLDER;
+ }
+ return userValue;
+ }
+
+ private ValueWrapper toWrapper(Object value) {
+ return (value != null ? new SimpleValueWrapper(fromStoreValue(value)) : null);
+ }
+
+ @SuppressWarnings("serial")
+
+ private static class NullHolder implements Serializable {
+
+ }
}
diff --git a/grails-cache/src/main/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCacheManager.groovy b/grails-cache/src/main/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCacheManager.groovy
index ab7cc818bf..6b5b9b433d 100644
--- a/grails-cache/src/main/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCacheManager.groovy
+++ b/grails-cache/src/main/groovy/grails/plugin/cache/GrailsConcurrentLinkedMapCacheManager.groovy
@@ -33,43 +33,43 @@ import java.util.concurrent.ConcurrentMap
@CompileStatic
class GrailsConcurrentLinkedMapCacheManager implements GrailsCacheManager {
- protected final ConcurrentMap<String, Cache> cacheMap = new ConcurrentHashMap<String, Cache>()
+ protected final ConcurrentMap<String, Cache> cacheMap = new ConcurrentHashMap<String, Cache>()
- Collection<String> getCacheNames() {
- return Collections.unmodifiableSet(cacheMap.keySet())
- }
+ Collection<String> getCacheNames() {
+ return Collections.unmodifiableSet(cacheMap.keySet())
+ }
- Cache getCache(String name) {
- return getCache(name, 10000)
- }
+ Cache getCache(String name) {
+ return getCache(name, 10000)
+ }
- Cache getCache(String name, int capacity) {
- Cache cache = cacheMap.get(name)
- if (cache == null) {
- cache = createConcurrentLinkedMapCache(name, capacity)
- Cache existing = cacheMap.putIfAbsent(name, cache)
- if (existing != null) {
- cache = existing
- }
- }
- return cache
- }
+ Cache getCache(String name, int capacity) {
+ Cache cache = cacheMap.get(name)
+ if (cache == null) {
+ cache = createConcurrentLinkedMapCache(name, capacity)
+ Cache existing = cacheMap.putIfAbsent(name, cache)
+ if (existing != null) {
+ cache = existing
+ }
+ }
+ return cache
+ }
- boolean cacheExists(String name) {
- getCacheNames().contains(name)
- }
+ boolean cacheExists(String name) {
+ getCacheNames().contains(name)
+ }
- boolean destroyCache(String name) {
- cacheMap.remove(name) != null
- }
+ boolean destroyCache(String name) {
+ cacheMap.remove(name) != null
+ }
- protected GrailsConcurrentLinkedMapCache createConcurrentLinkedMapCache(String name, long capacity) {
- return new GrailsConcurrentLinkedMapCache(name, capacity)
- }
+ protected GrailsConcurrentLinkedMapCache createConcurrentLinkedMapCache(String name, long capacity) {
+ return new GrailsConcurrentLinkedMapCache(name, capacity)
+ }
- void setConfiguration(CachePluginConfiguration configuration) {
- configuration.caches.each { String key, CachePluginConfiguration.CacheConfig value ->
- getCache(key, value.maxCapacity)
- }
- }
+ void setConfiguration(CachePluginConfiguration configuration) {
+ configuration.caches.each { String key, CachePluginConfiguration.CacheConfig value ->
+ getCache(key, value.maxCapacity)
+ }
+ }
}
diff --git a/grails-cache/src/main/groovy/grails/plugin/cache/GrailsConcurrentMapCache.java b/grails-cache/src/main/groovy/grails/plugin/cache/GrailsConcurrentMapCache.java
index 67421ec98f..d545951f51 100644
--- a/grails-cache/src/main/groovy/grails/plugin/cache/GrailsConcurrentMapCache.java
+++ b/grails-cache/src/main/groovy/grails/plugin/cache/GrailsConcurrentMapCache.java
@@ -18,11 +18,11 @@
*/
package grails.plugin.cache;
+import org.springframework.cache.concurrent.ConcurrentMapCache;
+
import java.util.Collection;
import java.util.concurrent.ConcurrentMap;
-import org.springframework.cache.concurrent.ConcurrentMapCache;
-
/**
* Extends the default implementation to return GrailsValueWrapper instances instead of
* SimpleValueWrapper. This isn't useful for this implementation but is for others where
@@ -34,26 +34,26 @@ import org.springframework.cache.concurrent.ConcurrentMapCache;
*/
public class GrailsConcurrentMapCache extends ConcurrentMapCache implements GrailsCache {
- public GrailsConcurrentMapCache(String name) {
- super(name);
- }
+ public GrailsConcurrentMapCache(String name) {
+ super(name);
+ }
- public GrailsConcurrentMapCache(String name, boolean allowNullValues) {
- super(name, allowNullValues);
- }
+ public GrailsConcurrentMapCache(String name, boolean allowNullValues) {
+ super(name, allowNullValues);
+ }
- public GrailsConcurrentMapCache(String name, ConcurrentMap<Object, Object> store, boolean allowNullValues) {
- super(name, store, allowNullValues);
- }
+ public GrailsConcurrentMapCache(String name, ConcurrentMap<Object, Object> store, boolean allowNullValues) {
+ super(name, store, allowNullValues);
+ }
- @Override
- public GrailsValueWrapper get(Object key) {
- Object value = getNativeCache().get(key);
- return value == null ? null : new GrailsValueWrapper(fromStoreValue(value), null);
- }
+ @Override
+ public GrailsValueWrapper get(Object key) {
+ Object value = getNativeCache().get(key);
+ return value == null ? null : new GrailsValueWrapper(fromStoreValue(value), null);
+ }
- @SuppressWarnings("unchecked")
- public Collection<Object> getAllKeys() {
- return getNativeCache().keySet();
- }
+ @SuppressWarnings("unchecked")
+ public Collection<Object> getAllKeys() {
+ return getNativeCache().keySet();
+ }
}
diff --git a/grails-cache/src/main/groovy/grails/plugin/cache/GrailsConcurrentMapCacheManager.groovy b/grails-cache/src/main/groovy/grails/plugin/cache/GrailsConcurrentMapCacheManager.groovy
index 6a6d7a5ab9..aa43a9456d 100644
--- a/grails-cache/src/main/groovy/grails/plugin/cache/GrailsConcurrentMapCacheManager.groovy
+++ b/grails-cache/src/main/groovy/grails/plugin/cache/GrailsConcurrentMapCacheManager.groovy
@@ -19,11 +19,11 @@
package grails.plugin.cache
import groovy.transform.CompileStatic
-import org.grails.plugin.cache.GrailsCacheManager;
+import org.grails.plugin.cache.GrailsCacheManager
+import org.springframework.cache.Cache
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.ConcurrentMap
-import org.springframework.cache.Cache
/**
* Based on org.springframework.cache.concurrent.ConcurrentMapCacheManager.
@@ -34,39 +34,39 @@ import org.springframework.cache.Cache
@CompileStatic
class GrailsConcurrentMapCacheManager implements GrailsCacheManager {
- protected final ConcurrentMap<String, Cache> cacheMap = new ConcurrentHashMap<String, Cache>()
+ protected final ConcurrentMap<String, Cache> cacheMap = new ConcurrentHashMap<String, Cache>()
- Collection<String> getCacheNames() {
- Collections.unmodifiableSet(cacheMap.keySet())
- }
+ Collection<String> getCacheNames() {
+ Collections.unmodifiableSet(cacheMap.keySet())
+ }
- Cache getCache(String name) {
- Cache cache = cacheMap.get(name)
- if (cache == null) {
- cache = createConcurrentMapCache(name)
- Cache existing = cacheMap.putIfAbsent(name, cache)
- if (existing != null) {
- cache = existing
- }
- }
- cache
- }
+ Cache getCache(String name) {
+ Cache cache = cacheMap.get(name)
+ if (cache == null) {
+ cache = createConcurrentMapCache(name)
+ Cache existing = cacheMap.putIfAbsent(name, cache)
+ if (existing != null) {
+ cache = existing
+ }
+ }
+ cache
+ }
- boolean cacheExists(String name) {
- getCacheNames().contains(name)
- }
+ boolean cacheExists(String name) {
+ getCacheNames().contains(name)
+ }
- boolean destroyCache(String name) {
- cacheMap.remove(name) != null
- }
+ boolean destroyCache(String name) {
+ cacheMap.remove(name) != null
+ }
- protected GrailsConcurrentMapCache createConcurrentMapCache(String name) {
- new GrailsConcurrentMapCache(name)
- }
+ protected GrailsConcurrentMapCache createConcurrentMapCache(String name) {
+ new GrailsConcurrentMapCache(name)
+ }
- void setConfiguration(CachePluginConfiguration configuration) {
- configuration.caches.each { String key, CachePluginConfiguration.CacheConfig value ->
- getCache(key)
- }
- }
+ void setConfiguration(CachePluginConfiguration configuration) {
+ configuration.caches.each { String key, CachePluginConfiguration.CacheConfig value ->
+ getCache(key)
+ }
+ }
}
diff --git a/grails-cache/src/main/groovy/grails/plugin/cache/GrailsValueWrapper.java b/grails-cache/src/main/groovy/grails/plugin/cache/GrailsValueWrapper.java
index 6b74a361e6..8ff0708b91 100644
--- a/grails-cache/src/main/groovy/grails/plugin/cache/GrailsValueWrapper.java
+++ b/grails-cache/src/main/groovy/grails/plugin/cache/GrailsValueWrapper.java
@@ -27,14 +27,14 @@ import org.springframework.cache.support.SimpleValueWrapper;
*/
public class GrailsValueWrapper extends SimpleValueWrapper {
- protected Object nativeWrapper;
+ protected Object nativeWrapper;
- public GrailsValueWrapper(Object value, Object nativeWrapper) {
- super(value);
- this.nativeWrapper = nativeWrapper;
- }
+ public GrailsValueWrapper(Object value, Object nativeWrapper) {
+ super(value);
+ this.nativeWrapper = nativeWrapper;
+ }
- public Object getNativeWrapper() {
- return nativeWrapper;
- }
+ public Object getNativeWrapper() {
+ return nativeWrapper;
+ }
}
diff --git a/grails-cache/src/main/groovy/grails/plugin/cache/util/ClassUtils.java b/grails-cache/src/main/groovy/grails/plugin/cache/util/ClassUtils.java
index 5a6df4b185..a4da98e2dd 100644
--- a/grails-cache/src/main/groovy/grails/plugin/cache/util/ClassUtils.java
+++ b/grails-cache/src/main/groovy/grails/plugin/cache/util/ClassUtils.java
@@ -19,12 +19,11 @@
package grails.plugin.cache.util;
import grails.util.GrailsNameUtils;
+import org.springframework.util.ReflectionUtils;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
-import org.springframework.util.ReflectionUtils;
-
/**
* @author Jeff Brown
*/
@@ -35,7 +34,7 @@ public class ClassUtils {
* object using a corresponding getter method. If no getter method is found
* then this method will look for the corresponding field and return its value.
*
- * @param object object to inspect
+ * @param object object to inspect
* @param propertyOrFieldName the name of the field or property to retrieve
* @return the value of the field or property, null if neither is found
*/
diff --git a/grails-cache/src/test/groovy/grails/plugin/cache/CacheTagLibSpec.groovy b/grails-cache/src/test/groovy/grails/plugin/cache/CacheTagLibSpec.groovy
index 3047071bd8..1d699ebb74 100644
--- a/grails-cache/src/test/groovy/grails/plugin/cache/CacheTagLibSpec.groovy
+++ b/grails-cache/src/test/groovy/grails/plugin/cache/CacheTagLibSpec.groovy
@@ -28,7 +28,6 @@ import spock.lang.Specification
import jakarta.servlet.ServletException
-
class CacheTagLibSpec extends Specification implements TagLibUnitTest<CacheTagLib> {
GrailsCacheManager grailsCacheManager
diff --git a/grails-cache/src/test/groovy/grails/plugin/cache/CacheableParseSpec.groovy b/grails-cache/src/test/groovy/grails/plugin/cache/CacheableParseSpec.groovy
index 99b859bdb6..7bb482dfe3 100644
--- a/grails-cache/src/test/groovy/grails/plugin/cache/CacheableParseSpec.groovy
+++ b/grails-cache/src/test/groovy/grails/plugin/cache/CacheableParseSpec.groovy
@@ -95,13 +95,11 @@ return TestService
then:
1 * keyGenerator.generate("TestService", "multiply", _, [x:1, y:2, tenantId: "test"])
-
cleanup:
System.setProperty(SystemPropertyTenantResolver.PROPERTY_NAME, "")
datastore?.close()
}
-
void "test include tenant id when used with @CurrentTenant and @Transactional"() {
given:
def config = [(Settings.SETTING_MULTI_TENANCY_MODE): MultiTenancySettings.MultiTenancyMode.DISCRIMINATOR,
@@ -141,7 +139,6 @@ return TestService
then:
1 * keyGenerator.generate("TestService", "multiply", _, [x:1, y:2, tenantId: "test"])
-
cleanup:
System.setProperty(SystemPropertyTenantResolver.PROPERTY_NAME, "")
datastore?.close()
diff --git a/grails-codecs-core/build.gradle b/grails-codecs-core/build.gradle
index 4fa52b2bb4..970f96a6ea 100644
--- a/grails-codecs-core/build.gradle
+++ b/grails-codecs-core/build.gradle
@@ -57,4 +57,5 @@ apply {
from rootProject.layout.projectDirectory.file('gradle/docs-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/publish-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/test-config.gradle')
+ from rootProject.layout.projectDirectory.file('gradle/style-enforcement-config.gradle')
}
\ No newline at end of file
diff --git a/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/DigestUtils.groovy b/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/DigestUtils.groovy
index fccb6489a1..0960e45b1d 100644
--- a/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/DigestUtils.groovy
+++ b/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/DigestUtils.groovy
@@ -33,12 +33,10 @@ abstract class DigestUtils {
def src
if (data instanceof Byte[] || data instanceof byte[]) {
src = data
- }
- else if (data instanceof List || data.getClass().isArray()) {
+ } else if (data instanceof List || data.getClass().isArray()) {
src = new byte[data.size()]
data.eachWithIndex { v, i -> src[i] = v }
- }
- else {
+ } else {
src = data.toString().getBytes(StandardCharsets.UTF_8)
}
md.update(src) // This probably needs to use the thread's Locale encoding
diff --git a/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/HexCodecExtensionMethods.groovy b/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/HexCodecExtensionMethods.groovy
index 7dda93f99a..0944166cd1 100644
--- a/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/HexCodecExtensionMethods.groovy
+++ b/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/HexCodecExtensionMethods.groovy
@@ -57,8 +57,7 @@ class HexCodecExtensionMethods {
str.eachWithIndex { val, idx ->
if (!(idx % 2)) {
currentByte = HEXDIGITS.indexOf(val) << 4
- }
- else {
+ } else {
output << (currentByte | HEXDIGITS.indexOf(val))
currentByte = 0
}
diff --git a/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/MD5BytesCodecExtensionMethods.groovy b/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/MD5BytesCodecExtensionMethods.groovy
index 4b5fdeccc6..8422367f87 100644
--- a/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/MD5BytesCodecExtensionMethods.groovy
+++ b/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/MD5BytesCodecExtensionMethods.groovy
@@ -24,7 +24,7 @@ class MD5BytesCodecExtensionMethods {
// Returns the byte[] of the digest, taken from UTF-8 of the string representation
// or the raw data coerced to bytes
static encodeAsMD5Bytes(theTarget) {
- if(theTarget == null || theTarget instanceof NullObject) {
+ if (theTarget == null || theTarget instanceof NullObject) {
return null
}
DigestUtils.digest("MD5", theTarget)
diff --git a/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/SHA1BytesCodecExtensionMethods.groovy b/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/SHA1BytesCodecExtensionMethods.groovy
index 398dac6c9f..967db854b7 100644
--- a/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/SHA1BytesCodecExtensionMethods.groovy
+++ b/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/SHA1BytesCodecExtensionMethods.groovy
@@ -23,7 +23,7 @@ import org.codehaus.groovy.runtime.NullObject
class SHA1BytesCodecExtensionMethods {
// Returns the byte[] of the digest
static encodeAsSHA1Bytes(theTarget) {
- if(theTarget == null || theTarget instanceof NullObject) {
+ if (theTarget == null || theTarget instanceof NullObject) {
return null
}
DigestUtils.digest("SHA-1", theTarget)
diff --git a/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/SHA1CodecExtensionMethods.groovy b/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/SHA1CodecExtensionMethods.groovy
index f952e00325..0eb9d8f138 100644
--- a/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/SHA1CodecExtensionMethods.groovy
+++ b/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/SHA1CodecExtensionMethods.groovy
@@ -23,7 +23,7 @@ import org.codehaus.groovy.runtime.NullObject
class SHA1CodecExtensionMethods {
// Returns the byte[] of the digest
static encodeAsSHA1(theTarget) {
- if(theTarget == null || theTarget instanceof NullObject) {
+ if (theTarget == null || theTarget instanceof NullObject) {
return null
}
theTarget.encodeAsSHA1Bytes().encodeAsHex()
diff --git a/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/SHA256BytesCodecExtensionMethods.groovy b/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/SHA256BytesCodecExtensionMethods.groovy
index d3aab53f5c..05de30348d 100644
--- a/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/SHA256BytesCodecExtensionMethods.groovy
+++ b/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/SHA256BytesCodecExtensionMethods.groovy
@@ -23,7 +23,7 @@ import org.codehaus.groovy.runtime.NullObject
class SHA256BytesCodecExtensionMethods {
// Returns the byte[] of the digest
static encodeAsSHA256Bytes(theTarget) {
- if(theTarget == null || theTarget instanceof NullObject) {
+ if (theTarget == null || theTarget instanceof NullObject) {
return null
}
DigestUtils.digest("SHA-256", theTarget)
diff --git a/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/SHA256CodecExtensionMethods.groovy b/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/SHA256CodecExtensionMethods.groovy
index a34298e1a9..1034ba090b 100644
--- a/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/SHA256CodecExtensionMethods.groovy
+++ b/grails-codecs-core/src/main/groovy/org/grails/plugins/codecs/SHA256CodecExtensionMethods.groovy
@@ -23,7 +23,7 @@ import org.codehaus.groovy.runtime.NullObject
class SHA256CodecExtensionMethods extends DigestUtils {
// Returns the byte[] of the digest
static encodeAsSHA256(theTarget) {
- if(theTarget == null || theTarget instanceof NullObject) {
+ if (theTarget == null || theTarget instanceof NullObject) {
return null
}
theTarget.encodeAsSHA256Bytes()?.encodeAsHex()
diff --git a/grails-codecs/build.gradle b/grails-codecs/build.gradle
index a109b376ad..c8802f4b83 100644
--- a/grails-codecs/build.gradle
+++ b/grails-codecs/build.gradle
@@ -67,4 +67,5 @@ apply {
from rootProject.layout.projectDirectory.file('gradle/docs-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/publish-config.gradle')
from rootProject.layout.projectDirectory.file('gradle/test-config.gradle')
+ from rootProject.layout.projectDirectory.file('gradle/style-enforcement-config.gradle')
}
\ No newline at end of file
diff --git a/grails-codecs/src/main/groovy/org/grails/commons/CodecArtefactHandler.java b/grails-codecs/src/main/groovy/org/grails/commons/CodecArtefactHandler.java
index bcf4cc69ea..b34e9461e8 100644
--- a/grails-codecs/src/main/groovy/org/grails/commons/CodecArtefactHandler.java
+++ b/grails-codecs/src/main/groovy/org/grails/commons/CodecArtefactHandler.java
@@ -34,7 +34,9 @@ public class CodecArtefactHandler extends ArtefactHandlerAdapter {
@Override
public boolean isArtefactClass(@SuppressWarnings("rawtypes") Class clazz) {
- if (clazz == null) return false;
+ if (clazz == null) {
+ return false;
+ }
return clazz.getName().endsWith(DefaultGrailsCodecClass.CODEC) && !DomainClassArtefactHandler.isDomainClass(clazz);
}
diff --git a/grails-codecs/src/main/groovy/org/grails/commons/DefaultGrailsCodecClass.java b/grails-codecs/src/main/groovy/org/grails/commons/DefaultGrailsCodecClass.java
index 1e815ae11e..b186a3a3cb 100644
--- a/grails-codecs/src/main/groovy/org/grails/commons/DefaultGrailsCodecClass.java
+++ b/grails-codecs/src/main/groovy/org/grails/commons/DefaultGrailsCodecClass.java
@@ -18,13 +18,8 @@
*/
package org.grails.commons;
-import org.grails.core.AbstractInjectableGrailsClass;
import groovy.lang.Closure;
-
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
+import org.grails.core.AbstractInjectableGrailsClass;
import org.grails.encoder.CodecFactory;
import org.grails.encoder.CodecIdentifier;
import org.grails.encoder.CodecMetaClassSupport;
@@ -38,20 +33,25 @@ import org.grails.encoder.EncodingStateRegistry;
import org.grails.encoder.EncodingStateRegistryLookup;
import org.grails.encoder.EncodingStateRegistryLookupHolder;
import org.grails.encoder.StreamingEncoder;
-import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.core.Ordered;
import org.springframework.util.ReflectionUtils;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
/**
* @author Jeff Brown
* @since 0.4
*/
public class DefaultGrailsCodecClass extends AbstractInjectableGrailsClass implements InitializingBean, GrailsCodecClass, Ordered {
+
public static final String CODEC = CodecArtefactHandler.TYPE;
+ private static int instantionCounter = 0;
private Encoder encoder;
private Decoder decoder;
- private static int instantionCounter=0;
private int order = 100 + instantionCounter++;
private boolean initialized = false;
@@ -64,7 +64,9 @@ public class DefaultGrailsCodecClass extends AbstractInjectableGrailsClass imple
}
private void initializeCodec() {
- if (initialized) return;
+ if (initialized) {
+ return;
+ }
initialized = true;
Integer orderSetting = getStaticPropertyValue("order", Integer.class);
if (orderSetting != null) {
@@ -73,42 +75,42 @@ public class DefaultGrailsCodecClass extends AbstractInjectableGrailsClass imple
Object instance = getReferenceInstance();
if (Encoder.class.isAssignableFrom(getClazz())) {
encoder = (Encoder) instance;
- encoder = (Encoder)autowireCodecBean(encoder);
+ encoder = (Encoder) autowireCodecBean(encoder);
if (encoder instanceof Ordered) {
- order = ((Ordered)encoder).getOrder();
+ order = ((Ordered) encoder).getOrder();
}
}
if (Decoder.class.isAssignableFrom(getClazz())) {
decoder = (Decoder) instance;
- decoder = (Decoder)autowireCodecBean(decoder);
+ decoder = (Decoder) autowireCodecBean(decoder);
if (decoder instanceof Ordered) {
- order = ((Ordered)decoder).getOrder();
+ order = ((Ordered) decoder).getOrder();
}
}
- if (encoder==null && decoder==null) {
- CodecFactory codecFactory=null;
+ if (encoder == null && decoder == null) {
+ CodecFactory codecFactory = null;
if (CodecFactory.class.isAssignableFrom(getClazz())) {
- codecFactory=(CodecFactory) instance;
- codecFactory=(CodecFactory)autowireCodecBean(codecFactory);
+ codecFactory = (CodecFactory) instance;
+ codecFactory = (CodecFactory) autowireCodecBean(codecFactory);
}
- if (codecFactory==null) {
- codecFactory=getStaticPropertyValue("codecFactory", CodecFactory.class);
- codecFactory=(CodecFactory)autowireCodecBean(codecFactory);
+ if (codecFactory == null) {
+ codecFactory = getStaticPropertyValue("codecFactory", CodecFactory.class);
+ codecFactory = (CodecFactory) autowireCodecBean(codecFactory);
}
- if (codecFactory==null) {
- codecFactory=new ClosureCodecFactory(instance);
+ if (codecFactory == null) {
+ codecFactory = new ClosureCodecFactory(instance);
}
- encoder=codecFactory.getEncoder();
- decoder=codecFactory.getDecoder();
+ encoder = codecFactory.getEncoder();
+ decoder = codecFactory.getDecoder();
if (codecFactory instanceof Ordered) {
- order = ((Ordered)codecFactory).getOrder();
+ order = ((Ordered) codecFactory).getOrder();
}
}
if (encoder != null) {
if (encoder instanceof StreamingEncoder) {
- encoder=new StreamingStateAwareEncoderWrapper((StreamingEncoder)encoder);
+ encoder = new StreamingStateAwareEncoderWrapper((StreamingEncoder) encoder);
} else {
- encoder=new StateAwareEncoderWrapper(encoder);
+ encoder = new StateAwareEncoderWrapper(encoder);
}
}
}
@@ -123,7 +125,28 @@ public class DefaultGrailsCodecClass extends AbstractInjectableGrailsClass imple
return existingBean;
}
+ public Encoder getEncoder() {
+ return encoder;
+ }
+
+ public Decoder getDecoder() {
+ return decoder;
+ }
+
+ public void configureCodecMethods() {
+ // for compatibility. Not everything (especially unit tests written by existing Grails applications) call afterPropertiesSet(), but everything calls
+ // configureCodecMethods() at least once
+ initializeCodec();
+
+ new CodecMetaClassSupport().configureCodecMethods(this);
+ }
+
+ public int getOrder() {
+ return order;
+ }
+
private class ClosureCodecFactory implements CodecFactory {
+
private Encoder encoder;
private Decoder decoder;
private final Object codecInstance;
@@ -132,11 +155,11 @@ public class DefaultGrailsCodecClass extends AbstractInjectableGrailsClass imple
this.codecInstance = codecInstance;
Closure<Object> encoderClosure = getMethodOrClosureMethod(getClazz(), "encode");
if (encoderClosure != null) {
- encoder=new ClosureEncoder(getName(), encoderClosure);
+ encoder = new ClosureEncoder(getName(), encoderClosure);
}
Closure<Object> decoderClosure = getMethodOrClosureMethod(getClazz(), "decode");
if (decoderClosure != null) {
- decoder=new ClosureDecoder(getName(), decoderClosure);
+ decoder = new ClosureDecoder(getName(), decoderClosure);
}
}
@@ -152,13 +175,13 @@ public class DefaultGrailsCodecClass extends AbstractInjectableGrailsClass imple
@SuppressWarnings("unchecked")
Closure<Object> closure = getStaticPropertyValue(methodName, Closure.class);
if (closure == null) {
- Method method = ReflectionUtils.findMethod(clazz, methodName, (Class<?>[])null);
+ Method method = ReflectionUtils.findMethod(clazz, methodName, (Class<?>[]) null);
if (method != null) {
Object owner;
if (Modifier.isStatic(method.getModifiers())) {
- owner=clazz;
+ owner = clazz;
} else {
- owner=codecInstance;
+ owner = codecInstance;
}
return new MethodCallingClosure(owner, method);
}
@@ -170,12 +193,13 @@ public class DefaultGrailsCodecClass extends AbstractInjectableGrailsClass imple
}
private static class ClosureDecoder implements Decoder {
+
private CodecIdentifier codecIdentifier;
private Closure<Object> closure;
public ClosureDecoder(String codecName, Closure<Object> closure) {
- this.codecIdentifier=new DefaultCodecIdentifier(codecName);
- this.closure=closure;
+ this.codecIdentifier = new DefaultCodecIdentifier(codecName);
+ this.closure = closure;
}
public CodecIdentifier getCodecIdentifier() {
@@ -188,10 +212,11 @@ public class DefaultGrailsCodecClass extends AbstractInjectableGrailsClass imple
}
private static class StateAwareEncoderWrapper implements Encoder {
+
private Encoder delegate;
public StateAwareEncoderWrapper(Encoder delegate) {
- this.delegate=delegate;
+ this.delegate = delegate;
}
public CodecIdentifier getCodecIdentifier() {
@@ -200,18 +225,19 @@ public class DefaultGrailsCodecClass extends AbstractInjectableGrailsClass imple
public Object encode(Object target) {
if (target instanceof Encodeable) {
- return ((Encodeable)target).encode(this);
+ return ((Encodeable) target).encode(this);
}
- EncodingStateRegistry encodingState=lookupEncodingState();
+ EncodingStateRegistry encodingState = lookupEncodingState();
if (encodingState != null && target instanceof CharSequence) {
- if (!encodingState.shouldEncodeWith(this, (CharSequence)target)) {
+ if (!encodingState.shouldEncodeWith(this, (CharSequence) target)) {
return target;
}
}
Object encoded = delegate.encode(target);
- if (encodingState != null && encoded instanceof CharSequence)
- encodingState.registerEncodedWith(this, (CharSequence)encoded);
+ if (encodingState != null && encoded instanceof CharSequence) {
+ encodingState.registerEncodedWith(this, (CharSequence) encoded);
+ }
return encoded;
}
@@ -221,7 +247,7 @@ public class DefaultGrailsCodecClass extends AbstractInjectableGrailsClass imple
}
public void markEncoded(CharSequence string) {
- EncodingStateRegistry encodingState=lookupEncodingState();
+ EncodingStateRegistry encodingState = lookupEncodingState();
if (encodingState != null) {
encodingState.registerEncodedWith(this, string);
}
@@ -237,24 +263,28 @@ public class DefaultGrailsCodecClass extends AbstractInjectableGrailsClass imple
}
private static class StreamingStateAwareEncoderWrapper extends StateAwareEncoderWrapper implements StreamingEncoder {
+
private StreamingEncoder delegate;
+
public StreamingStateAwareEncoderWrapper(StreamingEncoder delegate) {
super(delegate);
- this.delegate=delegate;
+ this.delegate = delegate;
}
+
public void encodeToStream(Encoder thisInstance, CharSequence source, int offset, int len, EncodedAppender appender,
- EncodingState encodingState) throws IOException {
+ EncodingState encodingState) throws IOException {
delegate.encodeToStream(this, source, offset, len, appender, encodingState);
}
}
private static class ClosureEncoder implements Encoder {
+
private CodecIdentifier codecIdentifier;
private Closure<Object> closure;
public ClosureEncoder(String codecName, Closure<Object> closure) {
- this.codecIdentifier=new DefaultCodecIdentifier(codecName);
- this.closure=closure;
+ this.codecIdentifier = new DefaultCodecIdentifier(codecName);
+ this.closure = closure;
}
public CodecIdentifier getCodecIdentifier() {
@@ -262,7 +292,9 @@ public class DefaultGrailsCodecClass extends AbstractInjectableGrailsClass imple
}
public Object encode(Object target) {
- if (target==null) return null;
+ if (target == null) {
+ return null;
+ }
return closure.call(target);
}
@@ -280,6 +312,7 @@ public class DefaultGrailsCodecClass extends AbstractInjectableGrailsClass imple
}
private static class MethodCallingClosure extends Closure<Object> {
+
private static final long serialVersionUID = 1L;
private Method method;
@@ -287,7 +320,7 @@ public class DefaultGrailsCodecClass extends AbstractInjectableGrailsClass imple
super(owner);
maximumNumberOfParameters = 1;
parameterTypes = new Class[]{Object.class};
- this.method=method;
+ this.method = method;
}
protected Object callMethod(Object argument) {
@@ -300,33 +333,14 @@ public class DefaultGrailsCodecClass extends AbstractInjectableGrailsClass imple
}
protected Object doCall(Object[] args) {
- Object target=null;
- if (args != null && args.length > 0)
- target=args[0];
- if (target==null) {
+ Object target = null;
+ if (args != null && args.length > 0) {
+ target = args[0];
+ }
+ if (target == null) {
return null;
}
return callMethod(target);
}
}
-
- public Encoder getEncoder() {
- return encoder;
- }
-
- public Decoder getDecoder() {
- return decoder;
- }
-
- public void configureCodecMethods() {
- // for compatibility. Not everything (especially unit tests written by existing Grails applications) call afterPropertiesSet(), but everything calls
- // configureCodecMethods() at least once
- initializeCodec();
-
- new CodecMetaClassSupport().configureCodecMethods(this);
- }
-
- public int getOrder() {
- return order;
- }
}
diff --git a/grails-codecs/src/main/groovy/org/grails/commons/GrailsCodecClass.java b/grails-codecs/src/main/groovy/org/grails/commons/GrailsCodecClass.java
index f3456bcb67..1591be02d1 100644
--- a/grails-codecs/src/main/groovy/org/grails/commons/GrailsCodecClass.java
+++ b/grails-codecs/src/main/groovy/org/grails/commons/GrailsCodecClass.java
@@ -29,5 +29,6 @@ import org.grails.encoder.CodecFactory;
* @since 0.4
*/
public interface GrailsCodecClass extends InjectableGrailsClass, CodecFactory {
- public void configureCodecMethods();
+
+ void configureCodecMethods();
}
diff --git a/grails-codecs/src/main/groovy/org/grails/plugins/codecs/CodecsGrailsPlugin.groovy b/grails-codecs/src/main/groovy/org/grails/plugins/codecs/CodecsGrailsPlugin.groovy
index 403897ba7f..af29028a5e 100644
--- a/grails-codecs/src/main/groovy/org/grails/plugins/codecs/CodecsGrailsPlugin.groovy
+++ b/grails-codecs/src/main/groovy/org/grails/plugins/codecs/CodecsGrailsPlugin.groovy
@@ -32,6 +32,7 @@ import org.grails.encoder.impl.RawCodec
* @since 0.4
*/
class CodecsGrailsPlugin extends Plugin {
+
def version = GrailsUtil.getGrailsVersion()
def dependsOn = [core: version]
def watchedResources = "file:./grails-app/utils/**/*Codec.groovy"
diff --git a/grails-codecs/src/main/groovy/org/grails/plugins/codecs/DefaultCodecLookup.java b/grails-codecs/src/main/groovy/org/grails/plugins/codecs/DefaultCodecLookup.java
index 519ba504e2..2596e89bf1 100644
... 158948 lines suppressed ...