groovy
  1. groovy
  2. GROOVY-2490

Static properties are not overriden correctly in the byte code

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.5, 1.5.1
    • Fix Version/s: 1.5.2
    • Component/s: bytecode
    • Labels:
      None
    • Number of attachments :
      0

      Description

      If you have two java classes like this:

      public class One {
      
          static String foo = "hello";
      }
      public class Two extends One{
      
          static String foo = "goodbye";
      }
      

      And you write a test like this:

      public class StaticOverrideTest extends TestCase {
      
          public void testOne() {
              System.out.println("One.foo = " + One.foo);
              System.out.println("Two.foo = " + Two.foo);
          }
      }
      

      It prints

      "hello"
      "goodbye"

      As expected. Do the same thing with two Groovy classes

      class One { static foo = "hello" }
      class Two extends One { static foo = "goodbye" }
      
      println One.foo
      println Two.foo
      

      It prints

      "hello"
      "hello"

      The problem appears to be at the byte code level

        Activity

        Hide
        Graeme Rocher added a comment -
        Show
        Graeme Rocher added a comment - This is effecting http://jira.codehaus.org/browse/GRAILS-2104
        Hide
        Alex Tkachman added a comment -

        Can't reproduce.
        Testcase added

        Show
        Alex Tkachman added a comment - Can't reproduce. Testcase added
        Hide
        Paul King added a comment -

        I did make some fixes on other bugs recently which may have fixed this. Not sure though and the test coverage in this area isn't great, so +1 for the test case .

        Show
        Paul King added a comment - I did make some fixes on other bugs recently which may have fixed this. Not sure though and the test coverage in this area isn't great, so +1 for the test case .
        Hide
        Paul King added a comment -

        close off release 1.5.4

        Show
        Paul King added a comment - close off release 1.5.4

          People

          • Assignee:
            Alex Tkachman
            Reporter:
            Graeme Rocher
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: