Commit Graph

4157 Commits

Author SHA1 Message Date
Juergen Hoeller 7de1dc826a Consistently handle generics in TypeDescriptor.equals
Properly processes recursive types through always comparing generics via the top-level ResolvableType (rather than through nested TypeDescriptors with custom ResolvableType instances).

Closes gh-33932
2024-12-10 22:16:10 +01:00
Brian Clozel 78f28fda54 Merge branch '6.2.x' 2024-12-09 11:18:28 +01:00
Brian Clozel 13df9058a4 Introduce "unsafeAllocated" flag in TypeHint
This metadata information is required for supporting libraries using
`sun.misc.Unsafe#allocateInstance(Class<?>)`, even though Spring
Framework is not using this feature.

Closes gh-34055
2024-12-09 11:08:48 +01:00
Juergen Hoeller 5e62ae19a9 Merge branch '6.2.x' 2024-12-05 17:42:45 +01:00
Juergen Hoeller b5dd0a60f8 Restore lenient match against unresolvable wildcard
Closes gh-33982
2024-12-05 17:41:49 +01:00
Stéphane Nicoll b8cdef6d29 Merge branch '6.2.x' 2024-12-05 17:01:50 +01:00
Stéphane Nicoll e618f922c2 Resolve nested placeholders with a fallback having one
This commit fixes a regression in PlaceHolderParser where it would no
longer resolve nested placeholders for a case where the fallback has a
placeholder itself.

This is due to the Part implementations and how they are structure, and
this commit makes sure that nested resolution happens consistently.

Closes gh-34020
2024-12-05 16:59:30 +01:00
Juergen Hoeller 2b9010c2a2 Remove APIs marked as deprecated for removal
Closes gh-33809
2024-12-04 13:19:39 +01:00
Sam Brannen 5ac0b8e22e Remove obsolete code 2024-12-03 15:08:57 +01:00
Brian Clozel ba312f6c7c Update AOT support after RuntimeHints changes
This commit adapts AOT support in various modules after the RuntimeHints
and related deprecation changes.

`MemberCategory.INTROSPECT_*` hints are now removed and
`MemberCategory.*_FIELDS` are  replaced with
`MemberCategory.INVOKE*_FIELDS` when invocation is needed.

Usage of `RuntimeHintsAgent` are also deprecated.

Closes gh-33847
2024-11-29 14:44:05 +01:00
Brian Clozel 71362c953c Revisit RuntimeHints API
The `RuntimeHints` API mainly reflects what is needed to write GraalVM
reachability metadata. The latest GraalVM version simplified its
format. This commit applies relevant simplifications as parts of it are
not needed anymore.

The new metadata format implies methods, constructors and fields
introspection as soon as a reflection hint is registered for a type. As
a result, `ExecutableMode.INTROSPECT`, and all `MemberCategory` values
except `MemberCategory.INVOKE_*` are being deprecated.
They have no replacement, as registering a type hint is enough.
In practice, it is enough to replace this:

```
hints.reflection().registerType(MyType.class, MemberCategory.DECLARED_FIELDS);
```

By this:
```
hints.reflection().registerType(MyType.class);
```

As for `MemberCategory.PUBLIC_FIELDS` and `MemberCategory.DECLARED_FIELDS`,
values were replaced by `INVOKE_PUBLIC_FIELDS` and
`INVOKE_DECLARED_FIELDS` to make their original intent clearer and align
with the rest of the API. Note, if you were using those values for
reflection only, you can safely remove those hints in favor of a simple
type hint.

See gh-33847
2024-11-29 14:43:59 +01:00
Brian Clozel fec2ed5540 Implement new GraalVM reachability metadata format
As of GraalVM 23, a new and simplified reachability metadata format is
available. Metadata now consists of a single
"reachability-metadata.json" file that contains all the information
previously spread in multiple files. The new format does not include
some introspection flags, as they're now automatically included when a
hint is registered against a type.
Also, "typeReachable" has been renamed as "typeReached" to highlight the
fact that the event considered is the static initialization of the type,
not when the static analysis performed during native compilation is
reaching the type.

This new format ships with a JSON schema, which this commit is tested
against.

See gh-33847
2024-11-29 14:43:55 +01:00
Brian Clozel 989eb37fb7 Update AOT resource hints with new GraalVM behavior
Prior to this commit, the resource hints for AOT applications would
generate JSON metadata with `java.util.regex.Pattern`, like:

```
{
  "resources": {
    "includes": [
      {
        "pattern": "\\Qbanner.txt\\E"
      }
    ]
  }
}
```

This regexp feature, as well as "includes" and "excludes" are not supported
anymore with the new metadata format. This commit removes the pattern
format which is now replaced by a "glob" format.
"globs" should only contain "*" (zero or more characters in a path
segment)  or "**" (zero or more path segments).
Some instances of resource hint registration should be migrated as a
result.
For example, "/files/*.ext" matched both "/files/a.ext" and
"/files/folder/b.txt" in the past. The new behavior matches only the
former, unless the "/files/**/*.ext" glob pattern is used.

This commit also removes the "excludes" support, which was not widely
used and very often could lead to subtle behavior.

Closes gh-31340
2024-11-29 14:43:52 +01:00
Brian Clozel 5fa9460bf6 Temporarily revert changes for gh-33616
See gh-33616
2024-11-28 18:07:23 +01:00
Brian Clozel 5d492689b7 Create MetadataReaderFactory instances with factory methods
Prior to this commit, Spring would create directly
`SimpleMetadataReaderFactory` instances or would manually create
`CachingMetadataReaderFactory` which extend
`SimpleMetadataReaderFactory`. This would prevent usage of the new
`ClassFileMetadataReaderFactory` in our internal codebase.

This commit replaces manual instantiations with calls to
`MetadataReaderFactory` factory methods and makes
`CachingMetadataReaderFactory` delegate to another factory created with
the same factory methods.

This allows internal usage of `ClassFileMetadataReaderFactory`
internally.

Closes gh-33616
2024-11-28 16:30:16 +01:00
Brian Clozel 4f260a4511 Add ClassFile implementation for class metadata
Prior to this commit, Spring Framework would allow two ways of getting
class metadata:
* `StandardClassMetadata`, using the Java reflection API
* `SimpleMetadataReaderFactory`, using ASM to read the class bytecode

This commit adds a new implementation for this feature, this time using
the new `ClassFile` API which is taken out of preview in Java 24.

See gh-33616
2024-11-28 16:29:50 +01:00
Sébastien Deleuze ddec8d2653 Add missing `@Contract` annotation to ObjectUtils#isEmpty
Closes gh-33984
2024-11-28 15:17:02 +01:00
Sébastien Deleuze 1aede291bb Move Kotlin value class unboxing to InvocableHandlerMethod
Before this commit, in Spring Framework 6.2, Kotlin value class
unboxing was done at CoroutinesUtils level, which is a good fit
for InvocableHandlerMethod use case, but not for other ones like
AopUtils.

This commit moves such unboxing to InvocableHandlerMethod in
order to keep the HTTP response body support while fixing other
regressions.

Closes gh-33943
2024-11-27 16:39:26 +01:00
CHOICORE 41421d106b Fix log level in PathMatchingResourcePatternResolver
See gh-33956
2024-11-26 19:51:17 +01:00
Sam Brannen 7f7819329c Update copyright headers
See gh-33903
2024-11-17 15:14:16 +01:00
KNU-K 2494ecb47b Simplify utility implementations in spring-core
Closes gh-33903
2024-11-17 15:08:30 +01:00
Sam Brannen 6544698078 Polish contribution
See gh-33902
2024-11-17 11:45:37 +01:00
taehyun e0e96c487f Simplify implementation of FilteredIterator
Closes gh-33902
2024-11-17 11:41:22 +01:00
Juergen Hoeller 1c2dbec971 Merge branch '6.1.x' 2024-11-13 22:26:54 +01:00
Juergen Hoeller fec6ba4dfe Polishing 2024-11-13 22:26:06 +01:00
Juergen Hoeller 37b110a181 Polishing 2024-11-13 19:00:08 +01:00
Juergen Hoeller 25e2c1b7ce Merge branch '6.1.x'
# Conflicts:
#	framework-platform/framework-platform.gradle
#	spring-web/src/main/java/org/springframework/http/client/reactive/JettyClientHttpConnector.java
2024-11-13 15:12:55 +01:00
Juergen Hoeller 01c85b1afb Add explicit note on blocking in case of concurrency limit
Closes gh-33873
2024-11-13 15:09:02 +01:00
Sébastien Deleuze 72e7f1552b Refine `@Contract` Javadoc
This commit refines `@Contract` Javadoc to mention
this and new return values.

Closes gh-33849
2024-11-06 12:03:19 +01:00
Sébastien Deleuze 7e1d6fe934 Merge branch '6.1.x' 2024-11-05 10:27:22 +01:00
Johnny Lim 0beb56a58c Fix indentation to use tabs in Kotlin source files
Closes gh-33840
2024-11-05 10:24:02 +01:00
Sam Brannen e3301dd1c4 Merge branch '6.1.x' 2024-11-03 16:17:43 +01:00
Sam Brannen 6bd4687706 Update copyright headers
See gh-33839
2024-11-03 16:14:41 +01:00
Tran Ngoc Nhan 07b12666b4 Fix typos in Javadoc and variable names
Closes gh-33839
2024-11-03 16:13:50 +01:00
Stéphane Nicoll 2b601f9e51 Merge branch '6.1.x' 2024-11-03 18:16:31 +09:00
Stéphane Nicoll d43126705f Polish "Add test coverage for DomUtils"
See gh-33768
2024-11-03 18:15:34 +09:00
kunaljani1100 57bbf0ca0f Add test coverage for DomUtils
See gh-33768
2024-11-03 13:44:07 +09:00
Juergen Hoeller 864cb25eec Upgrade to ASM 9.7.1
Closes gh-33821
2024-10-30 16:44:47 +01:00
Sébastien Deleuze 9166688b6f Remove the pure attribute from `@Contract`
Closes gh-33820
2024-10-30 15:11:44 +01:00
Sébastien Deleuze da8925131e Polish `@Contract` Javadoc 2024-10-30 15:11:28 +01:00
Sébastien Deleuze a005c325f7 Introduce `@CheckReturnValue` annotation
This commit introduces a `@CheckReturnValue` annotation,
inspired from org.jetbrains.annotations.CheckReturnValue,
that specifies that the method return value must be used.

See gh-33818
2024-10-30 14:45:35 +01:00
Sam Brannen f427ac383d (Re)suppress deprecation warnings
See gh-33780
2024-10-30 10:52:01 +01:00
Juergen Hoeller 9e3371ef07 Mark ListenableFuture as deprecated for removal
Closes gh-33808
2024-10-29 18:36:40 +01:00
Juergen Hoeller 3732c71168 Merge branch '6.1.x' 2024-10-28 22:12:12 +01:00
Juergen Hoeller 323de1208a Document limited support for lifecycle management
Closes gh-33780
2024-10-28 22:08:41 +01:00
rstoyanchev f1cfe7a3d4 InputStreamSubscriber instantiation and Javadoc
See gh-31677
2024-10-28 12:45:53 +00:00
rstoyanchev dfaf7a0c6a Rename InputStreamSubscriber to SubscriberInputStream
It is both, but InputStream is what's exposed for public use,
in effect an InputStream backed by a Subscriber source.

See gh-31677
2024-10-28 12:45:53 +00:00
rstoyanchev 86a42db002 InputStreamSubscriber/Tests conform to style
See gh-31677
2024-10-28 12:45:53 +00:00
rstoyanchev d4b31fd4b2 InputStreamSubscriber compiler issues
See gh-31677
2024-10-28 12:45:53 +00:00
rstoyanchev a366ea0e15 Align InputStreamSubscriber copies
There are legitimate differences, but also some are fixes that
should be on both sides.

See gh-31677
2024-10-28 12:45:53 +00:00
OlegDokuka 37622a7f90 Support Publisher to InputStream conversion
See gh-31677
2024-10-28 12:45:53 +00:00
Sam Brannen 5532574f56 Remove unused casts and variables 2024-10-25 15:16:05 +02:00
Sam Brannen 1b3e96b9bf Merge branch '6.1.x' 2024-10-25 14:49:46 +02:00
Sam Brannen e340e45f5a Rename aopAvailable constants in TransactionSynchronizationUtils
Closes gh-33796
2024-10-25 14:41:41 +02:00
Juergen Hoeller 081d0b33d4 Consistently sort jar entries in doFindPathMatchingJarResources
Includes consistent clearCache() behavior for manifest entries.

Closes gh-33771
See gh-33705
2024-10-22 21:29:22 +02:00
Phillip Webb 1c69a3c521 Fix `PathMatchingResourcePatternResolver` manifest classpath discovery
Update `PathMatchingResourcePatternResolver` so that in addition to
searching the `java.class.path` system property for classpath enties,
it also searches the `MANIFEST.MF` files from within those jars.

Prior to this commit, the `addClassPathManifestEntries()` method
expected that the JVM had added `Class-Path` manifest entries to the
`java.class.path` system property, however, this did not always happen.

The updated code now performs a deep search by loading `MANIFEST.MF`
files from jars discovered from the system property. To deal with
potential performance issue, loaded results are also now cached.

The updated code has been tested with Spring Boot 3.3 jars extracted
using `java -Djarmode=tools`.

See gh-33705
2024-10-22 21:10:29 +02:00
Juergen Hoeller 267d3a36ae Merge branch '6.1.x'
# Conflicts:
#	spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossLoadTimeWeaver.java
2024-10-21 18:14:50 +02:00
Juergen Hoeller e235e661d8 Polishing 2024-10-21 18:13:42 +02:00
Stéphane Nicoll bdf76b2f8d Restore nested property resolution for non CharSequence types
Closes gh-33727

Co-authored-by: Andy Wilkinson <andy.wilkinson@broadcom.com>
2024-10-17 10:25:50 +02:00
Juergen Hoeller fa955934e7 Merge branch '6.1.x'
# Conflicts:
#	spring-beans/src/main/java/org/springframework/beans/factory/annotation/QualifierAnnotationAutowireCandidateResolver.java
2024-10-16 17:19:30 +02:00
Juergen Hoeller fde7116ae4 Consistently skip processing of plain Java annotations
Closes gh-33580
2024-10-16 17:17:22 +02:00
Juergen Hoeller e89218b39a Merge branch '6.1.x' 2024-10-16 13:46:22 +02:00
Juergen Hoeller 11d4272ff4 Use Locale.ROOT consistently for toLower/toUpperCase
Closes gh-33708
2024-10-16 13:36:23 +02:00
rstoyanchev bdcfbee7df Merge branch '6.1.x' 2024-10-16 12:11:23 +01:00
rstoyanchev 23656aebc6 Use Locale.ROOT consistently for toLower/toUpperCase
See gh-33708
2024-10-16 12:05:54 +01:00
Juergen Hoeller fb6a6892ef Merge branch '6.1.x' 2024-10-16 11:36:30 +02:00
Juergen Hoeller feb6a5f52d Polishing 2024-10-16 11:35:23 +02:00
Tran Ngoc Nhan e191c34078 Polishing
Closes gh-33681
2024-10-14 16:44:42 +02:00
KimJuHyun 5bcce17fd9 Add tests for CollectionUtils
- findValueOfType
- findCommonElementType
- firstElement
- lastElement
- toArray
- compositeMap

Closes gh-33694
2024-10-14 16:10:05 +02:00
Sam Brannen 59ef5e140f Update warning for use of convention-based annotation attribute overrides
See gh-28761
2024-10-09 10:03:22 +02:00
Sam Brannen ad4f0c99bf Polish StringUtilsTests 2024-10-06 15:36:16 +02:00
zinzo 2cd1ee8a24 Add unit tests for StringUtils.hasLength()
Closes gh-33658
2024-10-06 15:28:41 +02:00
Sam Brannen b0c7d15d9f Polishing 2024-10-05 13:57:24 +02:00
Park Sung Jun 32df079b05 Polish use of constants in StringUtils
The hardcoded '.' and '\\' literals have been replaced by the use of
EXTENSION_SEPARATOR and WINDOWS_FOLDER_SEPARATOR_CHAR.

Closes gh-33654
2024-10-05 13:57:24 +02:00
SungbinYang 65ac17ee78 Refactor: Replace hardcoded path separator with PATH_SEPARATOR constant
Replaced the hardcoded '/' path separator with the `PATH_SEPARATOR` constant
to improve code readability and maintainability. This change ensures
consistency across the codebase when handling path separators.

Closes gh-33646
2024-10-04 09:19:16 +02:00
Sam Brannen 309897497a Update copyright header 2024-10-01 12:35:01 +02:00
Hyunwoo Kim 893f5dcb9b
Replace "null" with NULL_STRING constant in ObjectUtils.nullSafeConciseToString()
Closes gh-33625
2024-10-01 12:33:40 +02:00
Sébastien Deleuze 56a0a33e5d Add a missing test case for ObjectUtils#unwrapOptional
Closes gh-33618
2024-10-01 09:42:58 +02:00
Tran Ngoc Nhan 4d87c77649 Add test cases for ObjectUtils#unwrapOptional
See gh-33618
2024-10-01 09:41:39 +02:00
SungbinYang fc8bd64f34 Simplify ObjectUtils#unwrapOptional
This commit replaces optional.isEmpty() and optional.get() with
optional.orElse(null) for better efficiency and readability.

Closes gh-33612
2024-09-30 18:32:43 +02:00
Yanming Zhou 8941e2876e Replace 'e.g.' with 'for example' in documentation and comments
Closes gh-33515
2024-09-26 14:11:17 +02:00
Juergen Hoeller 073cfd405b Merge branch '6.1.x' 2024-09-25 14:24:35 +02:00
Juergen Hoeller 49da92b6a3 Avoid http URL String (making checkstyleNohttp happy)
See gh-33561
2024-09-25 13:53:34 +02:00
Juergen Hoeller 885f650911 Merge branch '6.1.x' 2024-09-25 12:46:37 +02:00
Juergen Hoeller daa109e2ec Preserve URLStreamHandler in toRelativeURL and convertClassLoaderURL
Closes gh-33561
See gh-33199
2024-09-25 12:45:34 +02:00
rstoyanchev 7051cddcf7 Align OutputStreamPublisher's
Align internal handling and contracts. The core copy could do without
those contracts, but it helps with alignment, and it's internal to
the implementation.

Closes gh-33592
2024-09-25 11:42:26 +01:00
rstoyanchev f6c31bb6c3 Align OutputStreamPublisher's
Update constructors to match and drop unnecessary factory methods.

See gh-33592
2024-09-25 11:42:26 +01:00
rstoyanchev 113b430fab Align OutputStreamPublisher's
Apply recent nullability changes, and formatting differences.

See gh-33592
2024-09-25 11:42:26 +01:00
Juergen Hoeller 5f6b8d5582 Polishing 2024-09-24 18:59:17 +02:00
Simon Baslé f7aa4409bb Merge branch '6.1.x' 2024-09-24 11:01:57 +02:00
Simon Baslé 7df9db3bb7 Polishing test
Assert that BlockHound doesn't trigger, rather than assertions on a
condition that makes the test flakky because concurrency is involved.
2024-09-24 11:01:37 +02:00
Tran Ngoc Nhan c85050eb43 Consistently use CharSequence.isEmpty() for emptiness checks
Closes gh-33577
2024-09-23 17:10:21 +02:00
Simon Baslé 06d240b558 Merge branch '6.1.x' 2024-09-17 16:42:09 +02:00
Simon Baslé de4ff4b44b Polishing tests
This commit adds more test coverage of SpringCoreBlockHoundIntegration.

See gh-33450
2024-09-17 16:40:40 +02:00
Simon Baslé f6e96a24d4 Add BlockHound exception for ConcurrentReferenceHashMap$ReferenceManager
This commit adds a SpringCoreBlockHoundIntegration configuration to
allows `pollForPurge` method to block.

Closes gh-33450
2024-09-17 16:40:40 +02:00
Juergen Hoeller 20bc5ef68b Accept nested array type for upUntilUnresolvable check as well
Closes gh-33535
2024-09-17 16:20:54 +02:00
Sébastien Deleuze 52f0e8fb6d Refine null-safety for additional Assert methods
Closes gh-33530
2024-09-13 14:47:00 +02:00
Juergen Hoeller e9f9a7ae8e Merge branch '6.1.x'
# Conflicts:
#	framework-platform/framework-platform.gradle
2024-09-11 17:17:38 +02:00
Juergen Hoeller 54dbb9f52a Upgrade to Objenesis 3.4
Closes gh-33526
2024-09-11 17:15:37 +02:00
Patrick Strawderman 7827188e8e Avoid empty array allocations in AnnotationTypeMapping
Closes gh-33507
2024-09-11 09:49:39 +02:00