private void diagnoseUnknownParent(@NotNull CompositeElement parent, @NotNull IElementType parentElementType) {
    String msg = "Java code reference '" + getText() + "' has unknown parent: '" + parent + "' (" + parent.getClass() + ")" +
                 "; of type: " + parentElementType + "\n";
    while (parent != null && parent.getPsi() instanceof PsiExpression) {
      parent = parent.getTreeParent();
      msg += " Parent: '" + parent + "'\n";
    }
    if (parent != null) {
      msg += "PSI of the top-level PsiExpression parent:\n"+DebugUtil.treeToString(parent, true);
    }
    LOG.error(msg);
  }
private void diagnoseUnknownParent(@NotNull CompositeElement parent, @NotNull IElementType parentElementType)