zcommon/src/main/java/org/zkoss/lang/Classes.java

Summary

Maintainability
F
2 wks
Test Coverage

Method coerce has a Cognitive Complexity of 125 (exceeds 5 allowed). Consider refactoring.
Open

    public static Object coerce(Class<?> cls, Object val)
    throws ClassCastException {
        if (cls.isInstance(val))
            return val;

Severity: Minor
Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 2 days to fix

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 Classes.java has 1005 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* Classes.java


    Purpose: Utilities to handle Class
    Description:
Severity: Major
Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 2 days to fix

    Method coerce has 163 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static Object coerce(Class<?> cls, Object val)
        throws ClassCastException {
            if (cls.isInstance(val))
                return val;
    
    
    Severity: Major
    Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 6 hrs to fix

      Classes has 45 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public class Classes {
          private static final Logger log = LoggerFactory.getLogger(Classes.class);
      
          private static final Object NOT_FOUND = new Object();
      
      
      Severity: Minor
      Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 6 hrs to fix

        Method myGetCloseMethod has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
        Open

            private static final
            Method myGetCloseMethod(final Class<?> cls, final String name,
            final Class<?>[] argTypes, final boolean bySubclass)
            throws NoSuchMethodException {
        //        assert argTypes != null: "Caller shall handle null";
        Severity: Minor
        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 5 hrs to fix

        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 matched has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

            private static boolean matched(Class[] types, Object[] args, boolean loosely) {
                if (types.length == args.length) {
                    final Object[] argcvt = loosely ? new Object[args.length]: args;
                    boolean cvted = false;
                    for (int k = args.length;;) {
        Severity: Minor
        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 4 hrs to fix

        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 myGetCloseMethods has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

            private static final Method[]
            myGetCloseMethods(final Class<?> cls, final String name,
            final Class<?>[] argTypes, final boolean bySubclass) {
        //        assert argTypes != null: "Caller shall handle null";
                final List<Method> mtds = new LinkedList<Method>();
        Severity: Minor
        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 4 hrs to fix

        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 myGetAcsObj has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            private static final AccessibleObject
            myGetAcsObj(Class<?> cls, String name, Class<?>[] argTypes, int flags)
            throws NoSuchMethodException {
                //try public set/get
                final String decoratedName =
        Severity: Minor
        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 3 hrs to fix

        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 looselyCast has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            private static Object looselyCast(Class type, Object arg) {
                if (type == Integer.class || type == int.class) {
                    if (arg instanceof Number)
                        return ((Number) arg).intValue();
                } else if (type == Long.class || type == long.class) {
        Severity: Minor
        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 3 hrs to fix

        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 coerce has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            public static Object coerce(Class<?> cls, Object val, boolean nullable)
            throws ClassCastException {
                if (nullable || val != null)
                    return coerce(cls, val);
        
        
        Severity: Minor
        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 3 hrs to fix

        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 parseMethod has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            public static final MethodInfo parseMethod(String signature) 
            throws IllegalSyntaxException {
                int len = signature.length();
                int j = Strings.skipWhitespaces(signature, 0);
                int k = Strings.anyOf(signature, "( \t\n\r", j);
        Severity: Minor
        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 2 hrs to fix

        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 parseMethod has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static final MethodInfo parseMethod(String signature) 
            throws IllegalSyntaxException {
                int len = signature.length();
                int j = Strings.skipWhitespaces(signature, 0);
                int k = Strings.anyOf(signature, "( \t\n\r", j);
        Severity: Major
        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 2 hrs to fix

          Method myGetAcsObj has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static final AccessibleObject
              myGetAcsObj(Class<?> cls, String name, Class<?>[] argTypes, int flags)
              throws NoSuchMethodException {
                  //try public set/get
                  final String decoratedName =
          Severity: Minor
          Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 2 hrs to fix

            Method toInternalForm has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

                public static final String toInternalForm(String clsName) {
                    final int k = clsName.indexOf('[');
                    if (k <= 0) { //not an array, or already in internal form
                        return clsName;    //just return
                    }
            Severity: Minor
            Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 1 hr to fix

            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 getSuperClasses has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                public static final Class<?>[] getSuperClasses(Class<?> cls, Class<?>[] clsToCheck) {
                    if (clsToCheck!=null) {
                        int[] hits = new int[clsToCheck.length];
                        int no = 0;
                        for (int j=0; j<clsToCheck.length; ++j)
            Severity: Minor
            Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 1 hr to fix

            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 myGetCloseMethod has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static final
                Method myGetCloseMethod(final Class<?> cls, final String name,
                final Class<?>[] argTypes, final boolean bySubclass)
                throws NoSuchMethodException {
            //        assert argTypes != null: "Caller shall handle null";
            Severity: Minor
            Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 1 hr to fix

              Method equals has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                      public boolean equals(Object o) {
                          if (this == o) return true;
                          if (!(o instanceof AOInfo))
                              return false;
              
              
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 1 hr to fix

              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 myGetCloseMethods has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static final Method[]
                  myGetCloseMethods(final Class<?> cls, final String name,
                  final Class<?>[] argTypes, final boolean bySubclass) {
              //        assert argTypes != null: "Caller shall handle null";
                      final List<Method> mtds = new LinkedList<Method>();
              Severity: Minor
              Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 1 hr to fix

                Method coerce has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static Object coerce(Class<?> cls, Object val, boolean nullable)
                    throws ClassCastException {
                        if (nullable || val != null)
                            return coerce(cls, val);
                
                
                Severity: Minor
                Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 1 hr to fix

                  Method toInternalForm has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static final String toInternalForm(String clsName) {
                          final int k = clsName.indexOf('[');
                          if (k <= 0) { //not an array, or already in internal form
                              return clsName;    //just return
                          }
                  Severity: Minor
                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 1 hr to fix

                    Method toAttributeName has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static final String toAttributeName(String methodName) {
                            int len = methodName.length();
                            if (len < 2)
                                return null;
                    
                    
                    Severity: Minor
                    Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 1 hr to fix

                    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 toAttributeName has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static final String toAttributeName(String methodName) {
                            int len = methodName.length();
                            if (len < 2)
                                return null;
                    
                    
                    Severity: Minor
                    Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 1 hr to fix

                      Method matched has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private static boolean matched(Class[] types, Object[] args, boolean loosely) {
                              if (types.length == args.length) {
                                  final Object[] argcvt = loosely ? new Object[args.length]: args;
                                  boolean cvted = false;
                                  for (int k = args.length;;) {
                      Severity: Minor
                      Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 1 hr to fix

                        Method getAnyMethod has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static final Method
                            getAnyMethod(Class<?> cls, String name, Class<?>[] argTypes)
                            throws NoSuchMethodException {
                                try {
                                    return cls.getDeclaredMethod(name, argTypes);
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 1 hr to fix

                        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 getMethodInPublic has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static final Method
                            getMethodInPublic(Class<?> cls, String name, Class<?>[] argTypes)
                            throws NoSuchMethodException {
                                final Method m = cls.getMethod(name, argTypes);
                                if (Modifier.isPublic(m.getDeclaringClass().getModifiers()))
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 55 mins to fix

                        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 getTopmostInterface has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static Class<?> getTopmostInterface(Class<?> cls, Class<?> subIF) {
                                if (cls.isInterface())
                                    return subIF.isAssignableFrom(cls) ? cls: null;
                        
                                while (cls != null) {
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 55 mins to fix

                        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 isAttribute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static final boolean isAttribute(String methodName) {
                                int len = methodName.length();
                                if (len < 2)
                                    return false;
                        
                        
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 45 mins to fix

                        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 match has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private static
                            Method match(Class<?> cls, String name, Object[] args, boolean loosely) {
                                final Method[] ms = cls.getMethods();
                                for (int j = 0; j < ms.length; ++j) {
                                    if (!ms[j].getName().equals(name)
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 45 mins to fix

                        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 getClassOfSignature has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private static final
                            Class getClassOfSignature(ClassResolver resolver, String clsnm)
                            throws ClassNotFoundException {
                                try {
                                    return resolver != null ?
                        Severity: Minor
                        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 35 mins to fix

                        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 false;
                        Severity: Major
                        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return new Byte((String)val);
                          Severity: Major
                          Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                            return new Float(((Number)val).floatValue());
                            Severity: Major
                            Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                              return ((Number) arg).longValue();
                              Severity: Major
                              Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                        return j==len || Character.isUpperCase(methodName.charAt(j));
                                Severity: Major
                                Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                                  return new BigDecimal((String)val);
                                  Severity: Major
                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                                    return val;
                                    Severity: Major
                                    Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                              return null; //not castable
                                      Severity: Major
                                      Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                return null;
                                        Severity: Major
                                        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                          return cls.getField(name);
                                          Severity: Major
                                          Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                        return true;
                                            Severity: Major
                                            Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                              return new Character((char)((Number)val).shortValue());
                                              Severity: Major
                                              Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                                return new Float(((Date)val).getTime());
                                                Severity: Major
                                                Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                                  return Byte.class == cls ? null: Objects.ZERO_BYTE;
                                                  Severity: Major
                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                    return Short.class == cls ? null: Objects.ZERO_SHORT;
                                                    Severity: Major
                                                    Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                                      return BigIntegers.toBigInteger((Integer)val);
                                                      Severity: Major
                                                      Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                        return new Float((String)val);
                                                        Severity: Major
                                                        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                          return Long.valueOf((String) val);
                                                          Severity: Major
                                                          Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                        return new String(buf);
                                                            Severity: Major
                                                            Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                              return new Byte(((Number)val).byteValue());
                                                              Severity: Major
                                                              Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                                return Long.class == cls ? null: Objects.ZERO_LONG;
                                                                Severity: Major
                                                                Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                                  return ((Number) arg).intValue();
                                                                  Severity: Major
                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                                    return getAnyMethod(cls, name, argTypes);
                                                                    Severity: Major
                                                                    Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                                          return getAnyMethod(cls, isMethodName, argTypes);
                                                                      Severity: Major
                                                                      Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                        return Float.class == cls ? null: Objects.ZERO_FLOAT;
                                                                        Severity: Major
                                                                        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                          return val;
                                                                          Severity: Major
                                                                          Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                            Avoid too many return statements within this method.
                                                                            Open

                                                                                            return ((Number) val).shortValue();
                                                                            Severity: Major
                                                                            Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                              Avoid too many return statements within this method.
                                                                              Open

                                                                                              return new BigInteger((String)val);
                                                                              Severity: Major
                                                                              Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                Avoid too many return statements within this method.
                                                                                Open

                                                                                            return getAnyField(cls, name);
                                                                                Severity: Major
                                                                                Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

                                                                                                  return val;
                                                                                  Severity: Major
                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                    Avoid too many return statements within this method.
                                                                                    Open

                                                                                                    return Double.class == cls ? null: Objects.ZERO_DOUBLE;
                                                                                    Severity: Major
                                                                                    Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                      Avoid too many return statements within this method.
                                                                                      Open

                                                                                                      return s.length() > 0 ? new Character(s.charAt(0)): Objects.NULL_CHARACTER;
                                                                                      Severity: Major
                                                                                      Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                        Avoid too many return statements within this method.
                                                                                        Open

                                                                                                        return BigIntegers.toBigInteger((Byte)val);
                                                                                        Severity: Major
                                                                                        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                          Avoid too many return statements within this method.
                                                                                          Open

                                                                                                          return new Date(((Number)val).longValue());
                                                                                          Severity: Major
                                                                                          Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                            Avoid too many return statements within this method.
                                                                                            Open

                                                                                                            return Character.class == cls ? null: Objects.NULL_CHARACTER;
                                                                                            Severity: Major
                                                                                            Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                              Avoid too many return statements within this method.
                                                                                              Open

                                                                                                              return null;
                                                                                              Severity: Major
                                                                                              Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                Avoid too many return statements within this method.
                                                                                                Open

                                                                                                                return null;
                                                                                                Severity: Major
                                                                                                Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                  Avoid too many return statements within this method.
                                                                                                  Open

                                                                                                                  return BigIntegers.toBigInteger((Short)val);
                                                                                                  Severity: Major
                                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                    Avoid too many return statements within this method.
                                                                                                    Open

                                                                                                                    return ((Date) val).getTime();
                                                                                                    Severity: Major
                                                                                                    Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                      Avoid too many return statements within this method.
                                                                                                      Open

                                                                                                                      return null;
                                                                                                      Severity: Major
                                                                                                      Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                        Avoid too many return statements within this method.
                                                                                                        Open

                                                                                                                        return val;
                                                                                                        Severity: Major
                                                                                                        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                          Avoid too many return statements within this method.
                                                                                                          Open

                                                                                                                          return ((Number) val).intValue();
                                                                                                          Severity: Major
                                                                                                          Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                            Avoid too many return statements within this method.
                                                                                                            Open

                                                                                                                            return new BigDecimal((BigInteger)val);
                                                                                                            Severity: Major
                                                                                                            Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                              Avoid too many return statements within this method.
                                                                                                              Open

                                                                                                                              return ((Date) val).getTime();
                                                                                                              Severity: Major
                                                                                                              Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                Avoid too many return statements within this method.
                                                                                                                Open

                                                                                                                                return ((BigInteger) val).signum() != 0;
                                                                                                                Severity: Major
                                                                                                                Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                  Avoid too many return statements within this method.
                                                                                                                  Open

                                                                                                                                  return val;
                                                                                                                  Severity: Major
                                                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                    Avoid too many return statements within this method.
                                                                                                                    Open

                                                                                                                                return Objects.ZERO_INTEGER;
                                                                                                                    Severity: Major
                                                                                                                    Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                      Avoid too many return statements within this method.
                                                                                                                      Open

                                                                                                                                  return Objects.ZERO_BIG_INTEGER;
                                                                                                                      Severity: Major
                                                                                                                      Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                        Avoid too many return statements within this method.
                                                                                                                        Open

                                                                                                                                        return ((Number) val).intValue() != 0;
                                                                                                                        Severity: Major
                                                                                                                        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                          Avoid too many return statements within this method.
                                                                                                                          Open

                                                                                                                                          return new BigDecimal((String)val);
                                                                                                                          Severity: Major
                                                                                                                          Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                            Avoid too many return statements within this method.
                                                                                                                            Open

                                                                                                                                        return Objects.ZERO_BYTE;
                                                                                                                            Severity: Major
                                                                                                                            Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                              Avoid too many return statements within this method.
                                                                                                                              Open

                                                                                                                                              return ((Number) val).doubleValue();
                                                                                                                              Severity: Major
                                                                                                                              Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                Open

                                                                                                                                                return ((BigDecimal) val).signum() != 0;
                                                                                                                                Severity: Major
                                                                                                                                Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                  Open

                                                                                                                                                  return Integer.valueOf((String) val);
                                                                                                                                  Severity: Major
                                                                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                    Open

                                                                                                                                                    return BigDecimals.toBigDecimal(((Number)val).intValue());
                                                                                                                                    Severity: Major
                                                                                                                                    Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                      Open

                                                                                                                                                      return Boolean.valueOf((String)val);
                                                                                                                                      Severity: Major
                                                                                                                                      Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                        Open

                                                                                                                                                        return val;
                                                                                                                                        Severity: Major
                                                                                                                                        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                          Open

                                                                                                                                                          return Boolean.TRUE; //non-null is true
                                                                                                                                          Severity: Major
                                                                                                                                          Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                            Open

                                                                                                                                                            return new BigDecimal(((Date)val).getTime());
                                                                                                                                            Severity: Major
                                                                                                                                            Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                              Open

                                                                                                                                                          return Objects.ZERO_DOUBLE;
                                                                                                                                              Severity: Major
                                                                                                                                              Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                Open

                                                                                                                                                                return val;
                                                                                                                                                Severity: Major
                                                                                                                                                Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                  Open

                                                                                                                                                                  return new BigDecimal(Double.toString((Double)val));
                                                                                                                                                  Severity: Major
                                                                                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                    Open

                                                                                                                                                                return Objects.ZERO_LONG;
                                                                                                                                                    Severity: Major
                                                                                                                                                    Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                      Open

                                                                                                                                                                  return Boolean.FALSE;
                                                                                                                                                      Severity: Major
                                                                                                                                                      Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                        Open

                                                                                                                                                                    return Objects.ZERO_SHORT;
                                                                                                                                                        Severity: Major
                                                                                                                                                        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                          Open

                                                                                                                                                                          return val;
                                                                                                                                                          Severity: Major
                                                                                                                                                          Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                            Open

                                                                                                                                                                            return BigIntegers.toBigInteger(((Date)val).getTime());
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                              Open

                                                                                                                                                                              return BigIntegers.toBigInteger(((Number)val).longValue());
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                Open

                                                                                                                                                                                return Double.valueOf((String)val);
                                                                                                                                                                Severity: Major
                                                                                                                                                                Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                                                  Avoid too many return statements within this method.
                                                                                                                                                                  Open

                                                                                                                                                                                  return Short.valueOf((String) val);
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                                                    Avoid too many return statements within this method.
                                                                                                                                                                    Open

                                                                                                                                                                                    return Integer.class == cls ? null: Objects.ZERO_INTEGER;
                                                                                                                                                                    Severity: Major
                                                                                                                                                                    Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                                                      Avoid too many return statements within this method.
                                                                                                                                                                      Open

                                                                                                                                                                                      return null;
                                                                                                                                                                      Severity: Major
                                                                                                                                                                      Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                                                        Avoid too many return statements within this method.
                                                                                                                                                                        Open

                                                                                                                                                                                        return ((Number) val).longValue();
                                                                                                                                                                        Severity: Major
                                                                                                                                                                        Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                                                          Avoid too many return statements within this method.
                                                                                                                                                                          Open

                                                                                                                                                                                      return Objects.ZERO_BIG_DECIMAL;
                                                                                                                                                                          Severity: Major
                                                                                                                                                                          Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                                                            Avoid too many return statements within this method.
                                                                                                                                                                            Open

                                                                                                                                                                                            return new BigDecimal(Float.toString((Float)val));
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                                                              Avoid too many return statements within this method.
                                                                                                                                                                              Open

                                                                                                                                                                                          return Objects.toString(val);
                                                                                                                                                                              Severity: Major
                                                                                                                                                                              Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

                                                                                                                                                                                Avoid too many return statements within this method.
                                                                                                                                                                                Open

                                                                                                                                                                                                return Boolean.class == cls ? null: Boolean.FALSE;
                                                                                                                                                                                Severity: Major
                                                                                                                                                                                Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 30 mins to fix

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

                                                                                                                                                                                      public final static String correctFieldName(String name) {
                                                                                                                                                                                          int j = name.indexOf('-');
                                                                                                                                                                                          if (j < 0)
                                                                                                                                                                                              return name; //nothing to change
                                                                                                                                                                                  
                                                                                                                                                                                  
                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 25 mins to fix

                                                                                                                                                                                  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 newInstance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                                  Open

                                                                                                                                                                                      public static final
                                                                                                                                                                                      Object newInstance(Class<?> cls, Object[] args)
                                                                                                                                                                                      throws NoSuchMethodException, InstantiationException,
                                                                                                                                                                                      InvocationTargetException, IllegalAccessException {
                                                                                                                                                                                          if (args == null || args.length == 0)
                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 25 mins to fix

                                                                                                                                                                                  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 getAnyField has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                                  Open

                                                                                                                                                                                      public static final Field getAnyField(Class<?> cls, String name)
                                                                                                                                                                                      throws NoSuchFieldException {
                                                                                                                                                                                          for (;;) {
                                                                                                                                                                                              try {
                                                                                                                                                                                                  return cls.getDeclaredField(name);
                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 25 mins to fix

                                                                                                                                                                                  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 isNumeric has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                                                                                                  Open

                                                                                                                                                                                      public static final boolean isNumeric(Class<?> cls, boolean extend) {
                                                                                                                                                                                          if (cls.isPrimitive())
                                                                                                                                                                                              return extend ||
                                                                                                                                                                                                  (!cls.equals(char.class) && !cls.equals(boolean.class));
                                                                                                                                                                                  
                                                                                                                                                                                  
                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java - About 25 mins to fix

                                                                                                                                                                                  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

                                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                                  Open

                                                                                                                                                                                          } else if (Double.class == cls || double.class == cls) {
                                                                                                                                                                                              if (val == null) {
                                                                                                                                                                                                  return Double.class == cls ? null: Objects.ZERO_DOUBLE;
                                                                                                                                                                                              } else if (val instanceof Double) { //double.class
                                                                                                                                                                                                  return val;
                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java and 1 other location - About 1 hr to fix
                                                                                                                                                                                  zcommon/src/main/java/org/zkoss/lang/Classes.java on lines 1374..1386

                                                                                                                                                                                  Duplicated Code

                                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                                  Tuning

                                                                                                                                                                                  This issue has a mass of 94.

                                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                                  Refactorings

                                                                                                                                                                                  Further Reading

                                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                                  Open

                                                                                                                                                                                          } else if (Long.class == cls || long.class == cls) {
                                                                                                                                                                                              if (val == null) {
                                                                                                                                                                                                  return Long.class == cls ? null: Objects.ZERO_LONG;
                                                                                                                                                                                              } else if (val instanceof Long) { //long.class
                                                                                                                                                                                                  return val;
                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java and 1 other location - About 1 hr to fix
                                                                                                                                                                                  zcommon/src/main/java/org/zkoss/lang/Classes.java on lines 1386..1398

                                                                                                                                                                                  Duplicated Code

                                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                                  Tuning

                                                                                                                                                                                  This issue has a mass of 94.

                                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                                  Refactorings

                                                                                                                                                                                  Further Reading

                                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                                  Open

                                                                                                                                                                                          } else if (Integer.class == cls || int.class == cls) {
                                                                                                                                                                                              if (val == null) {
                                                                                                                                                                                                  return Integer.class == cls ? null: Objects.ZERO_INTEGER;
                                                                                                                                                                                              } else if (val instanceof Integer) { //int.class
                                                                                                                                                                                                  return val;
                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java and 1 other location - About 1 hr to fix
                                                                                                                                                                                  zcommon/src/main/java/org/zkoss/lang/Classes.java on lines 1364..1374

                                                                                                                                                                                  Duplicated Code

                                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                                  Tuning

                                                                                                                                                                                  This issue has a mass of 76.

                                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                                  Refactorings

                                                                                                                                                                                  Further Reading

                                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                                  Open

                                                                                                                                                                                          } else if (Short.class == cls || short.class == cls) {
                                                                                                                                                                                              if (val == null) {
                                                                                                                                                                                                  return Short.class == cls ? null: Objects.ZERO_SHORT;
                                                                                                                                                                                              } else if (val instanceof Short) { //short.class
                                                                                                                                                                                                  return val;
                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java and 1 other location - About 1 hr to fix
                                                                                                                                                                                  zcommon/src/main/java/org/zkoss/lang/Classes.java on lines 1338..1348

                                                                                                                                                                                  Duplicated Code

                                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                                  Tuning

                                                                                                                                                                                  This issue has a mass of 76.

                                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                                  Refactorings

                                                                                                                                                                                  Further Reading

                                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                                  Open

                                                                                                                                                                                          protected MethodInfo(String r, String m, String[] argTs, String[] argNs, String tEx) {
                                                                                                                                                                                              returnType = r;
                                                                                                                                                                                              method = m;
                                                                                                                                                                                              argTypes = argTs;
                                                                                                                                                                                              argNames = argNs;
                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java and 1 other location - About 40 mins to fix
                                                                                                                                                                                  zksandbox/src/main/java/org/zkoss/zksandbox/DemoItem.java on lines 31..37

                                                                                                                                                                                  Duplicated Code

                                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                                  Tuning

                                                                                                                                                                                  This issue has a mass of 50.

                                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                                  Refactorings

                                                                                                                                                                                  Further Reading

                                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                                  Open

                                                                                                                                                                                          for (int j = 0; j< clses.length; ++j)
                                                                                                                                                                                              try {
                                                                                                                                                                                                  return getMethodInPublic(clses[j], name, argTypes);
                                                                                                                                                                                              } catch (NoSuchMethodException ex) { //ignore it
                                                                                                                                                                                              }
                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java and 1 other location - About 30 mins to fix
                                                                                                                                                                                  zcommon/src/main/java/org/zkoss/lang/Classes.java on lines 1204..1208

                                                                                                                                                                                  Duplicated Code

                                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                                  Tuning

                                                                                                                                                                                  This issue has a mass of 42.

                                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                                  Refactorings

                                                                                                                                                                                  Further Reading

                                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                                  Open

                                                                                                                                                                                              for (int j = 0; j< clses.length; ++j)
                                                                                                                                                                                                  try {
                                                                                                                                                                                                      return getAnyMethod(clses[j], name, argTypes);
                                                                                                                                                                                                  } catch (NoSuchMethodException e2) { //ignore it
                                                                                                                                                                                                  }
                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java and 1 other location - About 30 mins to fix
                                                                                                                                                                                  zcommon/src/main/java/org/zkoss/lang/Classes.java on lines 756..760

                                                                                                                                                                                  Duplicated Code

                                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                                  Tuning

                                                                                                                                                                                  This issue has a mass of 42.

                                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                                  Refactorings

                                                                                                                                                                                  Further Reading

                                                                                                                                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                                  Open

                                                                                                                                                                                                  if (argType == null
                                                                                                                                                                                                  || (!bySubclass && mType.isAssignableFrom(argType))
                                                                                                                                                                                                  || (bySubclass && argType.isAssignableFrom(mType)))
                                                                                                                                                                                                      continue; //match one argument
                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java and 1 other location - About 30 mins to fix
                                                                                                                                                                                  zcommon/src/main/java/org/zkoss/lang/Classes.java on lines 917..920

                                                                                                                                                                                  Duplicated Code

                                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                                  Tuning

                                                                                                                                                                                  This issue has a mass of 40.

                                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                                  Refactorings

                                                                                                                                                                                  Further Reading

                                                                                                                                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                                  Open

                                                                                                                                                                                                  if (argType == null
                                                                                                                                                                                                  || (!bySubclass && mType.isAssignableFrom(argType))
                                                                                                                                                                                                  || (bySubclass && argType.isAssignableFrom(mType)))
                                                                                                                                                                                                      continue; //match
                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                  Found in zcommon/src/main/java/org/zkoss/lang/Classes.java and 1 other location - About 30 mins to fix
                                                                                                                                                                                  zcommon/src/main/java/org/zkoss/lang/Classes.java on lines 989..992

                                                                                                                                                                                  Duplicated Code

                                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                                  Tuning

                                                                                                                                                                                  This issue has a mass of 40.

                                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                                  Refactorings

                                                                                                                                                                                  Further Reading

                                                                                                                                                                                  There are no issues that match your filters.

                                                                                                                                                                                  Category
                                                                                                                                                                                  Status