-
Notifications
You must be signed in to change notification settings - Fork 795
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
Obfuscate virtual field accessors #4385
Obfuscate virtual field accessors #4385
Conversation
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.
Looks good to me, and appreciate the clear comment.
d93f028
to
38c16bb
Compare
@@ -39,15 +39,15 @@ void field() { | |||
@Test | |||
void setter() { | |||
assertEquals( | |||
"set__opentelemetryVirtualField$java$lang$Runnable$java$lang$String__", | |||
"__set__opentelemetryVirtualField$java$lang$Runnable$java$lang$String__", |
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.
Do we need then __
both before and after set/get
prefix?
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.
The last __
is for encoding []
in array class name suffix. This is needed because [
is one of the few characters that can't be used in a field or method name https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-4.html#jvms-4.2.2
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 meant the second __
in __set__
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's not needed, but seems ok to me (and code is shorter to include it since it's part of the field name)
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.
While I think that the idea of this pr is good, adding __
prefix to get/set methods makes them less likely to confuse something that is looking for plain getters and setters I also believe that this pr does not tackle the root cause of the problem, user code should never have seen these methods in the first place. Made another pr #4390 that hopefully fixes this.
I removed the comment, since #4390 takes care of that now, but I think worth keeping the method name change |
* Obfuscate virtual field accessors * Update internal-reflection instrumentation * Update test * Remove outdated comment
Resolves application errors when monitoring Confluence with the javaagent: