Skip to content

Bad function name some time #116

Description

@sergeevik

If custom jsonata function is lambda then name is useless (com.dashjoin.jsonata.Jsonata$$Lambda/0x00000217108ce4d8)

Image

and some other place similar behavior:

all function methods ignore name parameter:

    public static<A,B,R> JFunction function(String name, Fn1<A,R> func, String signature) {
        return new JFunction(func.getJFunctionCallable(), signature);
    }

it is bad because in log i get useless error:

com.dashjoin.jsonata.JException: Argument "1" of Object "com.dashjoin.jsonata.Jsonata$$Lambda/0x00000217108ce4d8" does not match Object signature
	at com.dashjoin.jsonata.utils.Signature.throwValidationError(Signature.java:289) ~[jsonata-0.9.9.jar:na]

in example it was Signature. When create JFuntion with signature. name of function ignored for Signature

        public JFunction(String functionName, JFunctionCallable function, String signature, int numberOfArgs) {
            this.functionName = functionName;
            this.function = function;
            this.numberOfArgs = numberOfArgs;
            if (signature!=null)
                // use classname as default, gets overwritten once the function is registered
                this.signature = new Signature(signature, function.getClass().getName()); <-- class name maybe lambda
        }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions