JavaRush /Java Blog /Random EN /Coffee break #61. Tools that improve the quality of Java ...

Coffee break #61. Tools that improve the quality of Java code. Java language and open source projects

Published in the Random EN group

Tools that improve the quality of Java code

Source: Dev.to The best way to protect your code from avoidable bugs is to use static code analysis tools. They can help you find and fix problematic code before it goes live. Let's take a look at some of the popular static analysis tools that you can use to test your code in various situations.Coffee break #61.  Tools that improve the quality of Java code.  Java language and open source projects - 1

deep source

DeepSource is probably the best static code analyzer for Java out there. DeepSource detects over 170 Java code quality issues, including performance bugs, security issues, and anti-patterns. It currently supports Java projects on Gradle, in the future DeepSource will also add support for Maven and Android. In addition, the creators of DeepSource are working on adding support for Autofix: this will allow Java developers to fix problems without writing code. Peculiarities:
  • Detects over 170 code quality issues.
  • OpenJDK versions 8 to 14 are supported.
  • Integration: Gradle.
Licensing: Free to use for open source projects, students, and non-profit organizations. Paid plans start at $12 per user per month.

SonarQube

SonarQube is an open source Java static code analysis toolkit that combines the functionality of tools such as FindBugs and PMD. SonarQube's intuitive dashboards keep history, which improves tracking of code quality. SonarQube uses advanced analysis techniques such as pattern matching. He also analyzes the data flow, finds obvious problems in the structure of the code, errors and security vulnerabilities. Peculiarities:
  • Contains 597 rules for detecting various code quality issues.
  • Supports all language versions up to Java 14.
  • Integration: Maven, Gradle, Ant.
Licensing: The Community Edition is free and open source. The cost of a license for commercial versions is from 120 euros.

SpotBugs

SpotBugs is the successor to FindBugs: a Java static code analysis tool that examines the JVM bytecode, finds signs of potential bugs and security vulnerabilities by identifying coding defects. These defects are reported in warnings, but not all warnings are necessarily defects: they can indicate possible performance problems. The latest version contains over 400 warnings divided into four categories: (1) most dangerous, (2) dangerous, (3) serious, (4) requiring attention. Peculiarities:
  • Detects more than 400 types of errors in the code.
  • SpotBugs requires JRE (or JDK) 1.8.0 or later. However, it can parse programs compiled for any version of Java from 1.0 to 1.9.
  • Integration: Ant, Maven, Gradle.
Licensing: Free and open source.

PMD

The PMD parses the Java source code, checks it against its list of rules, and informs the user of problem strings. PMD can detect common problems such as hardcoding passwords and IP addresses, using a forEach loop instead of a traditional for, and code that violates the law of Demeter or implements the God Class antipattern. Peculiarities:
  • Over 250 rules for detecting problems in Java.
  • Language support up to Java 13
  • Integration: Maven, Gradle.
Licensing: Free and open source.

Ecl Emma

EclEmma (based on the JaCoCo library) is a free set of Java code coverage tools for Eclipse. It measures code coverage and provides data about it using visual reports. EclEmma highlights lines of code and the total percentage of code completed, and tracks line and branch coverage. The tool helps developers evaluate code that has not been properly tested and focuses on areas with low coverage. It supports 3 types of report formats: HTML, XML and CSV. Peculiarities:
  • Supports Java class files from version 1.0 to 14.
  • Integration: Ant, Maven.
Licensing: Free and open source.

check style

Checkstyle is a Java static code analysis tool that helps developers set and maintain coding standards. Checkstyle detects rule violations, helps you fix them, and reformat your code using IDEs like Eclipse, IntelliJ IDEA, or NetBeans. Peculiarities:
  • Over 180 Java code style checks.
  • Support for languages ​​up to Java 14.
  • Integration: Ant, Maven.
Licensing: Free and open source.

JArchitect

JArchitect is a Java static analysis tool that evaluates code metrics such as the number of method parameters, variables, and lines, looping complexity in a program, afferent and efferent binding, and so on. It measures, queries, and visualizes your code, avoiding unexpected issues and building up technical debt. Peculiarities:
  • Language support from Java 8 to 13.
  • Over 450 rules.
  • Integration: Maven, Gradle, Ant.
Licensing: 14-day free trial, free open source license for non-commercial open source software projects, $149 personal license, $299 developer edition, $549 Build Machine.

JUnit

JUnit is a popular unit testing framework for projects developed in Java that allows developers to write and run unit tests for Java 8 and above. JUnit checks the state and behavior of code with simple yet powerful control statements. Getting started with JUnit is easy, with many more annotation options for more complex scenarios. Peculiarities:
  • JUnit 5 (latest release) requires Java 8 (or higher) at runtime.
  • Integration: Maven, Gradle, Ant.
Licensing: Free and open source.

Java language and open source projects

Source: Opensource If you use Java to write business applications, you should be aware that Java Standard Edition (SE) is not open source software. Moreover, in January 2019, Oracle changed its policy to require a commercial license for any use of SE, from a local development environment to a production environment. This change raised many questions among developers regarding license compliance when using Java. If you still have doubts about how to use Java in open source projects, this article will give you all the information you need.Coffee break #61.  Tools that improve the quality of Java code.  Java language and open source projects - 2

Emerging platforms in the Java community

OpenJDK (Open Java Development Kit) is a free and open source implementation of Java SE. It is an alternative that allows over 70% of Java developers to continue using their Java application environments while remaining in the open source ecosystem. OpenJDK is distributed under the GNU GPLv2 license.. Because it guarantees freedom of redistribution, it makes OpenJDK the default choice for Java developers when creating Java SE compatible desktop applications. Oracle continues to develop and support Enterprise Java (Java EE), built on the Java SE platform. Java EE includes additional features beyond SE to support large scale, scalable, layered, and secure applications across a variety of enterprise environments. In September 2017, the Java EE platform was handed over to the Eclipse Foundation , resulting in more agile processes, a change in governance, and more flexible licensing. A year later, in 2018, the Eclipse Foundation announced the release of a new Jakarta EE brand.. It is designed to support developers moving from Java EE to the new platform. The evolution from Java EE to Jakarta EE has also influenced many enterprise Java developers to implement new business logic.

Framework development as Java evolves

Meanwhile, new technologies such as RESTful API (2000), HTTP 2 (2015), and JSON (2017) have been developed alongside rapidly changing web architectures. Interest in microservice architectures grew, but because Java EE was in transition, it didn't catch on to these new paradigms. In response to requests from the Java community, several companies (IBM, Red Hat, and Tomitribe) created MicroProfile in 2016, a specification that optimizes the Enterprise Java platform for microservice architectures. MicroProfile later joined the Eclipse Foundation, giving enterprise Java developers two options for implementing microservice architectures: SpringBoot or MicroProfile. MicroProfile allows developers to create portable Java-based microservices for different vendor solutions while providing interoperability between the respective Java/Jakarta EE and MicroProfile APIs in the same application. If you are interested in Enterprise development in Java, then MicroProfile Starterwill be an excellent choice for learning microservices in practice. The MicroProfile Starter graphical user interface greatly simplifies code generation when building a monolithic Java application server. The MicroProfile runtime supports deploying an application artifact (such as a JAR or WAR file) and running it as a Java application server with the MicroProfile specification. You can select the desired cloud runtime (such as Quarkus ) from the MicroProfle Starter runtime list, and then select specifications for additional enterprise features such as fault tolerance, OpenAPI, OpenTracing, and more. Once you've completed these steps, click Download to start developing your app.Coffee break #61.  Tools that improve the quality of Java code.  Java language and open source projects - 3

Conclusion

Navigating Java from an open source perspective can be a bit confusing given the language's long history and change. The use of OpenJDK and Jakarta EE allows Java developers to support standard enterprise applications without sacrificing open source freedom. If you want to learn more about this, we recommend that you take a look at MicroProfile or Quarkus.
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION