X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Fconstants%2FJavaMethod.java;h=6d02784a23eedc083b28284779ca238019b4c84b;hp=a5efd23f604d5732b9ed1043dade1d2721a2fdf3;hb=7a2202d5fdd3da3c9b5fdf5e56f10de24df2774e;hpb=8daf1d98d61e83fc6450ddac8e800476a9d52ab3 diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/constants/JavaMethod.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/constants/JavaMethod.java index a5efd23f6..6d02784a2 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/constants/JavaMethod.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/constants/JavaMethod.java @@ -55,7 +55,10 @@ public class JavaMethod extends FunctionValue { @Override public Type applyExact(MethodBuilder mb, Val[] parameters) { - if(returnTypeDesc == null) { + if(returnTypeDesc == null || parameterTypeDescs == null) { + // This method may be called from multiple threads at the same time when returnTypeDesc + // and parameterTypeDescs are uninitialized. Double initialization is OK in this case, + // but because there are two fields, we have to check that both are initialized. JavaTypeTranslator tt = mb.getJavaTypeTranslator(); returnTypeDesc = tt.toTypeDesc(returnType); parameterTypeDescs = JavaTypeTranslator.filterVoid(