boolean (PsiExpression expression) { expression = PsiUtil.skipParenthesizedExprDown(expression); if (!(expression instanceof PsiMethodCallExpression methodCallExpression)) { return false; } final PsiReferenceExpression methodExpression = methodCallExpression.getMethodExpression(); @NonNls final String name = methodExpression.getReferenceName(); if (!"holdsLock".equals(name)) { return false; } final PsiMethod method = methodCallExpression.resolveMethod(); if (method == null) { return false; } final PsiClass aClass = method.getContainingClass(); return com.intellij.psi.util.InheritanceUtil.isInheritor(aClass, "java.lang.Thread"); }