Package gov.nasa.jpf.jvm

Examples of gov.nasa.jpf.jvm.MethodInfo


    this.description = description;
  }
 
  public String getMemberName() {
    if(member instanceof MethodInfo) {
      MethodInfo mi = ((MethodInfo) member);
      if("<init>".equals(mi.getName())) // constructors
        return memberClass.getSimpleName() + " " + mi.getLongName();
                  //Arrays.toString(mi.getArgumentTypeNames()).replace('[','(').replace(']', ')');
      return mi.getReturnTypeName() + " " + mi.getLongName();
    }
    if(member instanceof FieldInfo) {
      FieldInfo fi = ((FieldInfo) member);
      return fi.getType() + " " + fi.getName();
    }
View Full Code Here


 
  public static void main(String[] args) {
    ClassInfo model = new ModelClassProvider().loadClassInfo("java.lang.System");
    ClassInfo peer  = new NativePeerProvider().loadNativePeerClass(model);
   
    MethodInfo modelMethod = model.getMethod("currentTimeMillis", "()J", false);
    System.out.println(modelMethod);
   
    MethodInfo peerMethod = peer.getMethod(
        "currentTimeMillis____J", "(Lgov/nasa/jpf/jvm/MJIEnv;I)J", false);
    System.out.println(peerMethod);
   
    MangledMethodInfoComparator comp1 = new MangledMethodInfoComparator(true);
    System.out.println(comp1.compare(modelMethod, peerMethod));
View Full Code Here

   * Prints a warning message if the method being used has been generated
   * by this tool.
   */
  @Override
  public void methodEntered(JVM vm) {
    MethodInfo m = vm.getLastMethodInfo();
    if(isGenerated(m)) {
      logger.warning("The method `" + m.getFullName() +
          "` is missing from the model class.\n\t" +
          "A default implementation is being used.");
    }
  }
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);
   
    assertEquals(0, comp.compare(modelMethod, peerMethod));
View Full Code Here

  }
 
  @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);
   
    assertEquals(0, comp.compare(peerMethod, modelMethod));
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);
   
    assertFalse(0 == comp.compare(peerMethod, modelMethod));
View Full Code Here

  }
 
  @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);
   
    assertFalse(0 == comp.compare(modelMethod, peerMethod));
View Full Code Here

      String returnType,
      String name,
      String[] arguments
      )
  {
    MethodInfo mi = createMock(MethodInfo.class);
    expect(mi.getClassInfo()).andReturn(classInfo).anyTimes();
    expect(mi.getModifiers()).andReturn(modifiers).anyTimes();
    expect(mi.getName()).andReturn(name).anyTimes();
    expect(mi.getReturnType()).andReturn(returnType).anyTimes();
    expect(mi.getArgumentTypeNames()).andReturn(arguments).anyTimes();
   
    expect(mi.getSignature()).andReturn(signature).anyTimes();
   
    expect(mi.isPrivate()).andReturn(Modifier.isPrivate(modifiers)).anyTimes();
    expect(mi.isProtected()).andReturn(Modifier.isProtected(modifiers)).anyTimes();
    expect(mi.isPublic()).andReturn(Modifier.isPublic(modifiers)).anyTimes();
   
    replay(mi);
    return mi;
  }
View Full Code Here

  public void testEqual1() {
    ClassInfo ci = createMock(ClassInfo.class);
    expect(ci.getName()).andReturn("java.lang.String").anyTimes();
    expect(ci.isInterface()).andReturn(false).anyTimes();
    replay(ci);
    MethodInfo m1 = new MethodInfo(ci, "substring", "(I)Ljava/lang/String;", 0, 0, Modifier.PUBLIC);
    MethodInfo m2 = new MethodInfo(ci, "substring", "(I)Ljava/lang/String;", 0, 0, Modifier.PUBLIC);
    int result = new MethodInfoComparator().compare(m1, m2);
    assertEquals(0, result);
  }
View Full Code Here

  public void testEqual3() {
    ClassInfo ci = createMock(ClassInfo.class);
    expect(ci.getName()).andReturn("java.lang.String").anyTimes();
    expect(ci.isInterface()).andReturn(false).anyTimes();
    replay(ci);
    MethodInfo m1 = new MethodInfo(ci, "substring", "(I)Ljava/lang/String;", 0, 0, Modifier.PUBLIC);
    MethodInfo m2 = new MethodInfo(ci, "substring", "(I)Ljava/lang/String;", 0, 0, Modifier.PUBLIC | Modifier.NATIVE);
    int result = new MethodInfoComparator().compare(m1, m2);
    assertEquals(0, result);
  }
View Full Code Here

TOP

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

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.