taycaldwell / riot-api-java

Riot Games API Java Library
http://taycaldwell.github.io/riot-api-java/
Apache License 2.0
190 stars 73 forks source link

AsyncExample's call to getSummoner fails on cast to Map<String, Summoner> #103

Closed ryanhaveson closed 7 years ago

ryanhaveson commented 7 years ago

Hi there. I am running the sample code "AsyncExample".

When request.getDto() is called in the onRequestSucceded call from apiAsync.getSummoner, it is failing to be cast to a Map<String, Summoner> as it is expecting type class.Summoner. This results in a ClassCastException.

--Ryan

Linnun commented 7 years ago

Looks like we forgot to update that example for the v3 Api changes. This has been fixed now: https://github.com/taycaldwell/riot-api-java/commit/b7a3927e066513508a5723a3f235a51943e25acc

Thanks!

ryanhaveson commented 7 years ago

With this fix, the compiler spews an error:

Error:(43, 33) java: local variable eSummoner is accessed from within inner class; needs to be declared final.

I never knew that rule. Not sure if it is only some compilers that enforce this. Seems like it would be better as a warning not an error...

--Ryan