code: @Programmatic
      public List<ApplicationPermission> findOrphaned() {
  
          final List<String> packageNames = applicationFeatureRepository.packageNames();
          final Set<String> availableClasses = Sets.newTreeSet();
          for (String packageName : packageNames) {
              appendClasses(packageName, ApplicationMemberType.PROPERTY, availableClasses);
              appendClasses(packageName, ApplicationMemberType.COLLECTION, availableClasses);
              appendClasses(packageName, ApplicationMemberType.ACTION, availableClasses);
          }
  
          final List<ApplicationPermission> orphaned = Lists.newArrayList();
  
          final List<ApplicationPermission> permissions = allPermissions();
          for (ApplicationPermission permission : permissions) {
              final ApplicationFeatureType featureType = permission.getFeatureType();
              final String featureFqn = permission.getFeatureFqn();
  
              switch (featureType) {
  
              case PACKAGE:
                  if(!packageNames.contains(featureFqn)) {
                      orphaned.add(permission);
                  }
                  break;
              case CLASS:
                  if(!availableClasses.contains(featureFqn)) {
                      orphaned.add(permission);
                  }
                  break;
              case MEMBER:
  
                  final List<String> split = Splitter.on('#').splitToList(featureFqn);
                  final String fqClassName = split.get(0);
                  final String memberName = split.get(1);
  
                  final int lastDot = fqClassName.lastIndexOf('.');
                  final String packageName = fqClassName.substring(0, lastDot);
                  final String className = fqClassName.substring(lastDot + 1);
  
                  final List<String> memberNames = memberNamesOf(packageName, className);
  
                  if(!memberNames.contains(memberName)) {
                      orphaned.add(permission);
                  }
                  break;
              }
          }
  
          return orphaned;
      }
docs: region > findOrphaned (programmatic)