Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-2139

Can not init instances with super(...)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.1-beta-3
    • 1.1-rc-1
    • None
    • None
    • jdk6u2

    Description

      I failed to compile my old project with groovy1.1beta3, but ok with groovy1.1beta2, so I tried to inspect why.
      At last, I found the following code can not be executed properly in groovy1.1beta3, which is abstracted from my project.

      Base.groovy
      class Base {
      	int v
      
      	public Base(int v) {
      		this.v = v
      	}
      }
      
      Derived.groovy
      class Derived extends Base {
      	int[] vs
      
      	public Derived(vs) {
      		super(vs.size)
      		this.vs = vs
      	}
      
      	public static void main(String[] args) {
      		int[] vs = new int[5]
      		println vs.length
      		Base b = new Derived(vs);
      		println b.vs
      	}
      }
      

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            daniel_sun Daniel Sun
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: