Package gov.nasa.jpf.jvm

Examples of gov.nasa.jpf.jvm.ClassInfo


    assertTrue(result > 0);
  }
 
  @Test
  public void testSort1() {
    ClassInfo ci = createMock(ClassInfo.class);
    expect(ci.getName()).andReturn("java.lang.System").anyTimes();
    replay(ci);

    FieldInfo[] infos = {
        FieldInfo.create(ci, "out", "Ljava/io/PrintStream;", Modifier.PUBLIC | Modifier.STATIC, 0, 0),
        FieldInfo.create(ci, "in", "Ljava/io/PrintStream;", Modifier.PUBLIC | Modifier.STATIC, 0, 0),
View Full Code Here


public class OrphanFieldCheckerTest {

  @Test
  public void successInstanceTest() {
    ClassInfo model =
        cls("test.Class",
            field(PUBLIC, "java.lang.String", "name")           
            );
    ClassInfo standard =
        cls("test.Class",
            field(PUBLIC, "java.lang.String", "name"),
            field(PROTECTED, "java.lang.String", "fullName")
            );
    Map<MaybeVersion, ClassInfo> versions = new HashMap<MaybeVersion, ClassInfo>();
View Full Code Here

*/
public class MangledMethodInfoComparatorTest {

  @Test
  public void testEqual1() {
    ClassInfo model = cls("java.lang.System");
    MethodInfo modelMethod =
        method(model, "()J", PUBLIC, "long", "currentTimeMillis", new String[0]);
   
    ClassInfo peer = cls("gov.nasa.jpf.jvm.JPF_java_lang_System");
    MethodInfo peerMethod = method(peer, "()J", PUBLIC, "long",
        Types.getJNIMangledMethodName("", "currentTimeMillis", "()J"), new String[0]);
   
    MangledMethodInfoComparator comp = new MangledMethodInfoComparator(true);
   
View Full Code Here

    assertEquals(0, comp.compare(modelMethod, peerMethod));
  }
 
  @Test
  public void testEqual2() {
    ClassInfo model = cls("java.lang.System");
    MethodInfo modelMethod =
        method(model, "()J", PUBLIC, "long", "currentTimeMillis", new String[0]);
   
    ClassInfo peer = cls("gov.nasa.jpf.jvm.JPF_java_lang_System");
    MethodInfo peerMethod = method(peer, "()J", PUBLIC, "long",
        Types.getJNIMangledMethodName("", "currentTimeMillis", "()J"), new String[0]);
   
    MangledMethodInfoComparator comp = new MangledMethodInfoComparator(false);
   
View Full Code Here

  private static void addClassInfo(FieldInfo mi, ClassInfo ci) {
    expect(mi.getClassInfo()).andReturn(ci).anyTimes();
  }
 
  public static ClassInfo cls(String name, InfoObject... members) {
    ClassInfo ci = createMock(ClassInfo.class);
    expect(ci.getName()).andReturn(name).anyTimes();
    ArrayList<MethodInfo> methods = new ArrayList<MethodInfo>();
    ArrayList<FieldInfo> instanceFields = new ArrayList<FieldInfo>();
    ArrayList<FieldInfo> staticFields = new ArrayList<FieldInfo>();
    for (InfoObject member : members) {
      if(member instanceof MethodInfo){
        addClassInfo((MethodInfo) member, ci);
        replay(member);
        methods.add((MethodInfo) member);
      }
      else {
        FieldInfo f = (FieldInfo) member;
        addClassInfo(f, ci);
        replay(f);
        if(Modifier.isStatic(f.getModifiers()))
          staticFields.add(f);
        else
          instanceFields.add(f);
      }
    }
    expect(ci.getDeclaredMethodInfos()).andReturn(methods.toArray(new MethodInfo[0])).anyTimes();
    expect(ci.getDeclaredInstanceFields()).andReturn(instanceFields.toArray(new FieldInfo[0])).anyTimes();
    expect(ci.getDeclaredStaticFields()).andReturn(staticFields.toArray(new FieldInfo[0])).anyTimes();
   
    replay(ci);
    return ci;
  }
View Full Code Here

  }
 
  @Test
  public void successStaticTest() {
    ClassInfo model =
        cls("test.Class",
            field(PUBLIC | STATIC, "java.lang.String", "name")
            );
    ClassInfo standard =
        cls("test.Class",
            field(PUBLIC | STATIC, "java.lang.String", "name")
            );
    Map<MaybeVersion, ClassInfo> versions = new HashMap<MaybeVersion, ClassInfo>();
    versions.put(just(6), standard);
View Full Code Here

  }
 
  @Test
  public void failureInstanceTest() {
    ClassInfo model =
        cls("test.Class",
            field(PUBLIC, "java.lang.String", "name"),
            field(PROTECTED, "java.lang.Thread", "t")
            );
    ClassInfo standard =
        cls("test.Class",
            field(PUBLIC, "java.lang.String", "name")
            );
    Map<MaybeVersion, ClassInfo> versions = new HashMap<MaybeVersion, ClassInfo>();
    versions.put(just(6), standard);
View Full Code Here

  }
 

  @Test
  public void testNotEqual1() {
    ClassInfo model = cls("java.lang.System");
    MethodInfo modelMethod =
        method(model, "()J", PUBLIC, "long", "nanoTime", new String[0]);
   
    ClassInfo peer = cls("gov.nasa.jpf.jvm.JPF_java_lang_System");
    MethodInfo peerMethod = method(peer, "()J", PUBLIC, "long",
        Types.getJNIMangledMethodName("", "currentTimeMillis", "()J"), new String[0]);
   
    MangledMethodInfoComparator comp = new MangledMethodInfoComparator(false);
   
View Full Code Here

    assertFalse(0 == comp.compare(peerMethod, modelMethod));
  }
 
  @Test
  public void testNotEqual2() {
    ClassInfo model = cls("java.lang.System");
    MethodInfo modelMethod =
        method(model, "()J", PUBLIC, "long", "nanoTime", new String[0]);
   
    ClassInfo peer = cls("gov.nasa.jpf.jvm.JPF_java_lang_System");
    MethodInfo peerMethod = method(peer, "()J", PUBLIC, "long",
        Types.getJNIMangledMethodName("", "currentTimeMillis", "()J"), new String[0]);
   
    MangledMethodInfoComparator comp = new MangledMethodInfoComparator(true);
   
View Full Code Here

  }
 
  @Test
  public void failureStaticTest() {
    ClassInfo model =
        cls("test.Class",
            field(PUBLIC | STATIC, "java.lang.String", "name"),
            field(PROTECTED | STATIC, "int", "n")
            );
    ClassInfo standard =
        cls("test.Class",
            field(PUBLIC | STATIC, "java.lang.String", "name")
            );
    Map<MaybeVersion, ClassInfo> versions = new HashMap<MaybeVersion, ClassInfo>();
    versions.put(just(6), standard);
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.