2024 Clojure 州情调查中分享你的想法!

欢迎!请参阅关于页面了解有关此网站的更多信息。

+1 投票
Clojure

repro.clj

(defn create-application []
  (let [credential (com.microsoft.aad.msal4j.ClientCredentialFactory/createFromSecret "sekrit")
        builder (com.microsoft.aad.msal4j.ConfidentialClientApplication/builder "client id" credential)
        authority "some authority"]
    (->
      builder
      (.authority ^String authority)
      (.build))))

(create-application)

运行

clj -Sdeps '{:deps {com.microsoft.azure/msal4j {:mvn/version "1.8.1"}}}' repro.clj

具体类的源代码位于https://github.com/AzureAD/microsoft-authentication-library-for-java/blob/dev/src/main/java/com/microsoft/aad/msal4j/ConfidentialClientApplication.java

基类位于https://github.com/AzureAD/microsoft-authentication-library-for-java/blob/dev/src/main/java/com/microsoft/aad/msal4j/AbstractClientApplicationBase.java,其中权限字段是用 Lombok Accessor 注解声明的...

1 个回答

0 投票

编辑

你似乎在调用一个设置器,Lombok 访问器仅定义了一个获取器

user=> (for [m (.getMethods com.microsoft.aad.msal4j.AbstractClientApplicationBase) :when (= (.getName m) "authority")] m)
(#object[java.lang.reflect.Method 0x6136998b "public java.lang.String com.microsoft.aad.msal4j.AbstractClientApplicationBase.authority()"])

user=> (for [m (.getMethods com.microsoft.aad.msal4j.ConfidentialClientApplication) :when (= (.getName m) "authority")] m)
(#object[java.lang.reflect.Method 0x676ff3b0 "public java.lang.String com.microsoft.aad.msal4j.ConfidentialClientApplication.authority()"])

编辑

我的错误,当然你在实际使用构造函数(一个名为 Builder 的静态内部类)它确实有一个设置器。反射器似乎找到了它

user=> (clojure.lang.Reflector/getMethods com.microsoft.aad.msal4j.ConfidentialClientApplication$Builder 1 "authority" false)
[#object[java.lang.reflect.Method 0x6b760460 "public com.microsoft.aad.msal4j.AbstractClientApplicationBase$Builder com.microsoft.aad.msal4j.AbstractClientApplicationBase$Builder.authority(java.lang.String) throws java.net.MalformedURLException"]]
...