jakartaee / expression-language

Jakarta Expression Language
https://eclipse.org/ee4j/el
Other
62 stars 49 forks source link

JDK 14 - Usage of yield #122

Closed GedMarc closed 2 years ago

GedMarc commented 4 years ago

On JDK 14 -

javax.el/src/main/java/com/sun/el/stream/Stream.java:[160,29] yield outside of switch expression [23:31:42][Step 3/3] [ERROR] (to invoke a method called yield, qualify the yield with a receiver or type name)

Thihup commented 3 years ago

Compiling with JDK 16 works fine. It gives a Javadoc warning, though:

[WARNING] Javadoc Warnings
[WARNING] /Systextil/workspace/el-ri/impl/src/main/java/com/sun/el/stream/Stream.java:67: warning: 'yield' may become a restricted identifier in a future release
[WARNING] yield(item);
[WARNING] ^
[WARNING] (to invoke a method called yield, qualify the yield with a receiver or type name)
[WARNING] /Systextil/workspace/el-ri/impl/src/main/java/com/sun/el/stream/Stream.java:97: warning: 'yield' may become a restricted identifier in a future release
[WARNING] yield(item);
[WARNING] ^
[WARNING] (to invoke a method called yield, qualify the yield with a receiver or type name)
[WARNING] /Systextil/workspace/el-ri/impl/src/main/java/com/sun/el/stream/Stream.java:161: warning: 'yield' may become a restricted identifier in a future release
[WARNING] yield(item);
[WARNING] ^
[WARNING] (to invoke a method called yield, qualify the yield with a receiver or type name)
fmorriso commented 2 years ago

I found the following fixed the issue for me: Change this: yield(); to this: Thread.yield();

GedMarc commented 2 years ago

This was resolved shortly after logging this with a new published released, the class itself is no longer in the library can resolve by updating your artifact version

The yield method was actually an internal call to a in-code placement of yield(), it didn't use the jvm new yield function, because of this Thread.yield() is actually the wrong solution ;)