Mixing Java 1.4 and 1.6 bytecode in a class hierarchy

后端 未结 5 2058
被撕碎了的回忆
被撕碎了的回忆 2021-01-07 11:27

The question first, the story will follow:

Is it safe to mix different bytecode version in a class hierarchy? What are the risks?

For a case, Class C extends

5条回答
  •  情话喂你
    2021-01-07 12:25

    You can compile with Java 6 but target 1.4 with a compiler setting. We did this for a migration project once. If/when 1.4 disappears, you then change your compiler settings again and target 1.6.

    Keeping the target version explicit also means that you can upgrade your SDK without fear of your JAR files becoming unusable to an older JVM.

提交回复
热议问题