On 26/02/2020 11:40, 向伟(识月) wrote:
Hi Florian,

This isn't a common usage.
For the below code:

String s1 = "s1".intern();
f.set("s1".intern(), f.get("s2"));

After calling reflection, the value of s1 is changed to "s2".
In some special scenarios, the original jar file can't be modified. But the user
expects to change the value of some string, and uses the above code to
implement it.

Although this usage isn't recommended, it isn't forbidden. We don't expect
the crash because of the usage.
You should have got a warning like "WARNING: An illegal reflective access ...".  Eventually it will be disallowed by default but in the mean-time there are dozens of ways to break the integrity, create security issues, or crash the VM with this type of hacking. Do you know what this library wants to change the value of an immutable String?

-Alan

Reply via email to