Package gov.nasa.jpf.jvm

Examples of gov.nasa.jpf.jvm.ClassInfo


   *
   * @param className the desired class
   * @return the {@link ClassInfo} object for the desired class.
   */
  public ClassInfo loadClassInfo(String className) {
    ClassInfo ci = null;
    for (File f : files) {
      if (f.isFile() && f.getName().endsWith(".jar")) {
        ci = loadFromJar(f, className);
      } else if (f.isDirectory()) {
        ci = loadFromDir(f, className);
View Full Code Here


    if(file != null) {
      try {
        byte[] data = Util.getClassBytes(new FileInputStream(file));
        ClassFile cf = new ClassFile(className, data);
//        return new UnregisteredClassInfo(cf);
        return new ClassInfo(cf, rnd.nextInt(1000));
      } catch (FileNotFoundException e) {
        logger.warning(e.getMessage());
      } catch (IOException e) {
        logger.warning(e.getMessage());
      } catch (ClassFileException e) {
View Full Code Here

    return null;
  }
 
  public static void main(String[] args) {
    ModelClassProvider mcp = new ModelClassProvider();
    ClassInfo ci = mcp.loadClassInfo("gov.nasa.jpf.jvm.AtomicFieldUpdater");
    System.out.println(ci);
    System.out.println(mcp.loadClassInfos());
  }
View Full Code Here

public class MissingMethodCheckerTest {
 
  @Test
  public void testSuccess1() {
    ClassInfo model =
        cls("java.lang.Object",
            method(PUBLIC, "java.lang.String", "toString", new String[]{})
            );
    ClassInfo standard =
        cls("java.lang.Object",
            method(PUBLIC, "java.lang.String", "toString", new String[]{})
            );
    Map<MaybeVersion, ClassInfo> versions = new HashMap<MaybeVersion, ClassInfo>();
    versions.put(just(6), standard);
View Full Code Here

    assertTrue(checker.check(model));   
  }
 
  @Test
  public void testSuccess2() {
    ClassInfo model =
        cls("java.lang.String",
            method(PUBLIC, "java.lang.String", "toString", new String[]{}),
            method(PUBLIC, "java.lang.String", "substring", new String[]{"int"})
            );
    ClassInfo standard =
        cls("java.lang.String",
            method(PUBLIC, "java.lang.String", "toString", new String[]{}),
            method(PUBLIC, "java.lang.String", "substring", new String[]{"int"})
            );
    Map<MaybeVersion, ClassInfo> versions = new HashMap<MaybeVersion, ClassInfo>();
View Full Code Here

    assertTrue(checker.check(model));   
  }
 
  @Test
  public void testFailure1() {
    ClassInfo model =
        cls("java.lang.String",
            method(PUBLIC, "java.lang.String", "toString", new String[]{}),
            method(PUBLIC, "java.lang.String", "substring", new String[]{"int"})
            );
    ClassInfo standard =
        cls("java.lang.String",
            method(PUBLIC, "java.lang.String", "toString", new String[]{}),
            method(PUBLIC, "java.lang.String", "substring", new String[]{"int","int"})
            );
    Map<MaybeVersion, ClassInfo> versions = new HashMap<MaybeVersion, ClassInfo>();
View Full Code Here

    assertFalse(checker.check(model));   
  }
 
  @Test
  public void testFailure2() {
    ClassInfo model =
        cls("java.lang.String",
            method(PUBLIC, "java.lang.String", "toString", new String[]{}),
            method(PROTECTED, "java.lang.String", "substring", new String[]{"int"})
            );
    ClassInfo standard =
        cls("java.lang.String",
            method(PUBLIC, "java.lang.String", "toString", new String[]{}),
            method(PUBLIC, "java.lang.String", "substring", new String[]{"int"})
            );
    Map<MaybeVersion, ClassInfo> versions = new HashMap<MaybeVersion, ClassInfo>();
View Full Code Here

public class FieldInfoComparatorTest {
 

  @Test
  public void compareEquals1() {
    ClassInfo ci = createMock(ClassInfo.class);
    expect(ci.getName()).andReturn("java.lang.System").times(2);
    replay(ci);
    FieldInfo f1 = FieldInfo.create(ci, "out", "Ljava/io/PrintStream;", Modifier.PUBLIC | Modifier.STATIC, 0, 0);
    FieldInfo f2 = FieldInfo.create(ci, "out", "Ljava/io/PrintStream;", Modifier.PUBLIC | Modifier.STATIC, 0, 0);
    int result = new FieldInfoComparator().compare(f1, f2);
    assertEquals(result, 0);
View Full Code Here

    assertEquals(result, 0);
  }
 
  @Test
  public void compareNotEquals2() {
    ClassInfo ci = createMock(ClassInfo.class);
    expect(ci.getName()).andReturn("java.lang.System").anyTimes();
    replay(ci);
    FieldInfo f1 = FieldInfo.create(ci, "out", "Ljava/io/PrintStrea;", Modifier.PUBLIC | Modifier.STATIC, 0, 0);
    FieldInfo f2 = FieldInfo.create(ci, "out", "Ljava/io/PrintStream;", Modifier.PUBLIC | Modifier.STATIC, 0, 0);
    int result = new FieldInfoComparator().compare(f1, f2);
    assertTrue(result < 0);
View Full Code Here

    assertTrue(result < 0);
  }
 
  @Test
  public void compareNotEquals3() {
    ClassInfo ci = createMock(ClassInfo.class);
    expect(ci.getName()).andReturn("java.lang.System").anyTimes();
    replay(ci);
    FieldInfo f1 = FieldInfo.create(ci, "out", "Ljava/io/PrintStream;", Modifier.PUBLIC | Modifier.STATIC, 0, 0);
    FieldInfo f2 = FieldInfo.create(ci, "in", "Ljava/io/PrintStream;", Modifier.PUBLIC | Modifier.STATIC, 0, 0);
    int result = new FieldInfoComparator().compare(f1, f2);
    assertTrue(result > 0);
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.