groovy

groovyc ant task creates invalid stub

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.5.6
  • Fix Version/s: 1.6-rc-1, 1.5.8, 1.7-beta-1
  • Component/s: None
  • Labels:
    None
  • Environment:
    WindowsXP, Ant 1.7.0
  • Testcase included:
    yes
  • Number of attachments :
    1

Description

When using the groovyc ant task, on certain conditions builds fail because the generated java stub is invalid.Our best example is when a groovy class inherits from a java class that has a basic type as a constructor parameter. The stub has a constructor that calls super(null, nulll), which fails when using a null type.

------java class----
public class Parent {
private String name;
private int number;

public Parent(String name, int number){ this.name=name; this.number=number; }
}
--------groovy class-------
class Child extends Parent {
public Child(String name, int number){ super(name,number); }
}

I've attached a working environment that reproduces the bug. just run the build file.

Activity

Hide
blackdrag blackdrag added a comment -

looks like this issue is fixed in 1.6/1.7 already

Show
blackdrag blackdrag added a comment - looks like this issue is fixed in 1.6/1.7 already
Hide
blackdrag blackdrag added a comment -

ok, looks like all versions might have the problem in some cases. I extended the stub generator to use the parameter types from the constructor definition for the cast if variables are used. That fixes the reported problem

Show
blackdrag blackdrag added a comment - ok, looks like all versions might have the problem in some cases. I extended the stub generator to use the parameter types from the constructor definition for the cast if variables are used. That fixes the reported problem

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: