Hey guys,
I was allowed to execute this code without a provision error:
public interface Factory {
PowershellFileWriter create(@Assisted Queryable<VariableSymbol>
variables,
@Assisted @NotModified ToolTemplate
toolTemplate,
@Assisted Path outputPath);
}
@Inject
public PowershellFileWriter(FileSystem fileSystem,
ResourceEnvironment.Factory envFactory,
@Assisted Queryable<VariableSymbol> variables,
@Assisted Path scriptPath,
@Assisted Path outputPath) {
//...
}
when it is pretty clearly in error:
- no use of ToolTemplate in the constructor
- 2 assisted args of the same type without naming either
The corrected version looks like this:
public interface Factory {
PowershellFileWriter create(Queryable<VariableSymbol> variables,
@Assisted("script") Path scriptPath,
@Assisted("out") Path outputPath);
}
@Inject
public PowershellFileWriter(FileSystem fileSystem,
ResourceEnvironment.Factory envFactory,
@Assisted Queryable<VariableSymbol>
variables,
@Assisted("script") Path scriptPath,
@Assisted("out") Path outputPath) {
why wasn't I given a resolution exception when I went to use this factory,
or a configuration exception when I bound up this factory? Isn't validation
done on the Factory interface when we use the FactoryModuleBuilder?
--
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-guice.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-guice/52237a42-109d-41e9-abb4-545dbbfc577a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.