private static ThreeState isInGroovyFile(@Nullable Location location) {
    if (location != null) {
      var refType = location.declaringType();
      try {
        String safeName = refType.sourceName();
        FileType fileType = FileTypeRegistry.getInstance().getFileTypeByFileName(safeName);
        if (fileType == UnknownFileType.INSTANCE) {
          return ThreeState.UNSURE;
        }
        if (fileType instanceof LanguageFileType languageFileType) {
          if (languageFileType.getLanguage() == GroovyLanguage.INSTANCE) {
            return ThreeState.YES;
          }
        }
      } catch (AbsentInformationException ignore) {
      }
    }
    return ThreeState.NO;
  }
private static ThreeState isInGroovyFile(@Nullable Location location)