Commit Graph

1757 Commits

Author SHA1 Message Date
Mark Paluch
443606bfa8 DATACMNS-1406 - Updated changelog. 2018-10-29 14:30:28 +01:00
Mark Paluch
a7b88acdc5 DATACMNS-1411 - Simplify TravisCI build definition.
Remove superfluous sudo declaration as TravisCI is decommissioning containerized builds.
2018-10-26 10:29:13 +02:00
Mark Paluch
8cea52125d DATACMNS-1403 - Polishing.
Rewrite auditing example to functional use of java.util.Optional.

Original pull request: #321.
2018-10-16 15:12:52 +02:00
heowc
f4f419c016 DATACMNS-1403 - Fixed example source in reference documentation.
Changed to example source for changed specifications.

Original pull request: #321.
2018-10-16 15:12:41 +02:00
Mark Paluch
616ef591d2 DATACMNS-1388 - Updated changelog. 2018-10-15 14:27:34 +02:00
Mark Paluch
a771f38fd2 DATACMNS-1395 - Updated changelog. 2018-10-15 11:37:20 +02:00
Mark Paluch
2c6831948f DATACMNS-1401 - Provide context class on runtime class definition.
We now provide the context class for private MethodHandle lookup in the context of the actual entity class to properly use MethodHandles.defineClass(…) and to avoid illegal access warnings caused by reflective access to the defineClass(…) method on class loaders.

Also, we now use the internal type name without adding the reference type decorator when casting the result of a wither invocation. CHECKCAST allowed on earlier Java runtimes (version 8 and earlier) to use the reference decorator (L…;) around the type name. Java 9 and newer reject this format with a ClassFormatError.

Original pull request: #318.
2018-10-08 13:53:18 +02:00
Oliver Gierke
dfd2781c76 DATACMNS-1396 - Polishing.
Original pull request: #319.
2018-10-08 13:53:18 +02:00
Mark Paluch
7c9d44659b DATACMNS-1396 - Use best-effort caching in CustomConversions and DefaultTypeMapper.
We now apply best-effort caching instead of atomic caching for custom conversions and type mapping. This change is a workaround for a Java 8 bug in ConcurrentHashMap where the computeIfAbsent(…) operation unconditionally locks nodes even when the node is already present.

The workaround is to assume the optimistic case by looking up the key and then falling back to computeIfAbsent if the key is absent.

Before:
TypicalEntityReaderBenchmark.simpleEntityReflectivePropertyAccessWithCustomConversionRegistry  thrpt   10   6487423,969 ±  349449,326  ops/s
DefaultTypeMapperBenchmark.readTyped                                                           thrpt   10  38213392,961 ± 5080789,480  ops/s
DefaultTypeMapperBenchmark.readUntyped                                                         thrpt   10  47565238,929 ±  855200,560  ops/s

After:
TypicalEntityReaderBenchmark.simpleEntityReflectivePropertyAccessWithCustomConversionRegistry  thrpt   10    7361251,834 ±  278530,209  ops/s
DefaultTypeMapperBenchmark.readTyped                                                           thrpt   10  122523380,422 ± 3839365,439  ops/s
DefaultTypeMapperBenchmark.readUntyped                                                         thrpt   10  181767673,793 ± 3549021,260  ops/s

Original pull request: #319.
2018-10-08 13:53:08 +02:00
Mark Paluch
fc4b2d1deb DATACMNS-1402 - Fix invocation of default Kotlin constructor.
We now correctly calculate the number of defaulting masks used to represent constructor arguments. Previously, we've been one off which caused that Kotlin classes with 32/33 parameters weren't able to be instantiated.

We also now reuse KotlinDefaultMask to apply defaulting calculation and removed code duplicates.
2018-10-04 14:38:28 +02:00
Mark Paluch
42ee9448d9 DATACMNS-1400 - Do not consider bridge modifier in Kotlin default-method discovery.
We now no longer consider bridge modifiers when looking up Kotlin default methods. We previously included checks whether a synthetic default method is also a bridge method to take all specifics of synthetic methods into account. With Kotlin 1.3, the compiler no longer sets the bridge flag. This behavior change would previously prevent usage of the copy method with classes compiled with Kotlin 1.3.

Default method discovery is still guesswork and Kotlin compiler reverse engineering as there is no documentation on how to look up this kind of methods.

Further references:
* https://youtrack.jetbrains.net/issue/KT-24415 - Remove bridge flag from default methods.
* https://youtrack.jetbrains.net/issue/KT-27317 - No documented rules for discoverability of generated methods.
2018-10-04 10:59:23 +02:00
Oliver Gierke
3d6e3dbcc0 DATACMNS-1399 - Fixed unit tests after change in exception message.
Original pull request: #313.
2018-10-01 10:29:49 +02:00
Vjkumar Bokar
47283aa47a DATACMNS-1399 - Fixed error message in repository fragment initialization.
Swapped parameters to match the placeholder semantics in the actual error message.

Original pull request: #313.
2018-10-01 10:16:11 +02:00
Mark Paluch
f58a5c8909 DATACMNS-1378 - After release cleanups. 2018-09-21 07:45:28 -04:00
Mark Paluch
dddf8e69d5 DATACMNS-1378 - Prepare next development iteration. 2018-09-21 07:45:26 -04:00
Mark Paluch
c19774f117 DATACMNS-1378 - Release version 2.1 GA (Lovelace). 2018-09-21 07:08:38 -04:00
Mark Paluch
31be97e8c8 DATACMNS-1378 - Prepare 2.1 GA (Lovelace). 2018-09-21 07:07:50 -04:00
Mark Paluch
c8066fd836 DATACMNS-1378 - Updated changelog. 2018-09-21 07:07:43 -04:00
Mark Paluch
7eacab6a34 DATACMNS-1391 - Use prefered constructors to discover Kotlin's copy method.
We now use the primary constructor of Kotlin classes to discover the copy method. We use the primary constructor args to compare signatures and only use the copy method that takes all parameters in the constructor args order. This allows to find the appropriate copy method in case the class declares multiple copy methods.

We now also cache the copy method (KCallable) to reduce lookups in BeanWrapper.

Original pull request: #312.
2018-09-18 18:34:57 +02:00
Mark Paluch
a31ac40c03 DATACMNS-1374 - Polishing.
Fix typo and complete the sentence.
2018-09-18 13:51:21 +02:00
Mark Paluch
d8307f39b2 DATACMNS-1374 - Polishing.
Fix typos. Extend pseudo-code in generated accessor. Remove previous documentation sections. Adapt Kotlin section to the updated documentation.
2018-09-17 15:58:59 +02:00
Oliver Gierke
b5d5506311 DATACMNS-1374 - Rewrite of reference documentation section on object mapping. 2018-09-17 15:58:46 +02:00
Mark Paluch
90586b3cb9 DATACMNS-1374 - Add section about object mutation, creation and property access. 2018-09-17 15:58:35 +02:00
Tobias Hermann
6297e4b6d1 DATACMNS-1392 - Fix typo in Parameters.getParameter(…) exception message.
Original pull request: #311.
2018-09-13 14:17:32 +02:00
Mark Paluch
3ec4fab89b DATACMNS-1360 - Updated changelog. 2018-09-10 14:15:48 +02:00
Mark Paluch
d5761c7c8d DATACMNS-1389 - Reorder repository candidate check.
We now check whether to use the repository configuration as last check to clarify store module responsibility first. This allows to place store-specific checks in RepositoryConfigurationExtensionSupport.useRepositoryConfiguration(…) such as rejecting reactive repositories for a store module that does not support reactive repositories

Previously, we called useRepositoryConfiguration(…) before checking whether the actual repository interface is handled by the store module. This resulted in rejection of reactive repositories by store modules that do not provide reactive support whereas the repository did not belong to the actual store module.

Related ticket: DATACMNS-1174.
2018-09-10 12:12:49 +02:00
Mark Paluch
78a35eaafd DATACMNS-1361 - Updated changelog. 2018-09-10 10:20:53 +02:00
Yuki Yoshida
aa3ed766b5 DATACMNS-1387 - Fix JavaDoc in CurrentDateTimeProvider and remove unused import. 2018-09-07 13:21:47 +02:00
Oliver Gierke
8b6cc3af11 DATACMNS-1386 - Avoid strong type dependency to Jackson in SpringDataWebConfiguration.
We now avoid using a Lambda to provide a default ObjectMapper instance in the code that's reflectively guarded against Jackson not being present. The lambda causes a method to be generated for the class that will require ObjectMapper to be present on reflection inspection of that method. Switching to a method reference to ObjectMapper's constructor resolves that problem as the indirection via the additional, offending method is not needed.

Further reading: https://www.javabullets.com/how-lambdas-and-anonymous-inner-classesaic-work/
2018-09-07 12:09:29 +02:00
Oliver Gierke
3dacaf64d8 DATACMNS-1384 - Support for j.u.Date and j.s.Timestamp in AnnotationRevisionMetadata.
We now properly convert legacy Date instances into Instants to expose the revision date. Support for Timestamp is transparent as it extends Date.
2018-09-01 18:34:56 +02:00
Oliver Gierke
1d4a53dc28 DATACMNS-1383 - Parameters now properly detects Pageable and Sort extensions.
One of the constructors of Pageable wasn't properly checking for assignability of Pageable parameters to detect them but was expecting Pageable itself being used under all circumstances. This has now been opened up by an assignability check.
2018-08-30 16:04:02 +02:00
Oliver Gierke
fc633f623d DATACMNS-1382 - Fixed property substitution of release train in dependencies section. 2018-08-30 11:40:19 +02:00
Mark Paluch
a37599075f DATACMNS-1174 - Polishing.
Trim trailing whitespaces. Javadoc fixes.
2018-08-29 12:01:31 +02:00
Mark Paluch
ee64225be0 DATACMNS-1174 - Reject reactive repository implementation by default.
We now reject reactive repository metadata by RepositoryConfigurationExtensionSupport.useRepositoryConfiguration(…) assuming that Spring Data modules provide only imperative repository support by default. Reactive store modules are required to override useRepositoryConfiguration(…) anyway to not accidentally implement imperative repositories with a reactive Repository extension.
2018-08-29 12:01:31 +02:00
Oliver Gierke
8e7a27cc72 DATACMNS-1032 - Deprecate UserCredentials. 2018-08-29 11:57:32 +02:00
Oliver Gierke
88b77d933e DATACMNS-1358 - After release cleanups. 2018-08-20 10:56:52 +02:00
Oliver Gierke
392d913317 DATACMNS-1358 - Prepare next development iteration. 2018-08-20 10:56:51 +02:00
Oliver Gierke
46df5b835c DATACMNS-1358 - Release version 2.1 RC2 (Lovelace). 2018-08-20 10:40:11 +02:00
Oliver Gierke
74cfca3517 DATACMNS-1358 - Prepare 2.1 RC2 (Lovelace). 2018-08-20 10:39:43 +02:00
Oliver Gierke
9903d47d4e DATACMNS-1358 - Updated changelog. 2018-08-20 10:39:30 +02:00
Oliver Gierke
f00d5b9ac6 DATACMNS-1376 - Polishing.
Moved JVM version lookup into Version.

Original pull request: #307.
2018-08-17 13:09:04 +02:00
Mark Paluch
0d39693c94 DATACMNS-1376 - Fix illegal access warning in DefaultMethodInvokingMethodInterceptor on Java 9 and higher.
We now attempt to use private MethodHandles lookup as the first mechanism to resolve a MethodHandle for default interface methods and fall back to reflection-based Lookup construction if private lookup is not available. Reflective availability is checked lazily to prevent illegal access on enum constant construction. This approach prevents an illegal access which was logged by attempting a reflection-based lookup first.

We also introduced a FALLBACK mechanism to split encapsulated access from a fallback mechanism.

Original pull request: #307.
2018-08-17 13:08:30 +02:00
Mark Paluch
9478441dbd DATACMNS-1373 - Use ReflectUtils.defineClass(…) to load generated EntityInstantiators.
We now use Spring's ReflectUtils.defineClass(…) to load generated EntityInstantiators which uses internally either MethodHandles.Lookup.defineClass(…) (on Java 9 and higher) or reflective defineClass invocation on the originating ClassLoader. Class injection into the originating ClassLoader assigns the ClassLoader of the entity to the generated class which allows optimized instantiation of package-protected classes and constructors.

Original pull request: #308.
2018-08-17 12:56:08 +02:00
Oliver Gierke
b0eb0c47d2 DATACMNS-1377 - ConvertingPropertyAccessor now properly coverts values for property paths.
Previously, ConvertingPropertyAccessor did not override PersistentPropertyAccessor.setProperty(PersistentPropertyPath, Object), so that the target value had to be of the leaf property's type. We now implement that method and convert it into that type before invoking the super method.
2018-08-17 11:47:31 +02:00
Oliver Gierke
14c2b5b766 DATACMNS-1375 - AnnotationRepositoryMetadata now exposes the offending repository name. 2018-08-16 14:06:01 +02:00
Oliver Gierke
22a6870d5c DATACMNS-1367 - Improved repository bootstrap logging.
Core information about the bootstrap mode, timing and number of repositories created is now logged in info. Individual repository registration is logged in trace now.

Related tickets: DATACMNS-1368.
2018-08-16 14:03:47 +02:00
Oliver Gierke
5da6cf20a2 DATACMNS-1368 - Add support for deferred repository initialization.
Both the XML and annotation based configuration sources now support a bootstrap mode configuration property that allow to configure whether repositories are eagerly initialized unless declared as lazy, initialized in a deferred way (just before the application context finishs bootstrapping) or entirely lazy (upon first usage, i.e. a method invocation).

We now register a custom AutowireCandidateResolver that will consider all injection points of lazy repositories lazy too. This will prevent them to accidentally trigger downstream infrastructure initialization.
2018-08-16 12:16:40 +02:00
Oliver Gierke
60bbc59054 DATACMNS-1366 - Performance improvements in CustomConversions.
Removed Optional wrapping for ConcurrentHashMap values in favor of using Void.class as null object. Avoid use streams and removed (repeated) non-null assertions in private methods. Benchmark numbers for calling ….hasCustomReadTarget(…) when non actually exists showing a 5 to 10% increase in performance:

Before:

Iteration   1: 41433276.537 ops/s
Iteration   2: 43991315.457 ops/s
Iteration   3: 45322063.260 ops/s
Iteration   4: 44906183.709 ops/s
Iteration   5: 45378084.579 ops/s
Iteration   6: 44912727.364 ops/s
Iteration   7: 45588155.896 ops/s
Iteration   8: 45453353.185 ops/s
Iteration   9: 45558273.633 ops/s
Iteration  10: 45473310.099 ops/s

After:

Iteration   1: 48979746.822 ops/s
Iteration   2: 48438497.338 ops/s
Iteration   3: 48627686.004 ops/s
Iteration   4: 48815459.842 ops/s
Iteration   5: 48004993.191 ops/s
Iteration   6: 48566871.366 ops/s
Iteration   7: 48604435.350 ops/s
Iteration   8: 47543377.257 ops/s
Iteration   9: 48250165.369 ops/s
Iteration  10: 47845463.861 ops/s
2018-08-16 08:58:07 +02:00
Michael J. Simons
c6af5b76c1 DATACMNS-1351 - Remove superfluous backslashes from reference documentation.
Original pull request: #300.
2018-08-15 15:19:16 +02:00
Mark Paluch
4600190d01 DATACMNS-1366 - Performance improvements in mapping subsystem
We now use a presized HashMap and Weak references in BasicPersistentEntity to improve memory and CPU profile and and avoid unmodifiable collection creation in BasicPersistentEntity.iterator(). Refactored ClassTypeInformation.from(…) lambda to method reference and predefined collection size for the cache. Reduced object instantiations during TypeDiscoverer.equals(…) by checking for type variable map emptiness to avoid Map iterator creation in Map.equals(…).

Original pull request: #305.
2018-08-15 15:13:41 +02:00