jmix-projects / jmix-ui

DEPRECATED. Use https://github.com/jmix-framework/jmix
https://www.jmix.io
3 stars 7 forks source link

Lambda conversion exception when hot-deploying screen controller class with Java 17 #740

Closed trx0eth7 closed 2 years ago

trx0eth7 commented 2 years ago

java version:

openjdk version "17.0.1" 2021-10-19 LTS
OpenJDK Runtime Environment (build 17.0.1+12-LTS)
OpenJDK 64-Bit Server VM (build 17.0.1+12-LTS, mixed mode, sharing)

jmix version: 1.1.0

project: https://github.com/trx0eth7/jmix-java-example

TC:

  1. Run app
  2. Log in as admin
  3. Open screen Application -> Orders

Exception:

Caused by: java.lang.RuntimeException: Unable to build lambda consumer MethodHandle(OrderBrowse,InitEvent)void
    at io.jmix.ui.sys.UiControllerReflectionInspector.lambda$getConsumerMethodFactory$1(UiControllerReflectionInspector.java:194) ~[jmix-ui-1.1.0.jar:na]
    at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4868) ~[guava-31.0.1-jre.jar:na]
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3533) ~[guava-31.0.1-jre.jar:na]
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2282) ~[guava-31.0.1-jre.jar:na]
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2159) ~[guava-31.0.1-jre.jar:na]
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2049) ~[guava-31.0.1-jre.jar:na]
    ... 102 common frames omitted
Caused by: java.lang.invoke.LambdaConversionException: Invalid caller: com.haulmont.jje.screen.order.OrderBrowse

I suppose that is related to java version because if you run the application with jdk 11, seems that works. I've checked it on java version:

openjdk version "11.0.13" 2021-10-19 LTS
OpenJDK Runtime Environment (build 11.0.13+8-LTS)
OpenJDK 64-Bit Server VM (build 11.0.13+8-LTS, mixed mode)

Note:

  1. The following must be defined in the build.gradle
    sourceCompatibility = JavaVersion.VERSION_17
    targetCompatibility = JavaVersion.VERSION_17
  2. Subscription method must be not empty
gorbunkov commented 2 years ago

The issues seems to happen only for hot-deployed classes. I got it after the following steps:

  1. Create new project, set JDK 17
  2. Crete new screen, add some Subscribe listener, e.g. InitEvent listener
  3. Run the application, open the screen - everything is ok
  4. Then modify the screen code, e.g. change the listener behavior - the class will be compiled and "hot-deployed" by Studio
  5. After that try to open the screen in the browser again - you'll get the error
reznikova21 commented 2 years ago

1.2.0-SNAPSHOT - verified