Evernote / evernote-sdk-android

Evernote SDK for Android
428 stars 168 forks source link

NoSuchMethodException when calling methods that require primitives #25

Closed Laurent-Sarrazin closed 11 years ago

Laurent-Sarrazin commented 11 years ago

Hi,

this thread on the forum led me to think that there's an issue with reflection for methods that require primitive arguments.

It seems to me that primitive values are auto-boxed and that the resulting

Ex with findNotes :

The call is

findNotes(filter, 0, 100, new OnClientCallback<NoteList>())

and the reflector tries to find

findNotes [class java.lang.String, class com.evernote.edam.notestore.NoteFilter, class java.lang.Integer, class java.lang.Integer]

and fails as the signature of the method is

findNotes(java.lang.String authenticationToken, com.evernote.edam.notestore.NoteFilter filter, int offset, int maxNotes)

The same thing happens with findNoteCounts(java.lang.String authenticationToken, com.evernote.edam.notestore.NoteFilter filter, boolean withTrash).

Do I miss something or is there really a problem ?

Laurent-Sarrazin commented 11 years ago

The fix should ideally check for all types but I think int and bool are sufficient right now. In my opinion, a best fix would be to change the methods' signatures but as they're thrift generated I guess it's not that easy...

tyvsmith commented 11 years ago

I'm going to investigate the class autoboxing problem a bit more today or tomorrow before merging the manual casting for Integer and Boolean..

Laurent-Sarrazin commented 11 years ago

Yep, it's quite ugly bit I couldn't manage to find a better way...