jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Gomes Rodrigues <ra0...@gmail.com>
Subject Error Prone (static analysis tool for Java that catches common programming mistakes) results
Date Thu, 27 Oct 2016 12:46:09 GMT
Hi all,

I have run Error Prone in JMeter source code


**** It have found  2 [ReferenceEquality] Comparison using reference
equality instead of value equality
http://errorprone.info/bugpattern/ReferenceEquality


    [javac]
C:\Util\0_perso\TestError\trunk\src\core\org\apache\jmeter\samplers\SampleSaveConfiguration.java:600:
warning: [ReferenceEquality] Comparison using reference equality instead of
value equality
    [javac]             stringValues = s.delimiter == delimiter ||
(delimiter != null && delimiter.equals(s.delimiter));
    [javac]                                        ^
    [javac]     (see http://errorprone.info/bugpattern/ReferenceEquality)
    [javac]   Did you mean 'stringValues = Objects.equals(s.delimiter,
delimiter) || (delimiter != null && delimiter.equals(s.delimiter));' or
'stringValues = s.delimiter.equals(delimiter) || (delimiter != null &&
delimiter.equals(s.delimiter));'?
    [javac]
C:\Util\0_perso\TestError\trunk\src\core\org\apache\jmeter\samplers\SampleSaveConfiguration.java:604:
warning: [ReferenceEquality] Comparison using reference equality instead of
value equality
    [javac]             complexValues = s.formatter == formatter ||
(formatter != null && formatter.equals(s.formatter));
    [javac]                                         ^
    [javac]     (see http://errorprone.info/bugpattern/ReferenceEquality)
    [javac]   Did you mean 'complexValues = Objects.equals(s.formatter,
formatter) || (formatter != null && formatter.equals(s.formatter));' or
'complexValues = s.formatter.equals(formatter) || (formatter != null &&
formatter.equals(s.formatter));'?



****And some [ClassNewInstance] Class.newInstance() bypasses exception
checking; prefer getConstructor().newInstance()
http://errorprone.info/bugpattern/ClassNewInstance

    [javac]
C:\Util\0_perso\TestError\trunk\src\core\org\apache\jmeter\testelement\property\MapProperty.java:119:
warning: [ClassNewInstance] Class.newInstance() bypasses exception
checking; prefer getConstructor().newInstance()
    [javac]             Map<String, JMeterProperty> newCol =
value.getClass().newInstance();

[javac]
^
    [javac]     (see http://errorprone.info/bugpattern/ClassNewInstance)
    [javac]   Did you mean 'Map<String, JMeterProperty> newCol =
value.getClass().getConstructor().newInstance();'?


****1 Synchronizing on non-final fields is not safe: if the field is ever
updated, different threads may end up locking on different objects
http://errorprone.info/bugpattern/SynchronizeOnNonFinalField

    [javac]
C:\Util\0_perso\TestError\trunk\src\core\org\apache\jmeter\reporters\Summariser.java:190:
warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is
not safe: if the field is ever updated, different threads may end up
locking on different objects.
    [javac]         synchronized (myTotals) {
    [javac]                      ^
    [javac]     (see
http://errorprone.info/bugpattern/SynchronizeOnNonFinalField)

****1 error [ChainingConstructorIgnoresParameter] The called constructor
accepts a parameter with the same name and type as one of its caller's
parameters, but its caller doesn't pass that parameter to it.  It's likely
that it was intended to.
http://errorprone.info/bugpattern/ChainingConstructorIgnoresParameter

    [javac]
C:\Util\0_perso\TestError\trunk\src\core\org\apache\jmeter\gui\util\FilePanel.java:44:
error: [ChainingConstructorIgnoresParameter] The called constructor accepts
a parameter with the same name and type as one of its caller's parameters,
but its caller doesn't pass that parameter to it.  It's likely that it was
intended to.
    [javac]         this(title, (String) null, false);
    [javac]             ^
    [javac]     (see
http://errorprone.info/bugpattern/ChainingConstructorIgnoresParameter)
    [javac]   Did you mean 'this(title, filetype, false);'?


Anybody have already use this tool and check if results ara false positive?

Error Prone : https://github.com/google/error-prone


Antonio

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message