Christopher Smith created GROOVY-11161:
------------------------------------------
Summary: Support extension methods inside the same compilation unit
Key: GROOVY-11161
URL: https://issues.apache.org/jira/browse/GROOVY-11161
Project: Groovy
Issue Type: Wish
Components: Compiler
Affects Versions: 4.0.14
Reporter: Christopher Smith
Currently, the Groovy compiler supports extension methods only if they are
previously compiled and provided to the current compilation run on the
classpath. I have several projects where using extension methods to make
project-specific micro-DSLs would substantially improve
readability/maintainability, but because the extension methods need to refer to
business objects, I would have to slice up the project into a pile of
micro-projects.
It would be very useful to be able to have a "bootstrap" mechanism to declare
extension methods within the same project they're applied to, in the same way
that annotations can be declared inside the same project. Either having an
annotation {{@ProvidesExtensionMethods}} or providing a {{META-INF}} file
(maybe being able to employ the usual mechanism for "forward extension
declarations"?) would accomplish what I think I'm looking for.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)