Integrate immutables:datatype with Plexus to remove the need for modifiable models#880
Integrate immutables:datatype with Plexus to remove the need for modifiable models#880
Conversation
|
This is also a helpful tool for achieving GH-877, as we can now dynamically use interface types within the future sealed type adapter. |
9496d24 to
07b7c49
Compare
|
Currently blocked by a bug in the library used by This is awaiting a merged fix within paul-hammant/qdox#287 to be released so that apache/maven-plugin-tools#944 can be closed in the next version of |
07b7c49 to
30bc301
Compare
| * runtime. | ||
| * | ||
| * @author Ashley Scopes | ||
| * @since TBC |
There was a problem hiding this comment.
TODO(ascopes): pin this to the next minor version.
30bc301 to
0a8c0ad
Compare
…types The implementation of this will expect users to take a 'kind' attribute on the marker for a sealed type parameter which is used via reflection to determine the concrete implementation class. Right now, we have to provide this info on each implementation via an annotation such that we can influence the behaviour that will eventually be provided for us by GH-880. This PR also changes the documentation and plugin interface so that users will pass in a <plugins> list containing all plugins now rather than having four distinct parameters for the same information. The exisiting parameters have been kept and still work the same way, but are now undocumented in the plugin guide, and are marked as deprecated-for-removal in v5.0.0. With this change, we will be able to use sealed implementation kinds for the <protoc/> parameter in future changes, further supporting GH-877.
| .withCauseExactlyInstanceOf(NoSuchMethodException.class); | ||
| } | ||
|
|
||
| static PlexusConfiguration xml2PlexusConfiguration(String lines) { |
There was a problem hiding this comment.
TODO: move to fixture class and remove duplicates
…types The implementation of this will expect users to take a 'kind' attribute on the marker for a sealed type parameter which is used via reflection to determine the concrete implementation class. Right now, we have to provide this info on each implementation via an annotation such that we can influence the behaviour that will eventually be provided for us by GH-880. This PR also changes the documentation and plugin interface so that users will pass in a <plugins> list containing all plugins now rather than having four distinct parameters for the same information. The exisiting parameters have been kept and still work the same way, but are now undocumented in the plugin guide, and are marked as deprecated-for-removal in v5.0.0. With this change, we will be able to use sealed implementation kinds for the <protoc/> parameter in future changes, further supporting GH-877.
1f58a5d to
d7809c3
Compare
ea16306 to
865975f
Compare
865975f to
acb6653
Compare
43bc9f9 to
faef78c
Compare
|
Hoping that apache/maven-plugin-tools#1046 will able to be merged to potentially unblock this. |
4df038f to
a7dff44
Compare
f3a2a67 to
38f11e3
Compare
7f9ef6b to
e240b73
Compare
e240b73 to
c600301
Compare
c600301 to
b8be2eb
Compare
b8be2eb to
d0afff5
Compare
c16b64d to
eec370c
Compare
c7b9100 to
fb6b340
Compare
|
Given QDox has been deprecated, we're just waiting for a new 3.x release of Maven Plugin Tools to allow us to disable QDox scanning generated classes. This should then hopefully be mergable! |
af93cf0 to
c811e2f
Compare
| } catch (ClassNotFoundException ex) { | ||
| return null; | ||
| } catch (ReflectiveOperationException ex) { | ||
| throw new IllegalStateException( |
There was a problem hiding this comment.
replace with Unchecked call introduced in GH-976.
| */ | ||
| @Modifiable | ||
| @Data | ||
| @Immutable |
There was a problem hiding this comment.
Add checks to project structure for @Modifiable annotations if possible so we can fail builds when they are used.
| */ | ||
| @Modifiable | ||
| @Data | ||
| @Immutable |
There was a problem hiding this comment.
Verify any changes rebased into this PR do not contain @Modifiable types.
c811e2f to
7735eb1
Compare
b9f841f to
015908e
Compare
…ype duplicates Implement initial POC for hooking Plexus into immutable builder classes Use fix from paul-hammant/qdox#271 temporarily to work around apache/maven-plugin-tools#944 Fix test compilation failure Fix ImmutablesDataPlexusConverter to handle stdlib/primitive types correctly Start writing unit tests for plexus converter for Immutables types Update logic in plexus converters Use Datatypes rather than Data for immutables Ran into immutables/immutables#1608 when initialising the data type descriptors. Add missing test case for immutables/immutables#1608 Update Plexus converter to use weak references to class types Move test data to subpackage Fix issues with nested type handling, add new test cases Suppress testdata in Checkstyle
015908e to
87a0da7
Compare
This PR removes the need to use modifiable models with Plexus due to the lack of ability to handle the builder pattern.
We utilise the
immutables:datatypelibrary to generate reflective descriptors of our immutable types that support dynamically being used as builders at runtime. From this, we wrap the logic in a Plexus converter shim that can dynamically perform these operations during parameter conversion.As a result, many of our internal types are now fully immutable and none need a duplicated "modifiable" type along side it to keep Plexus and Maven happy. This also means our APIs can now make use of the interface type in their declaration rather than the implementation.