Skip to content

Instantly share code, notes, and snippets.

@robfletcher
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save robfletcher/5d9c79aec1c7bb694517 to your computer and use it in GitHub Desktop.

Select an option

Save robfletcher/5d9c79aec1c7bb694517 to your computer and use it in GitHub Desktop.
Is this supposed to be able to compile?
import groovy.transform.*
@CompileStatic
class A {
private final String name
A(String name) {
this.name = name
}
}
@CompileStatic
class B extends A {}
@robfletcher
Copy link
Copy Markdown
Author

I only get a runtime error when I try to new B()

@glaforge
Copy link
Copy Markdown

glaforge commented Aug 8, 2014

I think B needs to have a constructor calling A's.
But we could probably have a better error, and especially a compilation error (at least with @cs).

@robfletcher
Copy link
Copy Markdown
Author

@glaforge Yes, that's why I'm surprised it compiles. Especially with @CompileStatic on the classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment