groovy

Strange behavior of category support

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.5
  • Fix Version/s: 1.5.8
  • Component/s: groovy-jdk
  • Labels:
    None
  • Environment:
    Windows XP SP2
  • Number of attachments :
    0

Description

static method in sub category class could not override that in super category class.

More information to recreate the problem
****************************************************
TestBaseCategory .java
****************************************************
package zero.assemble.flow.util;
public class TestBaseCategory {

public static void test(Object str) { System.out.println("test() in TestBaseCategory"); }
}

****************************************************
TestCategory.java
****************************************************
package zero.assemble.flow.util;
public class TestCategory extends TestBaseCategory{
public static void test(Object str) { System.out.println("test() in TestCategory"); }
}

****************************************************
test.groovy
****************************************************
use (zero.assemble.flow.util.TestCategory) {
"abc".test()
}

In the system console, it should show the "test() in TestCategory", but it show
"test() in TestBaseCategory",
When our debug the code, we found the
org.codehaus.groovy.runtime.metaclass.NewMetaMethod#getDeclaringClass() could
not return correct class.

Activity

There are no comments yet on this issue.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: