groovy
  1. groovy
  2. GROOVY-4840

LogASTTransformation fails if super class defines a private log field

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical 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
    • Number of attachments :
      0

      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.

        Activity

        Hide
        Hamlet D'Arcy added a comment -

        fixed in the trunk and 1.8.x branch. You may want to double check my "fixed versions" field to make sure it is correct.

        Show
        Hamlet D'Arcy added a comment - fixed in the trunk and 1.8.x branch. You may want to double check my "fixed versions" field to make sure it is correct.
        Hide
        Guillaume Laforge added a comment -

        Fix versions should be 1.8.1 and 1.9-beta-1, since they will be the next available releases of those two branches.
        Thanks for the fix Hamlet!

        Show
        Guillaume Laforge added a comment - Fix versions should be 1.8.1 and 1.9-beta-1, since they will be the next available releases of those two branches. Thanks for the fix Hamlet!

          People

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

            Dates

            • Created:
              Updated:
              Resolved: