-
Notifications
You must be signed in to change notification settings - Fork 25
[LML] Resolve LmlActor annotation value from field name #65
Comments
There might have been some issues with this approach (valid LML IDs do not have to be valid Java identifiers and actors collections you mentioned), but I don't see why it shouldn't be added. Not sure if LibGDX reflection API allows to do that at this point, but I'll look into it when I finally force myself to update LML. ;) I'll try this weekend. |
I believe so, since you already use Thanks a lot, really looking forward for this little but very useful improvement. |
Yeah, you need a reference to the |
BTW, I just thought the same technique could be applied to |
I think I originally wanted to avoid that partially because applications can be obfuscated with Proguard before the release, changing field and method names. This will either break your game or force you to exclude extra classes from the Proguard settings. Even though it might seem redundant, it's actually a sensible practice to keep meta-data in the annotations. That said, it will certainly reduce boilerplate required to define LML view handlers, so I don't see why we shouldn't include that. |
I've never played much with code obfuscation and can only guess, but should not those runtime methods like |
Unless you specifically tell the obfuscation lib not to rename fields/methods, |
Ah, text references to fields and methods from LML templates, right. I think it's a common practice to note if library requires any extra Proguard rules, at least, as I could remember, a lot of top used Android libs describe it under corresponding readme/wiki section or supply within an artifact. |
|
Thanks, will do! |
Isn't VisUI development halted? There was no release for |
I can't say for sure if current VisUI is compatible with latest |
Thanks. I'll wait for the release until the latest VisUI version. |
I feel like I might be missing something, but still I don't see any reason against this approach.
If there is no
value
specified forLmlActor
annotation, it could be resolved implicitly from related field name, e.g.@LmlActor Button button;
=@LmlActor("button") Button button;
.This might be not universal since,
value
is array and annotation may be assigned to collection field type. But I see singular widget declaration as a general case and duplicating field name most of the time makes code cumbersome.The text was updated successfully, but these errors were encountered: