Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-4840

LogASTTransformation fails if super class defines a private log field

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.8.0
    • Fix Version/s: 1.8.1, 1.9-beta-1
    • Component/s: groovy-jdk
    • Labels:
      None

      Description

      Given a Java class which has a private static final Log log = ... field, I find that I cannot apply the @Commons annotation (or, indeed, any other logging annotation) to a subclass without specifying a name other than 'log'. That seems a bit absurd - the sub-classes shouldn't be able to access the super-class log, as it is private. And, indeed, attempting to run code which accesses the private super-class 'log' variable fails with a 'groovy.lang.MissingPropertyException'.

      The fix for this would be to check if the owning class of the field (which is acquired on line 81 of LogASTTransformation.groovy) is the one we are currently processing. If so, then fail it. Otherwise, only fail it if the field is non-private - Package, Protected, or Public.

        Attachments

          Activity

            People

            • Assignee:
              hamletdrc Hamlet D'Arcy
              Reporter:
              ipsi Andrew
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: