Commit Graph

1288 Commits

Author SHA1 Message Date
Juergen Hoeller fd53d2a51a Consistent use of @Nullable in spring-test
This commit also removes nullability from two common spots: ResolvableType.getType() and TargetSource.getTarget(), both of which are never effectively null with any regular implementation. For such scenarios, a non-null empty type/target is the cleaner contract.

Issue: SPR-15540
2017-06-08 22:52:59 +02:00
Juergen Hoeller 55b0fe1027 Unwrap SpringValidatorAdapter (e.g. CustomValidatorBean) to native Validator
Issue: SPR-15629
(cherry picked from commit 8330134)
2017-06-07 18:33:13 +02:00
Juergen Hoeller f813712f5b Consistent use of @Nullable across the codebase (even for internals)
Beyond just formally declaring the current behavior, this revision actually enforces non-null behavior in selected signatures now, not tolerating null values anymore when not explicitly documented. It also changes some utility methods with historic null-in/null-out tolerance towards enforced non-null return values, making them a proper citizen in non-null assignments.

Some issues are left as to-do: in particular a thorough revision of spring-test, and a few tests with unclear failures (ignored as "TODO: NULLABLE") to be sorted out in a follow-up commit.

Issue: SPR-15540
2017-06-07 14:19:15 +02:00
Sebastien Deleuze b494c53b40 Avoid defining nullability for non-relevant API
Defining nullability of some API like EnvironmentCapable
or ConditionContext causes issues in Spring Boot because
in the context where they are used, it is known for sure
they will return non-null values even if their API can in
other context return null values.

It is better in this case for both Java and Kotlin to
not define at all the nullabity of such API.

In practice, this is achieved by removing the package level
@NonNullApi annotation and adding it only on the
relevant classes.

Issue: SPR-15540
2017-05-31 22:51:33 +02:00
Sebastien Deleuze 1f28825f9d Add more @Nullable parameters based on null usage
Issue: SPR-15540
2017-05-31 21:42:23 +02:00
Sebastien Deleuze c3e6afb879 Improve null-safety to fix some Spring Boot warnings
Issue: SPR-15540
2017-05-31 17:14:49 +02:00
Sebastien Deleuze b47d713e14 Add missing @Nullable annotations on parameters
Issue: SPR-15540
2017-05-31 16:56:08 +02:00
Sebastien Deleuze 87598f48e4 Introduce null-safety of Spring Framework API
This commit introduces 2 new @Nullable and @NonNullApi
annotations that leverage JSR 305 (dormant but available via
Findbugs jsr305 dependency and already used by libraries
like OkHttp) meta-annotations to specify explicitly
null-safety of Spring Framework parameters and return values.

In order to avoid adding too much annotations, the
default is set at package level with @NonNullApi and
@Nullable annotations are added when needed at parameter or
return value level. These annotations are intended to be used
on Spring Framework itself but also by other Spring projects.

@Nullable annotations have been introduced based on Javadoc
and search of patterns like "return null;". It is expected that
nullability of Spring Framework API will be polished with
complementary commits.

In practice, this will make the whole Spring Framework API
null-safe for Kotlin projects (when KT-10942 will be fixed)
since Kotlin will be able to leverage these annotations to
know if a parameter or a return value is nullable or not. But
this is also useful for Java developers as well since IntelliJ
IDEA, for example, also understands these annotations to
generate warnings when unsafe nullable usages are detected.

Issue: SPR-15540
2017-05-27 08:57:01 +02:00
Juergen Hoeller 3cc94ae8b5 Consistently accept "taskExecutor" bean of type Executor (as stated in @EnableAsync's javadoc)
Issue: SPR-15566
2017-05-25 23:37:02 +02:00
Andy Clement 109746a03b Adjust source in test class to work around eclipse compiler bug
Issue: SPR-15586
2017-05-24 13:24:24 -07:00
Juergen Hoeller cb3d1befcd LocalValidatorFactoryBean properly supports unwrap at ValidatorFactory level
Also documents limitation for Bean Validation 2.0's getClockProvider() method.

Issue: SPR-15561
Issue: SPR-13482
2017-05-18 21:00:56 +02:00
Juergen Hoeller ba501791c9 Consistent use of WebFlux terminology over Web Reactive 2017-05-05 14:21:01 +02:00
Juergen Hoeller 1f5eaf20b0 Basic test for functional bean registration within a configuration class
Issue: SPR-13779
2017-05-04 11:26:21 +02:00
Juergen Hoeller 1ea54eb2c6 GenericFilterBean lazily initializes its default environment
Alignment with HttpServletBean; consistent use of EnvironmentCapable.

Issue: SPR-15469
2017-04-27 21:38:30 +02:00
Juergen Hoeller 8b50f887db Caching annotations on interface methods with CGLIB proxies
Issue: SPR-15271
2017-04-26 18:16:47 +02:00
Juergen Hoeller 6c43d14a77 Async annotations on interface methods with CGLIB proxies
Issue: SPR-14949
2017-04-26 18:16:40 +02:00
Juergen Hoeller 91df0653fe Polishing 2017-04-17 15:05:34 +02:00
Juergen Hoeller 5d3249f692 Recommendation for consistent @Profile declarations on overloaded @Bean methods
Issue: SPR-15266
2017-04-17 14:52:06 +02:00
Juergen Hoeller 022aefdfe8 Explicit note about @Profile declarations on overloaded @Bean methods
Also marks @Conditional as @Documented, aligned with other annotations.

Issue: SPR-15266
2017-04-15 14:17:45 +02:00
Juergen Hoeller 9abf249cee Explicitly replace target ApplicationListener with singleton proxy, if any (avoiding double registration/invocation)
Issue: SPR-15452
2017-04-15 14:10:28 +02:00
Juergen Hoeller 0b118322b0 Polishing 2017-04-13 16:17:05 +02:00
Juergen Hoeller 1735ba22cb ShadowingClassLoader can be constructed without default excludes
Issue: SPR-15439
2017-04-12 15:34:50 +02:00
Juergen Hoeller c4e0d6c2a2 UnknownHostException as resource-not-found for properties files
Plus first-class declaration of FileNotFoundException in Resource javadoc.

Issue: SPR-15433
2017-04-11 11:45:30 +02:00
Juergen Hoeller 15b5dd9f12 Polishing 2017-04-10 15:36:45 +02:00
Juergen Hoeller a95843a068 Dependency tracking for Supplier-created beans
Issue: SPR-15417
2017-04-07 18:01:28 +02:00
Juergen Hoeller 67ea4b3a05 package-info for repackaged libraries (and other polishing) 2017-04-06 14:10:46 +02:00
Juergen Hoeller 917207b7ae Support for @Order on nested configuration classes
Issue: SPR-15384
2017-04-04 17:17:03 +02:00
Sam Brannen 51f23cb424 Polish JavaDoc for date-time and number format annotations 2017-04-03 16:48:05 +02:00
Sam Brannen 279c56a385 Fix typo in JavaDoc 2017-04-03 16:43:55 +02:00
Sebastien Deleuze e2fd398bad Specify explicitly Kotlin extensions return type
The main purpose is to specify nullability.
2017-03-30 14:25:13 +02:00
Sam Brannen 7a01771a45 Polishing 2017-03-28 19:27:03 +02:00
Sam Brannen 0b11785852 Improve tests for PropertySourcesPlaceholderConfigurer 2017-03-28 19:26:45 +02:00
QBNemo 26101892c1 Fix typo
Closes gh-1354
2017-03-27 10:11:50 +02:00
Grant Hutchins e087db1ecb Fix typo
Closes gh-1364
2017-03-27 10:04:15 +02:00
Juergen Hoeller e892e02f41 Polishing 2017-03-21 17:44:47 +01:00
Juergen Hoeller fc2e635c05 Lookup methods work on configuration classes as well
Issue: SPR-15316
2017-03-07 13:51:43 +01:00
Juergen Hoeller 6d6cf01a42 Polishing 2017-02-28 13:13:23 +01:00
Juergen Hoeller d003f6614b Tests for annotation lookups in interfaces (currently ignored for CGLIB proxies)
Issue: SPR-15271
Issue: SPR-14949
Issue: SPR-14322
2017-02-28 13:11:15 +01:00
Juergen Hoeller d4a1b59b4c Skip transaction/caching metadata retrieval for java.lang.Object methods
Also retrieves CacheConfig as merged annotation now, aligned with other caching annotations.

Issue: SPR-15296
2017-02-28 13:08:55 +01:00
Juergen Hoeller cbd19153c4 Polishing 2017-02-22 16:53:54 +01:00
Juergen Hoeller f4de1ea147 Polishing 2017-02-22 15:32:19 +01:00
Juergen Hoeller 7fb0ad37da ConfigurationClassEnhancer explicitly handles non-interceptable FactoryBeans
Issue: SPR-15275
2017-02-22 15:32:04 +01:00
Juergen Hoeller 370e3d683a Polishing 2017-02-20 23:00:12 +01:00
Stephane Nicoll 73909f41cb Polish 2017-02-20 16:29:05 +01:00
Stephane Nicoll 1c74a1a0fe Improve allowNullValue handling when a null value is provided
This commit improves `AbstractValueAdaptingCache` to throw a dedicated
exception if `allowNullValues` is `false` and a `null` value is provided
anyway. This avoid a lower-level exception from the cache library that
will miss some context.

Issue: SPR-15173
2017-02-20 16:08:08 +01:00
Juergen Hoeller 1ee0626c94 Polishing 2017-02-17 21:06:58 +01:00
Juergen Hoeller 8d707eb530 Polishing 2017-02-16 15:37:31 +01:00
Juergen Hoeller 599c1ba73e Polishing 2017-02-15 18:05:38 +01:00
Juergen Hoeller 54f01cffaf Drop weaving support for pre-Servlet-3.1 servers
Issue: SPR-14467
2017-02-15 18:03:49 +01:00
Juergen Hoeller 44ec6e0037 Polishing 2017-02-13 15:07:07 +01:00