Skip to content

Commit 4cb2f12

Browse files
committed
Fix check for duplicate method descriptor
1 parent 78faa3d commit 4cb2f12

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/SVMImageLayerWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ private void persistMethod(AnalysisMethod method, Supplier<PersistedAnalysisMeth
598598
}
599599

600600
String methodDescriptor = imageLayerSnapshotUtil.getMethodDescriptor(method);
601-
if (methodDescriptors.put(methodDescriptor, method) != null) {
601+
if (methodDescriptors.putIfAbsent(methodDescriptor, method) != null) {
602602
throw GraalError.shouldNotReachHere("The method descriptor should be unique, but %s got added twice.\nThe first method is %s and the second is %s."
603603
.formatted(methodDescriptor, methodDescriptors.get(methodDescriptor), method));
604604
}

0 commit comments

Comments
 (0)