DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • How To Approach Dependency Management in Java [Video]
  • NullPointerException in Java: Causes and Ways to Avoid It
  • The First Annual Recap From JPA Buddy
  • Visually Designing Views for Java Web Apps

Trending

  • How to Submit a Post to DZone
  • Spring Authentication With MetaMask
  • Docker and Kubernetes Transforming Modern Deployment
  • Log Analysis Using grep
  1. DZone
  2. Coding
  3. Java
  4. Support for Java 9 in IntelliJ IDEA

Support for Java 9 in IntelliJ IDEA

Support for Java 9 has come to IntelliJ IDEA! Check out this post to find out some of the Java 9-specific features that have been included.

Trisha Gee user avatar by
Trisha Gee
·
Jul. 13, 17 · News
Like (8)
Save
Tweet
Share
7.91K Views

Join the DZone community and get the full member experience.

Join For Free

As Java 9 continues to evolve, so does IntelliJ IDEA’s support for it. This screencast shows the new features to support Java 9 development in the upcoming IntelliJ IDEA 2017.2 release.

In the rest of this blog post, we’ll break down what’s in the video and talk about each feature.

As you’d expect, a lot of the improvements are to support the Java Platform Module System. One of the new features to help developers getting up to speed with Jigsaw and Java modularity is the new Java Module Diagram. This diagram shows the modules you’ve defined in your project in green; any automatic modules, (those modules that are dependencies on traditional jar files) in blue; and any JDK modules in yellow.

Java Module Diagram

You’ll notice there are two different types of lines in the diagram, the thick blue lines show "requires transitive," the thinner black lines are standard "requires" dependencies.

These diagrams give a clear picture of which modules have been defined and which modules they depend upon, and can help you either to create a clean separation when creating a modular system, or simply visualize what’s going on with the new Java Platform Module System.

If you are working with Java 9 modules, you’ll see code completion and generation has been improved for the module-info.java file. For a start, the generated module name more closely matches the IntelliJ IDEA module name.

Error in open module

Errors and warnings and their suggested fixes have also been improved. For example, if you try to use opens in a module that is already open, the error is clear and you can opt to either remove the opens statement or change the module so it’s no longer open.

Open module fixes

Duplicate opens or provides statements are detected and can be deleted or merged.

Duplicate opens statement

You can also use find usages on a module name to locate other places that use this module, including JDK modules that use it.

Find module usages

And, of course, you can refactor module-info files, for example using rename.

Project Jigsaw has a wider impact than just allowing you to create your own modules. Modularity impacts the visibility of packages, so classes that were previously accessible may not be anymore. This even includes reflection. IntelliJ IDEA’s inspections can help locate reflection code that tries to access modules that are not on the module path, and offers suggestions to fix the problem.

Reflection warnings

There are a few new inspections to help migrate code to Java 9. There’s a section under the Java language level migration aids inspections for Java 9.

New inspections

The first inspection highlights module-info files that require automatic modules – automatic modules are useful during migration to Java 9, but over time code should be migrated to use true modules. By default, this only highlights transitive dependencies, as this means your code is exposing automatic modules to other modules.

Using unmodifiableSet

The second inspection points out places where we can use the new Collections Factory Methods. For example, if we’re creating an unmodifiableSet, this verbose code can be enormously simplified in Java 9. We can also convert unmodifiableList to the new syntax too.

Using Set.of

There’s one final inspection to help us make use of new Java 9 features. If your code has while loops that wait for a particular value to change, they can be updated to add the new onSpinWait hint, which allows the runtime to potentially optimise this operation.

Suggestion to add onSpinWait

Finally, IntelliJ IDEA is also ready for the updates to Javadoc in Java 9. Generated Javadoc is now searchable, letting developers search for classes, methods, or keywords in the documentation. To make the most use of this, you may want to add an index tag to your documentation to provide keywords to the search.

intellij Java (programming language)

Published at DZone with permission of Trisha Gee, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • How To Approach Dependency Management in Java [Video]
  • NullPointerException in Java: Causes and Ways to Avoid It
  • The First Annual Recap From JPA Buddy
  • Visually Designing Views for Java Web Apps

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: