Package org.xmlvm.util.analytics.data

Examples of org.xmlvm.util.analytics.data.TypeHierarchy


        return file.getName().toLowerCase().endsWith(".class");
      }
    });
    System.out.println("Getting type hierarchy for " + classes.length + " classes.");

    TypeHierarchy result= new TypeHierarchy();
    final String basePath= library.getAbsolutePath();
    for (UniversalFile clazz : classes)
    {
      String fileName= clazz.getRelativePath(basePath).replace('\\', '.');
      DirectClassFile classFile= new DirectClassFile(clazz.getFileAsBytes(), fileName, false);
      classFile.setAttributeFactory(StdAttributeFactory.THE_ONE);
      try
      {
        classFile.getMagic();
      }
      catch (ParseException ex)
      {
        continue;
      }

      final int DOT_CLASS_LENGTH= ".class".length();
      String className= fileName.substring(0, fileName.length() - DOT_CLASS_LENGTH).replace('/', '.');

      // Super-class.
      if (classFile.getSuperclass() != null)
      {
        String superClassName= Util.parseClassName(classFile.getSuperclass().getClassType().getClassName()).toString();
        result.addDirectSubType(className, superClassName);
      }

      // Interfaces
      TypeList interfaces= classFile.getInterfaces();
      if (interfaces != null)
      {
        for (int i= 0; i < interfaces.size(); i++)
        {
          String interfaceName= Util.parseClassName(interfaces.getType(i).getClassName()).toString();
          result.addDirectSubType(className, interfaceName);
        }
      }
    }
    return result;
  }
View Full Code Here


    // It might become interesting for other libraries or for when the rules
    // change.

    // Compute the type hierarchy of the given set of classes.
    HierarchyAnalyzer hierarchyAnalyzer= new HierarchyAnalyzer(libraryPath);
    TypeHierarchy hierarchy= hierarchyAnalyzer.analyze();

    // First we determine the list of mock methods we need to insert into
    // green classes to prevent bubbling up of calls into red methods.
    Set<String> mockMethods= determineGreenMockMethods(dependencies, hierarchy);
View Full Code Here

      System.err.println("Invalid usage.\nExpected: HierarchyAnalyer <filename.jar|directory>");
      System.exit(-1);
    }

    HierarchyAnalyzer analyzer= new HierarchyAnalyzer(args[0]);
    TypeHierarchy hierarchy= analyzer.analyze();

    System.out.println("Type hierarchy:");
    System.out.println(hierarchy.toString());
  }
View Full Code Here

TOP

Related Classes of org.xmlvm.util.analytics.data.TypeHierarchy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.