LlamaLad7/MixinExtras

LocalRef error can happen when you capture a ref as a lambda parameter

MattiDragon opened this issue · 2 comments

You can get the following error when you capture a localref variable in a lambda or otherwise, such that it is only read after the handler completes:

java.lang.IllegalStateException: Uninitialized LocalRef! This should never happen! Please report to LlamaLad7!

In my case I was messing with executors in resource reload code and accidentally captured it in a lambda that executes on another thread. This is easy to work around on the user side, and I don't see how mixin extras could resonably support using variables later, but it would be nice if the error on a disposed localref would be different from an uninitialized one.

Mostly just reporting because the error is somewhat misleading

You're probably right that there should be 2 error messages, will fix.
The one for a disposed ref should also most likely explain that it's probably the user's fault.

Done in 0.2.0-rc.2