Hey, I’m trying to call <https://github.com/jesper...
# announcements
c
Hey, I’m trying to call https://github.com/jesperfj/force-rest-api/blob/b1f6330d49211f639b903225926d081fcece487e/src/main/java/com/force/api/ResourceRepresentation.java#L36-L38 from kotlin but I get the error
Copy code
expecting an element
val res = api.getSObject("Account", "0015000000VALDtAAP").as(Account::class)
                                                          ^
It seems there is an internal kotlin function/keyword 
as
 that prevents me from calling that function on my class. For instance the class String  can get the same error
Copy code
>>> val x = "10"
>>> x.f1("ola")
error: unresolved reference: f1
x.f1("ola")
  ^
>>> x.as("ola")
error: expecting an element
x.as("ola")
  ^
I should get the same error but nope, any idea what’s going on ?
k
Keep it threaded, don't flood the channel with a whole code snippet. Also did you ask at the project tracker / forums first?
🧵 1
s
Copy code
`as`
?
☝️ 2
d
The kotlin keyword that the compiler thinks you mean: https://kotlinlang.org/docs/typecasts.html#unsafe-cast-operator As Sourabh said above you simply need to escape to access the Java function
c
Cool I get passed this issue, thanks ! I tried with double quotes but didn’t know about it 👍