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 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
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
  1. DZone
  2. Coding
  3. Java
  4. New Inspections for Java 8 in IntelliJ IDEA 2016.1

New Inspections for Java 8 in IntelliJ IDEA 2016.1

IntelliJ has added new features in IDEA 2016.1 thanks to Java 8. Find out how JetBrains improved coding assistance.

Andrey Cheptcov user avatar by
Andrey Cheptcov
·
Apr. 19, 16 · News
Like (4)
Save
Tweet
Share
5.93K Views

Join the DZone community and get the full member experience.

Join For Free

Since Java 8 has been launched almost two years ago, it has been gaining more and more traction around the community. Most Java frameworks and platforms have either already migrated their APIs to Java 8, or are planning to do so.

With our latest update, the whole IntelliJ Platform has migrated to Java 8, which has allowed both ourselves and plugin developers to use the new language features. Among other reasons, this motivates us to further improve our coding assistance to make it more friendly to Java 8.

Misuse of java.util.Optional

IntelliJ IDEA now helps you avoid writing unsafe code when using java.util.Optional. It warns you if you call get() without first calling isPresent() to check if the value is available.

Also, you may be warned if you use java.util.Optional<T>, java.util.OptionalDouble, java.util.OptionalInt, java.util.OptionalLong or com.google.common.base.Optional as the type for a field or parameter, or if you use java.util.Optional or com.google.common.base.Optional types with an array or collection type parameter. Note that this setting is disabled by default.

Functional interfaces

In case a method reference points to a method of its own functional interface type, IntelliJ IDEA suggests replacing it with a qualifier.

You’ll also be warned when you’re calling a method of a functional interface, which is directly invoked on a lambda definition, method reference or anonymous class. This inspection provides a quick-fix to replace it with the implementation body for that functional interface.

Overloaded methods or constructors with similar functional interface type parameters, for which any call sites will need a cast or parameter type specified on the lambda expression to resolve ambiguity, may now be reported as well.

Guava

For those who would like to migrate their Guava code to Java 8 APIs, we’ve added a number of quick-fixes that help replace FluentIterable, Function, Optional and  Predicate with their Java 8 analogues.

That’s it for today. We hope these improvements will make adopting Java 8 a more enjoyable experience for you.

As always, we appreciate questions as well as your feedback here in comments or directly in our tracker.

intellij Java (programming language)

Published at DZone with permission of Andrey Cheptcov, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Quick Pattern-Matching Queries in PostgreSQL and YugabyteDB
  • Agile Transformation With ChatGPT or McBoston?
  • 5 Factors When Selecting a Database
  • Utilize OpenAI API to Extract Information From PDF Files

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

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: