MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/java/comments/ma0y6b/java_lambdas_can_deadlock_parallel_class/grqjqc6/?context=3
r/java • u/fredoverflow • Mar 21 '21
46 comments sorted by
View all comments
84
TL;DW Lambda bodies are implemented as private static methods, but during class initialization, other threads are blocked from calling static methods.
38 u/[deleted] Mar 21 '21 Whilst interesting; who would do such a thing? Having a heavy static class initialiser using a parallel stream like that.. ouch. 35 u/AndrewHaley13 Mar 21 '21 Well, this kind of edge case really needs to be fixed. It's far from obvious that lambda streams shouldn't be used in static initializers. 8 u/DasBrain Mar 21 '21 ¯\(ツ)/¯JDK-8215634Happens if you fix bugs so OpenJDK actually implements the spec.Also see apangin's great answer on Stack Overflow.
38
Whilst interesting; who would do such a thing? Having a heavy static class initialiser using a parallel stream like that.. ouch.
35 u/AndrewHaley13 Mar 21 '21 Well, this kind of edge case really needs to be fixed. It's far from obvious that lambda streams shouldn't be used in static initializers. 8 u/DasBrain Mar 21 '21 ¯\(ツ)/¯JDK-8215634Happens if you fix bugs so OpenJDK actually implements the spec.Also see apangin's great answer on Stack Overflow.
35
Well, this kind of edge case really needs to be fixed. It's far from obvious that lambda streams shouldn't be used in static initializers.
8 u/DasBrain Mar 21 '21 ¯\(ツ)/¯JDK-8215634Happens if you fix bugs so OpenJDK actually implements the spec.Also see apangin's great answer on Stack Overflow.
8
¯\(ツ)/¯
JDK-8215634
Happens if you fix bugs so OpenJDK actually implements the spec.Also see apangin's great answer on Stack Overflow.
84
u/fredoverflow Mar 21 '21
TL;DW Lambda bodies are implemented as private static methods, but during class initialization, other threads are blocked from calling static methods.