zel/src/main/java/org/zkoss/zel/BeanELResolver.java

Summary

Maintainability
F
6 days
Test Coverage

File BeanELResolver.java has 482 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
Severity: Minor
Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.java - About 7 hrs to fix

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

        private static Method getMethod0(Class<?> clazz, String methodName, Class<?>[] paramTypes, Object[] params) {
            Method matchingMethod = null;
            if (paramTypes != null) {
                try {
                    matchingMethod = Util.getMethod(clazz, clazz.getMethod(methodName, paramTypes));
    Severity: Minor
    Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.java - About 7 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 invoke has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        public Object invoke(ELContext context, Object base, Object method,
                Class<?>[] paramTypes, Object[] params) {
            if (context == null) {
                throw new NullPointerException();
            }
    Severity: Minor
    Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.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 write has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

            private Method write(ELContext ctx) {
                if (this.write == null) {
                    this.write = Util.getMethod(this.owner, descriptor.getWriteMethod());
                    
                    //20110921, henrichen: Introspector is too strict for Setter(must return void), here we loosen it
    Severity: Minor
    Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.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 setValue has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        public void setValue(ELContext context, Object base, Object property,
                Object value) {
            if (context == null) {
                throw new NullPointerException();
            }
    Severity: Minor
    Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.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 invoke has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public Object invoke(ELContext context, Object base, Object method,
                Class<?>[] paramTypes, Object[] params) {
            if (context == null) {
                throw new NullPointerException();
            }
    Severity: Major
    Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.java - About 2 hrs to fix

      Method getMethod0 has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private static Method getMethod0(Class<?> clazz, String methodName, Class<?>[] paramTypes, Object[] params) {
              Method matchingMethod = null;
              if (paramTypes != null) {
                  try {
                      matchingMethod = Util.getMethod(clazz, clazz.getMethod(methodName, paramTypes));
      Severity: Major
      Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.java - About 2 hrs to fix

        Method setValue has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public void setValue(ELContext context, Object base, Object property,
                    Object value) {
                if (context == null) {
                    throw new NullPointerException();
                }
        Severity: Major
        Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.java - About 2 hrs to fix

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

                  private PropertyDescriptor recoverIndexedPropertyDescriptor(Class baseClz, PropertyDescriptor pd) {
                      if (pd instanceof IndexedPropertyDescriptor) {
                          final IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
                          if (ipd.getIndexedReadMethod() != null) {
                              try {
          Severity: Minor
          Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.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 write has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  private Method write(ELContext ctx) {
                      if (this.write == null) {
                          this.write = Util.getMethod(this.owner, descriptor.getWriteMethod());
                          
                          //20110921, henrichen: Introspector is too strict for Setter(must return void), here we loosen it
          Severity: Minor
          Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.java - About 1 hr to fix

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

                    @Override
                    public boolean equals(Object obj) {
                        if (!(obj instanceof CachedMethodInfo))
                            return false;
                        if (!((CachedMethodInfo) obj).getMethodName().equals(this._methodName))
            Severity: Minor
            Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.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 invoke has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public Object invoke(ELContext context, Object base, Object method,
                        Class<?>[] paramTypes, Object[] params) {
            Severity: Minor
            Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.java - About 35 mins to fix

              Avoid too many return statements within this method.
              Open

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

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

                    public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context, Object base) {
                        if (base == null) {
                            return null;
                        }
                
                Severity: Minor
                Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.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 {
                            int paramCount = 0;
                            if (params != null) {
                                paramCount = params.length;
                            }
                Severity: Major
                Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.java and 1 other location - About 2 hrs to fix
                zel/src/main/java/org/zkoss/zel/BeanELResolver.java on lines 559..583

                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 162.

                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

                            } catch (NoSuchMethodException e) {
                                //throw new MethodNotFoundException(e);
                                int paramCount = 0;
                                if (params != null) {
                                    paramCount = params.length;
                Severity: Major
                Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.java and 1 other location - About 2 hrs to fix
                zel/src/main/java/org/zkoss/zel/BeanELResolver.java on lines 584..607

                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 162.

                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 (matchingMethod.isVarArgs()) {
                                int varArgIndex = parameterTypes.length - 1;
                                // First argCount-1 parameters are standard
                                for (int i = 0; (i < varArgIndex); i++) {
                                    parameters[i] = factory.coerceToType(params[i],
                Severity: Major
                Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.java and 1 other location - About 2 hrs to fix
                zel/src/main/java/org/zkoss/zel/Util.java on lines 617..635

                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 158.

                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

                    static {
                        if (System.getSecurityManager() == null) {
                            CACHE_SIZE = Integer.parseInt(
                                    System.getProperty(CACHE_SIZE_PROP, "1000"));
                        } else {
                Severity: Minor
                Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.java and 1 other location - About 55 mins to fix
                zel/src/main/java/org/zkoss/zel/impl/lang/ExpressionBuilder.java on lines 55..70

                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 67.

                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

                                    for (int i = 0; i < parameterTypes.length; i++) {
                                        parameters[i] = factory.coerceToType(params[i],
                                                parameterTypes[i]);
                                    }
                Severity: Minor
                Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.java and 1 other location - About 40 mins to fix
                zel/src/main/java/org/zkoss/zel/Util.java on lines 637..640

                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 48.

                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

                        } catch (InvocationTargetException e) {
                            Throwable cause = e.getCause();
                            if (cause instanceof ThreadDeath) {
                                throw (ThreadDeath) cause;
                            }
                Severity: Minor
                Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.java and 1 other location - About 40 mins to fix
                zel/src/main/java/org/zkoss/zel/impl/parser/AstValue.java on lines 300..309

                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 48.

                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 3 locations. Consider refactoring.
                Open

                        } catch (InvocationTargetException e) {
                            Throwable cause = e.getCause();
                            Util.handleThrowable(cause);
                            throw new ELException(Util.message(context, "propertyWriteError",
                                    base.getClass().getName(), property.toString()), cause);
                Severity: Minor
                Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.java and 2 other locations - About 35 mins to fix
                zel/src/main/java/org/zkoss/zel/BeanELResolver.java on lines 108..113
                zel/src/main/java/org/zkoss/zel/BeanELResolver.java on lines 165..170

                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 46.

                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 3 locations. Consider refactoring.
                Open

                            } catch (InvocationTargetException ee) {
                                Throwable cause = ee.getCause();
                                Util.handleThrowable(cause);
                                throw new ELException(Util.message(context, "propertyWriteError",
                                        base.getClass().getName(), property.toString()), cause);
                Severity: Minor
                Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.java and 2 other locations - About 35 mins to fix
                zel/src/main/java/org/zkoss/zel/BeanELResolver.java on lines 108..113
                zel/src/main/java/org/zkoss/zel/BeanELResolver.java on lines 143..148

                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 46.

                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 3 locations. Consider refactoring.
                Open

                        } catch (InvocationTargetException e) {
                            Throwable cause = e.getCause();
                            Util.handleThrowable(cause);
                            throw new ELException(Util.message(context, "propertyReadError",
                                    base.getClass().getName(), property.toString()), cause);
                Severity: Minor
                Found in zel/src/main/java/org/zkoss/zel/BeanELResolver.java and 2 other locations - About 35 mins to fix
                zel/src/main/java/org/zkoss/zel/BeanELResolver.java on lines 143..148
                zel/src/main/java/org/zkoss/zel/BeanELResolver.java on lines 165..170

                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 46.

                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