Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Clojure by

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)

Run with:

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

The source code for the concrete class is at https://github.com/AzureAD/microsoft-authentication-library-for-java/blob/dev/src/main/java/com/microsoft/aad/msal4j/ConfidentialClientApplication.java

And the base class is at https://github.com/AzureAD/microsoft-authentication-library-for-java/blob/dev/src/main/java/com/microsoft/aad/msal4j/AbstractClientApplicationBase.java where the authority field is declared with a Lombok Accessor annotation...

1 Answer

0 votes
by
edited by

You appear to be calling a setter, the Lombok accessor only defines a getter:

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()"])

edit:

My mistake, of course you are actually using the builder (a static inner class named Builder) which does have a setter. The reflector appeas to find it:

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"]]
by
...