GROOVY-11508: change exception to detailed warning #2117
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://issues.apache.org/jira/browse/GROOVY-11508
This PR converts the
RuntimeParserException
, which stops compilation, to a more detailed warning about using aTrait
orInterface
with more than one generic type parameter via inheritance.Resolves grails/grails-data-mapping#1811 which is a significant open issue for the Groovy 3.0.x to 4.0.x upgrade in preparation for Grails 7. Grails 6 and lower were still on Groovy 3.0.x.
Precise simplified example of the code which results in the exception with Groovy 4.0.x compiler: grails/grails-data-mapping#1811 (comment)
grails/grails-data-mapping#1811 (comment) - the decompiled Grails Domain Classes, compiled with Groovy 4.0.23, after changing the exception to a warning. These Grails Domains, with inheritance, compile and run without issue once the exception is removed during pre-compilation verification.
In each instance the
Trait
orInterface
which is implemented with 2+ generic types via inheritance, have generic types which are compatible and extend in a lineage hierarchy.The Groovy 4 compiler only copies the lowest level Trait or Interface methods into the class, before compiling, which was the approach in Groovy 3 and same and expected approach in Groovy 4.
Example output after restoring Domain Inheritance and Inheritance tests on https://github.com/grails/grails-data-mapping/