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.

File name too long when nesting subcomponents

See original GitHub issue

I’m going through the final steps to fully convert our app to Dagger 2, tying the hierarchy of subcomponents together. We have a deep hierarchy of sub components. This means the subcomponent names are too long:

error while writing DaggerDevRegisterAppComponent.DevLoggedInComponentImpl.DevRootActivityComponentImpl.SellerFlow_MobileComponentImpl.HomeScreen_MobileComponentImpl.TenderPath_ComponentImpl.AbstractGiftCardBalancePath_ComponentImpl.GiftCardBalanceInputScreen_ComponentImpl: 
./DaggerDevRegisterAppComponent$DevLoggedInComponentImpl$DevRootActivityComponentImpl$SellerFlow_MobileComponentImpl$HomeScreen_MobileComponentImpl$TenderPath_ComponentImpl$AbstractGiftCardBalancePath_ComponentImpl$GiftCardBalanceInputScreen_ComponentImpl.class (File name too long)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:17

github_iconTop GitHub Comments

19reactions
pycommented, Aug 4, 2016

Why are you making fun of me? )c:

On Wednesday, August 3, 2016, Gregory Kick notifications@github.com wrote:

@valeriyo https://github.com/valeriyo, I’d rather not add an API for tweaking something that is entirely an implementation detail.

@loganj https://github.com/loganj, if by “flag naming scheme” you mean using top-level classes rather than nested classes, that would be an option, but means that we’d have to generate components very differently. We would either have to make a lot of fields accessible or pass around a bunch of state (probably more than the max number of cxtor args).

@ronshapiro https://github.com/ronshapiro, that’s a variant of flattening the component hierarchy that might dodge some accessibility issues, but does complicate the generated code because you can no longer use the implicit this pointer. We’d have to start keeping track of some number of parent references and traverse the correct number of them to get to some Provider. E.g. this.parent.parent.parent.applicationProvider. Ick. It’d work but it seems like it’d be a little gross.

OK, time to make fun of @py https://github.com/py. Not really, but that is exactly the type of thing we don’t want to show up in a stack trace. We might as well call them $$$FastClassByGuice$$. 😛

@ronshapiro https://github.com/ronshapiro, I’d stick with AtomicInterger b/c incrementAndGet() is useful even if you don’t care about concurrency.

So, here’s what I’m thinking we can do…

  • Let’s use 255 characters as the heuristic. It’s not exactly right, but should cover most cases correctly.
  • Collapse names w/ some version of initialisms, but only when we have to. I.e. walk the whole tree of subcomponents, figure out the name size and just shorten the ones that are required to make them and all of their children fit.

Sound like a reasonable enough plan?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/google/dagger/issues/421#issuecomment-237394827, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOB0hcM1_U-t6o-t2bo3F4RiBIza_Oiks5qcRXzgaJpZM4Ja9NX .

5reactions
gk5885commented, Aug 4, 2016

Sorry, @py. Let me invite you to join in making fun of @pyricau.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReactJS Sub Component Directory Structure - Stack Overflow
I'd either consider another level of nesting, or try to rewrite it and split the code into two files but still under component1...
Read more >
Understanding the Purpose of Nested Components | Pluralsight
Here, we have created two different components using CLI, but before proceeding with the nested component, we need to declare it within app....
Read more >
Components and Nesting in Figma - YouTube
Design powerful and reusable elements for your site https://designcode.io/figma-components-and-nestingComponents are reusable elements in ...
Read more >
Create a Family with Nested and Shared Components
However, notice the ganged window name, Gang_Fixed Host, is listed with the subcomponents. This window represents the main window composed of ...
Read more >
Configure Patterns for Automatic Nesting of Transpiled Files
Since version 2016.3 files nesting will be done automatically basing of file names. Rules for this nesting are hardcoded at the moment (see...
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