Skip to content

AutoFactory does not handle varargs parameters #326

@zstewar1

Description

@zstewar1

I'm trying to convert an existing type to be partially injected using autofactory, but our existing constructors and client code makes use of varargs to pass in differing numbers of arguments.

For example:

@AutoFactory
class MyClass {
    public MyClass(@Provided InjectedParameter ip, RepeatedParameter... rp) {
        // ...
    }
}

However the signature of the corresponding create method is: MyClassFactory.create(RepeatedParameter[] rp) which rather defeats the point.

It's possible to work around this by changing the signature to accept a List<RepeatedParameter> and using Arrays.asList(), but it would be better if AutoFactory just supported varargs parameters directly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions