boolean (@NotNull VirtualFile file, int line, @NotNull Project project) { return canPutAtElement(file, line, project, (element, document) -> { if (DumbService.isDumb(project)) { // always allow line breakpoints in dumb mode return true; } if (element instanceof PsiField) { PsiExpression initializer = ((PsiField)element).getInitializer(); if (initializer != null && !PsiTypes.nullType().equals(initializer.getType())) { Object value = JavaPsiFacade.getInstance(project).getConstantEvaluationHelper().computeConstantExpression(initializer); return value == null; } return false; } else if (element instanceof PsiMethod) { PsiCodeBlock body = ((PsiMethod)element).getBody(); if (body != null) { PsiStatement[] statements = body.getStatements(); if (statements.length > 0 && document.getLineNumber(statements[0].getTextOffset()) == line) { return true; } } return false; } return true; }); }