how java jaxb works?

前端 未结 2 1508
渐次进展
渐次进展 2021-01-18 18:42

Just curious about how jaxb works, I have a class annotated as follows:

@XmlRootElement(name = \"MyJaxb\")
Class MyJaxb
{
      @XmlElement
      protected S         


        
2条回答
  •  被撕碎了的回忆
    2021-01-18 19:16

    Beyond answer that reflection can by-pass checks (which is correct), this is also something that other JDK internal parts need, specifically default Object serialization and deserialization. In general this is allowed because many tools benefit from such access. And like others have correctly pointed out, access rights are not meant as real security barriers. They are there to help programmers design abstractions properly, make it easier to come up with good designs.

提交回复
热议问题