public void checkParameterizables() {
    LoggingConfiguration.setVerbose(Level.VERBOSE);
    knownParameterizables = new ArrayList<>();
    try {
      Enumeration<URL> us = getClass().getClassLoader().getResources(ELKIServiceLoader.RESOURCE_PREFIX);
      while(us.hasMoreElements()) {
        URL u = us.nextElement();
        if("file".equals(u.getProtocol())) {
          for(String prop : new File(u.toURI()).list()) {
            try {
              knownParameterizables.add(Class.forName(prop));
            }
            catch(ClassNotFoundException e) {
              LOG.warning("Service file name is not a class name: " + prop);
              continue;
            }
          }
        }
        else if(("jar".equals(u.getProtocol()))) {
          JarURLConnection con = (JarURLConnection) u.openConnection();
          try (JarFile jar = con.getJarFile()) {
            Enumeration<JarEntry> entries = jar.entries();
            while(entries.hasMoreElements()) {
              String prop = entries.nextElement().getName();
              if(prop.startsWith(ELKIServiceLoader.RESOURCE_PREFIX)) {
                prop = prop.substring(ELKIServiceLoader.RESOURCE_PREFIX.length());
              }
              else if(prop.startsWith(ELKIServiceLoader.FILENAME_PREFIX)) {
                prop = prop.substring(ELKIServiceLoader.FILENAME_PREFIX.length());
              }
              else {
                continue;
              }
              try {
                knownParameterizables.add(Class.forName(prop));
              }
              catch(ClassNotFoundException e) {
                LOG.warning("Service file name is not a class name: " + prop);
                continue;
              }
            }
          }
        }
      }
    }
    catch(IOException | URISyntaxException e) {
      throw new AbortException("Error enumerating service folders.", e);
    }

    final String internal = de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameterizer.class.getPackage().getName();
    for(final Class<?> cls : ELKIServiceRegistry.findAllImplementations(Object.class, false, false)) {
      // Classes in the same package are special and don't cause warnings.
      if(cls.getName().startsWith(internal)) {
        continue;
      }
      try {
        State state = State.NO_CONSTRUCTOR;
        state = checkV3Parameterization(cls, state);
        if(state == State.ERROR) {
          continue;
        }
        state = checkDefaultConstructor(cls, state);
        if(state == State.ERROR) {
          continue;
        }
        boolean expectedParameterizer = checkSupertypes(cls);
        if(state == State.NO_CONSTRUCTOR && expectedParameterizer) {
          LOG.verbose("Class " + cls.getName() + //
          " implements a parameterizable interface, but doesn't have a public and parameterless constructor!");
        }
        if(state == State.INSTANTIABLE && !expectedParameterizer) {
          LOG.verbose("Class " + cls.getName() + //
          " has a parameterizer, but there is no service file for any of its interfaces.");
        }
      }
      catch(NoClassDefFoundError e) {
        LOG.verbose("Class discovered but not found: " + cls.getName() + " (missing: " + e.getMessage() + ")");
      }
    }
  }
public void checkParameterizables ( ) { LoggingConfiguration . setVerbose ( Level . VERBOSE ) ; knownParameterizables = new ArrayList < > ( ) ; try { Enumeration < URL > us = getClass ( ) . getClassLoader ( ) . getResources ( ELKIServiceLoader . RESOURCE_PREFIX ) ; while ( us . hasMoreElements ( ) ) { URL u = us . nextElement ( ) ; if ( "file" . equals ( u . getProtocol ( ) ) ) { for ( String prop : new File ( u . toURI ( ) ) . list ( ) ) { try { knownParameterizables . add ( Class . forName ( prop ) ) ; } catch ( ClassNotFoundException e ) { LOG . warning ( "Service file name is not a class name: " + prop ) ; continue ; } } } else if ( ( "jar" . equals ( u . getProtocol ( ) ) ) ) { JarURLConnection con = ( JarURLConnection ) u . openConnection ( ) ; try ( JarFile jar = con . getJarFile ( ) ) { Enumeration < JarEntry > entries = jar . entries ( ) ; while ( entries . hasMoreElements ( ) ) { String prop = entries . nextElement ( ) . getName ( ) ; if ( prop . startsWith ( ELKIServiceLoader . RESOURCE_PREFIX ) ) { prop = prop . substring ( ELKIServiceLoader . RESOURCE_PREFIX . length ( ) ) ; } else if ( prop . startsWith ( ELKIServiceLoader . FILENAME_PREFIX ) ) { prop = prop . substring ( ELKIServiceLoader . FILENAME_PREFIX . length ( ) ) ; } else { continue ; } try { knownParameterizables . add ( Class . forName ( prop ) ) ; } catch ( ClassNotFoundException e ) { LOG . warning ( "Service file name is not a class name: " + prop ) ; continue ; } } } } } } catch ( IOException | URISyntaxException e ) { throw new AbortException ( "Error enumerating service folders." , e ) ; } final String internal = de . lmu . ifi . dbs . elki . utilities . optionhandling . Parameterizer . class . getPackage ( ) . getName ( ) ; for ( final Class < ? > cls : ELKIServiceRegistry . findAllImplementations ( Object . class , false , false ) ) { if ( cls . getName ( ) . startsWith ( internal ) ) { continue ; } try { State state = State . NO_CONSTRUCTOR ; state = checkV3Parameterization ( cls , state ) ; if ( state == State . ERROR ) { continue ; } state = checkDefaultConstructor ( cls , state ) ; if ( state == State . ERROR ) { continue ; } boolean expectedParameterizer = checkSupertypes ( cls ) ; if ( state == State . NO_CONSTRUCTOR && expectedParameterizer ) { LOG . verbose ( "Class " + cls . getName ( ) + " implements a parameterizable interface, but doesn't have a public and parameterless constructor!" ) ; } if ( state == State . INSTANTIABLE && ! expectedParameterizer ) { LOG . verbose ( "Class " + cls . getName ( ) + " has a parameterizer, but there is no service file for any of its interfaces." ) ; } } catch ( NoClassDefFoundError e ) { LOG . verbose ( "Class discovered but not found: " + cls . getName ( ) + " (missing: " + e . getMessage ( ) + ")" ) ; } } }
Validate all "Parameterizable" objects for parts of the API contract that
cannot be specified in Java interfaces (such as constructors, static
methods)