-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #31 in resource-loader #32
Conversation
Oh btw do we even need the |
@Shadow | ||
protected abstract void load(List<?> resources); | ||
|
||
@Inject( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that this changes more than is needed, as you could keep the previous implementation and wrap the original.call(...)
s in try-catch blocks with the same effect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that too at first but WrapOperation evaluates the arguments of the function call in order to capture them, and trying to evaluate the list argument throws an exception, so the mixin is not called at all after that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aaaahhh gotcha, alright then, this change looks good
I suppose not. Ideally we'd allow uppercase language codes in those versions. Something for later. |
|
||
@Final | ||
@Shadow | ||
private Map<String, String> translations; | ||
|
||
@WrapOperation( | ||
@Shadow | ||
protected abstract void load(List<?> resources); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: please parameterize this properly (should be List<Resources>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh true yeah
Instead of wrapping the
load
call, the alternate lang formats are injected before the argument callinggetResources
is evaluated. Any exception thrown from this argument evaluation will no longer prevent loading of the alternate files.This changes the evaluation order of the variants but users of these different file name options (
lang/en_US.lang
,lang/en_US.json
,lang/en_us.lang
,lang/en_us.json
) should not expect a specific ordering anyway.