Avoiding Reflection When Calling a Java Variation Method in Clojure

I am trying to avoid reflection when calling IssueInputParameters.addCustomFieldValue () from the JIRA API. However, even with the full-valued Clojure type, a warning is still issued that reflection is in use.

The method signature specified in javadocs is as follows:

IssueInputParameters addCustomFieldValue(Long customFieldId, String... values) 

So I'm trying to call it this:

 (fn [^com.atlassian.jira.issue.IssueInputParameters i, ^Long l] (.addCustomFieldValue il (into-array String ["foo"]))) 

Actual calls work, but reflection is always used:

 Reflection warning, NO_SOURCE_PATH:1 - call to addCustomFieldValue can't be resolved. 

How can this be avoided?

+4
source share
1 answer

The String[] hint explicitly works when executed as follows:

 (fn [^com.atlassian.jira.issue.IssueInputParameters i, ^Long l] (.addCustomFieldValue il ^"[Ljava.lang.String;" (into-array String ["foo"]))) 
+4
source

Source: https://habr.com/ru/post/1416192/


All Articles