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.

Includes visibility validation is too strict

See original GitHub issue

The 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
cgdeckercommented, Mar 19, 2019

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.

0reactions
ronshapirocommented, Mar 18, 2019
Read more comments on GitHub >

github_iconTop 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 >

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