Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chapter 19 does not compile #10

Closed
NoRefill opened this issue Jan 20, 2017 · 5 comments
Closed

Chapter 19 does not compile #10

NoRefill opened this issue Jan 20, 2017 · 5 comments

Comments

@NoRefill
Copy link

I have been following along in the book. When I added the code for Chapter 19, the DatabaseExtensions.kt file will not compile. To ensure that I didn't type something wrong, I got a zip of the Chapter 19 commit and got the same error:

  • Error:(8, 19) Object must be declared abstract or implement abstract member public abstract fun parseRow(columns: Map<String, Any?>): T defined in org.jetbrains.anko.db.MapRowParser
  • Error:(9, 13) 'parseRow' overrides nothing
  • Error:(13, 18) Object must be declared abstract or implement abstract member public abstract fun parseRow(columns: Map<String, Any?>): T defined in org.jetbrains.anko.db.MapRowParser
  • Error:(14, 13) 'parseRow' overrides nothing

I'm using buildVersonSdk 25.0.0, targetSdkVersion 25, ext.support_version 25.1.0, ext.kotlin_version 1.0.6, ext_anko_version 0.9 in Android Studio. Everything had worked up to the transition from earlier chapters to chapter 19. Since I'm new to Kotlin, I don't have a clue what is wrong or how to fix it.

@NoRefill
Copy link
Author

I reverted to Anko version 0.8.3 in AndroidStudio and the demo app code is working now. I don't know if something in Anko changed and demo the broke or if Anko has a bug. I suspect the latter, but am not knowledgeable enough to make that call and possibly send a bug report to Anko developers.

@NoRefill
Copy link
Author

OK, I figured it out. Lack of nullable values in anko-db #154 in Anko changed the Pair<String, Any> to nullable Pair<String, Any?> which requires similar changes to the function signatures for parseList() and parseOpt().

@antoniolg
Copy link
Owner

Yeah sorry, that's the thing. I'm updating the book these days to cover changes in Kotlin 1.0.6 and Anko 0.9. Will also update this repository accordingly.

Thanks!

@NoRefill
Copy link
Author

Well, 1.0.X version of a language, these kinds of things are going to happen. The worst part of this issue is the not-very-helpful compiler errors. I would have expected something more like "type mismatch" or, better, "non-nullable type used with nullable parameter".

Thanks for the comment and looking forward to the update.

@antoniolg
Copy link
Owner

I finished updating the book, and the new code is on the repo. If you have the digital edition, you'll receive the update soon (may be you did already).

Closing this. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants