You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Grant Haywood <mr...@gmail.com> on 2019/08/08 06:25:47 UTC

Re: Moving from (3.0 alpha 4 -> beta 1) causes access error to arise

This bug is still present in beta 3.

with this code (access public field of current class inside a closure)


@TypeChecked
@CompileStatic
class KvOp extends KvdnOperation implements KVOperation {
    public KVData D

....


            startOperation(this.valueType, TXTYPE.KV_SUBMIT, key, content, {
                D.getMap(this.strAddr, { AsyncResult<AsyncMap> res ->
......

I get

123: Access to java.lang.Object#D is forbidden @ line 123, column 17.
                   D.getMap(this.strAddr, { AsyncResult<AsyncMap> res ->

It looks like I cannot access any class field from inside an
anonamyous closure.

If i change the line to
                session.D.getMap(this.strAddr, { AsyncResult<AsyncMap> res ->
I get
/home/g/kvdn/src/main/groovy/net/iowntheinter/kvdn/storage/kv/impl/KvOp.groovy:
124: Access to java.lang.Object#session is forbidden @ line 124,
column 17.
                   session.D.getMap(this.strAddr, { AsyncResult<AsyncMap> res ->






On 7/15/19, Grant Haywood <mr...@gmail.com> wrote:
> This bug is still present in 3.0.0-beta2
>
> On Sun, May 26, 2019 at 2:45 PM Grant Haywood <mr...@gmail.com>
> wrote:
>
>> I have attempted a build against 3.0.0-20190525.075505-1086 (are
>> groovy-json build numbers out of sync?
>> i ended up using                        3.0.0-20190525.183916-1086 for
>> groovy-json)
>>
>> I still get the same error, however this time line information is
>> available!
>>
>> KvOp.groovy: 115: Access to java.lang.Object#D is forbidden @ line 115,
>> column 13.
>>                D.getMap(this.strAddr, { AsyncResult<AsyncMap> res ->
>>                ^
>>
>> That is progress, I still don't know why there is access forbidden here
>> however :/
>>
>> On Sun, May 26, 2019 at 9:13 PM Paul King <pa...@asert.com.au> wrote:
>>
>>> There are a couple of bugs fixed already which sound similar. If you can
>>> try a snapshot version (see downloads page), and see if your problems
>>> are
>>> already fixed, that would be great.
>>>
>>> On Mon, May 27, 2019 at 7:09 AM Grant Haywood <mr...@gmail.com>
>>> wrote:
>>>
>>>> Hello;
>>>> Building my project on groovy 3.0 beta 1 causes an error I have not
>>>> seen
>>>> before.
>>>>
>>>>     -1: Access to java.lang.Object#D is forbidden @ line -1, column -1.
>>>>
>>>> The line information seems to be suppressed  or lost
>>>>
>>>> D is declared typed at the top of the class
>>>>     public KVData D
>>>>
>>>> it is assigned in the constructor
>>>>     this.D = session.D
>>>>
>>>> and used in several methods, always in the form D.getMap(.....
>>>>
>>>> in session (where D is assigned from) it is also declared typed and
>>>> public
>>>>     public KVData D, M
>>>>
>>>> Has any one else had this type of issue with beta-1?
>>>>
>>>>
>


-- 


-Grant Haywood

Re: Moving from (3.0 alpha 4 -> beta 1) causes access error to arise

Posted by "Daniel.Sun" <su...@apache.org>.
Dear Grant,

    FYI,
https://stackoverflow.com/questions/20030026/difference-between-typechecked-and-compilestatic

    Please use either @CompileStatic or @TypeChecked, and do not mix the
usage of the two annotations.

    In short, you can just use @CompileStatic in your cases. According to
your sample project, the solution should work.

Cheers,
Daniel.Sun



-----
Apache Groovy committer & PMC member 
Blog: http://blog.sunlan.me 
Twitter: @daniel_sun 

--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html

Re: Moving from (3.0 alpha 4 -> beta 1) causes access error to arise

Posted by "Daniel.Sun" <su...@apache.org>.
> FYI there is a ticket for this issue (GROOVY-9215) 
The ticket is updated to "Fixed": 
https://issues.apache.org/jira/browse/GROOVY-9215

Cheers,
Daniel.Sun




-----
Apache Groovy committer & PMC member 
Blog: http://blog.sunlan.me 
Twitter: @daniel_sun 

--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html

Re: Moving from (3.0 alpha 4 -> beta 1) causes access error to arise

Posted by Grant Haywood <mr...@gmail.com>.
Thanks for the link explaining the details, ill keep that in mind.
I will test with the next release
FYI there is a ticket for this issue (GROOVY-9215)

On 8/22/19, Daniel.Sun <su...@apache.org> wrote:
> Hi Grant,
>
> The issue should be fixed completely. Please try the next release of 3.0.0.
>
>
> P.S. submitting JIRA issues can help us track issues and remind us of
> fixing
> them ;-)
>
> Cheers,
> Daniel.Sun
>
>
>
>
> -----
> Apache Groovy committer & PMC member
> Blog: http://blog.sunlan.me
> Twitter: @daniel_sun
>
> --
> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html
>


-- 


-Grant Haywood

Re: Moving from (3.0 alpha 4 -> beta 1) causes access error to arise

Posted by "Daniel.Sun" <su...@apache.org>.
Hi Grant,

The issue should be fixed completely. Please try the next release of 3.0.0. 

P.S. submitting JIRA issues can help us track issues and remind us of fixing
them ;-)

Cheers,
Daniel.Sun




-----
Apache Groovy committer & PMC member 
Blog: http://blog.sunlan.me 
Twitter: @daniel_sun 

--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html

Re: Moving from (3.0 alpha 4 -> beta 1) causes access error to arise

Posted by Grant Haywood <mr...@gmail.com>.
Thanks for your response,

I have created
https://issues.apache.org/jira/browse/GROOVY-9215

On 8/8/19, Daniel.Sun <su...@apache.org> wrote:
>> This bug is still present in beta 3.
>
> I have not seen the message...
> Could you please submit a JIRA ticket?
>
> Cheers,
> Daniel.Sun
>
>
>
> -----
> Apache Groovy committer & PMC member
> Blog: http://blog.sunlan.me
> Twitter: @daniel_sun
>
> --
> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html
>


-- 


-Grant Haywood

Re: Moving from (3.0 alpha 4 -> beta 1) causes access error to arise

Posted by "Daniel.Sun" <su...@apache.org>.
> This bug is still present in beta 3. 

I have not seen the message...
Could you please submit a JIRA ticket?

Cheers,
Daniel.Sun



-----
Apache Groovy committer & PMC member 
Blog: http://blog.sunlan.me 
Twitter: @daniel_sun 

--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html

Re: Moving from (3.0 alpha 4 -> beta 1) causes access error to arise

Posted by "Daniel.Sun" <su...@apache.org>.
Hi Grant,

  A lot of STC issues have been fixed since groovy 3.0.0-beta-1. Could you
give groovy 3.0.0-beta-3 a try? 
  If the issue still exists in groovy 3.0.0-beta-3, could you please submit
a JIRA ticket? ( https://issues.apache.org/jira/projects/GROOVY/summary )

Cheers,
Daniel.Sun



-----
Apache Groovy committer & PMC member 
Blog: http://blog.sunlan.me 
Twitter: @daniel_sun 

--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html

Re: Moving from (3.0 alpha 4 -> beta 1) causes access error to arise

Posted by Grant Haywood <mr...@gmail.com>.
Other instances of the same type of error poped up in the code base,
and they where resolved by either disabling the TypeChecked
annotation, or in some cases, disabling the CompileStatic annotation

On 8/8/19, Grant Haywood <mr...@gmail.com> wrote:
> Removing
> import groovy.transform.TypeChecked
>
> appears to resolve this compile error. This is defiantly a bug.
>
> On 8/8/19, Grant Haywood <mr...@gmail.com> wrote:
>> This bug is still present in beta 3.
>>
>> with this code (access public field of current class inside a closure)
>>
>>
>> @TypeChecked
>> @CompileStatic
>> class KvOp extends KvdnOperation implements KVOperation {
>>     public KVData D
>>
>> ....
>>
>>
>>             startOperation(this.valueType, TXTYPE.KV_SUBMIT, key,
>> content,
>> {
>>                 D.getMap(this.strAddr, { AsyncResult<AsyncMap> res ->
>> ......
>>
>> I get
>>
>> 123: Access to java.lang.Object#D is forbidden @ line 123, column 17.
>>                    D.getMap(this.strAddr, { AsyncResult<AsyncMap> res ->
>>
>> It looks like I cannot access any class field from inside an
>> anonamyous closure.
>>
>> If i change the line to
>>                 session.D.getMap(this.strAddr, { AsyncResult<AsyncMap>
>> res
>> ->
>> I get
>> /home/g/kvdn/src/main/groovy/net/iowntheinter/kvdn/storage/kv/impl/KvOp.groovy:
>> 124: Access to java.lang.Object#session is forbidden @ line 124,
>> column 17.
>>                    session.D.getMap(this.strAddr, { AsyncResult<AsyncMap>
>> res ->
>>
>>
>>
>>
>>
>>
>> On 7/15/19, Grant Haywood <mr...@gmail.com> wrote:
>>> This bug is still present in 3.0.0-beta2
>>>
>>> On Sun, May 26, 2019 at 2:45 PM Grant Haywood <mr...@gmail.com>
>>> wrote:
>>>
>>>> I have attempted a build against 3.0.0-20190525.075505-1086 (are
>>>> groovy-json build numbers out of sync?
>>>> i ended up using                        3.0.0-20190525.183916-1086 for
>>>> groovy-json)
>>>>
>>>> I still get the same error, however this time line information is
>>>> available!
>>>>
>>>> KvOp.groovy: 115: Access to java.lang.Object#D is forbidden @ line 115,
>>>> column 13.
>>>>                D.getMap(this.strAddr, { AsyncResult<AsyncMap> res ->
>>>>                ^
>>>>
>>>> That is progress, I still don't know why there is access forbidden here
>>>> however :/
>>>>
>>>> On Sun, May 26, 2019 at 9:13 PM Paul King <pa...@asert.com.au> wrote:
>>>>
>>>>> There are a couple of bugs fixed already which sound similar. If you
>>>>> can
>>>>> try a snapshot version (see downloads page), and see if your problems
>>>>> are
>>>>> already fixed, that would be great.
>>>>>
>>>>> On Mon, May 27, 2019 at 7:09 AM Grant Haywood
>>>>> <mr...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hello;
>>>>>> Building my project on groovy 3.0 beta 1 causes an error I have not
>>>>>> seen
>>>>>> before.
>>>>>>
>>>>>>     -1: Access to java.lang.Object#D is forbidden @ line -1, column
>>>>>> -1.
>>>>>>
>>>>>> The line information seems to be suppressed  or lost
>>>>>>
>>>>>> D is declared typed at the top of the class
>>>>>>     public KVData D
>>>>>>
>>>>>> it is assigned in the constructor
>>>>>>     this.D = session.D
>>>>>>
>>>>>> and used in several methods, always in the form D.getMap(.....
>>>>>>
>>>>>> in session (where D is assigned from) it is also declared typed and
>>>>>> public
>>>>>>     public KVData D, M
>>>>>>
>>>>>> Has any one else had this type of issue with beta-1?
>>>>>>
>>>>>>
>>>
>>
>>
>> --
>>
>>
>> -Grant Haywood
>>
>
>
> --
>
>
> -Grant Haywood
>


-- 


-Grant Haywood

Re: Moving from (3.0 alpha 4 -> beta 1) causes access error to arise

Posted by Grant Haywood <mr...@gmail.com>.
Removing
import groovy.transform.TypeChecked

appears to resolve this compile error. This is defiantly a bug.

On 8/8/19, Grant Haywood <mr...@gmail.com> wrote:
> This bug is still present in beta 3.
>
> with this code (access public field of current class inside a closure)
>
>
> @TypeChecked
> @CompileStatic
> class KvOp extends KvdnOperation implements KVOperation {
>     public KVData D
>
> ....
>
>
>             startOperation(this.valueType, TXTYPE.KV_SUBMIT, key, content,
> {
>                 D.getMap(this.strAddr, { AsyncResult<AsyncMap> res ->
> ......
>
> I get
>
> 123: Access to java.lang.Object#D is forbidden @ line 123, column 17.
>                    D.getMap(this.strAddr, { AsyncResult<AsyncMap> res ->
>
> It looks like I cannot access any class field from inside an
> anonamyous closure.
>
> If i change the line to
>                 session.D.getMap(this.strAddr, { AsyncResult<AsyncMap> res
> ->
> I get
> /home/g/kvdn/src/main/groovy/net/iowntheinter/kvdn/storage/kv/impl/KvOp.groovy:
> 124: Access to java.lang.Object#session is forbidden @ line 124,
> column 17.
>                    session.D.getMap(this.strAddr, { AsyncResult<AsyncMap>
> res ->
>
>
>
>
>
>
> On 7/15/19, Grant Haywood <mr...@gmail.com> wrote:
>> This bug is still present in 3.0.0-beta2
>>
>> On Sun, May 26, 2019 at 2:45 PM Grant Haywood <mr...@gmail.com>
>> wrote:
>>
>>> I have attempted a build against 3.0.0-20190525.075505-1086 (are
>>> groovy-json build numbers out of sync?
>>> i ended up using                        3.0.0-20190525.183916-1086 for
>>> groovy-json)
>>>
>>> I still get the same error, however this time line information is
>>> available!
>>>
>>> KvOp.groovy: 115: Access to java.lang.Object#D is forbidden @ line 115,
>>> column 13.
>>>                D.getMap(this.strAddr, { AsyncResult<AsyncMap> res ->
>>>                ^
>>>
>>> That is progress, I still don't know why there is access forbidden here
>>> however :/
>>>
>>> On Sun, May 26, 2019 at 9:13 PM Paul King <pa...@asert.com.au> wrote:
>>>
>>>> There are a couple of bugs fixed already which sound similar. If you
>>>> can
>>>> try a snapshot version (see downloads page), and see if your problems
>>>> are
>>>> already fixed, that would be great.
>>>>
>>>> On Mon, May 27, 2019 at 7:09 AM Grant Haywood
>>>> <mr...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hello;
>>>>> Building my project on groovy 3.0 beta 1 causes an error I have not
>>>>> seen
>>>>> before.
>>>>>
>>>>>     -1: Access to java.lang.Object#D is forbidden @ line -1, column
>>>>> -1.
>>>>>
>>>>> The line information seems to be suppressed  or lost
>>>>>
>>>>> D is declared typed at the top of the class
>>>>>     public KVData D
>>>>>
>>>>> it is assigned in the constructor
>>>>>     this.D = session.D
>>>>>
>>>>> and used in several methods, always in the form D.getMap(.....
>>>>>
>>>>> in session (where D is assigned from) it is also declared typed and
>>>>> public
>>>>>     public KVData D, M
>>>>>
>>>>> Has any one else had this type of issue with beta-1?
>>>>>
>>>>>
>>
>
>
> --
>
>
> -Grant Haywood
>


-- 


-Grant Haywood