frida-java-bridge
frida-java-bridge copied to clipboard
Always prepend underscores to field names
Because of the way Frida resolve name conflicts, it can be hard to determine the name of a field in Frida. To prevent this, this patch make the naming of fields consistent (as long as there isn't another conflict).
Resolve #240
I'm a bit on the fence on this one, since there may also be a clashing method name prefixed with an underscore. My gut feeling is that we should come up with a better approach on the next major bump. Perhaps fields should be prefixed with a character that's illegal in method names. Would also like to remove the wrapper that has the value
property, as it's very confusing. (And the introspection has limited value anyway.)
My gut feeling is that we should come up with a better approach on the next major bump
Is there such a thing? I think in both cases (Java and JavaScript) methods and properties have the same restrictions of an identifier.
It might be a bit verbose but why not expose it through two different properties? You could do it like so:
cls.fields.abc
cls.methods.abc()
or if you want it to be a bit less verbose:
cls.f.abc
cls.m.abc()
Whatever we do we need to be careful not to break peoples existing scripts and infrastructure too badly.
Sure, and I think that my proposed solution fits your criteria but it also won't fix it 100%
However, if we are thinking long term about the next major version bump we should widen our options to breaking changes. I can't think of a way to identify fields and methods without putting them in separate properties.
Hmm. This will still be confusing if a method is named _x
, since a field named x
won't then also be visible as _x
.
I think I will close this PR until we decide on a solution