Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Re-use the same infrastructure for `DirectInstantiator` and `MapNotationConverter` caches

This makes the cache in `MapNotationConverter` thread-safe. It's not yet externalized though.

    • -0
    • +50
    ./ReflectionCache.java
  1. … 1 more file in changeset.
Make `CachedConstructor` safer by wrapping parameter types in `WeakReferences`

Impact on performance is yet to be checked...

Fix initial match not found in service registry candidate list

  1. … 1 more file in changeset.
Slightly optimize `DirectInstantiator`

This commit reworks the direct instantiator cache, by avoiding to recompute the parameter types of the

constructor each time, as well as wrapped parameter types. The reason is that `getParameterTypes` clones

the underlying parameter type array, which creates garbage immediately collected, for each constructor

we test, for each instantiation.

  1. … 1 more file in changeset.
Remove unnecessary parameter

+review REVIEW-6090

  1. … 5 more files in changeset.
Move type hierarchy walker to `base-services`

We'll need it in other places, too.

+review REVIEW-5989

  1. … 6 more files in changeset.
Move `PropertyAccessorType` to `base-services`

    • -0
    • +149
    ./PropertyAccessorType.java
  1. … 18 more files in changeset.
Add a cache for `propertyExists` because it is intensively called from `ConventionAwareHelper`

  1. … 1 more file in changeset.
Avoid relying on exceptions to find reflective information like `getField`

Those methods are called a number of time in the Gradle build itself and cause a lot of exceptions to be thrown and caught for nothing.

Replace usage of `String#format` with good old string concatenation

The rationale behind this change is that while `String#format` is usually admitted as good for readability (this is arguable),

in practice it is very bad for performance. Since Java 6, the JVM (the JIT, to be correct) does a pretty good job at optimizing

string concatenation. However, it is only capable to do so if we're using "dirty" string concatenations (using `+`), or `StringBuilder`.

However, usage of `StringBuilder` is not recommended either for 2 reasons:

1. it significantly decreases code readability

2. in Java 9, String concatenation is even more optimized thanks to `invokedynamic`, and code using `StringBuilder` will *not* benefit

from this optimization.

There are sill leftover `String#format` calls in the code, in the following cases:

- the call is used to generate an exception message. That's 90% of the remaining calls.

- the call is obviously a debug message, often used in `toString` (because as we all know, `toString` should only be used for debugging)

- the format includes specific number formatting patterns

- I missed it

  1. … 226 more files in changeset.
Fix regression in error reporting

+review REVIEW-5921

Optimize `DirectInstantiator`

* remove the use of an intermediate `ArrayList` to build the result

* cache `getConstructors` call

* add JMH benchmark to prove that caching is faster

+review REVIEW-5921

  1. … 3 more files in changeset.
Rework setting of project properties to avoid dynamic calls altogether

  1. … 5 more files in changeset.
`coll.toArray(new T[coll.size()])` => `coll.toArray(new T[0])`

> Bottom line: toArray(new T[0]) seems faster, safer, and contractually cleaner, and therefore should be the default choice now. Future VM optimizations may close this performance gap for toArray(new T[size]), rendering the current "believed to be optimal" usages on par with an actually optimal one. Further improvements in toArray APIs would follow the same logic as toArray(new T[0]) — the collection itself should create the appropriate storage.

http://shipilev.net/blog/2016/arrays-wisdom-ancients/

Let's see what our performance tests say, if this is noticeable at all.

Changes made by IDEA "Structural Replace":

$coll$.toArray(new $T$[$coll$.size()])

=>

$coll$.toArray(new $T$[0])

+review REVIEW

  1. … 38 more files in changeset.
Use struct binding information when generating proxies

Use the pre-calculated method bindings to generate view proxies. With

this change some logic has been moved out from the proxy generator,

making it simpler.

It is now possible for the validation of extensible types (which is now

spread between instantiation, type registration and schema extraction)

to happen mostly in one place, where we have all the required context.

This change also opens up the possibility to remove `@Managed` as a

concept, and handle all view types the same way.

+review REVIEW-5761

  1. … 25 more files in changeset.
Include some more context in exceptions thrown when the value provided for a scalar typed property cannot be converted to the target type.

In particular, include the name of the property and the value that was provided.

    • -0
    • +29
    ./UnsupportedPropertyValueException.java
  1. … 3 more files in changeset.
Reorder methods

+review REVIEW-5595

Allow handle package definition in antlr4

- add some more test coverage for antlr4

- rework invocation of different antlr implementations

  1. … 5 more files in changeset.
Tweak some wording and docs as to what PropertyDetails.getGetters() (and setters) actually represents.

Tweak a few test names.

+review REVIEW-5561

  1. … 1 more file in changeset.
Documents class inspection and PropertyDetails

+review REVIEW-5557

  1. … 1 more file in changeset.
[GRADLE-3317] Cleans up class inspection post code review * Moves test closer to the real issue * Adds more coverage to class inspector test * Prevents redundantly walking the super class hierarchy

+review REVIEW-5557

  1. … 3 more files in changeset.
[GRADLE-3317] Changes class inspection to inspect superclasses before interfaces

+review

  1. … 2 more files in changeset.
Add the inheritance “structure” to ClassDetails.

+review REVIEW-5536

  1. … 1 more file in changeset.
Bust out class inspector internal types so they can be used elsewhere.

+review REVIEW-5536

    • -0
    • +40
    ./MethodSignature.java
    • -0
    • +77
    ./MutableClassDetails.java
    • -0
    • +53
    ./MutablePropertyDetails.java
Reorganised managed model creation to have the schema provide the creation strategy.

This allows custom schema extraction strategies to have a say in how objects are to be created.

+review REVIEW-5536

  1. … 49 more files in changeset.
Moves check for default toString to Reflection util class

+review REVIEW-5501

  1. … 2 more files in changeset.
Make DirectInstantiator a singleton.

  1. … 89 more files in changeset.
Adding generic types to readableField methods

+review REVIEW-5337

Adding support for locating static methods to JavaReflectionUtil

+review REVIEW-5337

  1. … 3 more files in changeset.
Making PropertyAccessor generic

+review REVIEW-5337

  1. … 4 more files in changeset.