Commit Graph

3055 Commits

Author SHA1 Message Date
Sébastien Deleuze 23a58e6bab Skip ModuleFinder#ofSystem usage on native
gh-28506 introduces a big footprint regression on
native, so it should for now be skipped when
compiling to native images. Such support could
potentially be re-introduced via gh-29081.

Closes gh-29183
2022-09-21 16:47:57 +02:00
Sébastien Deleuze 77fdd69cd1 Skip Javadoc generation for the GraalVM feature module
It is currently broken due to missing modules/exports
configuration and it is not a public API we want to document.

Closes gh-29178
2022-09-20 16:38:48 +02:00
Sam Brannen 321092ce6f Consistent use of @Deprecated(since = "6.0") 2022-09-20 14:34:24 +02:00
Stephane Nicoll 671f843d34 Remove deprecated code
Closes gh-29160
2022-09-15 16:29:38 +02:00
Sam Brannen b87d48b99b Merge branch '5.3.x' 2022-09-14 17:18:00 +02:00
Marc Wrobel ce49068ff9 Fix links in Javadoc and reference docs
- Fix broken links (by using a new URL, an alternative URL, or a
  Wayback Machine link)

- Use HTTPS where possible

- Remove https://issuetracker.springsource.com/browse/EBR-349: this
  link is dead and is also mentioned in
  https://jira.spring.io/browse/SPR-8093

- Clean up nohttp allowlist.lines

Closes gh-28876
2022-09-14 17:00:11 +02:00
Sam Brannen 8d92c57777 Merge branch '5.3.x'
# Conflicts:
#	spring-tx/src/main/java/org/springframework/jca/cci/core/support/CciDaoSupport.java
2022-09-14 16:52:55 +02:00
Marc Wrobel 92a231cf91 Fix typos in Javadoc, reference docs, and code
Closes gh-28822
2022-09-14 16:45:34 +02:00
Sam Brannen 992a81ab68 Merge branch '5.3.x'
# Conflicts:
#	spring-web/src/main/java/org/springframework/web/util/WebUtils.java
2022-09-14 16:12:04 +02:00
Sam Brannen 50dff77d01 Polish contribution 2022-09-14 16:08:01 +02:00
Marc Wrobel 0f479293b1 Replace use of the <tt> HTML tag in Javadoc
The <tt> HTML tag was used in HTML 4 to define teletype text. It is not
supported in HTML5, and its use is discouraged.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tt

Closes gh-28819
2022-09-14 15:56:16 +02:00
Sam Brannen a2445dcb8a Polishing 2022-09-14 15:27:11 +02:00
Sam Brannen 911d1f2dea Suppress warnings 2022-09-14 15:27:11 +02:00
Sam Brannen 354117da7f Merge branch '5.3.x' 2022-09-14 14:38:10 +02:00
Sam Brannen 529481c44c Polish contribution
See gh-29150
2022-09-14 14:35:43 +02:00
Jens Dietrich 35d379f9d3 Add missing @Nullable in SettableListenableFuture
Closes gh-29150
2022-09-14 14:32:37 +02:00
Juergen Hoeller 50d34366bc Polishing 2022-09-14 12:55:53 +02:00
Arjen Poutsma 71f9a84d22 Fix releasing bug in StringDecoder
This commit fixes an issue in StringDecoder, where, if the buffer did
not contain any delimiters, it was released before it was relayed to
any subscribers.

Closes gh-29119
2022-09-13 15:46:24 +02:00
Brian Clozel 5f62d1dc8e Add className variants in ReflectionHintsPredicates
This commit adds predicates variants that accept `String className`
instead of actual `Class<?>` when checking for fields and method hints.
This is useful when the type under test is not visible from the current
test class.

Closes gh-29143
2022-09-13 14:00:55 +02:00
Sam Brannen 349bcb4364 Suppress warnings 2022-09-12 17:46:03 +02:00
Sam Brannen e653ee60a0 Polish ClassPathResourceTests 2022-09-12 17:40:43 +02:00
Sam Brannen 138f9c64be Consistently return absolute path from ClassPathResource#getPath
Prior to this commit, the Javadoc for the getPath() method in
ClassPathResource stated the following.

> Return the path for this resource (as resource path within the class path).

That implied the returned path was an "absolute path" within the class
path; however, that was not always true.

If the resource was created using ClassPathResource(String) or
ClassPathResource(String, ClassLoader), the returned path was a cleaned
version of the ABSOLUTE PATH supplied to the constructor, WITHOUT a
leading slash.

If the resource was created using ClassPathResource(String, Class) with
an absolute path, the returned path was a cleaned version of the
ABSOLUTE PATH supplied to the constructor, WITH a leading slash.

If the resource was created using ClassPathResource(String, Class) with
a relative path, the returned path was a cleaned version of the
RELATIVE PATH supplied to the constructor.

In addition, ClassPathResource does not provide public access the Class
passed to the ClassPathResource(String, Class) constructor.

Consequently, the path returned by getPath() could not be reliably used
with ClassLoader.getResource(String) or with the recently introduced
registerResource(Resource) method in ResourceHints.

This commit addresses this issue by ensuring that getPath()
consistently returns the absolute path within the class path without a
leading slash.

See gh-29083
Reverts gh-29094
Closes gh-29099
2022-09-12 17:40:43 +02:00
Stephane Nicoll 58a2b79699 Harmonize hint registration
Previously, a shortcut method for the default ExecutableMode was
provided, but we found out that the shortcut makes it harder to
determine the intent.

This commit harmonizes hints registration for types, methods, and
fields. An ExecutableMode is now mandatory to register a method or
constructor. Previous methods that infer a mode or provided a
customizer of the builder are deprecated.

Closes gh-29135
2022-09-12 14:51:04 +02:00
Stephane Nicoll 042a4f3518 Polish "Adapt FieldHint to recent GraalVM versions"
See gh-29130
2022-09-12 14:50:28 +02:00
SreenathTM 1cb5f00723 Adapt FieldHint to recent GraalVM versions
In recent GraalVM versions, allowWrite and allowUnsafeAccess have been
deprecated and are no longer use. This commit updates FieldHint to
remove the irrelevant properties.

See gh-29130
2022-09-12 14:50:28 +02:00
유예본(Yebon You)/Platform Engineering팀/11ST fa1f7f6dc7 Use InputStream's contracts instead of StreamUtils
Since Spring Framework 6.0 requires Java 17, we can now use
`InputStream` new contracts when manipulating streams.

Closes gh-27702
2022-09-12 10:21:50 +02:00
Brian Clozel 0770d86936 Deprecate StreamUtils.emptyInput()
Closes gh-29125
2022-09-12 10:21:50 +02:00
Patrick Strawderman d4a74c8f9d Update StreamUtils drain and emptyInput to use JDK builtins
Update StreamUtils.drain to use InputStream.transferTo with a null
OutputStream. This avoids allocating buffers for cases where the
supplied InputStream has an optimized transferTo method (e.g.,
ByteArrayInputStream and FileInputStream).

Additionally, update StreamUtils.emptyInput to simply call
InputStream.nullInputStream.

Closes gh-28961
2022-09-12 10:21:50 +02:00
Stephane Nicoll 7642ac82f6 Apply @PropertySource in AOT-generated context
This commit records `@PropertySource` declarations defined on
configuration classes so that these are contributed to the environment
of a context that is initialized by generated code.

Closes gh-28976
2022-09-12 10:09:37 +02:00
Stephane Nicoll ae706f3954 Allow MethodReference to define a more flexible signature
This commit moves MethodReference to an interface with a default
implementation that relies on a MethodSpec. Such an arrangement avoid
the need of specifying attributes of the method such as whether it is
static or not.

The resolution of the invocation block now takes an
ArgumentCodeGenerator rather than the raw arguments. Doing so gives
the opportunity to create more flexible signatures.

See gh-29005
2022-09-12 10:07:31 +02:00
Stephane Nicoll 8a4a89b9d9 Allow a MethodReference to be produced from a GeneratedMethod
This commit updates GeneratedMethod and its underlying infrastructure
to be able to produce a MethodReference. This simplifies the need when
such a reference needs to be created manually and reuses more of what
MethodReference has to offer.

See gh-29005
2022-09-12 10:07:13 +02:00
Sam Brannen 649c2f56fd Accept only ClassPathResource in ResourceHints#registerResource()
This commit throws an exception in registerResource() if the supplied
resource is not a ClassPathResource.

See gh-29083
2022-09-11 23:33:39 +02:00
Sam Brannen 6d83a959fb Rename registerResourceIfNecessary to registerResource
This commit renames registerResourceIfNecessary() to registerResource()
and throws an exception if the class path resource does not exist.

Closes gh-29083
2022-09-10 19:49:56 +02:00
Patrick Strawderman cdb38e8482 Increase StreamUtils.BUFFER_SIZE to 8192
This aligns the buffer size used in StreamUtils with the buffer sizes
used throughout the JDK (see InputStream, BufferedInputStream, Files).

Closes gh-28965
2022-09-09 22:04:10 +02:00
Brian Clozel 2b5ca63339 Fix serialization compiler warnings with Java 18
As of Java 18, the serial lint warning in javac has been expanded to
check for class fields that are not marked as `Serializable`.
See https://www.oracle.com/java/technologies/javase/18all-relnotes.html#JDK-8202056

In the Spring Framework codebase, this can happen with `Map`, `Set` or
`List` attributes which are often assigned with an unmodifiable
implementation variant. Such implementations are `Serializable` but
cannot be used as field types.

This commit ensures that the following changes are applied:
* fields are marked as transient if they can't be serialized
* classes are marked as `Serializable` if this was missing
* `@SuppressWarnings("serial")` is applied where relevant
2022-09-09 20:24:26 +02:00
Brian Clozel 21612eba19 Disable BlockHound tests on Java 18+
BlockHound is not currently compatible with Java 18.
2022-09-09 20:22:16 +02:00
Phillip Webb 665deb4d82 Add examples to Javadoc for Throwing*.of factory methods
Closes gh-28969
2022-09-09 09:33:50 -07:00
Sam Brannen d46a816745 Remove deprecated SynthesizedAnnotation interface
The SynthesizedAnnotation interface is no longer used in the core
Spring Framework and should not be used by external parties either.

Closes gh-29092
2022-09-08 12:12:51 +02:00
Sam Brannen 8a0e1969b0 Revert "Introduce isSynthesizable in MergedAnnotation"
This reverts commit 32346b8382.

Closes gh-29093
2022-09-08 12:12:51 +02:00
Sam Brannen 75dfd47826 Delete unused code in ReflectionHintsPredicatesTests 2022-09-08 12:12:51 +02:00
Sébastien Deleuze e1c94d7e6b Remove obsolete RuntimeHintsUtils
Closes gh-29058
2022-09-08 09:25:09 +02:00
Sam Brannen ae861a2b3e Document leading slash semantics for ClassPathResource.getPath()
See gh-29094
2022-09-07 15:28:35 +02:00
Sébastien Deleuze 9cfe79186d Stop using RuntimeHintsUtils
Due to gh-29053, we can stop using RuntimeHintsUtils to
register SynthesizedAnnotation proxies.

Closes gh-29059
2022-09-07 10:10:07 +02:00
Brian Clozel 323d1907c1 Do not require full type reflection when listing methods/fields
Prior to this commit, the `RuntimeHintsAgent` and its testing
infrastructure would assume that calling `MyClass.class.getMethods()`
requires a reflection hint on the class for introspecting public/private
methods.

GraalVM does not require this, in fact this call only returns methods
that have reflection hints in the native image.

This commit refines the agent behavior for `Class.getMethods()`,
`Class.getDeclaredMethods()`, `Class.getFields()` and
`Class.getDeclaredFields()`. With this change, registering at least one
method/field for reflection is enough to match.

During the execution of Java tests, all methods and fields will be
provided, regardless of hints being registered or not. This could cause
false negatives where we're missing reflection hints on methods or
fields.
This risk is mitigated thanks to additional instrumentation on
`Method.getAnnotations()`, `Method.getParameterTypes()` and
`Method.invoke()`. If a method is found reflectively, chances are it
will be used for further reflection.

Closes gh-29091
2022-09-06 22:14:10 +02:00
Sam Brannen 6cce47176a Further clarify the semantics of ClassPathResource.getPath()
See gh-29094
2022-09-06 20:34:12 +02:00
Sam Brannen 018122f684 Update Javadoc for ResourceHints.registerResourceIfNecessary()
See gh-29094
2022-09-06 20:18:24 +02:00
Sam Brannen d57e061d3f Introduce getAbsolutePath() in ClassPathResource
Since getPath() returns a relative path if the resource was created
using the ClassPathResource(String,Class) constructor, there was
previously no way to consistently obtain the absolute path to the
resource within the class path.

This commit addresses this shortcoming by introducing a new
getAbsolutePath() for consistently obtaining the absolute path to the
resource within the class path.

See gh-29083
Closes gh-29094
2022-09-06 20:09:24 +02:00
Sam Brannen 1052f48eb6 Clarify semantics of ClassPathResource.getPath()
This commit also improves the overall Javadoc in ClassPathResource.

See gh-29094
2022-09-06 20:08:21 +02:00
Sébastien Deleuze b8c1fc9202 Revert "Remove RuntimeHintsUtils"
This reverts commit 3e327f5641.
2022-09-06 18:21:34 +02:00
Sébastien Deleuze 3e327f5641 Remove RuntimeHintsUtils
Due to gh-29053, we can stop using RuntimeHintsUtils to
register SynthesizedAnnotation proxies.

Closes gh-29058
Closes gh-29059
2022-09-06 15:31:02 +02:00