Is the creation of Java class files deterministic?

前端 未结 11 1634
抹茶落季
抹茶落季 2020-12-02 11:04

When using the same JDK (i.e. the same javac executable), are the generated class files always identical? Can there be a difference depending on the

11条回答
  •  鱼传尺愫
    2020-12-02 11:25

    Most probably, the answer is "yes", but to have precise answer, one does need to search for some keys or guid generation during compiling.

    I can't remember the situation where this occurs. For example to have ID for serializing purposes it is hardcoded, i.e. generated by programmer or IDE.

    P.S. Also JNI can matter.

    P.P.S. I found that javac is itself written in java. This means that it is identical on different platforms. Hence it would not generate different code without a reason. So, it can do this only with native calls.

提交回复
热议问题