fix: race-conditions during startup #870
Annotations
11 errors and 10 warnings
|
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/InMemoryPreferenceStore.java#L318
For any method that returns an collection (such as an array, Collection or Map), it is better to return
an empty one rather than a null reference. This removes the need for null checking all results and avoids
inadvertent NullPointerExceptions.
See Effective Java, 3rd Edition, Item 54: Return empty collections or arrays instead of null
ReturnEmptyCollectionRatherThanNull (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull
|
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/InMemoryPreferenceStore.java#L324
For any method that returns an collection (such as an array, Collection or Map), it is better to return
an empty one rather than a null reference. This removes the need for null checking all results and avoids
inadvertent NullPointerExceptions.
See Effective Java, 3rd Edition, Item 54: Return empty collections or arrays instead of null
ReturnEmptyCollectionRatherThanNull (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull
|
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/InMemoryPreferenceStore.java#L330
For any method that returns an collection (such as an array, Collection or Map), it is better to return
an empty one rather than a null reference. This removes the need for null checking all results and avoids
inadvertent NullPointerExceptions.
See Effective Java, 3rd Edition, Item 54: Return empty collections or arrays instead of null
ReturnEmptyCollectionRatherThanNull (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull
|
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/InMemorySecurePreferenceStore.java#L70
For any method that returns an collection (such as an array, Collection or Map), it is better to return
an empty one rather than a null reference. This removes the need for null checking all results and avoids
inadvertent NullPointerExceptions.
See Effective Java, 3rd Edition, Item 54: Return empty collections or arrays instead of null
ReturnEmptyCollectionRatherThanNull (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull
|
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/InMemorySecurePreferenceStore.java#L76
For any method that returns an collection (such as an array, Collection or Map), it is better to return
an empty one rather than a null reference. This removes the need for null checking all results and avoids
inadvertent NullPointerExceptions.
See Effective Java, 3rd Edition, Item 54: Return empty collections or arrays instead of null
ReturnEmptyCollectionRatherThanNull (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull
|
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/InMemorySecurePreferenceStore.java#L184
For any method that returns an collection (such as an array, Collection or Map), it is better to return
an empty one rather than a null reference. This removes the need for null checking all results and avoids
inadvertent NullPointerExceptions.
See Effective Java, 3rd Edition, Item 54: Return empty collections or arrays instead of null
ReturnEmptyCollectionRatherThanNull (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_errorprone.html#returnemptycollectionratherthannull
|
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L27
Some classes contain overloaded getInstance. The problem with overloaded getInstance methods
is that the instance created using the overloaded method is not cached and so,
for each call and new objects will be created for every invocation.
SingleMethodSingleton (Priority: 2, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_errorprone.html#singlemethodsingleton
|
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L90
A singleton class should only ever have one instance. Failure to check
whether an instance has already been created may result in multiple
instances being created.
SingletonClassReturningNewInstance (Priority: 2, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_errorprone.html#singletonclassreturningnewinstance
|
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L108
Reports calls to overridable methods on `this` during object initialization. These
are invoked on an incompletely constructed object and can be difficult to debug if overridden.
This is because the subclass usually assumes that the superclass is completely initialized
in all methods. If that is not the case, bugs can appear in the constructor, for instance,
some fields that are still null may cause a NullPointerException or be stored somewhere
else to blow up later.
To avoid this problem, only use methods that are static, private, or final in constructors.
Note that those methods also must not call overridable methods transitively to be safe.
ConstructorCallsOverridableMethod (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_errorprone.html#constructorcallsoverridablemethod
|
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L109
Reports calls to overridable methods on `this` during object initialization. These
are invoked on an incompletely constructed object and can be difficult to debug if overridden.
This is because the subclass usually assumes that the superclass is completely initialized
in all methods. If that is not the case, bugs can appear in the constructor, for instance,
some fields that are still null may cause a NullPointerException or be stored somewhere
else to blow up later.
To avoid this problem, only use methods that are static, private, or final in constructors.
Note that those methods also must not call overridable methods transitively to be safe.
ConstructorCallsOverridableMethod (Priority: 1, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_errorprone.html#constructorcallsoverridablemethod
|
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L78
Java will initialize fields with known default values so any explicit initialization of those same defaults
is redundant and results in a larger class file (approximately three additional bytecode instructions per field).
RedundantFieldInitializer (Priority: 3, Ruleset: Performance)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_performance.html#redundantfieldinitializer
|
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L109
Code containing duplicate String literals can usually be improved by declaring the String as a constant field.
AvoidDuplicateLiterals (Priority: 3, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_errorprone.html#avoidduplicateliterals
|
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L115
Code containing duplicate String literals can usually be improved by declaring the String as a constant field.
AvoidDuplicateLiterals (Priority: 3, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_errorprone.html#avoidduplicateliterals
|
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/Preferences.java#L171
Avoid using hard-coded literals in conditional statements. By declaring them as static variables
or private members with descriptive names maintainability is enhanced. By default, the literals "-1" and "0" are ignored.
More exceptions can be defined with the property "ignoreMagicNumbers".
The rule doesn't consider deeper expressions by default, but this can be enabled via the property `ignoreExpressions`.
With this property set to false, if-conditions like `i == 1 + 5` are reported as well. Note that in that case,
the property ignoreMagicNumbers is not taken into account, if there are multiple literals involved in such an expression.
AvoidLiteralsInIfCondition (Priority: 3, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_errorprone.html#avoidliteralsinifcondition
|
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/PreferencesPage.java#L21
Java allows the use of several variables declaration of the same type on one line.
However, it can lead to quite messy code. This rule looks for several declarations on the same line.
OneDeclarationPerLine (Priority: 4, Ruleset: Best Practices)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_bestpractices.html#onedeclarationperline
|
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/PreferencesPage.java#L140
Reports assignments to variables that are never used before the variable is overwritten,
or goes out of scope. Unused assignments are those for which
1. The variable is never read after the assignment, or
2. The assigned value is always overwritten by other assignments before the next read of
the variable.
The rule tracks assignements to fields of `this`, and static fields of the current class.
This may cause some false positives in timing-sensitive concurrent code, which the rule cannot detect.
The rule may be suppressed with the standard `@SuppressWarnings("unused")` tag.
The rule subsumes {% rule "UnusedLocalVariable" %}, and {% rule "UnusedFormalParameter" %}.
Those violations are filtered
out by default, in case you already have enabled those rules, but may be enabled with the property
`reportUnusedVariables`. Variables whose name starts with `ignored` or `unused` are filtered out, as
is standard practice for exceptions.
Limitations:
* The rule currently cannot know which method calls throw exceptions, or which exceptions they throw.
In the body of a try block, every method or constructor call is assumed to throw. This may cause false-negatives.
The only other language construct that is assumed to throw is the `throw` statement, in particular,
things like `assert` statements, or NullPointerExceptions on dereference are ignored.
* The rule cannot resolve assignments across constructors, when they're called with the special
`this(...)` syntax. This may cause false-negatives.
Both of those limitations may be partly relaxed in PMD 7.
UnusedAssignment (Priority: 3, Ruleset: Best Practices)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_bestpractices.html#unusedassignment
|
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/PreferencesPage.java#L151
Java will initialize fields with known default values so any explicit initialization of those same defaults
is redundant and results in a larger class file (approximately three additional bytecode instructions per field).
RedundantFieldInitializer (Priority: 3, Ruleset: Performance)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_performance.html#redundantfieldinitializer
|
plugin/src/main/java/io/snyk/eclipse/plugin/preferences/PreferencesPage.java#L159
Code should never throw NullPointerExceptions under normal circumstances. A catch block may hide the
original error, causing other, more subtle problems later on.
AvoidCatchingNPE (Priority: 3, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_errorprone.html#avoidcatchingnpe
|
plugin/src/main/java/io/snyk/eclipse/plugin/wizards/SnykWizardAuthenticatePage.java#L73
Assigning a "null" to a variable (outside of its declaration) is usually bad form. Sometimes, this type
of assignment is an indication that the programmer doesn't completely understand what is going on in the code.
NOTE: This sort of assignment may used in some cases to dereference objects and encourage garbage collection.
NullAssignment (Priority: 3, Ruleset: Error Prone)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_errorprone.html#nullassignment
|
plugin/src/main/java/io/snyk/languageserver/download/LsDownloader.java#L33
Reports assignments to variables that are never used before the variable is overwritten,
or goes out of scope. Unused assignments are those for which
1. The variable is never read after the assignment, or
2. The assigned value is always overwritten by other assignments before the next read of
the variable.
The rule tracks assignements to fields of `this`, and static fields of the current class.
This may cause some false positives in timing-sensitive concurrent code, which the rule cannot detect.
The rule may be suppressed with the standard `@SuppressWarnings("unused")` tag.
The rule subsumes {% rule "UnusedLocalVariable" %}, and {% rule "UnusedFormalParameter" %}.
Those violations are filtered
out by default, in case you already have enabled those rules, but may be enabled with the property
`reportUnusedVariables`. Variables whose name starts with `ignored` or `unused` are filtered out, as
is standard practice for exceptions.
Limitations:
* The rule currently cannot know which method calls throw exceptions, or which exceptions they throw.
In the body of a try block, every method or constructor call is assumed to throw. This may cause false-negatives.
The only other language construct that is assumed to throw is the `throw` statement, in particular,
things like `assert` statements, or NullPointerExceptions on dereference are ignored.
* The rule cannot resolve assignments across constructors, when they're called with the special
`this(...)` syntax. This may cause false-negatives.
Both of those limitations may be partly relaxed in PMD 7.
UnusedAssignment (Priority: 3, Ruleset: Best Practices)
https://docs.pmd-code.org/pmd-doc-7.11.0/pmd_rules_java_bestpractices.html#unusedassignment
|
The logs for this run have expired and are no longer available.
Loading