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.

[Suggestion] Way to declare injected interfaces elsewhere

See original GitHub issue

One of my projects has around 300 lines worth of injected interfaces. This makes the fmj very messy and 7x longer than it needs to be. On top of this, since $ is used for inner classes AND to mark something as a placeholder for gradle, we need this in our processResources:

for (int i = 0; i < 6000; i++) {
	String name = "class_$i"
	properties.put(name, name)
}
properties.put("DeserializerAccessor", "DeserializerAccessor")
properties.put("MixAccessor", "MixAccessor")
properties.put("AnimatedTextureAccessor", "AnimatedTextureAccessor")
properties.put("BuilderAccessor", "BuilderAccessor")
properties.put("EntryAccessor", "EntryAccessor")

I’ve tried storing them elsewhere and copying them over with gradle property expansion in processResources, but that doesn’t work since loom directly reads the file. I tried messing around with adding a source set for it to look at, but got nowhere. Specifying injected interfaces elsewhere would solve this.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Juuxelcommented, Jun 29, 2022

Not a solution for the long files, but you can rewrite $ as \u0024 in JSON files to prevent processResources from trying to expand it.

0reactions
modmuss50commented, Jun 29, 2022

Oh my bad, I read the code snippet totally wrong 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dependency injection guidelines - .NET | Microsoft Learn
Learn various dependency injection guidelines and best practices for .NET application development.
Read more >
ASP.NET Core Dependency Injection - Registering Multiple ...
There are two methods on the interface. The first is called CanEnrich and this will take the message object and determine if this...
Read more >
IoC and binding to interfaces - Stack Overflow
I'm taking a hearty recommendation to use Ninject. Cool. But as I sit down to create my first class that will rely on...
Read more >
To Inject Or Not To Inject - Simple Thread
I was speaking with Phil Haack this week at MIX 09 and we were discussing his choice to drop Dependency Injection from his...
Read more >
NET Core Dependency Injection - Seeing Sharply
If you already know what DI is, and how to use interfaces to mock your classes and test them, etc. then you can...
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