Includes visibility validation is too strict
See original GitHub issueThe following component is valid:
@Component(modules = {
ModuleIncludes.StringModule.class,
ModuleIncludes.IntegerModule.class
})
interface ModuleIncludes {
String string();
@Module
abstract class StringModule {
@Provides static String string(Integer value) {
return value.toString();
}
}
@Module
abstract class IntegerModule {
@Provides static Integer value() {
return 2;
}
}
}
But if I change it to
@Component(modules = ModuleIncludes.StringModule.class)
interface ModuleIncludes {
String string();
@Module(includes = IntegerModule.class)
abstract class StringModule {
@Provides static String string(Integer value) {
return value.toString();
}
}
@Module
abstract class IntegerModule {
@Provides static Integer value() {
return 2;
}
}
}
Dagger will reject it:
src/main/java/com/example/ModuleIncludes.java:12: error: This module is public, but it includes non-public (or effectively non-public) modules. Either reduce the visibility of this module or make com.example.ModuleIncludes.IntegerModule public.
abstract class StringModule {
^
src/main/java/com/example/ModuleIncludes.java:7: error: com.example.ModuleIncludes.StringModule has errors
@Component(modules = ModuleIncludes.StringModule.class)
^
2 errors
If the module isn’t require to be public when included directly on the component, why is it required to be so when declared as a transitive module?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Restrict Channel Visibility & Validation Status Visibility for New ...
Salesforce should allow to restrict the visibility of 'Channel', and 'Validation Status' through User Profiles during article Creation.
Read more >How to Make the RequiredField Validator visible
You can call the ValidatorValidate() function in javascript to make a validator execute it's validation logic (and show up if necessary).
Read more >Mobile Usability report - Search Console Help
The Mobile Usability report shows which pages in your property have usability problems when viewed on mobile devices. The top level view shows...
Read more >Don't make validations too strict - Joyform
Over validating makes your forms hard to fill and stops the users' fluency.
Read more >Kubernetes Multi Cluster Visibility: Why & How to Get It
Even if you had a policy that told engineers to set the resource request, it can be too hard to track down who...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, that seems like a slightly different issue than what we fixed in bfdecad. We should only be doing that validation for modules that are effectively public, i.e. those that may actually be referenced outside their package. I’ll get a fix in soon.
@cgdecker