MethodDescriptors { public static MethodDescriptor fromDesc(String desc, String name) { final MethodKey key = new MethodKey(name, desc); return methodDescriptorCache.computeIfAbsent(key, MethodDescriptors::newDescriptor); } private  MethodDescriptors(); static MethodDescriptor fromDesc(String desc, String name);  }
@Test public void testMethodDescriptionParser() { MethodDescriptor desc1 = MethodDescriptors.fromDesc("([I[[Lfoo/Bar;Z)V", "baz"); MethodDescriptor desc2 = new MethodDescriptorBuilder() .returnType(TypeDescriptors.fromRaw("V")) .parameterTypes( TypeDescriptors.fromRaw("[I"), TypeDescriptors.fromRaw("[[Lfoo/Bar;"), TypeDescriptors.fromRaw("Z") ) .name("baz") .build(); assertEquals("Method descriptors should be identical", desc1, desc2); }
@Test public void testPrettyParameters() { MethodDescriptor desc = MethodDescriptors.fromDesc("([I[[Lfoo/Bar;Z)V", "baz"); assertEquals("(int[], foo.Bar[][], boolean)", desc.prettyParameters()); }