I ran error-prone 2.0.13 with a custom configuration[1] to discover
these errors.  Our pom.xml uses error-prone at 2.0.5 since newer
versions require JDK 8 to run[2] so we miss out on a years worth of new
checks.  While we only require JDK 6 to run jclouds, I believe we
require JDK 7 to compile the filesystem blobstore.  If we require JDK 8
instead we can enable these checks while still targeting a JDK 6
runtime.

[1] https://github.com/andrewgaul/jclouds/tree/error-prone
[2] https://github.com/google/error-prone/issues/369

On Sun, Oct 23, 2016 at 08:32:16PM +0200, Ignasi Barrera wrote:
> Thanks!
> 
> Out of curiosity, how did you catch these using error prone? AFAIK we
> have it already configured [1] but I've never seen such errors
> (although I have to say I have no idea how error-prone works, so I may
> have missed them).
> 
> 
> [1] https://github.com/jclouds/jclouds/blob/master/project/pom.xml#L741-L767
> 
> On 23 October 2016 at 15:39,  <g...@apache.org> wrote:
> > Repository: jclouds-labs
> > Updated Branches:
> >   refs/heads/master e1670f5c9 -> 1063deafa
> >
> >
> > Avoid improper equality comparisons
> >
> > Found via error-prone.
> >
> >
> > Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
> > Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/1063deaf
> > Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/1063deaf
> > Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/1063deaf
> >
> > Branch: refs/heads/master
> > Commit: 1063deafa4f118d3be39c495f3f93816e85b0389
> > Parents: e1670f5
> > Author: Andrew Gaul <g...@apache.org>
> > Authored: Sun Oct 23 06:38:46 2016 -0700
> > Committer: Andrew Gaul <g...@apache.org>
> > Committed: Sun Oct 23 06:38:46 2016 -0700
> >
> > ----------------------------------------------------------------------
> >  .../azurecompute/arm/features/VirtualMachineApiLiveTest.java  | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> > ----------------------------------------------------------------------
> >
> >
> > http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/1063deaf/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualMachineApiLiveTest.java
> > ----------------------------------------------------------------------
> > diff --git 
> > a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualMachineApiLiveTest.java
> >  
> > b/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualMachineApiLiveTest.java
> > index 35ccd89..a11ff71 100644
> > --- 
> > a/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualMachineApiLiveTest.java
> > +++ 
> > b/azurecompute-arm/src/test/java/org/jclouds/azurecompute/arm/features/VirtualMachineApiLiveTest.java
> > @@ -16,6 +16,7 @@
> >   */
> >  package org.jclouds.azurecompute.arm.features;
> >
> > +import static org.assertj.core.api.Assertions.assertThat;
> >  import static org.jclouds.util.Predicates2.retry;
> >  import static org.testng.Assert.assertNotNull;
> >  import static org.testng.Assert.assertTrue;
> > @@ -120,15 +121,15 @@ public class VirtualMachineApiLiveTest extends 
> > BaseAzureComputeApiLiveTest {
> >        boolean jobDone = retry(new Predicate<String>() {
> >           @Override
> >           public boolean apply(String name) {
> > -            return 
> > !api().get(name).properties().provisioningState().equals("Creating");
> > +            return 
> > !api().get(name).properties().provisioningState().equals(VirtualMachineProperties.ProvisioningState.CREATING);
> >           }
> >        }, 60 * 20 * 1000).apply(vmName);
> >        assertTrue(jobDone, "create operation did not complete in the 
> > configured timeout");
> >
> >        VirtualMachineProperties.ProvisioningState status = 
> > api().get(vmName).properties().provisioningState();
> >        // Cannot be creating anymore. Should be succeeded or running but 
> > not failed.
> > -      assertTrue(!status.equals("Creating"));
> > -      assertTrue(!status.equals("Failed"));
> > +      
> > assertThat(status).isNotEqualTo(VirtualMachineProperties.ProvisioningState.CREATING);
> > +      
> > assertThat(status).isNotEqualTo(VirtualMachineProperties.ProvisioningState.FAILED);
> >     }
> >
> >     @Test(dependsOnMethods = "testCreate")
> >

-- 
Andrew Gaul
http://gaul.org/

Reply via email to