The IntelliJ IDEA Blog : IntelliJ IDEA – the Leading Java and Kotlin IDE, by JetBrains | The JetBrains Blog https://blog.jetbrains.com Developer Tools for Professionals and Teams Tue, 20 Jun 2023 17:19:22 +0000 en-US hourly 1 https://blog.jetbrains.com/wp-content/uploads/2023/02/cropped-icon-512-32x32.png The IntelliJ IDEA Blog : IntelliJ IDEA – the Leading Java and Kotlin IDE, by JetBrains | The JetBrains Blog https://blog.jetbrains.com 32 32 IntelliJ IDEA 2023.1.3 Is Out! https://blog.jetbrains.com/idea/2023/06/intellij-idea-2023-1-3/ Tue, 20 Jun 2023 17:19:18 +0000 https://blog.jetbrains.com/?post_type=idea&p=365135 The third bug-fix update for v2023.1 is now available.

You can update to this version from inside the IDE, using the Toolbox App, or using snaps if you are a Ubuntu user. You can also download it from our website.

Here are the most notable fixes and updates that IntelliJ IDEA 2023.1.3 brings:

  • We fixed the issue that was causing the IDE to crash when using the navigation feature in Raycast. [IDEA-317346]
  • Navigation to implementations works as expected in decompiled classes. [IDEA-308933]
  • The issue with launching multi-module projects using the Quarkus run configuration has been resolved. [IDEA-317297]
  • The issue that caused the deletion of records from the list of local tasks has been fixed. [IDEA-274672]
  • We fixed the issues that were causing the main menu groups to malfunction and not process actions correctly on macOS. [IDEA-319117], [IDEA-318603
  • Several issues that affected working in LightEdit mode have been fixed [IDEA-315639], [IDEA-315526], [IDEA-316537].
  • Building JPS projects utilizing JDK 8 with both JDK and project files stored on WSL no longer fails. [IDEA-319240]
  • The IDE no longer erroneously reports autowiring errors in @ConfigurationProperties for fields set via application.properties when using Lombok in Spring Boot projects. [IDEA-319269]
  • Several issues appearing when setting active Spring profiles have been fixed. [IDEA-177780], [IDEA-177783], [IDEA-309671], [IDEA-314635]

You can find a full list of the resolved issues in the release notes.

We always look forward to your feedback and bug reports in our issue tracker.

Happy developing!

]]>
IntelliJ IDEA 2023.2 EAP 5: Option to Commit Specific Lines of Code, Ability to Run Tomcat on WSL, Docker Updates, and More https://blog.jetbrains.com/idea/2023/06/intellij-idea-2023-2-eap-5/ Fri, 16 Jun 2023 14:31:47 +0000 https://blog.jetbrains.com/?post_type=idea&p=362938 IntelliJ IDEA 2023.2 EAP 5 is out! The new build offers long-awaited support for partial commits and the ability to run and debug applications in WSL Tomcat, as well as improvements for the HTTP Client, Docker, Kubernetes, Swagger, and more. 

You can get the latest build from our website, through the free Toolbox App, or via snaps for Ubuntu. 

This blog post provides the most notable improvements introduced in IntelliJ IDEA 2023.2 EAP 5. If you want to learn about the refinements included in the previous EAP builds, check out these blog posts.  

Version control systems

Option to commit specific lines of code

IntelliJ IDEA 2023.2 EAP 5 introduces a highly anticipated feature to selectively commit specific parts of code chunks. To perform a partial commit, select the lines within a chunk and call Include these lines into commit from the context menu. The chunk will be divided into individual lines with the selected ones highlighted. You can add or exclude lines from the selection using checkboxes or the context menu.  

Frameworks and technologies 

Updated UI for the Run/Debug widget in the Services tool window

We’ve reworked the UI for running and debugging actions in the Services view to make the look and feel of the toolbar consistent with the main Run/Debug widget.  

Ability to run and debug Tomcat on WSL 

As of IntelliJ IDEA 2023.2 EAP 5, it is possible to run and debug applications deployed to Tomcat on the Windows Subsystem for Linux (WSL). To work with Tomcat-based applications on WSL, you need to have the JAVA_HOME environment variable declared in either the /etc/environment or ~/.bashrc file.

Support for Swagger and OpenAPI schemas in the HTTP Client 

The HTTP Client is now capable of understanding Swagger and OpenAPI specifications and providing corresponding code completion options for JSON requests.

JSON body completion in JavaScript 

The IDE now provides completion for JSON object keys in JavaScript code, for instance code with the fetch() call or the axios library. It now supports Spring MVC server endpoints, and we plan to expand the number of supported server frameworks in the future.

Support for JavaScript imports in the HTTP Client

It is now possible to share common JavaScript code for HTTP Client request handlers via imported modules.

PDF and HTML previews for responses in the HTTP Client

IntelliJ IDEA is now able to display previews of PDF and HTML files right in the results of requests in the HTTP Client.

Improvements for Swagger Codegen

The IDE now provides a better user experience when setting up Swagger Codegen configurations. First, we’ve reworked the Edit Swagger Codegen Configuration dialog, making tailoring the run configuration to your requirements more straightforward. 

Additionally, it is now possible to access the Swagger Codegen run configuration right from the gutter without having to specify any additional settings.

Auto-completion for Spring Boot configuration keys in VM options 

While setting up a new Spring Boot run configuration, the VM options field provides auto-completion options for keys appearing after the -D flag.

Support for Spring AOP in Kotlin

We’ve extended IntelliJ IDEA’s support for utilizing AspectJ in Spring applications. The IDE now provides analysis and completion for Kotlin code, just as it already did for Java code. 

Support for editing AsyncAPI files

It is now possible to conveniently work with the AsyncAPI specification format in IntelliJ IDEA. The IDE supports schema validation functionality and provides code completion for references, the Endpoints view, and the Editor Preview pane. 

Docker 

Preview of files inside Docker image layers 

It is now easy to access and preview the contents of a Docker image layer in the Services view. Select the image from the list, select Show layers, and click Analyze image for more information. You can then view a list of the files stored in the layer and easily open a selected file in the editor by right-clicking on the file and calling the Open File (or Download File for binaries) option. 

Set Docker container to run as a Before Launch task for run configurations

It is now possible to set Docker run configuration to run before another configuration by designating it a Before Launch task. The IDE will wait for the container that is currently running to be healthy, and then it will launch the next run configuration. To set up a queue, first create a required Docker run configuration and then add it to the container via Modify options | Add before launch task | Run configuration.

Kubernetes 

Support for multiple kubeconfig files within a single project 

We have introduced a new feature that allows you to set up multiple kubeconfig files within a single project. This simplifies the experience of handling multiple clusters or working with environments on different clusters in the same project. To set the files up, go to File | Settings | Build, Execution, Deployment | Kubernetes. 

Ability to view deployment logs

You can now view logs for deployments in Kubernetes clusters from the Services tool window. Right-click on Deployment in the tree and then select Follow Log or Download Log from the context menu. 

These are the most noteworthy updates for this week! For the full list of implemented changes, please refer to the release notes. Stay tuned to learn about the other features expected in the major IntelliJ IDEA 2023.2 release. 

Your feedback is very important to us, so please make sure to participate in the Early Access Program, test out the new features, and let us know what you think about them. You can do so via the Submit Feedback form available from the Help menu, in the comments section under this blog post, or by reaching out to us on Twitter. If you encounter any bugs, please report them to our issue tracker

Happy developing! 

]]>
New Livestream: Jakarta EE Integration Testing https://blog.jetbrains.com/idea/2023/06/new-livestream-jakarta-ee-integration-testing/ Wed, 14 Jun 2023 10:47:29 +0000 https://blog.jetbrains.com/wp-content/uploads/2023/06/Featured_Blog_image_1280x720-2x-1.png https://blog.jetbrains.com/?post_type=idea&p=363047 Join us for the new IntelliJ IDEA livestream with Rudy De Busscher to learn about Jakarta EE Integration Testing.

Date: June 29, 2023

Time: 3:00 – 4:00 pm UTC

Session abstract

Testing applications is challenging because repeatable tests require additional systems, such as databases, in a specific state.

Despite the fact that Jakarta EE doesn’t have any testing specifications, you can perform integration testing for your applications by using several libraries.

In this livestream, we’ll take a look at the libraries alongside examples and the problems associated with each of them. In addition, we’ll examine the Testcontainers framework, which allows developers to test real-world applications by deploying them in containers using the production runtime and its dependent systems.

An application can be tested and remotely debugged using one of the libraries we’ll explore in the livestream.

Asking questions

Rudy will try to answer all of your questions during the session. If we run out of time, we’ll post the answers to any remaining questions in a follow-up blog post. We’ll do our best to get all of your questions answered.

Your speaker and host

Speaker

Rudy De Busscher

Rudy De Busscher is a Java Enterprise Backend Developer and Developer Advocate at MicroStream. Rudy loves crafting enterprise backend applications, working on open-source projects, helping customers, and spreading his coding knowledge.
rdebusscher@gmail.com

Follow Rudy De Busscher on Twitter.

Host

Mala Gupta

A Java Champion and JUG leader, Mala has authored multiple books with Manning, Packt, and O’Reilly Publications. An international speaker at industry conferences, she has more than 2 decades of experience in the software industry. She has been actively supporting Java certification as a path to career advancement.

 

Happy Developing!

]]>
IntelliJ IDEA 2023.2 EAP 4: Updated Run Widget, Enhanced Stack Trace Analysis, Refactoring Improvements, and More https://blog.jetbrains.com/idea/2023/06/intellij-idea-2023-2-eap-4/ Fri, 09 Jun 2023 15:10:44 +0000 https://blog.jetbrains.com/?post_type=idea&p=360479 The IntelliJ IDEA 2023.2 Early Access Program is reaching its halfway mark, with the fourth EAP build now available. 

You can get the latest build from our website, the free Toolbox App, or via snaps for Ubuntu. 

Stay up to date with the latest enhancements for the Run widget, stack trace analysis, refactorings, and more in this article. To catch up on previously added features, refer to our other IntelliJ IDEA 2023.2 Early Access Program blog posts.

User experience

Pinned run configurations in the Run widget

To make managing multiple run configurations easier, we’ve implemented the option to pin preferred configurations in the Run widget. To add a run configuration to the Pinned section, open the kebab menu (three dots) next to its name and select Pin. If you have multiple pinned configurations, you can easily rearrange them by dragging and dropping within the list.

File sorting by modification time in the Project view 

IntelliJ IDEA 2023.2 EAP 4 brings the long-awaited option to arrange your files in the Project view based on their modification time. This new functionality automatically reorders the files whenever the changes in your project are saved. To enable this feature, open the kebab menu (three dots) in the Project view and then select Tree Appearance | Sort by Modification Time.

Java

Improved navigation for stack trace analysis 

To facilitate stack trace analysis and make resolving bugs quicker, IntelliJ IDEA can now accurately guess the location of a method in the report even when line numbers are not available or have diverged. 

Enhanced taint analysis for dynamic SQL queries 

IntelliJ IDEA can now better analyze concatenations and interpolations of SQL in Java and Kotlin, detecting potentially unsafe queries and thereby protecting the code from possible SQL injection vulnerabilities.

Expanded refactoring options for multiple selected members

We’ve added new ways to apply some refactoring operations to several members at once.

You can now invoke Extract Delegate, Extract Interface, Extract Superclass, Pull Members Up, and Push Members Down on several members simultaneously by selecting them right in the Project or Structure tool window.

In addition, IntelliJ IDEA now supports multi-caret selection for an extended range of refactoring operations, including Encapsulate Fields, Move Static Members, Extract Delegate, Extract Interface, and Extract Superclass. To utilize this feature, place a caret in each member you want to apply the refactoring to, and the IDE will automatically preselect and check these members in the refactoring dialog.

Other

Increased default maximum heap size

Starting from 2023.2 EAP 4, the default value of the maximum heap size (Xmx) has been changed to 2 GB.

These are the most notable updates for this week. For the full list of implemented changes, refer to the release notes.

We encourage you to test out these new features and share your feedback about your experience in the comments section below or on Twitter. If you encounter any bugs, please submit a report to our issue tracker

Happy developing! 

]]>
Java Annotated Monthly – June 2023 https://blog.jetbrains.com/idea/2023/06/java-annotated-monthly-june-2023/ Mon, 05 Jun 2023 12:12:28 +0000 https://blog.jetbrains.com/wp-content/uploads/2023/06/java-annotated-blog-featured-image-1280x600-1.png https://blog.jetbrains.com/?post_type=idea&p=359130 Welcome to Java Annotated Monthly!

In this edition, we’ll share an abundance of Java news, specifically focusing on the planned features for JDK 21. As always, you’ll find a wide range of tutorials covering Java, Kotlin, and other related technologies. 

Additionally, we have thought-provoking blog posts discussing the potential threat that AI poses to developers and the importance of studying ML. Finally, don’t forget to explore the list of upcoming conferences scheduled for June!

Stay informed and inspired with our hand-picked collection of Java insights and resources.

Java News

Java News Roundup 1, 2, 3, 4, 5  – These articles bring together the most crucial news from the world of Java. Don’t miss out! 

JavaDoc JDK 20 Updates – Sip of Java – JDK 20 brought several changes to JavaDoc. This article looks at how these changes can help you learn about preview features and make linking easier.

Interpolating Strings Like a King in Java 21 – Inside Java Newscast #47 – Watch this short video to get more familiar with string templates, which help you deal with literal text with embedded expressions and use template processors to produce specialized results.

Java Gets a Boost with String Templates: Simplifying Code and Improving Security – JEP 430, String Templates (Preview), has been promoted from Proposed to Targeted status for JDK 21.

Java Gets a Boost with the Record Pattern, Enabling More Expressive Coding – JEP 440, Record Patterns, has progressed from Proposed to Targeted status for JDK 21. The feature will be fully delivered with improvements based on feedback from previous preview rounds.
JEP proposed to target JDK 21: 452: Key Encapsulation Mechanism API – This JEP introduces an API for key encapsulation mechanisms (KEMs) – an encryption technique for securing symmetric keys using public key cryptography.

Breaking down Barriers: Introducing JDK 21’s Approach to Beginner-Friendly Java Programming – JEP 445, Unnamed Classes and Instance Main Methods (Preview), has been promoted to Targeted status. This feature is designed to make it easier for beginners to write their first programs in Java without needing to understand advanced features.

The SolutionFactory To Java’s Problems – Keynote – Is verbose Java too old school and not fun for modern “kids”? Project Amber aims to modernize the language! In this presentation, you’ll discover how it addresses the existing pain points of Java. 

Quality Outreach Heads-up – JDK 21: Sequenced Collections Incompatibilities – When you use Sequenced Collections, newly created interfaces introduce new default methods which can cause conflicts resulting in source or binary incompatibilities. Read this article to find out what kind of conflicts may arise and how to deal with them. 

State of Java Survey – Azul is conducting a Java user survey until June 15, 2023. If you participate (which takes about 10 minutes), you’ll receive the survey report and have a chance to win prizes like a MacBook Pro or a set of AirPods. Your participation will also contribute to the collective knowledge.

Java Tutorials and Tips

String TemplatesCay Horstman explains how string templates work for Java and shows minor differences in its syntax compared with other languages.  

A Glance At The Java Performance ToolboxAna-Maria Mihalceanu demonstrates how JDK tools can help you gain insights into classes and threads and can perform live GC analysis or heap dump post-processing. 

Java Concurrency: Condition – In this article, learn how to make threads wait on specific conditions by using the Condition interface.

The Basis of Virtual Threads: ContinuationsHüseyin Akdoğan turns the spotlight on Continuations, sometimes called “coroutines”, that are the basis of virtual threads.

These notions represent sequential code that may suspend or yield execution at some point by itself and can be resumed by a caller.

Arrays Utility Class – Sip of Java – Take a look at how to efficiently use the Arrays class for handling everyday operations on arrays.

Formatting Inlined @value in Javadocs – Javadoc specifies the details of our methods using special tags. This article studies several new tags that can improve your Javadoc experience.

Creating Scalable OpenAI GPT Applications in Java – In this article and included video, you’ll learn to incorporate the OpenAI GPT engine into your Java projects.

Foojay Podcast #23: Java Profiling and Performance – In this podcast, you’ll gain insights into the challenges of Java profiling, explore various profiling approaches, and discover when and how to use profiling to optimize your code performance.

Unleashing the Power of Lightweight Concurrency: A Comprehensive Guide to Java Virtual Threads (Part 1) – In this article, A N M Bazlur Rahman covers the basics of Java virtual threads, how they work, why they are beneficial for developers, and how they overcome the limitations of traditional Java threads.

OpenJDK – Change the Future of Java – Oracle has created the OpenJDK Developers’ Guide for aligning developers around terminology and processes for participating in the OpenJDK Project. Watch the video to learn how you can contribute to the future of Java.

Avoiding Pitfalls With Java Optional: Common Mistakes and How To Fix Them [Video] – Learn how to avoid traps with Java Optional and use it efficiently to produce readable code.

JavaFinder: Keeping Track of Java InventoriesGerrit Grunwald shares a simple command-line tool that helps you search for Java distributions installed on your machine.

Patterns: Exhaustiveness, Unconditionality, and Remainder – This article explains how to provide compile-time checking for whether a particular switch is exhaustive for its selector type.

Rolling Binary Trees: A Guide to Common Design Patterns in Java – In this article, George Tanev introduces a linear time algorithm for moving and implementing binary trees in Java.

Languages, Frameworks, Libraries, and Technologies

This Week in Spring 1, 2, 3, 4, 5 – All of the major Spring news from the past month is here. 

Spring Transaction and Connection ManagementVlad Mihalcea explains how Spring handles transaction and database connection management. The covered topics include Spring TransactionInterceptor, read-write and read-only Spring data JPA database connection management, pushing the @Transactional methods further down to data-specific services, and more. 

Spring Tips: go fast with Spring Boot 3.1 – In this edition, Josh Long explores the remarkable efficiencies brought by the latest Spring Boot 3.1 release.

Spring Tips: Go Fast With Spring Boot 3.1 – In this installment, Josh Long looks at how the new Spring Boot 3.1 release delivers incredible efficiencies for developers and machines.

Spring Boot Debugging with Aspect-Oriented Programming (AOP)Shai Almog demonstrates how to use AOP to debug a Spring Boot application effectively.

Deploying apps with JCEF – How exactly do you deploy an app that uses JCEF? To solve this problem, you can use a sample Conveyor app that is described in more detail in this article. 

How to Backup and Restore a PostgreSQL Database – Discover all of the process stages, from preparing a database to using commands to back up and restore a PostgreSQL database.

Postgres JSON Functions With Hibernate 5 – Take a look at how you can add support for JSON functions in your projects that use Hibernate 5 and Postgres with the posjsonhelper library.

Is Podman a Drop-in Replacement for Docker? – You may have read that Podman is a drop-in replacement for Docker. But is it actually as easy as it sounds? In this blog, you will start with a production-ready Dockerfile and execute Podman commands like you would when using Docker.

Java Developer vs. ChatGPT Part I: Writing a Spring Boot MicroserviceRoni Dover describes an experiment where a seasoned Java developer is pitted against the all-knowing generative AI to find out once and for all if an AI can generate a Java microservice end to end. 

Hugging Face Presents HuggingChat, Open Source Alternative to ChatGPT – HuggingChat is a new AI chatbot on Hugging Face that can perform various tasks like article drafting, coding, problem-solving, and answering questions – just like ChatGPT but with a cuter name.

Hibernate default entity sequence – In this article by Vlad Mihalcea, you can find out how the default entity sequence changes when migrating from Hibernate 5 to Hibernate 6. 

Write Once, Run Embedded in any IDE – After creating several Java GUI applications, Anthony Goubard found it interesting to run them within IntelliJ IDEA, Eclipse, and NetBeans. Instead of writing three plugins for each application, he devised a solution described in this article. 

Using Async-Profiler and Jattach Programmatically with AP-LoaderJohannes Bechberger shares his approach to reducing hassle when using async-profiler and jattach. He wrapped async-profiler and jattach in a platform-independent JAR which can be pulled from Maven Central. In this article, he focuses on its programmatic usage.

Building High Performance Microservices for Java with Micronaut & GraalVM – In this video, Bert Beckwith walks you through Micronaut’s support for GraalVM Native Image. You can also take a look at new support for developing portable multi-cloud applications and microservices and preview some of the features in Micronaut 4, including support for records and virtual threads.

The Power of Precise Names: An Example – Is it always bad to have a long method name? Or is it beneficial because it provides precision? Discover the answer in this article.

Getting Started with Eclipse Collections — Part 4 – In this part of the series, Donald Raab explains how to use several of the most commonly used methods to process information in collections.

Kotlin Corner

KotlinConf’23 videos – All of the videos from the recent KotlinConf are live on YouTube! Check out the keynote for all of the announcements! 

TalkingKotlin podcast: Synthesizing a Database with Kotlin – Does synthesizing a database sound like magic to you? In this episode of Talking Kotlin, we discuss how Synthesized.io uses Kotlin together with custom DSLs and OpenAPI to do just that!

Kotlin Coroutines 1.7.0 – The most recent release is here! 

How to implement hexagonal architecture with your Spring Boot application – In this article, Matthias Schenk shows how to implement a hexagonal architecture using Spring Boot with Kotlin.

Functional Error Handling in Kotlin, Part 1: Absent values, Nullables, Options  – Riccardo Cardin focuses on the functional approaches to error handling in Kotlin and introduces the Arrow library. 

How to start with Coroutines in Spring Boot applicationsMatthias Schenk describes the very basics when starting to work with Kotlin coroutines in a Spring Boot application for the first time. 

Data Objects in KotlinDomen Lanišnik writes about the data objects introduced in Kotlin 1.7.20 and those that are currently planned to be released in version 1.9. You can take a closer look at what they are and what issue they try to solve.

Conferences and Events

Check out the list of upcoming events that may be of interest to you: 

JCON EUROPE 2023 – International Java Community Conference at Cinedom Multiplex Cinema in Cologne, Germany. 

Ignite Summit – Ignite Summit is the premier event for developers who are interested in using Apache Ignite, distributed databases, and in-memory computing to tackle speed and scale challenges.

Culture and Community

Foojay Podcast #22: When Profession and Fun Overlap – In this episode of the Foojay Podcast, volunteers from different organizations explain how coding is used to inspire children to become engineers, or at least, learn to make the most out of the computers and tools around them.

Discovering the Secrets to Success: An Exclusive Interview with Java Champion Michael P. Redlich – Michael P. Redlich, a software developer with over 30 years of experience, highlights the significance of continuous learning, adapting to new technologies, and contributing to open-source projects. He addresses the current challenges faced by developers, including the rapid expansion of cloud computing, and shares entertaining anecdotes from his extensive industry experience.

Why I’m not so Alarmed about AI and Jobs – If you feel like your skills are not strong enough to survive the invasion of AI, this article is for you. 

How to get into ML for a developer? – Is it necessary to start from scratch to become an ML specialist, or can you somehow upgrade your existing knowledge?

Rules of Thumb for Software Development Estimations – In his article, Vadim Kravchenko reveals the honest facts about software estimation. You will discover the importance of estimations, along with the right and wrong methods to approach them.

A Developer Perspective on Developer ExperiencePaul Kelly shares examples from real companies that, in his opinion, frustrate developers and make it difficult for them to deliver. He also offers advice, from a developer’s perspective, on how to create an environment that supports innovation.

Google Maps Previews Aerial View API – Google Maps has introduced exciting new features like cinematic videos of points of interest, immersive views for routes, photorealistic 3D tiles, enhanced route customization, and more.

Working on an unfamiliar codebase – It’s common for developers to work on an unfamiliar codebase. Nicolas Fränke describes how he approaches the situation with the help of diagramming.

Tips for Effective Time Management – How can you maximize productivity and achieve your goals in a limited amount of time? Gunter Rotsaert shares his ideas on how to use your time wisely. Create to-do lists, say no to less important tasks, use in-between moments, and get many more tips from this article. 

Decoding Success: An Industry Expert’s Guide to Thriving in Software Development and Security – In this insightful interview, Erik Costlow, Senior Director of Product Management at Azul, provides valuable insights on his transition from engineering to product management, current industry trends, software development challenges, and advice for new programmers.

And Finally…

IntelliJ IDEA 2023.2 EAP Is Open! – We are now ready to provide you with new features and product enhancements in the Early Access Program for v2023.2. 

What’s New in IntelliJ IDEA 2023.1 for Spring Developers – This article highlights the most crucial updates introduced in v.2023.1, including full support for Lombok, reworked Spring tool window, navigation for Spring Security rules, and more. 

How to Work With Protobuf-Maven Projects in IntelliJ IDEAProtobuf, short for Protocol Buffers, is a language-agnostic data serialization format developed by Google. It is designed to efficiently and reliably serialize structured data to communicate between systems and programming languages. Read this article to learn more about the possibilities of working with Protobuf in IntelliJ IDEA.

Virtual Threads and Structured Concurrency in Java 21 With Loom – Watch this recording of our recent webinar, where José Paumard shows how virtual threads and structured concurrency work.

That’s all for today!

To propose content for the next edition of Java Annotated Monthly, reach out to us via email or Twitter. Keep in mind that articles need to be submitted by June 20.

Lastly, don’t forget that all JAM issues are archived on a dedicated website. So, if you came across an interesting blog but couldn’t read it at the time, don’t fret – you can find it there!

]]>
IntelliJ IDEA 2023.2 EAP 3: Light Theme With Light Header in the New UI, Single-Click Navigation Between Project Directories, and More https://blog.jetbrains.com/idea/2023/06/intellij-idea-2023-2-eap-3/ Fri, 02 Jun 2023 07:01:51 +0000 https://blog.jetbrains.com/?post_type=idea&p=358189 The third EAP build for IntelliJ IDEA 2023.2 is now available, bringing several UI enhancements and new settings to make it easier to tailor the IDE to your preferences and project requirements.

You can get the latest build from our website, the free Toolbox App, or via snaps for Ubuntu.

To stay up to date with the ongoing Early Access Program and explore previous updates, check out the dedicated section of our blog.

Let’s take a closer look at what the latest build has to offer.

User experience

Light theme with light header in the new UI

For v2023.2, we’ve refined the user experience with the Light theme by introducing the alternate Light with Light Header option, featuring matching light colors for window headers, tooltips, and notification balloons.

Single-click navigation between project directories

In the Project view, there’s a new Open Directories with Single Click option that makes expanding and collapsing the project folders quicker and more responsive. The option is available from the drop-down menu once you click on the three dots icon.

Improved main toolbar customization

We’ve expanded the customization options for the new UI’s main toolbar. You can now use a dropdown menu to quickly choose actions that you want to add to the toolbar. To do so, right-click on any widget, select Add to Main Toolbar, and explore the available options.

Suggested plugins in Settings/Preferences

To make it easier to configure the IDE for your specific projects and extend its functionality with plugins, we have updated the UI for the Settings/Preferences | Plugins section. It now includes a set of suggested plugins that is automatically defined based on your project specifics and appears at the top of the list.

These are the most notable highlights of the IntelliJ IDEA 2023.2 EAP 3 build. To see the full list of changes in this EAP build, please refer to the release notes.

Try out these new features and let us know what you think in the comments below or on Twitter. If you encounter any bugs, please report them via our issue tracker.

Happy developing!

]]>
How to Work With Protobuf-Maven Projects in IntelliJ IDEA https://blog.jetbrains.com/idea/2023/05/how-to-work-with-protobuf-maven-projects-in-intellij-idea/ Mon, 22 May 2023 09:59:29 +0000 https://blog.jetbrains.com/wp-content/uploads/2023/05/How2Pro_Blog_Featured_image.png https://blog.jetbrains.com/?post_type=idea&p=356417 Protobuf, short for Protocol Buffers, is a language-agnostic data serialization format developed by Google. It is designed to efficiently and reliably serialize structured data to communicate between different systems and programming languages. Protobuf offers a compact binary representation of data, making it efficient for data storage, transmission over networks, or persistent storage.

Protobuf uses a language called Protocol Buffer Language (proto) to define the structure of the data. The proto files specify the message types, fields, and their data types. These files serve as a contract between the systems involved, ensuring data consistency and compatibility.

Protobuf comes with a code generation tool that generates data access classes or structures in various programming languages based on the proto file.

Let’s explore the possibilities of working with Protobuf in IntelliJ IDEA.

Getting started

Let’s start with a sample Protobuf project that creates an address book.

In the project, we have an address.proto file with the following syntax:

syntax = "proto2";
package protobuf;
option java_package = "org.example.protobuf";
option java_outer_classname = "AddressBookProtos";
message Person {
 required int32 id = 1;
 required string name = 2;
 repeated string numbers = 3;
 optional string email = 4;
}
message AddressBook {
 repeated Person people = 1;
}

We also have a Java application with the following syntax: 

public class Application {
   public static void main(String[] args) {
       int id = new Random().nextInt();
       String name = "Test";
       String email = "test@example.org";
       String number = "01234567890";
       AddressBookProtos.Person person = AddressBookProtos.Person.newBuilder()
               .setId(id)
               .setName(name)
               .setEmail(email)
               .addNumbers(number)
               .build();
       AddressBookProtos.AddressBook addressBook = AddressBookProtos.AddressBook.newBuilder()
               .addPeople(person)
               .build();
       System.out.println(addressBook);
   }
}

We are going to use Maven to build our project. Here is the pom.xml:

<dependencies>
   <dependency>
       <groupId>com.google.protobuf</groupId>
       <artifactId>protobuf-java</artifactId>
       <version>3.23.0</version>
   </dependency>
</dependencies>
<build>
   <plugins>
       <plugin>
           <groupId>com.github.os72</groupId>
           <artifactId>protoc-jar-maven-plugin</artifactId>
           <version>3.11.4</version>
           <executions>
               <execution>
                   <phase>generate-sources</phase>
                   <goals>
                       <goal>run</goal>
                   </goals>
                   <configuration>
                       <optimizeCodegen>false</optimizeCodegen>
                       <protocVersion>3.23.0</protocVersion>
                       <includeStdTypes>true</includeStdTypes>
                   </configuration>
               </execution>
           </executions>
       </plugin>
   </plugins>
</build>

There are several similar Protobuf plugins, and you can choose whichever you prefer. In our case, we are using protoc-jar-maven-plugin.

The <execution> section has the generate-sources phase. During its execution, the plugin will generate a Java model based on the proto file in our project.

Basic setup and execution 

Let’s open this project inside IntelliJ IDEA and run our application:

When we look at the Build output, we’ll see errors:

This problem occurred because we didn’t generate the Java model. We can use the Maven tool window to generate our Java model by clicking the Generate Sources and Update Folders for All Projects icon. The application will now run successfully.

Advanced setup

Let’s modify our proto file. For example, let’s change Person.id from required int32 id = 1; to required string id = 1;

If we run the application again, we’ll get an error in our Build Output:

This happens because we didn’t generate the Java model after making our modifications. We can do it again manually, or we can add the Execute Before Build option to the generate-sources phase in the Maven tool window.

The Execute Before Build option sets a trigger and executes the specified phase each time we run our build.

There is one more thing we need to do – add the  build-helper-maven-plugin section to our pom.xml:

<plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>build-helper-maven-plugin</artifactId>
   <version>3.3.0</version>
   <executions>
       <execution>
           <id>test</id>
           <phase>generate-sources</phase>
           <goals>
               <goal>add-source</goal>
           </goals>
           <configuration>
               <sources>
       <source>${project.basedir}/target/generated-sources</source>
               </sources>
           </configuration>
       </execution>
   </executions>
</plugin>

Now, we’re all set and can build our project without any additional manual hassle. 

Conclusion

We hope that this has helped you understand how you can use Protobuf in your projects while working in IntelliJ IDEA.

As always, we’d love to hear your feedback. You can leave a comment below or use our issue tracker for feature requests.

Happy developing!

]]>
IntelliJ IDEA 2023.2 EAP 2: Text Search in Search Everywhere, GitLab Integration, New Java Inspections, and More https://blog.jetbrains.com/idea/2023/05/intellij-idea-2023-2-eap-2/ Thu, 18 May 2023 12:45:06 +0000 https://blog.jetbrains.com/?post_type=idea&p=356070 The second EAP build for IntelliJ IDEA 2023.2 has been released, offering a bunch of updates that include text search in Search Everywhere, initial GitLab integration, as well as code analysis improvements and better error detection for Java development.

You can get the latest build from our website, the free Toolbox App, or via snaps for Ubuntu.

If you want to catch up on the previous week’s updates, you can refer to this blog post for more details.

Now, let’s delve into what the new build offers.

User experience

Text search in Search Everywhere

The Search Everywhere (Double ⇧ / Double Shift) functionality, primarily utilized for searching through files, classes, methods, actions, and settings, now includes text search capabilities similar to Find in Files. With this enhancement, text search results are displayed when there are few or no other search results available for a given query. The feature is enabled by default and can be managed in Settings/Preferences | Advanced Settings | Search Everywhere.

Syntax highlighting in inspection descriptions 

In Settings / Preferences | Editor | Inspections, we’ve implemented syntax highlighting for code samples, which facilitates comprehension of any given inspection and its purpose.

VCS

GitLab integration

IntelliJ IDEA 2023.2 EAP 2 introduces initial integration with GitLab, allowing you to work with the Merge Request functionality right from the IDE, thus streamlining your development workflow.

Java

New inspections and other code analysis improvements 

We have improved and expanded our Java inspections to assist you in maintaining high-quality code and detecting potential issues more effectively.

A new Incorrect ‘MessageFormat’ pattern inspection will now warn you when pattern references do not match the arguments.

This inspection also detects and highlights incorrect usages of quotes and braces in MessageFormat patterns.

The IDE now reports calls with explicit ChronoField or ChronoUnit arguments and suggests replacing them with calls of more specific methods, thus simplifying the code.  

Also, IntelliJ IDEA now provides a warning about unsupported ChronoField and ChronoUnit constants used in conjunction with LocalTime or LocalDateTime.

The IDE’s code analysis now supports ranges for get and getLong methods of LocalDateTime and LocalTime classes. It also notifies you about redundant if statements that can be replaced with a constant value within the appropriate range.

IntelliJ IDEA has been enhanced to detect portions of long methods that can be neatly extracted into separate private methods. It suggests performing this extraction for the sake of improved code cleanliness.

Сode highlighting and navigation for format strings

Now, once you place the caret on a format specifier, the IDE will highlight the corresponding argument and other specifiers that point to it. Also, you can now use Go To Declaration (Ctrl+B/⌘B) to jump to the associated code location for a specific format string placeholder.

Improved support for the @snippet tag in Javadoc

IntelliJ IDEA now features improved functionality for working with the @snippet tag within Javadoc comments.It allows Markup comments within the @snippet tag, and they are now properly rendered in the documentation.

This enhancement includes support for code regions, meaning you can now specify a portion of code that you want to refer to in a Javadoc.

In addition, IntelliJ IDEA now supports the inclusion of external snippets within the @snippet tag, allowing you to reference external code snippets stored in separate files or sources and include them in Javadoc documentation.

These are the key highlights from the latest IntelliJ 2023.2 EAP build. For a comprehensive list of changes, please refer to the release notes.

We appreciate your active participation in the Early Access Program and highly value your feedback. You can share your thoughts about the new features with us on Twitter or by leaving a comment in the section below. If you find a bug, please report it to our issue tracker.

Happy developing!

]]>
IntelliJ IDEA 2023.1.2 is Out!  https://blog.jetbrains.com/idea/2023/05/intellij-idea-2023-1-2/ Tue, 16 May 2023 18:11:44 +0000 https://blog.jetbrains.com/?post_type=idea&p=355597 A new bug-fix update – IntelliJ IDEA 2023.1.2 – has arrived!

You can get the latest version from inside the IDE, via the Toolbox App, or by using snaps for Ubuntu. It is also possible to download it from our website.

Here are the most notable fixes included in this version:

  • The issue causing editor tabs to scroll slowly has been resolved. [IDEA-318576]
  • The IDE no longer erroneously considers projects stored on NFS-mounted drives to be read-only. [IDEA-315865]
  • The IDE no longer erroneously reports errors on missing accessors when you use @Embeddable in Spring Data JPA. [IDEA-240844]
  • The list of suggested imports again features all of the corresponding options. [IDEA-311127]
  • The IDE no longer mistakenly reports correct values of the Spring Boot spring.config.import configuration property as errors. [IDEA-301120]
  • spring.model.utils.resources no longer causes abnormally high CPU consumption. [IDEA-316653]
  • Resyncing Gradle projects no longer fails with the “Missing gradleIdentityPath” error. [IDEA-317045]
  • Resizing panes in the Project Structure | Modules dialog now works as expected. [IDEA-316957]

For more details, please refer to the release notes.

If you encounter any bugs, please report them to our issue tracker.

Happy developing!

]]>
New Livestream: Virtual Threads and Structured Concurrency in Java 21 With Loom https://blog.jetbrains.com/idea/2023/05/new-livestream-virtual-threads-and-structured-concurrency-in-java-2021-with-loom/ Mon, 15 May 2023 20:41:21 +0000 https://blog.jetbrains.com/wp-content/uploads/2023/05/Blog_Featured_image_1280x600-7.png https://blog.jetbrains.com/?post_type=idea&p=355135 Join us for the IntelliJ IDEA livestream with José Paumard to learn about how to work with virtual threads.

Date:  Thursday, May 25, 2023

Time: 4:00 pm – 5:00 pm UTC

Session abstract

Loom brought 2 preview features in Java 19: virtual threads and structured concurrency. Virtual threads are a new model of thread that is compatible with the current platform threads but much lighter. You can easily launch millions of virtual threads on a machine that would only support a few thousand platform threads. Virtual threads should be made final in JDK 21. Structured concurrency leverages this feature to write asynchronous code in a very easy way. It is built on an imperative mono-thread programming model built on top of virtual threads. These elements have been updated in Java 20. Java 20 also has a third preview feature delivered by the Loom project: a new model for ThreadLocal variables called ScopedValues that is meant to work with virtual threads. This presentation shows you how this all works, the new pattern you will be able to use for your asynchronous systems, and the performance you may expect.

Asking questions

José will try to answer all of your questions during the session. If we run out of time, we’ll post the answers to any remaining questions in a follow-up blog post. We’ll do our best to get all of your questions answered.

Your speaker and host

Speaker

José Paumard

José works as Java Developer Advocate at Oracle. With a PhD in applied mathematics and computer science, he was an assistant professor at the University Sorbonne Paris Nord for 25 years, and is now a Java Champion Alumnus and JavaOne Rockstar. He is a member of the French Paris Java User Group, has been a co-organizer of the Devoxx France conference, and is a disorganizer of JChateau, an unconference held in the Chateau of the Loire Valley. He works on the dev.java documentation website and publishes the JEP Café, a monthly video cast on YouTube. He is also a Pluralsight author in the Java space.

Speaker Twitter handle: twitter.com/JosePaumard

Speaker Github repo: github.com/JosePaumard

Host

Mala Gupta

A Java Champion and JUG leader, Mala has authored multiple books with Manning, Packt, and O’Reilly Publications. An international speaker at industry conferences, she has more than 2 decades’ experience in the software industry. She has been actively supporting Java certification as a path to career advancement.

Happy developing!

]]>
IntelliJ IDEA 2023.2 EAP Is Open! https://blog.jetbrains.com/idea/2023/05/intellij-idea-2023-2-eap/ Fri, 12 May 2023 18:31:29 +0000 https://blog.jetbrains.com/wp-content/uploads/2023/05/Blog_Featured_image_1280x600_IntelliJIDEA-2x-1.png https://blog.jetbrains.com/?post_type=idea&p=349775 Exciting news for IntelliJ IDEA enthusiasts – the Early Access Program for IntelliJ IDEA 2023.2 starts today!

This program offers you an early glimpse of the new features and improvements expected to land in the next upcoming version. If you’re not yet familiar with the EAP concept, check out this blog post for more details.

Join us for the next few weeks in exploring the newest additions to IntelliJ IDEA and provide your valuable feedback after testing out the new features.

The first IntelliJ IDEA 2023.2 EAP build introduces an easy way to instantly see performance data from IntelliJ Profiler, improvements for debugging reactive applications, a new solution to seamlessly generate shared indexes for projects, and a few UI improvements.

You can download the build from our website, get it from the free Toolbox App, or update to it using snaps if you’re an Ubuntu user.

Let’s take a look at what other new features and improvements are available to try in this build.

User experience

Reworked hamburger menu in the main toolbar on Windows and Linux

We’ve refined the behavior of the hamburger menu in the new UI that is located in the main toolbar for Windows and Linux. Once you click on the menu icon, the elements now appear horizontally over the toolbar.

Also, there’s now an option to turn this menu into a separate toolbar. For this, go to View | Appearance | Main menu as a Separate Toolbar.

Updated window controls on macOS 

When working on macOS in full screen mode using the new UI, the window controls are now displayed right in the main toolbar – not in the floating bar as before.

Profiler

In-editor performance hints

We keep improving IntelliJ Profiler to provide you with insightful information about how your application performs and make performance issues easier to investigate. In the first IntelliJ IDEA 2023.2 EAP build, we’ve introduced in-editor hints, which offer an easy way to interpret your code’s performance line by line and help you resolve performance problems faster.

With this addition, the data from IntelliJ Profiler is visualized right in the editor – the execution time and memory allocation data appear in the gutter next to the corresponding line of code. These annotations are color-coded to help you instantly see which methods require your attention the most. Calls taking the majority of the parent method’s time are highlighted in red, and they will additionally feature a fire icon if the total execution time is significantly affected.

This way, you can easily focus on performance bottlenecks and review them on the fly without having to perform a thorough, time-consuming analysis with the Flame Graph and Call Tree views.

Inline performance hints are enabled by default. If you want to turn them off, right-click on any annotation and click Close Line Annotations.

Run/Debug

Reactor Mono and Flux values evaluation 

When debugging your reactive application, you can now easily evaluate values of watches and local variables for Mono and Flux types. The IDE now detects them during debugging sessions and provides a corresponding get or collectList link in the Variables view, which you can click to instantly compute reactive stream items.

By default, the debugger fetches the first 100 items of Flux. You can configure this number in File | Settings | Languages & Frameworks | Reactive Streams. Please note that each time you trigger a computation, the IDE subscribes to a Publisher value and assumes that the operation is safe to retry.

Performance 

New tool for easily generating shared indexes

We’re introducing a new command line tool for quickly building and uploading shared indexes. It is designed to streamline teamwork and eliminate time wasted on locally indexing large projects.

The new tool simplifies the process of generating shared indexes for your team, requiring just a few clicks instead of multiple scripts and services. 

The workflow is straightforward: Download the archive, unzip it, and execute the binary file via the command line, specifying the project path. The tool will then configure an intellij.yaml file that you need to add to your project.

For more comprehensive customization, check out the scripts provided in readme.md.

These are the most notable updates for this week. To see the full list of changes in this EAP build, please refer to the release notes.

We’re committed to delivering the best experience for our users, and we value your input in helping us achieve that goal. If you encounter any bugs while working with this build, please submit a report using our issue tracker. If you have any questions or feedback, let us know in the comments below or get in touch with our team on Twitter.

Happy developing!

]]>
What’s New in IntelliJ IDEA 2023.1 for Spring Developers https://blog.jetbrains.com/idea/2023/05/2023-1-for-spring-developers/ Wed, 10 May 2023 08:25:19 +0000 https://blog.jetbrains.com/?post_type=idea&p=351236 The IntelliJ IDEA 2023.1 release came packed with updates for Spring. This blog post will highlight the most noticeable changes, including full support for Lombok, a reworked Spring tool window, navigation for Spring Security rules, Spring Security 6 support, and more.

Remember that these features are only available in IntelliJ IDEA Ultimate. 

Let’s take a look!

Full support for Lombok with Spring

Many developers like to use Lombok when working with the Spring framework. With v2023.1, we have added full support for all of Lombok’s helpful features, making your experience much more enjoyable and productive.

For instance, if you use Lombok’s RequiredArgsConstructor on bean classes, you can now navigate to autowired dependencies or candidates right from a field’s gutter icon.

Our inspections now also work with any Lombok-annotated Spring bean.

Additionally, IntelliJ IDEA now proposes a quick-fix for missing bean dependencies that takes Lombok annotations into account.

Reworked Spring tool window

The Spring tool window got a significant redesign to accompany the IDE-wide UI enhancements. Once you activate the new UI via Preferences/Settings | Appearance & Behavior | New UI, you can open the updated Spring tool window in two different ways: 

  • Hover over Go to … in the left-hand pane and select the Spring leaf.
  • Click on the icon in the gutter and choose Select in Spring View

The open tool window now has a minimalist appearance while still providing lots of information. More specifically, the window is now aligned vertically and appears as a simple list of Spring beans. You can search and filter the list according to your needs. The new view is much faster, which is particularly noticeable when working on large projects.

Incorrect transactional method call detection

One of known pitfalls of @Transactional usage in Spring is when such methods are accidentally called from within the bean itself. IntelliJ IDEA now shows warnings if you’re going to bypass the transactional proxy by calling the method directly.

Navigation for Spring Security rules

If your project uses Spring Security rules, the IDE detects all of the places where they are applied and lets you navigate to and from them.

In the gif below, you can see how clicking on a URL that comes with a security rule and selecting Show security configurations for URL brings us to the security matchers.

From there, you can return to the controller by clicking on the shield icon and selecting Navigate to secured URL

Spring Security 6 support

It is now possible to use code completion and navigate to URL mappings and security roles for APIs that were introduced in Spring Security 6, such as AbstractRequestMatcherRegistry.requestMatchers and HttpSecurity.securityMatcher.

Running MongoDB queries in the Database console from Spring Data repositories

If you have Spring repositories that contain MongoDB queries, you can now easily run the latter from the Database console. This is very convenient when you want to check whether a query works and what the result is after running it. 

In the example below, we press ⌥ Enter (macOS) or Alt + Enter (Windows or Linux) and select the Run query in console action from the list. The MongoDB query then appears in the Database console, where it can be edited and run with the triangle button. 

When you edit queries, code completion works inside them, allowing you to compose more complex ones quickly. 

In the following gif, we show how to get a list of people aged 25 and older with the help of $gt. 

Recognition of Swagger annotations for OpenAPI generation

Previously IntelliJ IDEA didn’t take into consideration Swagger 2.X annotations that you could use in Spring controllers. Starting from v2023.1, IntelliJ IDEA now takes them into consideration when generating OpenAPI. 

To see how this works, add the @Operation annotation and define the desired additional properties for your method. For example, you can add an ID and a description for it, and make it deprecated. Then click the URL next to the desired method and select Generate OpenAPI draft from the list. You will see that the annotation is considered in the generated YAML file and its effect is visible in the OpenAPI preview. 

Thanks for reading about the most prominent updates for Spring in v2023.1! Give them a try when working with Spring in IntelliJ IDEA. You can find more enhancements described on our What’s New page. If you think there are features that are missing and you would like us to add them, please let us know in the comments to this post.

]]>