How to port Java code to later jdk (e.g. 1.8)

What is the best way to port the java code of old jdk (1.5) to a newer version of Java (1.8) in order to provide its new features and improvements. We have a large Java code base jdk 5 and you want to upgrade to jdk 8.

There are many warnings and compiler hints (eg diamond operator, multicatch, unnecessary (un)boxingetc.), which will improve performance, readability, etc.

We use the NetBeans IDE. Are there any plugins we can use or are there migration scenarios?

+4
source share
3 answers

Found what I was looking for: Netbeans offers Inspect and Transform.

( ) .

:

  • Refactor
  • Inspect and Transform
  • configuration Manage
  • (, Can Use Diamond, Join catch sections using multicatch, unnecessary boxing ..)
  • Inspect
  • Do Refactoring

.

IntelliJ IDEA . . Analyze > Inspect Code ...

Eclipse clean up code style () source ().

+1

, Java 8, , Java , .

, , , , , , , .

, , .. , , .

Java 1.7 Java 1.8 , , .

, , . , , Java. , , , Java, , --.

+4

, , , , JDK 1.7 ( , JDK 1.8 , 1.7 Oracle):

  • checkstyle Eclipse,

  • JDK 1.7 Eclipse; , Eclipse, , ,

  • Theoretically, JDK 1.7 is backward compatible with 1.5. The exception is the assert and enum keywords. If you used these words as custom type / method names, you will get a compilation error. Therefore, in most cases, you can immediately proceed to warnings. If a click occurs, you can ignore many of these warnings (of course, only if you must)

+1
source

Source: https://habr.com/ru/post/1615311/


All Articles