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.

Unexpected error when 2 provided args of same type are present

See original GitHub issue

Code similar to this:

class MyClass @AssistedInject constructor(
    foobar: Foobar,
    @Assisted a: String,
    @Assisted b: String
) {
    @AssistedInject.Factory
    interface Factory {
        fun create(a: String, b: String): MyClass
    }
}

Results in:

Duplicate @Assisted parameters declared. Forget a qualifier annotation?

Since @Assisted args are supplied by the caller, it seems duplicates should be permitted. Am I missing something? Is this an annotation processing constraint?

I’ve solved the problem by adding qualifying annotations to both the MyClass constructor declaration and the factory function.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
JakeWhartoncommented, Aug 22, 2018

I don’t think we gain anything. The intent was just to start with the semantics of a regular injector where order isn’t a thing.

For validation I’d be tempted to force the argument names to match only when you have more than one argument of the same type.

0reactions
BenTilbrookcommented, Oct 16, 2018

Sounds good to me. Thanks for the change.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I'm getting a TypeError. How do I fix it? - Stack Overflow
It means exactly what it sounds like: there is an Error that is caused by the Type of one or more of the...
Read more >
error=>#<ArgumentError: wrong number of arguments (given ...
An unexpected error occurred! {:error=>#<ArgumentError: wrong number of arguments (given 3, expected 1..2)> #13777.
Read more >
How to Handle the Incompatible Types Error in Java - Rollbar
The Java incompatible types error happens when a value assigned to a variable or returned by a method is incompatible with the one...
Read more >
Fixing common type problems - Dart
Fixing common type problems · Undefined member · Invalid method override · Missing type arguments · Unexpected collection element type · Constructor initialization ......
Read more >
TypeError: More arguments needed - JavaScript | MDN
There is an error with how a function is called. More arguments need to be provided. Examples. Required arguments not provided. The Object....
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