groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Gilligan <s...@msgilligan.com>
Subject Problems with Groovy 2.4.8 and `final`.
Date Thu, 12 Jan 2017 22:44:55 GMT
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



Mime
View raw message