Issue Details (XML | Word | Printable)

Key: GROOVY-2490
Type: Bug Bug
Status: Closed Closed
Resolution: Cannot Reproduce
Priority: Blocker Blocker
Assignee: Alex Tkachman
Reporter: Graeme Rocher
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

Static properties are not overriden correctly in the byte code

Created: 10/Jan/08 05:54 AM   Updated: 08/Feb/08 01:26 AM
Component/s: bytecode
Affects Version/s: 1.5, 1.5.1
Fix Version/s: 1.5.2

Time Tracking:
Not Specified


 Description  « Hide
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



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Graeme Rocher added a comment - 10/Jan/08 05:56 AM

Alex Tkachman added a comment - 10/Jan/08 06:17 AM
Can't reproduce.
Testcase added

Paul King added a comment - 10/Jan/08 07:28 AM
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 .

Paul King added a comment - 08/Feb/08 01:26 AM
close off release 1.5.4