Details
-
Improvement
-
Status: Closed
-
Trivial
-
Resolution: Fixed
-
1.0-JSR-3
-
None
-
None
-
groovy jsr03, jdk 142_09
Description
When using a class that depends on another class that is not available, e.g. like this:
myjar1.jar : contains foo.MyClass1, which depends on bar.MyClass2
myjar2.jar : contains bar.MyClass2
A method in MyClass1:
public MyClass2 amethod(MyClass2 arg) { //...
and only myjar1.jar is on the classpath.
Now, if you do:
def cls = Class.forName('foo.MyClass1')
def m = cls.methods
you get:
Caught: groovy.lang.GroovyRuntimeException: Cannot read property: methods
which is not very informative. The property "methods" exists (i.e. the method getMethods()).
A simple improvement would be to tell what exception caused the reading of the given property to fail. At the moment getCause() on the thrown GroovyRuntimeException returns null.