Execution does not follow the code’s logic - both if and else clauses executed

Jmix version: 1.5.4
IntelliJ IDEA 2023.1.1 (Community Edition)
Build #IC-231.8770.65, built on April 27, 2023
Runtime version: 17.0.6+10-b829.9 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
GC: G1 Young Generation, G1 Old Generation
Non-Bundled Plugins: io.jmix.studio (2.0.1-231)
Kotlin: 231-1.8.21-IJ8770.65
Java 17.0.4.1 2022-08-18 LTS
Java™ SE Runtime Environment (build 17.0.4.1+1-LTS-2)
Java HotSpot™ 64-Bit Server VM (build 17.0.4.1+1-LTS-2, mixed mode, sharing)
Operating System: macOS 12.7.1 (21G920)
File System: Case-Sensitive Journaled HFS+ (APFS)
Browser: Safari - Version 17.1 (17616.2.9.11.9, 17616)
Database: PostgreSQL 13

Hi Everyone

For your information, I experienced truly devastating behaviour using IntelliJ IDEA 2023.1.1 (Community Edition) Build #IC-231.8770.65 with io.jmix.studio (2.0.1-231).

In the images below, which are in chronological order during the same run, you will see the following incorrect behaviours:

  1. My “if”, “else if” and “else” clauses were all executed one after another; this should never ever happen anywhere.
  2. I was not able to set some breakpoints within the “if else” statements
  3. If you observe the “templatePath” variable at the bottom of each image, you will see that its string’s modification (appends) are not aligned with the code statements.

I had this behaviour in at least one other “if else” statement that I could find.

Screenshot 2023-11-01 at 16.51.18

Screenshot 2023-11-01 at 16.51.32

Screenshot 2023-11-01 at 16.51.53

Screenshot 2023-11-01 at 16.52.34

Screenshot 2023-11-01 at 16.53.00

Screenshot 2023-11-01 at 16.53.12

Screenshot 2023-11-01 at 16.53.46

Screenshot 2023-11-01 at 17.05.29

Screenshot 2023-11-01 at 17.05.46

All of these incorrect behaviours stopped after upgrading to the following versions:

IntelliJ IDEA 2023.1.5 (Community Edition)
Build #IC-231.9392.1, built on July 25, 2023
Runtime version: 17.0.7+10-b829.16 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Non-Bundled Plugins: io.jmix.studio (2.0.4-231)
Kotlin: 231-1.8.21-IJ9392.1

Unfortunately, I did not update IntelliJ and Studio separately, to see if only one was causing the problem (I was too frustrated and had lost my patience).

This situation cost me about 5 hours of debugging time because I first thought, that my logic was not correct in several places, so I made some changes there first.

I do not expect an investigation into this problem; I would just like to warn everyone not to use this IntelliJ IDEA 2023.1.1 (Community Edition) Build #IC-231.8770.65 - io.jmix.studio (2.0.1-231) combination. That’s it, good luck!

Best regards
Chris

1 Like