416 Commits

Author SHA1 Message Date
Andy Wilkinson
e7e77a917f Align PropertiesLauncher's close behavior with JarLauncher
Previously, PropertiesLauncher would close each archive that it
iterated over when creating its ClassLoader. This was not aligned
with JarLauncher's behaviour and left the ClassLoader with closed
archives. The close was introduced in [1] and became more apparent
following the change to fail operations on closed archives [2].

This commit updates Launcher to remove the close() that was added in
[1]. This aligns the behavior of PropertiesLauncher with JarLauncher
and ensures that the ClassLoader does not have entries backed by
closed archives on its classpath.

Fixes gh-23165

[1] ad72f86bdb
[2] ed7a5db174
2020-09-10 09:40:44 +01:00
dreis2211
33cd875cb8 Simplify InputStream assertions
See gh-23052
2020-08-24 11:35:17 +02:00
Phillip Webb
ea8bd75ba1 Merge branch '2.3.x' 2020-08-19 10:34:17 -07:00
Phillip Webb
73038267a0 Merge branch '2.2.x' into 2.3.x 2020-08-19 10:34:06 -07:00
Phillip Webb
17e2d72bcb Fix Windows path issue in JarFileWrapperTests
See gh-22991
2020-08-19 10:33:23 -07:00
Phillip Webb
bd5266b9b1 Merge branch '2.3.x' 2020-08-19 10:22:55 -07:00
Phillip Webb
0dd38a7264 Merge branch '2.2.x' into 2.3.x 2020-08-19 10:22:45 -07:00
Phillip Webb
3fe2005e06 Use @AfterEach to close the source jar file
Update `JarFileWrapperTests` so that the jar files are closed after each
test.

See gh-22991
2020-08-19 10:22:10 -07:00
Phillip Webb
cfc053d75e Merge branch '2.3.x' 2020-08-18 16:21:23 -07:00
Phillip Webb
c5b12effbf Merge branch '2.2.x' into 2.3.x 2020-08-18 16:21:03 -07:00
Phillip Webb
2a137a2d8a Remove Mockito from JarFileWrapperTests
Remove Mockto from JarFileWrapperTests since it seems to be failing on
later versions of Java.

See gh-22991
2020-08-18 16:20:05 -07:00
Phillip Webb
aa2580bb51 Merge branch '2.3.x' 2020-08-18 15:39:08 -07:00
Phillip Webb
ba2ab3363b Merge branch '2.2.x' into 2.3.x 2020-08-18 15:38:53 -07:00
Phillip Webb
60b5de192c Merge branch '2.2.x' into 2.3.x 2020-08-18 15:38:11 -07:00
Phillip Webb
4e76138ebc Update copyright year of changed files 2020-08-18 15:37:59 -07:00
Phillip Webb
5997cbd21f Refine AbstractJarFile method visibility
Refine method visibility in an attempt to fix test issues on Java 11+.

See gh-22991
2020-08-18 15:37:37 -07:00
Phillip Webb
b60820564e Merge branch '2.3.x'
Closes gh-22999
2020-08-18 14:35:59 -07:00
Phillip Webb
2b1b096fac Merge branch '2.2.x' into 2.3.x
Closes gh-22998
2020-08-18 14:35:45 -07:00
Phillip Webb
aac367e9c5 Attempt to fix memory leak in JarFile class
Create a new `JarFileWrapper` class so that we can wrap and existing
`JarFile` and offer a version that can be safely closed.

Prior to this commit, we provided wrapper functionality in the `JarFile`
class itself. Unfortunately, because we override `close` and also create
a lot of wrappers this caused memory issues when running on Java 11.

With Java 11 `java.util.zip.ZipFile` class uses `FinalizableResource`
for any implementation that overrides `close()`. This means that any
wrapper classes will not be garbage collected until the JVM finalizer
thread runs.

Closes gh-22991
2020-08-18 14:07:03 -07:00
Stephane Nicoll
dac63fc3e5 Polish 2020-08-06 17:35:01 +02:00
Andy Wilkinson
f4508b4059 Merge branch '2.1.x' into 2.2.x
Closes gh-22547
2020-07-24 11:54:12 +01:00
Nelson Osacky
e41a53cf85 Add Gradle Enterprise Extension
This adds build caching and build scans.

The changes required disabling scans when using the maven invoker
plugin in order to not cause duplicate build scans when invoking other
maven builds. There is also an empty `.mvn` folder in the
spring-boot-starters project to prevent duplicate build scans as well
since there is no way to pass properties to the maven-javadoc-plugin.

The checkstyle plugin was causing a cache miss with the
`propertyExpansion` because it contains an absolute path. The absolute
path is now ignored and instead the files are added as inputs to the
checkstyle plugin. This only enables the local build cache. The remote
cache is not yet enabled.

On my local machine:

./mvnw clean install build times go from about 30 minutes to about 10 minutes.
./mvnw clean install -Pfull build times go from about 60 minutes to about 13 minutes.

See gh-22089
2020-07-24 11:47:24 +01:00
dreis2211
507eb9498b Use Class.getDeclaredConstructor().newInstance()
See gh-21913
2020-07-07 11:12:35 +01:00
Andy Wilkinson
056d5f3120 Enable deprecation compilation warnings
See gh-21271
2020-06-16 12:50:47 +01:00
Andy Wilkinson
07fb4b065d Merge branch '2.3.x'
Closes gh-21940
2020-06-16 10:10:38 +01:00
Andy Wilkinson
0de466e06e Require dependency on s-b-dependencies to use its constraints
Previously, Spring Boot's modules published Gradle Module Metadata
(GMM) the declared a platform dependency on spring-boot-dependencies.
This provided versions for each module's own dependencies but also had
they unwanted side-effect of pulling in spring-boot-dependencies
constraints which would influence the version of other dependencies
declared in the same configuration. This was undesirable as users
should be able to opt in to this level of dependency management, either
by using the dependency management plugin or by using Gradle's built-in
support via a platform dependency on spring-boot-dependencies.

This commit reworks how Spring Boot's build uses
spring-boot-dependencies and spring-boot-parent to provide its own
dependency management. Configurations that aren't seen by consumers are
configured to extend a dependencyManagement configuration that has an
enforced platform dependency on spring-boot-parent. This enforces
spring-boot-parent's version constraints on Spring Boot's build without
making them visible to consumers. To ensure that the versions that
Spring Boot has been built against are visible to consumers, the
Maven publication that produces pom files and GMM for the published
modules is configured to use the resolved versions from the module's
runtime classpath.

Fixes gh-21911
2020-06-16 08:50:21 +01:00
dreis2211
3d27391d47 Allow StringSequence.isEmpty() to be compatible with JDK 15
JDK 15 introduces isEmpty() on CharSequence which clashes with the one
declared in StringSequence because it is not public.

See gh-21713
2020-06-15 16:46:16 +02:00
Phillip Webb
82abcd3043 Merge branch '2.3.x' 2020-06-11 13:26:44 -07:00
Phillip Webb
2a37b2e258 Refine PropertiesLauncher close logic
Further attempt to fix Windows file issues.

See gh-21575
2020-06-11 13:25:56 -07:00
Phillip Webb
866ebf7c13 Merge branch '2.3.x' 2020-06-11 12:26:42 -07:00
Phillip Webb
8a249daf1a Refactor PropertiesLauncher so jars can be closed
Refactor the internals of `PropertiesLauncher` so that opened jar files
are tracked and can be closed after a test completes.

See gh-21575
2020-06-11 12:26:08 -07:00
Phillip Webb
ad6a0d473a Merge branch '2.3.x'
Closes gh-21768
2020-06-08 12:09:26 -07:00
Phillip Webb
b71bab2817 Document deprecations of Archive.iterator()
Closes gh-21695
2020-06-08 12:08:33 -07:00
Phillip Webb
d791d18231 Merge branch '2.3.x'
Closes gh-21727
2020-06-05 19:34:16 -07:00
Phillip Webb
2f973ebc33 Fix default Launcher.isExploded() result
Fix the default implementation of `Launcher.isExploded` which should
have returned `true`.

Fixes gh-21575
2020-06-05 19:32:06 -07:00
Phillip Webb
3107d2de51 Merge branch '2.3.x'
Fixes gh-21705 in master
2020-06-05 15:33:46 -07:00
Phillip Webb
9a235197dc Propagate manifest to exploded jars
Update `LaunchedURLClassLoader` so that packages defined from exploded
archive folders have manifest attributes applied to them. Prior to this
calling `package.getImplementationTitle()` would only return the a
manifiest attribute when running non-exploded.

The root cause of this issue is the way that `URLClassLoader` handles
the different URL types. For URLs that reference a jar the manifest is
available. For URLs that reference a folder it isn't. When running
exploded we use a URL that references to the `BOOT-INF/classes` folder
directly. To fix the issue we now attempt to detect when `definePackage`
is being called directly, and replace `null` entries with actual
manifest values.

Fixes gh-21705
2020-06-05 15:28:16 -07:00
dreis2211
54f93e9b0f Fix multi-release JAR test on JDK 15
See gh-21605
2020-06-05 11:56:50 +02:00
Madhura Bhave
2dc8048d08 Add missing since tags
Closes gh-21576
2020-06-02 17:22:46 -07:00
Phillip Webb
038ae93406 Update copyright year of changed files 2020-05-13 16:48:51 -07:00
Johnny Lim
665a127448 Fix JarFileTests.getInputStreamWhenClosed()
See gh-21365
2020-05-08 16:06:42 +02:00
Phillip Webb
4a8492d428 Further optimize StringSequence.startsWith
See gh-21259
2020-05-05 18:37:10 -07:00
dreis2211
70ffc70993 Optimize StringSequence.startsWith
See gh-21259
2020-05-05 18:37:10 -07:00
Phillip Webb
ad1248e4ec Replace "folder" with "directory"
Consistently use the term "directory" instead of "folder"

Closes gh-21218
2020-04-28 19:20:24 -07:00
Phillip Webb
50e9674631 Backport "Attempt to prevent JarFiles from being left open"
Update `JarFile` so that `super.close()` is called early so that the
file is not left open. Since we re-implement `JarFile` methods to work
directly on the underlying `RandomAccessDataFile`, it should be safe
to close immediately.

Closes gh-21177
2020-04-27 19:03:52 -07:00
Phillip Webb
77b9dd900c Merge branch '2.2.x'
See gh-21127
2020-04-25 22:21:23 -07:00
Phillip Webb
7d53f7d27f Attempt to prevent JarFiles from being left open
Update `JarFile` to also call `super.close()` early for nested jars.

See gh-21126
2020-04-25 22:20:53 -07:00
Phillip Webb
4f47b7b46a Merge branch '2.2.x'
See gh-21127
2020-04-25 13:32:43 -07:00
Phillip Webb
7c6e912463 Attempt to prevent JarFiles from being left open
Update `JarFile` so that `super.close()` is called early so that the
file is not left open. Since we re-implement `JarFile` methods to work
directly on the underlying `RandomAccessDataFile`, it should be safe
to close immediately.

See gh-21126
2020-04-25 13:03:07 -07:00
dreis2211
848127ae49 Avoid recompiling pattern in Handler#canonicalize
See gh-21103
2020-04-25 09:02:21 +02:00