New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix mutated metadata being cleared before it was written in Groovy classes #6749
Conversation
It fixes runtime errors but there are still some compile problems with |
Right because the code to retrieve the default values only looks at the runtime source of that information. If we should not leak the compile time data to runtime, which was the cause of the original issue, then either default value data will not be available at compile time or the methods to get the defaults needs to look at the compile time defaults. |
We have code that relies on compile-time default values so we need to fix it somehow 🤔 |
@jameskleeh can you link to the original issue, the original PR that broke everything to solve that issue and so on. None of the PRs that tried to mitigate this issue include any references to the issues they solve so it is hard to trace back the history of the issue |
@graemerocher The original issue is #6433 The fix I created for that was #6455 which basically reused the runtime cache at compile time. Because there was a singular cache the data from Groovy was leaking to Java. Groovy is creating proxies for annotation instances and the Java annotation metadata stuff is not designed to handle them. I tried to solve that issue by clearing the cache after compilation but that caused lots of issues with compiling code at runtime in our tests, so it was evident the runtime cache could not be cleared. The next step I took was to separate the compile time from runtime default value caches so the compile time cache could be cleared after compilation preventing one languages values leaking to another. #6734 Unfortunately I mistakenly cleared the mutated metadata too early for Groovy so that caused runtime issues of mutated metadata being missing. It also had the side effect of annotation default values not being available at compile time because the metadata only looks at the runtime cache and we aren't populating it |
I can confirm these changes fix the problems in Micronaut Data |
…asses (#6749) * Fix mutated metadata being cleared before it was written in Groovy classes * Add test for mutated metadata being used in bean definitions * Read defaults from compile time information for mutable metadata * Reuse existing test instead * Fix test
@dstepanov Please give this a try with data