void (@NotNull final PsiSynchronizedStatement statement) { final PsiExpression monitor = statement.getLockExpression(); if (monitor == null) return; final PsiType monitorType = monitor.getType(); if (monitorType == null) return; if (!isValueBasedClass(monitorType)) { final TypeConstraint constraint = TypeConstraint.fromDfType(CommonDataflow.getDfType(monitor)); final PsiType inferredType = constraint.getPsiType(statement.getProject()); if (monitorType.equals(inferredType)) return; if (!isValueBasedClass(inferredType)) return; } holder.registerProblem(monitor, JavaBundle.message("inspection.value.based.warnings.synchronization")); }