Загрузка...

Fixing the Incompatible types Error in IntelliJ/Kotlin After Upgrade

Discover how to resolve the `Incompatible types` error in IntelliJ after upgrading to newer Kotlin versions, especially in Corda applications.
---
This video is based on the question https://stackoverflow.com/q/67028660/ asked by the user 'Tywin Lannister' ( https://stackoverflow.com/u/11035966/ ) and on the answer https://stackoverflow.com/a/67204213/ provided by the user 'Tywin Lannister' ( https://stackoverflow.com/u/11035966/ ) at 'Stack Overflow' website. Thanks to these great users and Stackexchange community for their contributions.

Visit these links for original content and any more details, such as alternate solutions, latest updates/developments on topic, comments, revision history etc. For example, the original title of the Question was: IntelliJ/Kotlin upgrade causing "Incompatible types" error?

Also, Content (except music) licensed under CC BY-SA https://meta.stackexchange.com/help/licensing
The original Question post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/by-sa/4.0/ ) license, and the original Answer post is licensed under the 'CC BY-SA 4.0' ( https://creativecommons.org/licenses/by-sa/4.0/ ) license.

If anything seems off to you, please feel free to write me at vlogize [AT] gmail [DOT] com.
---
Troubleshooting the Incompatible types Error in IntelliJ/Kotlin

Introduction

Have you recently upgraded IntelliJ or Kotlin and encountered an unexpected error in your Corda application? If so, you're not alone. Many developers face issues after updating their development environments, which can lead to frustrating coding errors such as "Incompatible types." This guide addresses this common challenge, especially focused on a user who experienced this problem after upgrading to IntelliJ 2021.1.

The Problem

After upgrading to the latest versions of IntelliJ and Kotlin, our user started facing an error on their QueryCriteria statements that previously worked without issues. The specific error message read:

[[See Video to Reveal this Text or Code Snippet]]

Despite this error, the tests continued to run, but the persistent warnings prompted concern. This raised an important question about compatibility between different versions of IntelliJ, Kotlin, and Corda.

Understanding the Error

What Caused the Issue?

The issue originated from updating IntelliJ beyond the recommended version for Corda development. The official documentation indicated that Corda supports IntelliJ versions up to 2020.x and a specific Kotlin plugin version (1.2.71). However, our user inadvertently upgraded to IntelliJ 2021.1 during a routine update, leading to incompatibility between the IntelliJ environment and the Kotlin plugin.

Version Compatibility

Here’s a quick recap of the versions leading to the error:

IntelliJ Versions Tested:

2018.3 to 2019.3: No issues

2020.3.2: No issues

2021.1: Error appeared

Kotlin Plugin Versions Tested:

2019.3: No error

2020.3: No error

2021.1: Error appeared

Key Takeaway:

Always check documentation for version compatibility before upgrading!

Solution Steps

When dealing with such version-related issues, here’s how to approach resolving them effectively:

1. Rollback to Compatible Versions

Uninstall IntelliJ 2021.1: This was the source of the compatibility issue.

Reinstall IntelliJ 2020.3.3: This version worked without errors.

Check Plugin Compatibility: Ensure you’re using a Kotlin plugin compatible with your version of IntelliJ.

2. Update Project Settings and Configuration

Java and Kotlin Settings: Double-check your Project Structure settings to ensure everything aligns with the versions of IntelliJ and Kotlin you have chosen to use. Make sure there are no outdated configurations or default settings that might cause conflicts.

3. Be Cautious with Future Updates

Update Notifications: Prioritize manual updates to maintain control over the installed versions especially when you are working on critical applications like Corda.

Backup Settings: Before making updates, perform a configuration backup to easily revert in case things go wrong.

4. Ask for Help from the Community

If you encounter unexpected errors that seem unresolvable, engaging with the developer community can offer perspectives and solutions you might not have considered. Platforms like Stack Overflow or Kotlin forums are excellent resources for getting help from experienced developers.

Conclusion

Upgrading IDEs and programming languages can sometimes lead to compatibility issues, especially in specific application frameworks like Corda. In this case, our user managed to identify that the conflict arose due to IntelliJ's version upgrade. By rolling back to a compatible version and carefully managing plugin versions, they regained a stable development environment. Always remember to consult official documentation and maintain backups of your settings to minimize disruptions to your workflow.

If you have faced similar issues in your development journey, please share your exp

Видео Fixing the Incompatible types Error in IntelliJ/Kotlin After Upgrade канала vlogize
Страницу в закладки Мои закладки
Все заметки Новая заметка Страницу в заметки

На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.

Об использовании CookiesПринять