groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Gilligan <>
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:
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:

The following change fixes the build:

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.

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

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".



View raw message