question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Kotlin Toothpick draft specs - WIP

Use delegate properties for field injection

We should not use annotations for field injection, instead we will use delegate properties. For example:

by ktp.inject() // default scope
by ktp.lazy() // lazy
by ktp.provider() // provider

Moreover, there should be a way to:

  • Specify when to use the default scope and when to wait for a scope to be provided.
  • Use a named injection.

Kotlin friendly API for

Generate code compatible with optional parameters (possible?)

WIP

Moreover, KTP will be based on TP 2.0 -> no registries (no configuration needed), incremental annotation processing, better scope annotations, … (https://github.com/stephanenicolas/toothpick/issues/315, https://github.com/stephanenicolas/toothpick/issues/225)

Something you miss? Any suggestion? Please comment 🙂

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
PaulWoitaschekcommented, Dec 5, 2018

I think constructor injection is the preferred way for dependency injection on kotlin too. It’s explicit. You don’t have to run your tests to know you forgot dependencies when refactoring.

1reaction
code-twistercommented, Dec 4, 2018

@dimsuz constructor injections are indeed preferred in Java DI frameworks, and also when we’re talking about DI in general most of us think about JSR330. Not sure this applies to Kotlin though. I believe we should use the community brainpower to figure out something that’s more suited for Kotlin and what this language has to offer, rather than limiting ourselves to what DI meant for Java.

A DI framework is supposed to make dependency injection easy. KTP could be just that tailored specifically for Kotlin.

Also I think if you like how Toothpick for java works, I believe you could still use it in Kotlin it would just be a bit different (maybe more verbose) and you would depend on a Java module.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Project 885 Yasen / Graney Severodvinsk class
Length (on design waterline), 134-139 m / 435-452 feet, 127-130 m / 413-423 feet ; beam of the hull, 13 m 12-15 meters,...
Read more >
HEADQUARTERS! - Kittery Trading Post
KTP $39.99-$79.99 SALE $24.99-$39.99 photo courtesy of Columbia Sportswear ... Medium-weight with fleece liner. Black, grey or ... 36”- 40” DRAFT STOPPERS.
Read more >
Animal Products Notice: Specifications for Laboratories
The Animal Products (Recognised Laboratories and Persons Specifications for ... Key Technical Person (KTP) means a laboratory person formally appointed or ...
Read more >
Knowledge Transfer Partnerships (KTP) - Dalarna University
KTP is a project that secures positions for recent graduates in regional companies where they remain for up to two years working in...
Read more >
KTP Associate Recruitment Process - StudyLib
Recruitment and Retention of KTP Associates A Guide to Good Practice 1 of 55 Contents ... When you have drafted your job specification...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found