I am calling a method that returns an array:
val localTrustManagerFactory =
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm)
val localTrustManager =
((localTrustManagerFactory.getTrustManagers).apply(0)).asInstanceOf[X509TrustManager]
If I leave out the .apply call, I get a compile-time error:
val localTrustManager =
((localTrustManagerFactory.getTrustManagers)(0)).asInstanceOf[X509TrustManager]
error: too many arguments for method getTrustManagers: ()Array[javax.net.ssl.TrustManager]
Is there any better way to retrieve an array element? I though that the compiler would supply the apply method call implicitly.
UPDATE: The classes used in this code are from the standard Java library:
import javax.net.ssl.TrustManagerFactory
import javax.net.ssl.X509TrustManager
I don't know if the Scala compiler (2.9.2-1) interprets getTrustManagers as having an argument list or not.
getTrustManagersdefined and which scala version are you using? This really looks like a compiler bug.