freeacs/freeacs

View on GitHub
common/src/main/java/com/github/freeacs/common/scheduler/TaskDefaultImpl.java

Summary

Maintainability
A
0 mins
Test Coverage

Define and throw a dedicated exception instead of using a generic one.
Open

  public abstract void runImpl() throws Throwable;

Using such generic exceptions as Error, RuntimeException, Throwable, and Exception prevents calling methods from handling true, system-generated exceptions differently than application-generated errors.

Noncompliant Code Example

public void foo(String bar) throws Throwable {  // Noncompliant
  throw new RuntimeException("My Message");     // Noncompliant
}

Compliant Solution

public void foo(String bar) {
  throw new MyOwnRuntimeException("My Message");
}

Exceptions

Generic exceptions in the signatures of overriding methods are ignored, because overriding method has to follow signature of the throw declaration in the superclass. The issue will be raised on superclass declaration of the method (or won't be raised at all if superclass is not part of the analysis).

@Override
public void myMethod() throws Exception {...}

Generic exceptions are also ignored in the signatures of methods that make calls to methods that throw generic exceptions.

public void myOtherMethod throws Exception {
  doTheThing();  // this method throws Exception
}

See

Change the visibility of this constructor to "protected".
Open

  public TaskDefaultImpl(String taskName) {

Abstract classes should not have public constructors. Constructors of abstract classes can only be called in constructors of their subclasses. So there is no point in making them public. The protected modifier should be enough.

Noncompliant Code Example

public abstract class AbstractClass1 {
    public AbstractClass1 () { // Noncompliant, has public modifier
        // do something here
    }
}

Compliant Solution

public abstract class AbstractClass2 {
    protected AbstractClass2 () {
        // do something here
    }
}

Rename "t" which hides the field declared at line 8.
Open

    } catch (Throwable t) {

Overriding or shadowing a variable declared in an outer scope can strongly impact the readability, and therefore the maintainability, of a piece of code. Further, it could lead maintainers to introduce bugs because they think they're using one variable but are really using another.

Noncompliant Code Example

class Foo {
  public int myField;

  public void doSomething() {
    int myField = 0;
    ...
  }
}

See

At-clause should have a non-empty description.
Open

   * @throws Throwable

Parameter name 't' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'.
Open

  public void setThrowable(Throwable t) {

Checks that method parameter names conform to a specified pattern.By using accessModifiers property it is possibleto specify different formats for methods at different visibility levels.

To validate catch parameters please useCatchParameterName.

To validate lambda parameters please useLambdaParameterName.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Member name 't' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'.
Open

  private Throwable t;

There are no issues that match your filters.

Category
Status