fujaba/NetworkParser

View on GitHub
src/main/java/de/uniks/networkparser/ext/generic/ReflectionBlackBoxTester.java

Summary

Maintainability
F
2 wks
Test Coverage

Method testClass has a Cognitive Complexity of 112 (exceeds 5 allowed). Consider refactoring.
Open

    public boolean testClass(Object obj, Class<?> clazz, SimpleSet<String> ignoreMethods) {
        boolean reg = false;
        Set<Thread> oldThreads = Thread.getAllStackTraces().keySet();
        if (obj == null) {
            return true;

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File ReflectionBlackBoxTester.java has 824 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package de.uniks.networkparser.ext.generic;

/*
The MIT License

    Method getRandomValue has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

        private static Object getRandomValue(Class<?> clazz) {
            if (clazz != null && clazz.isPrimitive()) {
                if (equalsClass(clazz, byte.class, Byte.class)) {
                    return (byte) 0x50;
                }

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method mainTester has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

        public void mainTester(String[] args) {
            Object junitCore = ReflectionLoader.newInstanceStr("org.junit.runner.JUnitCore");
            SimpleSet<Class<?>> testClasses = new SimpleSet<Class<?>>();
            String blackBoxPackage = null;
            String path = "doc/";

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method testClass has 141 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public boolean testClass(Object obj, Class<?> clazz, SimpleSet<String> ignoreMethods) {
            boolean reg = false;
            Set<Thread> oldThreads = Thread.getAllStackTraces().keySet();
            if (obj == null) {
                return true;

      Method test has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          public boolean test(String packageName, NetworkParserLog logger) throws ClassNotFoundException, IOException,
                  InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
              String tester = Os.getTester();
              setTester();
              SimpleList<Class<?>> classesForPackage = ReflectionLoader.getClassesForPackage(packageName);

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      ReflectionBlackBoxTester has 32 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public class ReflectionBlackBoxTester {
          public static final String TYPE_NULLVALUE = "null";
          public static final String TYPE_MINVALUE = "min";
          public static final String TYPE_MIDDLEVALUE = "middle";
          public static final String TYPE_MAXVALUE = "max";

        Method getRandomValue has 85 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static Object getRandomValue(Class<?> clazz) {
                if (clazz != null && clazz.isPrimitive()) {
                    if (equalsClass(clazz, byte.class, Byte.class)) {
                        return (byte) 0x50;
                    }

          Method saveException has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

              private boolean saveException(Exception e, Class<?> clazz, Method m, Object[] call) {
                  if (clazz == null) {
                      return true;
                  }
                  String line = getLine(packageName, e, clazz.getSimpleName());

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method getMinValue has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              private static Object getMinValue(Class<?> clazz) {
                  if (clazz != null && clazz.isPrimitive()) {
                      if (equalsClass(clazz, boolean.class, Boolean.class)) {
                          return false;
                      }

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method getNullValue has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              private static Object getNullValue(Class<?> clazz) {
                  if (clazz != null && clazz.isPrimitive()) {
                      if (equalsClass(clazz, boolean.class, Boolean.class)) {
                          return false;
                      }

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method getMiddleValue has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              private static Object getMiddleValue(Class<?> clazz) {
                  if (clazz != null && clazz.isPrimitive()) {
                      if (equalsClass(clazz, boolean.class, Boolean.class)) {
                          return true;
                      }

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method getMaxValue has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              private static Object getMaxValue(Class<?> clazz) {
                  if (clazz != null && clazz.isPrimitive()) {
                      if (equalsClass(clazz, boolean.class, Boolean.class)) {
                          return false;
                      }

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method test has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public boolean test(String packageName, NetworkParserLog logger) throws ClassNotFoundException, IOException,
                      InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
                  String tester = Os.getTester();
                  setTester();
                  SimpleList<Class<?>> classesForPackage = ReflectionLoader.getClassesForPackage(packageName);

            Method getParameters has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                public static Object[] getParameters(Executable m, Class<?>[] parameters, String type, Object owner) {
                    if (parameters == null) {
                        return new Object[0];
                    }
                    int length = parameters.length;

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Method mainTester has 56 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public void mainTester(String[] args) {
                    Object junitCore = ReflectionLoader.newInstanceStr("org.junit.runner.JUnitCore");
                    SimpleSet<Class<?>> testClasses = new SimpleSet<Class<?>>();
                    String blackBoxPackage = null;
                    String path = "doc/";

              Method saveException has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private boolean saveException(Exception e, Class<?> clazz, Method m, Object[] call) {
                      if (clazz == null) {
                          return true;
                      }
                      String line = getLine(packageName, e, clazz.getSimpleName());

                Method withIgnoreClazzes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    public ReflectionBlackBoxTester withIgnoreClazzes(String... values) {
                        if (values == null) {
                            return this;
                        }
                        for (String item : values) {

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Method getParameters has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static Object[] getParameters(Executable m, Class<?>[] parameters, String type, Object owner) {
                        if (parameters == null) {
                            return new Object[0];
                        }
                        int length = parameters.length;

                  Method getNullValue has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private static Object getNullValue(Class<?> clazz) {
                          if (clazz != null && clazz.isPrimitive()) {
                              if (equalsClass(clazz, boolean.class, Boolean.class)) {
                                  return false;
                              }

                    Method getMinValue has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private static Object getMinValue(Class<?> clazz) {
                            if (clazz != null && clazz.isPrimitive()) {
                                if (equalsClass(clazz, boolean.class, Boolean.class)) {
                                    return false;
                                }

                      Method getMiddleValue has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private static Object getMiddleValue(Class<?> clazz) {
                              if (clazz != null && clazz.isPrimitive()) {
                                  if (equalsClass(clazz, boolean.class, Boolean.class)) {
                                      return true;
                                  }

                        Method getMaxValue has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private static Object getMaxValue(Class<?> clazz) {
                                if (clazz != null && clazz.isPrimitive()) {
                                    if (equalsClass(clazz, boolean.class, Boolean.class)) {
                                        return false;
                                    }

                          Avoid deeply nested control flow statements.
                          Open

                                                  if (item.startsWith(BLACKBOXTESTER)) {
                                                      int pos = item.indexOf('=');
                                                      if (pos > 0) {
                                                          blackBoxPackage = item.substring(pos + 1);
                                                      } else {

                            Method getLineFromThrowable has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private String getLineFromThrowable(String packageName, Throwable e, String clazzName) {
                                    if (e == null) {
                                        return "";
                                    }
                                    StackTraceElement[] stackTrace = e.getStackTrace();

                            Cognitive Complexity

                            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                            A method's cognitive complexity is based on a few simple rules:

                            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                            • Code is considered more complex for each "break in the linear flow of the code"
                            • Code is considered more complex when "flow breaking structures are nested"

                            Further reading

                            Avoid deeply nested control flow statements.
                            Open

                                                    if (m.getName().toLowerCase().startsWith(lowerCase)) {
                                                        continueFlag = true;
                                                        break;
                                                    }

                              Avoid deeply nested control flow statements.
                              Open

                                                      if (testClazz != null) {
                                                          testClasses.add(testClazz);
                                                      }

                                Avoid deeply nested control flow statements.
                                Open

                                                            if (types.length == 1) {
                                                                if (types[0] != int.class && types[0] != byte[].class && types[0] != String.class
                                                                        && types[0] != byte.class && types[0] != HTTPRequest.class) {
                                                                    m.invoke(obj, new SimpleEvent(this, "TESTER", null, null));
                                                                }

                                  Method output has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                      public void output(Object owner, String message, NetworkParserLog logger, int logLevel, Exception e) {

                                    Method getParamtoString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        public String getParamtoString(Object[] params) {
                                            StringBuilder sb = new StringBuilder();
                                            sb.append("(");
                                            if (params == null) {
                                                sb.append(")");

                                    Cognitive Complexity

                                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                    A method's cognitive complexity is based on a few simple rules:

                                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                    • Code is considered more complex for each "break in the linear flow of the code"
                                    • Code is considered more complex when "flow breaking structures are nested"

                                    Further reading

                                    Avoid too many return statements within this method.
                                    Open

                                                    return Short.MIN_VALUE;

                                      Avoid too many return statements within this method.
                                      Open

                                                  return ReflectionLoader.newInstance(clazz);

                                        Avoid too many return statements within this method.
                                        Open

                                                    return Array.newInstance(arrayClazz, dims);

                                          Avoid too many return statements within this method.
                                          Open

                                                      return null;

                                            Avoid too many return statements within this method.
                                            Open

                                                            return 8;

                                              Avoid too many return statements within this method.
                                              Open

                                                                          return c.newInstance(call);

                                                Avoid too many return statements within this method.
                                                Open

                                                                return (short) 2;

                                                  Avoid too many return statements within this method.
                                                  Open

                                                          return null;

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                    return Character.MIN_VALUE;

                                                      Avoid too many return statements within this method.
                                                      Open

                                                                      return (byte) 0x50;

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                return null;

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                          return Character.MAX_VALUE;

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                            return '\u0000';

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                              return Long.MIN_VALUE;

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                            return "Albert";

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                          return null;

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                                    return 0L;

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                                  return Object.class;

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                        return 42;

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                          return Character.MAX_VALUE;

                                                                            Avoid too many return statements within this method.
                                                                            Open

                                                                                        return new byte[][] { new byte[] { 1, 2 } };

                                                                              Avoid too many return statements within this method.
                                                                              Open

                                                                                          return null;

                                                                                Avoid too many return statements within this method.
                                                                                Open

                                                                                        return objects;

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

                                                                                                  return Double.MIN_VALUE;

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

                                                                                                return new File("");

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

                                                                                                      return Double.MAX_VALUE;

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                        return 'g';

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                          return 0.0f;

                                                                                            Avoid too many return statements within this method.
                                                                                            Open

                                                                                                            return 0.0d;

                                                                                              Avoid too many return statements within this method.
                                                                                              Open

                                                                                                              return Float.MIN_VALUE;

                                                                                                Avoid too many return statements within this method.
                                                                                                Open

                                                                                                        return null;

                                                                                                  Avoid too many return statements within this method.
                                                                                                  Open

                                                                                                                  return 6;

                                                                                                    Avoid too many return statements within this method.
                                                                                                    Open

                                                                                                                return getCustomValue(m, parameters, owner);

                                                                                                      Avoid too many return statements within this method.
                                                                                                      Open

                                                                                                                      return 0;

                                                                                                        Avoid too many return statements within this method.
                                                                                                        Open

                                                                                                                        return 3;

                                                                                                          Avoid too many return statements within this method.
                                                                                                          Open

                                                                                                                          return Long.MAX_VALUE;

                                                                                                            Avoid too many return statements within this method.
                                                                                                            Open

                                                                                                                            return true;

                                                                                                              Avoid too many return statements within this method.
                                                                                                              Open

                                                                                                                              return Float.MAX_VALUE;

                                                                                                                Avoid too many return statements within this method.
                                                                                                                Open

                                                                                                                                return (short) 1000;

                                                                                                                  Avoid too many return statements within this method.
                                                                                                                  Open

                                                                                                                                  return (long) 1000;

                                                                                                                    Avoid too many return statements within this method.
                                                                                                                    Open

                                                                                                                            return null;

                                                                                                                      Avoid too many return statements within this method.
                                                                                                                      Open

                                                                                                                                      return (double) 1000;

                                                                                                                        Avoid too many return statements within this method.
                                                                                                                        Open

                                                                                                                                        return (float) 1000;

                                                                                                                          Method equalsClass has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                          Open

                                                                                                                              private static boolean equalsClass(Class<?> clazz, Class<?>... checkClasses) {
                                                                                                                                  if (checkClasses == null || clazz == null) {
                                                                                                                                      return true;
                                                                                                                                  }
                                                                                                                                  for (Class<?> check : checkClasses) {

                                                                                                                          Cognitive Complexity

                                                                                                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                          A method's cognitive complexity is based on a few simple rules:

                                                                                                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                          • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                          • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                          Further reading

                                                                                                                          Method withIgnoreClazzes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                          Open

                                                                                                                              public ReflectionBlackBoxTester withIgnoreClazzes(Class<?> metaClass, String... methods) {
                                                                                                                                  if (metaClass == null) {
                                                                                                                                      return this;
                                                                                                                                  }
                                                                                                                                  String className = metaClass.getName();

                                                                                                                          Cognitive Complexity

                                                                                                                          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                                                                                                          A method's cognitive complexity is based on a few simple rules:

                                                                                                                          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                                                                                                          • Code is considered more complex for each "break in the linear flow of the code"
                                                                                                                          • Code is considered more complex when "flow breaking structures are nested"

                                                                                                                          Further reading

                                                                                                                          These nested if statements could be combined
                                                                                                                          Open

                                                                                                                                      if (ignoreSimpleException == false || exception == null || exception instanceof SimpleException == false) {
                                                                                                                                          output(m, "at " + clazz.getName() + causes + " " + shortName, logger, NetworkParserLog.LOGLEVEL_ERROR,
                                                                                                                                                  e);
                                                                                                                                          errorCount++;
                                                                                                                                          if(breakByErrorCount>0 && errorCount>=breakByErrorCount) {

                                                                                                                          CollapsibleIfStatements

                                                                                                                          Since: PMD 3.1

                                                                                                                          Priority: Medium

                                                                                                                          Categories: Style

                                                                                                                          Remediation Points: 50000

                                                                                                                          Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

                                                                                                                          Example:

                                                                                                                          void bar() {
                                                                                                                           if (x) { // original implementation
                                                                                                                           if (y) {
                                                                                                                           // do stuff
                                                                                                                           }
                                                                                                                           }
                                                                                                                          }
                                                                                                                          
                                                                                                                          void bar() {
                                                                                                                           if (x && y) { // optimized implementation
                                                                                                                           // do stuff
                                                                                                                           }
                                                                                                                          }

                                                                                                                          These nested if statements could be combined
                                                                                                                          Open

                                                                                                                                                          if (types[0] != int.class && types[0] != byte[].class && types[0] != String.class
                                                                                                                                                                  && types[0] != byte.class && types[0] != HTTPRequest.class) {
                                                                                                                                                              m.invoke(obj, new SimpleEvent(this, "TESTER", null, null));
                                                                                                                                                          }

                                                                                                                          CollapsibleIfStatements

                                                                                                                          Since: PMD 3.1

                                                                                                                          Priority: Medium

                                                                                                                          Categories: Style

                                                                                                                          Remediation Points: 50000

                                                                                                                          Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

                                                                                                                          Example:

                                                                                                                          void bar() {
                                                                                                                           if (x) { // original implementation
                                                                                                                           if (y) {
                                                                                                                           // do stuff
                                                                                                                           }
                                                                                                                           }
                                                                                                                          }
                                                                                                                          
                                                                                                                          void bar() {
                                                                                                                           if (x && y) { // optimized implementation
                                                                                                                           // do stuff
                                                                                                                           }
                                                                                                                          }

                                                                                                                          There are no issues that match your filters.

                                                                                                                          Category
                                                                                                                          Status