@Test
public void secondVersion() throws Exception {
String tclass = "executor.TestOne";
TypeRegistry typeRegistry = getTypeRegistry(tclass);
ReloadableType rtype = typeRegistry.addType(tclass, loadBytesForClass(tclass));
rtype.loadNewVersion("2", retrieveRename(tclass, tclass + "2"));
// testing executor is for second version and not first
// @formatter:off
checkType(rtype.getLatestExecutorBytes(),
"CLASS: executor/TestOne$$E2 v50 0x0001(public) super java/lang/Object\n"+
"SOURCE: TestOne2.java null\n"+
"FIELD 0x0001(public) i I\n"+
"METHOD: 0x0009(public static) ___init___(Lexecutor/TestOne;)V\n"+
" CODE\n"+
" L0\n"+
" ALOAD 0\n"+
" POP\n"+
" RETURN\n"+
" L1\n"+
"METHOD: 0x0009(public static) foo(Lexecutor/TestOne;Ljava/lang/String;)J\n"+
" CODE\n"+
" L0\n"+
" ALOAD 1\n"+
" INVOKESTATIC java/lang/Long.parseLong(Ljava/lang/String;)J\n"+
" LRETURN\n"+
" L1\n"+
"METHOD: 0x0009(public static) hashCode(Lexecutor/TestOne;)I\n"+
" CODE\n"+
" L0\n"+
" ALOAD 0\n"+
" LDC 0\n"+
" LDC i\n"+
" INVOKESTATIC org/springsource/loaded/TypeRegistry.instanceFieldInterceptionRequired(ILjava/lang/String;)Z\n"+
" IFEQ L1\n"+
" DUP\n"+
" LDC i\n"+
" INVOKESPECIAL executor/TestOne.r$get(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;\n"+
" CHECKCAST java/lang/Integer\n"+
" INVOKEVIRTUAL java/lang/Integer.intValue()I\n"+
" GOTO L2\n"+
" L1\n"+
" GETFIELD executor/TestOne.i I\n"+
" L2\n"+
" ICONST_2\n"+
" IMUL\n"+
" IRETURN\n"+
" L3\n"+
"\n");
Assert.assertEquals(
" L0\n"+
" ALOAD 1\n"+
" INVOKESTATIC java/lang/Long.parseLong(Ljava/lang/String;)J\n"+
" LRETURN\n"+
" L1\n",
toStringMethod(rtype.getLatestExecutorBytes(),"foo",false));
// @formatter:on
//
// @formatter:off
Assert.assertEquals(
" L0\n"+
" ALOAD 0\n"+
" LDC 0\n"+
" LDC i\n"+
" INVOKESTATIC org/springsource/loaded/TypeRegistry.instanceFieldInterceptionRequired(ILjava/lang/String;)Z\n"+
" IFEQ L1\n"+
" DUP\n"+
" LDC i\n"+
" INVOKESPECIAL executor/TestOne.r$get(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;\n"+
" CHECKCAST java/lang/Integer\n"+
" INVOKEVIRTUAL java/lang/Integer.intValue()I\n"+
" GOTO L2\n"+
" L1\n"+
" GETFIELD executor/TestOne.i I\n"+
" L2\n"+
" ICONST_2\n"+
" IMUL\n"+
" IRETURN\n"+
" L3\n",
toStringMethod(rtype.getLatestExecutorBytes(),"hashCode",false));
// @formatter:on
}