Hello Other Groovy Devs & Eric Miles

I thought an email will be a better way to communicate intent with this
ticket I raised

https://issues.apache.org/jira/browse/GROOVY-11670

This is my current setup

   - I have a bunch of java files, all of which work fine when compiled
   with JavaC
   - Lets say one file is named aLowerCaseClassName.java and it has a
   function build() that returns a new instance of aLowerCaseClassName
   - Lets say another file uses this class and has a method customBuild()
   that also returns a new instance of aLowerCaseClassName

I am trying to compile all these files with Groovy (to apply AST
transformations) and I see these problems

   - both build methods will cause a parsing error as detailed in the jira
   ticket
   - errors go away if I just rename the class starting with a capital
   letter. But this is not an option as I cannot change the Java code, so I
   have to do something as part of the groovy compile process

Eric, you suggested in the ticket that I can use import aliasing, I want to
understand this better

   - I assume the lower case class name is a problem only for return types?
   Will this work for other places? (generics, parameter types, field names
   etc)
   - I assume that I will have to do this import aliasing in every file
   where I use this class name
   - I will then have to change all class type uses in that file to use the
   uppercase class name (if it's just return types, then should I just change
   that?)
   - I also assume that this change will have to be done before the groovy
   compiler gets a hold of this file? I assume probably through a string
   reader source that I create for the file after some regex replacements
   maybe?

Are my assumptions right? Are there simpler ways to fix this on my side?

regards
Saravanan

Reply via email to