Where does Scala store information that cannot be represented in Java?

你离开我真会死。 提交于 2019-12-22 05:41:33

问题


There are some constructs that don't have equivalents in java. Examples would be

  • named parameters
  • instance private members

Where/How does Scala store the information necessary for this stuff (some kind of flag in the first case, the parameter names in the second case?

If I get it right this has to get stored in the byte code, since it works even if I just have a compiled library without the source code!?


回答1:


This information is captured in an annotation named ScalaSig in the class file (see this answer for an example).

You can view the (not very human-friendly) annotation with javap -verbose, or parse it using an internal API, but in general neither should be necessary.



来源:https://stackoverflow.com/questions/16456931/where-does-scala-store-information-that-cannot-be-represented-in-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!