Package gov.nasa.jpf.jvm

Examples of gov.nasa.jpf.jvm.ClassInfo


  }
 
  public static void main(String[] args) {
    ProviderFactory.init(JPF.createConfig(args));
    logger.setLevel(Level.ALL);
    ClassInfo cls = new ModelClassProvider().loadClassInfo("java.lang.System");
    OrphanNativePeerChecker onpc = new OrphanNativePeerChecker();
    SimpleCmdLineReporter reporter = new SimpleCmdLineReporter(JPF.createConfig(args));
    onpc.registerReporter(reporter);
    System.out.println(onpc.check(cls));
  }
View Full Code Here


    boolean noInconsistencies = true;
    Map<MaybeVersion, ClassInfo> versions = provider.loadClassInfo(cls.getName());
    FieldInfo[] modelFields = cls.getDeclaredStaticFields();
    Arrays.sort(modelFields, comparator);
    for(MaybeVersion ver : versions.keySet()) {
      ClassInfo std = versions.get(ver);
      FieldInfo[] stdFields = std.getDeclaredStaticFields();
      for (FieldInfo f : stdFields) {
        if(MemberLevel.getMemberLevel(f).compareTo(this.level) >= 0) {
          if (Arrays.binarySearch(modelFields, f, comparator) < 0) {
            signal(new Inconsistency(
                InconsistencyType.MISSING_FIELD, ver, cls, f,
View Full Code Here

    boolean noInconsistencies = true;
    Map<MaybeVersion, ClassInfo> versions = provider.loadClassInfo(cls.getName());
    FieldInfo[] modelFields = cls.getDeclaredInstanceFields();
    Arrays.sort(modelFields, comparator);
    for(MaybeVersion ver : versions.keySet()) {
      ClassInfo std = versions.get(ver);
      FieldInfo[] stdFields = std.getDeclaredInstanceFields();
      for (FieldInfo f : stdFields) {
        if(MemberLevel.getMemberLevel(f).compareTo(this.level) >= 0) {
          if (Arrays.binarySearch(modelFields, f, comparator) < 0) {
            signal(new Inconsistency(
                InconsistencyType.MISSING_FIELD, ver, cls, f,
View Full Code Here

  public boolean check(ClassInfo cls) {
    boolean noInconsistencies = true;
    Map<MaybeVersion, ClassInfo> versions = provider.loadClassInfo(cls.getName());
    FieldInfo[] modelFields = cls.getDeclaredStaticFields();
    for(MaybeVersion ver : versions.keySet()) {
      ClassInfo std = versions.get(ver);
      FieldInfo[] stdFields = std.getDeclaredStaticFields();
      Arrays.sort(stdFields, comparator);
      for (FieldInfo f : modelFields) {
        if(MemberLevel.getMemberLevel(f).compareTo(this.level) >= 0) {
          if (Arrays.binarySearch(stdFields, f, comparator) < 0) {
            signal(new Inconsistency(
View Full Code Here

   * accessed, that could be accomplished with method {@link #methodEntered(JVM)}
   */
  // TODO also check in the extension classpath variable
  @Override
  public void classLoaded(JVM vm) {
    ClassInfo last = vm.getLastClassInfo();
    addMissingFields(last);
    addMissingMethods(last);
  }
View Full Code Here

   * Builds a list of missing methods for the given {@link ClassInfo}
   * object.
   */
  List<MethodInfo> detectMissingMethods(ClassInfo cls) {
    List<MethodInfo> missingMethods = new ArrayList<MethodInfo>();
    ClassInfo std = standardClasses.loadClassInfo(just(runningJavaVer), cls.getName());
    if(std == null)
      return missingMethods;
    MethodInfo[] stdMethods = std.getDeclaredMethodInfos();
    MethodInfo[] modelMethods = cls.getDeclaredMethodInfos();
    Arrays.sort(modelMethods, methodComparator);
   
    for (MethodInfo m : stdMethods) {
      if(MemberLevel.getMemberLevel(m).compareTo(MemberLevel.PROTECTED) >= 0 &&
View Full Code Here

  /**
   * Builds a list of fields missing from the class.
   */
  List<FieldInfo> detectMissingFields(ClassInfo cls) {
    LinkedList<FieldInfo> missing = new LinkedList<FieldInfo>();
    ClassInfo std = standardClasses.loadClassInfo(just(runningJavaVer), cls.getName());
    if (std == null)
      return missing;
    missing.addAll(
        detectMissingFields(
            std.getDeclaredInstanceFields(),
            cls.getDeclaredInstanceFields()));
    missing.addAll(
        detectMissingFields(
            std.getDeclaredStaticFields(),
            cls.getDeclaredStaticFields()));
    return missing;
  }
View Full Code Here

  /**
   * Tries to get a ClassInfo object associated with the given
   * class name. Returns null if it does not find anything.
   */
  public ClassInfo loadNativePeerClass(String name) {
    ClassInfo peer = cache.get(name);
    if(peer == null) {
      peer = loadClassInfo(name);
      cache.put(name, peer);
    }   
    return peer;
View Full Code Here

      } else {
        peerClassName = pkg + '.' + peerName;
      }     
     
      for (JarFile jar : nativeJarFiles) {
        ClassInfo ci = loadFromJar(jar, peerClassName);
        if(ci != null &&
            Modifier.isPublic(ci.getModifiers())) { // to avoid IllegalAccessExceptions
          return ci;
        }
      }
    }
View Full Code Here

          // to avoid things like .ClassName for classes in the default package
          String name = (!"".equals(baseName))? baseName + "." : "";
          name += fileName.substring(fileName.lastIndexOf('.'));
          byte[] classBytes = Util.getClassBytes(new FileInputStream(f));
          ClassFile cf = new ClassFile(name, classBytes);
          ClassInfo ci = new UnregisteredClassInfo(cf);
          // FIXME it would be better to be able to perform this check earlier
          if(matchesSpecs(ci.getName(), specs)) {
            classInfos.add(ci);
          }
        } catch (FileNotFoundException e) {
          logger.warning("file " + f + " does not exist");
        } catch (IOException e) {
View Full Code Here

TOP

Related Classes of gov.nasa.jpf.jvm.ClassInfo

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.