Package org.springsource.loaded

Examples of org.springsource.loaded.MethodMember


    byte[] bytes = loadBytesForClass("data.SomeConstructors");
    TypeDescriptor typeDescriptor = new TypeDescriptorExtractor(registry).extract(bytes, false);
    MethodMember[] ctors = typeDescriptor.getConstructors();
    assertEquals(3, ctors.length);

    MethodMember publicCtor = ctors[0];
    assertEquals(Modifier.PUBLIC, publicCtor.getModifiers());
    assertEquals("<init>", publicCtor.getName());
    assertEquals("()V", publicCtor.getDescriptor());
    assertNull(publicCtor.getGenericSignature());
    assertEquals("0x1 <init>()V", publicCtor.toString());

    MethodMember privateCtor = ctors[1];
    assertEquals(Modifier.PRIVATE, privateCtor.getModifiers());
    assertEquals("<init>", privateCtor.getName());
    assertEquals("(Ljava/lang/String;I)V", privateCtor.getDescriptor());
    assertNull(privateCtor.getGenericSignature());
    assertEquals("0x2 <init>(Ljava/lang/String;I)V", privateCtor.toString());

    MethodMember protCtor = ctors[2];
    assertEquals(Modifier.PROTECTED, protCtor.getModifiers());
    assertEquals("<init>", protCtor.getName());
    assertEquals("(J)V", protCtor.getDescriptor());
    assertNull(protCtor.getGenericSignature());
    assertEquals("0x4 <init>(J)V", protCtor.toString());
  }
View Full Code Here


    TypeDescriptor typeDescriptor2 = registry.getExtractor().extract(bytes2, true);
    IncrementalTypeDescriptor itd = new IncrementalTypeDescriptor(typeDescriptor);
    itd.setLatestTypeDescriptor(typeDescriptor2);
    System.out.println(itd.toString(true));
    List<MethodMember> changed = itd.getNewOrChangedMethods();
    MethodMember m = getMethod(changed, "staticMethod");
    Assert.assertTrue(IncrementalTypeDescriptor.isNowNonStatic(m));
    m = getMethod(changed, "instanceMethod");
    Assert.assertTrue(IncrementalTypeDescriptor.isNowStatic(m));
    m = getMethod(changed, "publicMethod1");
    Assert.assertTrue(IncrementalTypeDescriptor.hasVisibilityChanged(m));
View Full Code Here

    byte[] bytes = loadBytesForClass("data.SomeConstructors2");
    TypeDescriptor typeDescriptor = new TypeDescriptorExtractor(registry).extract(bytes, false);
    MethodMember[] ctors = typeDescriptor.getConstructors();
    assertEquals(1, ctors.length);

    MethodMember publicCtor = ctors[0];
    // visibility matches type vis (for public/default)
    assertEquals(Modifier.PUBLIC, publicCtor.getModifiers());
    assertEquals("<init>", publicCtor.getName());
    assertEquals("()V", publicCtor.getDescriptor());
    assertNull(publicCtor.getGenericSignature());
    assertEquals("0x1 <init>()V", publicCtor.toString());
  }
View Full Code Here

      Constructor<?>[] clazzCs = null;
      TypeDescriptor desc = rtype.getLatestTypeDescriptor();
      MethodMember[] members = desc.getConstructors();
      Constructor<?>[] cs = new Constructor<?>[members.length];
      for (int i = 0; i < cs.length; i++) {
        MethodMember m = members[i];
        if (!liveVersion.hasConstructorChanged(m)) {
          if (clazzCs == null) {
            clazzCs = clazz.getDeclaredConstructors();
          }
          cs[i] = findConstructor(clazzCs, m);
View Full Code Here

    }
  }

  protected static void fixModifier(ReloadableType rtype, Constructor<?> constructor) {
    String desc = Type.getConstructorDescriptor(constructor);
    MethodMember rCons = rtype.getCurrentConstructor(desc);
    if (constructor.getModifiers() != rCons.getModifiers()) {
      JVM.setConstructorModifiers(constructor, rCons.getModifiers());
    }
  }
View Full Code Here

  private static boolean isDeleted(ReloadableType rtype, Method method) {
    //    ReloadableType rtype = getReloadableTypeIfHasBeenReloaded(method.getDeclaringClass());
    if (rtype == null || !rtype.hasBeenReloaded()) {
      return false;
    } else {
      MethodMember currentMethod = rtype.getCurrentMethod(method.getName(), Type.getMethodDescriptor(method));
      if (currentMethod == null) {
        return true; // Method not there, consider it deleted
      } else {
        return MethodMember.isDeleted(currentMethod); // Deleted bit is set consider deleted
      }
View Full Code Here

    ReloadableType rtype = getReloadableTypeIfHasBeenReloaded(c.getDeclaringClass());
    if (rtype == null) {
      return false;
    } else {
      TypeDescriptor desc = rtype.getLatestTypeDescriptor();
      MethodMember currentConstructor = desc.getConstructor(Type.getConstructorDescriptor(c));
      if (currentConstructor == null) {
        //TODO: test case with a deleted constructor
        return true; // Method not there, consider it deleted
      } else {
        return false;
View Full Code Here

      //Nothing special to be done
      return method.getDeclaredAnnotations();
    } else {
      // Method could have changed...
      CurrentLiveVersion clv = rtype.getLiveVersion();
      MethodMember methodMember = rtype.getCurrentMethod(method.getName(), Type.getMethodDescriptor(method));
      if (MethodMember.isCatcher(methodMember)) {
        if (clv.getExecutorMethod(methodMember) != null) {
          throw new IllegalStateException();
        }
        return method.getDeclaredAnnotations();
View Full Code Here

      //Nothing special to be done
      return method.getParameterAnnotations();
    } else {
      // Method could have changed...
      CurrentLiveVersion clv = rtype.getLiveVersion();
      MethodMember currentMethod = rtype.getCurrentMethod(method.getName(), Type.getMethodDescriptor(method));
      Method executor = clv.getExecutorMethod(currentMethod);
      Annotation[][] result = executor.getParameterAnnotations();
      if (!currentMethod.isStatic()) {
        //Non=static methods have an extra param.
        //Though extra param is added to front...
        //Annotations aren't being moved so we have to actually drop the *last* array element
        result = Utils.arrayCopyOf(result, result.length - 1);
      }
View Full Code Here

      //Nothing special to be done
      return c.getParameterAnnotations();
    } else {
      // Method could have changed...
      CurrentLiveVersion clv = rtype.getLiveVersion();
      MethodMember currentConstructor = rtype.getCurrentConstructor(Type.getConstructorDescriptor(c));
      Method executor = clv.getExecutorMethod(currentConstructor);
      Annotation[][] result = executor.getParameterAnnotations();
      //Constructor executor methods have an extra param.
      //Though extra param is added to front... annotations aren't being moved so we have to actually drop
      //the *last* array element
View Full Code Here

TOP

Related Classes of org.springsource.loaded.MethodMember

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.