CompletableFuture<PrimitiveValue> (@Nullable ObjectReference value, boolean now) { if (value != null) { ReferenceType type = value.referenceType(); return fields(type, now) .thenCompose(fields -> { Field valueField = ContainerUtil.find(fields, f -> "value".equals(f.name())); if (valueField != null) { return getValue(value, valueField, now) .thenApply(primitiveValue -> { if (primitiveValue instanceof PrimitiveValue) { String expected = PsiJavaParserFacadeImpl.getPrimitiveType(primitiveValue.type().name()).getBoxedTypeName(); String actual = type.name(); LOG.assertTrue(actual.equals(expected), "Unexpected unboxable value type" + "\nType: " + actual + "\nPrimitive value type: " + primitiveValue.type() + "\nBoxed type: " + expected); return (PrimitiveValue)primitiveValue; } return null; }); } return completedFuture(null); }); } return completedFuture(null); }