Search in sources :

Example 16 with MethodMember

use of org.springsource.loaded.MethodMember in project spring-loaded by spring-projects.

the class IncrementalTypeDescriptorTests method deletedMethods2.

// overridden (caught) method deleted
@Test
public void deletedMethods2() throws Exception {
    TypeRegistry registry = getTypeRegistry("");
    byte[] bytes = loadBytesForClass("typedescriptor.B");
    TypeDescriptor typeDescriptor = registry.getExtractor().extract(bytes, true);
    byte[] bytes2 = ClassRenamer.rename("typedescriptor.B", loadBytesForClass("typedescriptor.B2"));
    TypeDescriptor typeDescriptor2 = registry.getExtractor().extract(bytes2, true);
    IncrementalTypeDescriptor itd = new IncrementalTypeDescriptor(typeDescriptor);
    itd.setLatestTypeDescriptor(typeDescriptor2);
    List<MethodMember> deleted = itd.getDeletedMethods();
    System.out.println(deleted);
    Assert.assertEquals(1, deleted.size());
    Assert.assertEquals("0x1 m()V", deleted.get(0).toString());
}
Also used : IncrementalTypeDescriptor(org.springsource.loaded.IncrementalTypeDescriptor) TypeDescriptor(org.springsource.loaded.TypeDescriptor) IncrementalTypeDescriptor(org.springsource.loaded.IncrementalTypeDescriptor) TypeRegistry(org.springsource.loaded.TypeRegistry) MethodMember(org.springsource.loaded.MethodMember) Test(org.junit.Test)

Example 17 with MethodMember

use of org.springsource.loaded.MethodMember in project spring-loaded by spring-projects.

the class SignatureFinder method gatherConstructorSignatures.

private void gatherConstructorSignatures(String typeName, String version, Set<String> sigs) {
    TypeRegistry tr = getTypeRegistry("");
    byte[] bytes = null;
    if (version.equals("")) {
        bytes = loadBytesForClass(typeName);
    } else {
        bytes = retrieveRename(typeName, typeName + version);
    }
    TypeDescriptor typeDescriptor = new TypeDescriptorExtractor(tr).extract(bytes, true);
    for (MethodMember method : typeDescriptor.getConstructors()) {
        sigs.add(method.getDescriptor());
    }
}
Also used : TypeDescriptor(org.springsource.loaded.TypeDescriptor) TypeRegistry(org.springsource.loaded.TypeRegistry) MethodMember(org.springsource.loaded.MethodMember) TypeDescriptorExtractor(org.springsource.loaded.TypeDescriptorExtractor)

Aggregations

MethodMember (org.springsource.loaded.MethodMember)17 TypeDescriptor (org.springsource.loaded.TypeDescriptor)10 TypeRegistry (org.springsource.loaded.TypeRegistry)10 Test (org.junit.Test)8 ReloadableType (org.springsource.loaded.ReloadableType)8 TypeDescriptorExtractor (org.springsource.loaded.TypeDescriptorExtractor)5 Method (java.lang.reflect.Method)4 CurrentLiveVersion (org.springsource.loaded.CurrentLiveVersion)4 IncrementalTypeDescriptor (org.springsource.loaded.IncrementalTypeDescriptor)3 MethodHandle (java.lang.invoke.MethodHandle)1 MethodHandles (java.lang.invoke.MethodHandles)1 MethodType (java.lang.invoke.MethodType)1 ArrayList (java.util.ArrayList)1 Handle (org.objectweb.asm.Handle)1 Type (org.objectweb.asm.Type)1