You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Sean Gilligan <se...@msgilligan.com> on 2017/01/12 22:44:55 UTC

Problems with Groovy 2.4.8 and `final`.

I upgraded my bitcoinj-addons project from Groovy 2.4.7 to Groovy 2.4.8
today and it broke my build and my integration tests.

This is the build failure:

:bitcoinj-cli:compileGroovystartup failed:
/home/travis/build/msgilligan/bitcoinj-addons/bitcoinj-cli/src/main/groovy/com/msgilligan/bitcoinj/test/CLITestSupport.groovy:
14: Apparent variable 'testServers' was found in a static scope but
doesn't refer to a local variable, static field or class. Possible causes:
You attempted to reference a variable in the binding or an instance
variable from a static context.
You misspelled a classname or statically imported field. Please check
the spelling.
You attempted to use a method 'testServers' but left out brackets in a
place not allowed by the grammar.
 @ line 14, column 28.
       final String rpcUser = testServers.rpcTestUser

You can see the full log here in Travis:
https://travis-ci.org/msgilligan/bitcoinj-addons/builds/191446681

The following change fixes the build:
https://github.com/msgilligan/bitcoinj-addons/commit/496c72439d753765360a371173af04e60215e14f

However my integration tests fail unless I remove additional `final`
modifiers. The integration tests run on a Jenkins server with a
self-signed SSL cert, but you can see the failure there if you accept
the cert.

https://ci.omni.foundation/job/btc-integ-regtest/282/console

The test are failing because they're getting `null` values for the
members. The following changes fix those failures:

https://github.com/msgilligan/bitcoinj-addons/commit/8e95e3e1a0911a9623fc489f066412c3e092fa2e

The inheritance in the test code is a little convoluted because I'm
using both abstract base classes and Groovy traits to bring in
properties and methods for the tests. But I don't understand why `final`
would be a problem if the code works without it and the properties are
truly "final".

Thanks,

Sean



Re: Problems with Groovy 2.4.8 and `final`.

Posted by Paul King <pa...@asert.com.au>.
It's a known issue that was discovered too late to fix in 2.4.8:

https://issues.apache.org/jira/browse/GROOVY-8048

It will be mentioned in the official release announce email when
that gets sent out shortly. Just waiting on confirmation from
Baruch about a particular detail before I send that out.

Cheers, Paul.


On Fri, Jan 13, 2017 at 8:44 AM, Sean Gilligan <se...@msgilligan.com> wrote:
> I upgraded my bitcoinj-addons project from Groovy 2.4.7 to Groovy 2.4.8
> today and it broke my build and my integration tests.
>
> This is the build failure:
>
> :bitcoinj-cli:compileGroovystartup failed:
> /home/travis/build/msgilligan/bitcoinj-addons/bitcoinj-cli/src/main/groovy/com/msgilligan/bitcoinj/test/CLITestSupport.groovy:
> 14: Apparent variable 'testServers' was found in a static scope but
> doesn't refer to a local variable, static field or class. Possible causes:
> You attempted to reference a variable in the binding or an instance
> variable from a static context.
> You misspelled a classname or statically imported field. Please check
> the spelling.
> You attempted to use a method 'testServers' but left out brackets in a
> place not allowed by the grammar.
>  @ line 14, column 28.
>        final String rpcUser = testServers.rpcTestUser
>
> You can see the full log here in Travis:
> https://travis-ci.org/msgilligan/bitcoinj-addons/builds/191446681
>
> The following change fixes the build:
> https://github.com/msgilligan/bitcoinj-addons/commit/496c72439d753765360a371173af04e60215e14f
>
> However my integration tests fail unless I remove additional `final`
> modifiers. The integration tests run on a Jenkins server with a
> self-signed SSL cert, but you can see the failure there if you accept
> the cert.
>
> https://ci.omni.foundation/job/btc-integ-regtest/282/console
>
> The test are failing because they're getting `null` values for the
> members. The following changes fix those failures:
>
> https://github.com/msgilligan/bitcoinj-addons/commit/8e95e3e1a0911a9623fc489f066412c3e092fa2e
>
> The inheritance in the test code is a little convoluted because I'm
> using both abstract base classes and Groovy traits to bring in
> properties and methods for the tests. But I don't understand why `final`
> would be a problem if the code works without it and the properties are
> truly "final".
>
> Thanks,
>
> Sean
>
>