Commit Graph

1329 Commits

Author SHA1 Message Date
Oliver Drotbohm
092e23b08c DATACMNS-1470 - Further adaption of Spring HATEOAS 1.0 API changes. 2019-02-15 11:07:10 +01:00
Mark Paluch
aa39b9ba3a DATACMNS-1451 - Consider more than 16 immutable Kotlin properties in generated PropertyAccessor.
We now consider more than 16 immutable and nullable Kotlin properties per bucket in generated PropertyAccessors.

Previously only the first 16 properties were considered due to truncation of the defaulting bitmap. We used SIPUSH to render the defaulting mask in bytecode which is intended for 16 bit integers (short). Migrating to LDC (runtime constants) preserves the actual constant value of 32 bits and so we're considering now full buckets.
2019-02-13 12:01:22 +01:00
Greg Turnquist
8c076f921d DATACMNS-1470 - Upgrade to Spring HATEOAS 1.0 API 2019-02-02 00:09:48 +01:00
Oliver Drotbohm
8c75a92b24 DATACMNS-1476 - Added Slice.nextOrLastPageable() and ….previousOrFirstPageable().
We now expose methods that allow to traverse the Pageables but make sure we stay within the result bounds.

Related ticket: DATACMNS-1475.
2019-01-28 11:05:29 +01:00
Oliver Drotbohm
b5972257af DATACMNS-1475 - Fixed Javadoc of Slice.nextPageable() and ….previousPageable().
Documented Slice.nextPageable() and ….previousPageable() to return Pageable.unpaged() instead of null.

Follow-up ticket: DATACMNS-1476.
2019-01-28 11:05:17 +01:00
Christoph Strobl
0c1811946d DATACMNS-1081 - Polishing.
Update Javadoc.

Original Pull Request: #331
2019-01-23 10:24:43 +01:00
Mark Paluch
73eb4ca928 DATACMNS-1081 - Add ReactiveQuerydslPredicateExecutor.
We now ship with a common interface for reactive repositories that want to support Querydsl.

Original Pull Request: #331
2019-01-23 10:23:34 +01:00
Mark Paluch
c755c71a36 DATACMNS-1439 - Polishing.
Reformat, remove trailing whitespaces.

Original pull request: #325.
2019-01-15 12:57:18 +01:00
Mark Paluch
9fe35a24c9 DATACMNS-1439 - Use Java Beans decapitalization for default repository implementation bean names.
We now use Java Beans Introspector during default bean name derivation from class names. Previously, we used String.decapitalize(…) which decapitalizes always the first character. Java Beans do not decapitalize upper case sequences so a class name com.acme.UDPRepository translates to a bean name with UDPRepository instead of uDPRepository.

Original pull request: #325.
2019-01-15 12:57:18 +01:00
Oliver Drotbohm
fe1ccd50be DATACMNS-1466 - Polishing. 2019-01-11 11:48:26 +01:00
Oliver Drotbohm
e0c08e64e8 DATACMNS-1466 - Fixed potential ArrayIndexOutOfBoundsException in DefaultPersistentPropertyPath.
Introduced explicit content checks in ….getLeafProperty() and ….getBaseProperty().
2019-01-11 11:48:23 +01:00
Mark Paluch
1969f4bcdc DATACMNS-1459 - Update copyright years to 2019. 2019-01-02 12:12:19 +01:00
Oliver Drotbohm
0877ca8e11 DATACMNS-1456 - Polishing. 2018-12-21 15:17:51 +01:00
Oliver Drotbohm
135272ec3e DATACMNS-1456 - ExtensionAwareEvaluationContextProvider now uses a ConcurrentHashMap as cache. 2018-12-21 15:17:42 +01:00
Oliver Drotbohm
566e6a3258 DATACMNS-1455 - HateoasPageableHandlerMethodArgumentResolver handles Pageable.unpaged() coprrectly.
Pageable.unpaged() is now effectively handled like a null value given in the 1.x branch.
2018-12-21 09:55:11 +01:00
Francisco Soler
789099f6b9 DATACMNS-1453 - Fixed wrong assertion in AuditingBeanDefinitionRegistrarSupport.
Original pull request: #328.
2018-12-20 15:52:06 +01:00
Oliver Drotbohm
d8705c1cca DATACMNS-1448 - Repositories now favors primary repositories.
If multiple repositories pointing to a single domain type are found we now favor the one registered as primary bean definition. This allows allows reliable disambiguation on which repository is supposed to be used for generic repository interactions.

Related tickets: DATAREST-923.
2018-12-12 22:33:02 +01:00
Oliver Drotbohm
97390a1eef DATACMNS-1447 - Streamable now exposes Collectors.
Added Streamable.toStreamable() and ….toStreamable(Collector) to allow the creation of a Streamable from streams wither using a default List-based intermediate collector (former) or providing an explicit one (latter).
2018-12-12 11:26:15 +01:00
Oliver Drotbohm
f2967a919e DATACMNS-1443 - Fixed Querydsl web data binding for blank strings.
We now use StringUtils.hasLength(…) in the check whether to drop request elements from binding instead of ….hasText(…) as the latter drops blank strings so that's impossible to search for properties that contain a blank.
2018-12-10 16:55:26 +01:00
Oliver Drotbohm
4537c11eba DATACMNS-1440 - Added converters to parse LocalDate(Time) and Instant from their toString() representation. 2018-12-08 12:28:00 +01:00
Oliver Drotbohm
75c9ab0a63 DATACMNS-1430 - Tweaked TypeDiscoverer to consider subtypes of Streamable collection like. 2018-12-04 15:43:54 +01:00
Oliver Drotbohm
db6e4cc024 DATACMNS-1434 - Removed Javaslang support. 2018-12-04 14:05:24 +01:00
Oliver Drotbohm
a3a5c8e484 DATACMNS-1433 - Added additional Streamable.and(…) flavors for convenience.
Removed superfluous Streamable creation from DefaultImplementationlookupConfiguration.
2018-12-04 12:46:06 +01:00
Oliver Drotbohm
9b39f51635 DATACMNS-1432 - Added Streamable.toList() and ….toSet() for convenience. 2018-12-04 12:40:14 +01:00
Oliver Drotbohm
cf1eaff784 DATACMNS-1430 - Support for returning wrapper types of Streamable.
Extended IterableToStreamableConverter in use in QueryExecutionConverters so that it can not only return Streamable instances but also instances of types that have a factory method or constructor taking a Streamable (by making use of the ObjectToObjectConverter in a default ConversionService).
2018-12-04 11:47:56 +01:00
Mark Paluch
596b0d8177 DATACMNS-1422 - Fall back to reflection-based PropertyAccessor/EntityInstantiator on inaccessible framework types.
We now fall back to reflection-based PropertyAccessor/EntityInstantiator strategies when framework types are not visible by the entity's ClassLoader.

Typically, we use class generation to create and load PropertyAccessor and EntityInstantiator classes to bypass reflection. Generated types are injected into the ClassLoader that has loaded the actual entity. Generated classes implement framework types such as ObjectInstantiator and these interfaces must be visible to the ClassLoader that hosts the generated class. Some arrangements, such as OSGi isolate class repositories so the OSGi class loader cannot load our own types which prevents loading the generated class.

Original pull request: #324.
2018-11-23 15:19:54 +01:00
Oliver Drotbohm
9791bb9354 DATACMNS-1421 - Polishing.
Extracted method filter into dedicated method. Changed method order according to conventions.

Original pull request: #323.
2018-11-19 19:46:03 +01:00
Mark Paluch
5bbb458dc5 DATACMNS-1421 - Lookup most specific wither method for a property.
We now inspect all methods that match the wither method pattern (name, accepting a single argument) to find the most specific method returning the actual entity type.

Previously, we attempted to find a method only considering name and argument properties and not the return type. This lookup strategy could find a method returning the entity super type that isn't assignable to the entity type.

Original pull request: #323.
2018-11-19 19:46:03 +01:00
Oliver Drotbohm
9d16739943 DATACMNS-1419 - Added TypeInformation.isSubtypeOf(…). 2018-11-19 19:21:33 +01:00
Mark Paluch
caaec1b862 DATACMNS-1415 - Use thread-safe caching in SpelAwareProxyProjectionFactory.
We now use ConcurrentHashMap as type instead of HashMap to properly synchronize concurrent updates to missing cache elements.

The previously used HashMap was not thread-safe so concurrent modifications resulted in ConcurrentModificationException.
2018-11-12 16:01:21 +01: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
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
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
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
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
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
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
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