[jira] [Updated] (GROOVY-7750) @Lazy allows instantiation of abstract class

2016-05-14 Thread Jochen Theodorou (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-7750?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jochen Theodorou updated GROOVY-7750:
-
Description: 
Given this code:

{code:java}
@Lazy
Foo foo

abstract class Foo {}
{code}

You'll get:

{code}
java.lang.InstantiationException
at 
sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at 
org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:80)
at 
org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at 
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:239)
{code}

This isn't really helpful. If I mistype a method name, Groovy will help me out 
with suggestions, why not here?

MODIFICATION by blackdrag:
@Lazy should recognize this and fail compilation to avoid the initialization of 
an abstract class.

  was:
Given this code:

{code:java}
@Lazy
Foo foo

abstract class Foo {}
{code}

You'll get:

{code}
java.lang.InstantiationException
at 
sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at 
org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:80)
at 
org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at 
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:239)
{code}

This isn't really helpful. If I mistype a method name, Groovy will help me out 
with suggestions, why not here?


> @Lazy allows instantiation of abstract class
> 
>
> Key: GROOVY-7750
> URL: https://issues.apache.org/jira/browse/GROOVY-7750
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 2.4.4
>Reporter: Johann
>Priority: Minor
>  Labels: usability
>
> Given this code:
> {code:java}
> @Lazy
> Foo foo
> abstract class Foo {}
> {code}
> You'll get:
> {code}
> java.lang.InstantiationException
>   at 
> sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48)
>   at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
>   at 
> org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:80)
>   at 
> org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
>   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
>   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
>   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:239)
> {code}
> This isn't really helpful. If I mistype a method name, Groovy will help me 
> out with suggestions, why not here?
> MODIFICATION by blackdrag:
> @Lazy should recognize this and fail compilation to avoid the initialization 
> of an abstract class.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (GROOVY-7750) @Lazy allows instantiation of abstract class

2016-05-14 Thread Jochen Theodorou (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-7750?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jochen Theodorou updated GROOVY-7750:
-
Summary: @Lazy allows instantiation of abstract class  (was: Instantiation 
of abstract classes causes unhelpful exception)

> @Lazy allows instantiation of abstract class
> 
>
> Key: GROOVY-7750
> URL: https://issues.apache.org/jira/browse/GROOVY-7750
> Project: Groovy
>  Issue Type: Bug
>  Components: groovy-runtime
>Affects Versions: 2.4.4
>Reporter: Johann
>Priority: Minor
>  Labels: usability
>
> Given this code:
> {code:java}
> @Lazy
> Foo foo
> abstract class Foo {}
> {code}
> You'll get:
> {code}
> java.lang.InstantiationException
>   at 
> sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48)
>   at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
>   at 
> org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:80)
>   at 
> org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
>   at 
> org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
>   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
>   at 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:239)
> {code}
> This isn't really helpful. If I mistype a method name, Groovy will help me 
> out with suggestions, why not here?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)