3.1: Use of .class causes VerifyError
hlship Sep 26, 2006 12:22 PMWhenever I try to use the .class construct inside a Javassist method body, I get a VerifyError.
The text below is from my class transformer; it represents the additions and changes made to a particular class as it is loaded.
[DEBUG] RenderableUser Finished class transformation: InternalClassTransformation[
public org.apache.tapestry.integration.app1.components.RenderableUser extends java.lang.Object
implements org.apache.tapestry.runtime.ComponentLifecycle
add field: protected org.apache.tapestry.internal.InternalComponentResources _$resources;
extend method: public org.apache.tapestry.ComponentResources getComponentResources()
return _$resources;
add field: protected org.apache.tapestry.services.Environment _$environment;
add method: private org.apache.tapestry.Renderable _$environment_read_renderable()
return ($r) _$environment.peek(org.apache.tapestry.Renderable.class);
replace read _renderable: _$environment_read_renderable();
add method: private void _write__renderable(org.apache.tapestry.Renderable $1)
throw new java.lang.RuntimeException("Field org.apache.tapestry.integration.app1.components.RenderableUser._renderable is read-only.");
replace write _renderable: _write__renderable();
extend method: public void beginRender(org.apache.tapestry.MarkupWriter $1, org.apache.tapestry.runtime.LifecycleEvent $2)
{
if ($2.isAborted()) return;
render($1);
}
convert default constructor: initializer();
add constructor: org.apache.tapestry.integration.app1.components.RenderableUser(org.apache.tapestry.internal.InternalComponentResources $1, org.apache.tapestry.services.Environment $2)
{
_$resources = $1;
_$environment = $2;
initializer();
}
]
Results in:
java.lang.VerifyError: (class: org/apache/tapestry/integration/app1/components/RenderableUser, method: _$environment_read_renderable signature: ()Lorg/apache/tapestry/Renderable;) Inconsistent args_size for opc_invokeinterface at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328) at java.lang.Class.getConstructors(Class.java:1446) at org.apache.tapestry.internal.services.ReflectiveInstantiator.findConstructor(ReflectiveInstantiator.java:60) at org.apache.tapestry.internal.services.ReflectiveInstantiator.<init>(ReflectiveInstantiator.java:48) at org.apache.tapestry.internal.services.InternalClassTransformationImpl.createInstantiator(InternalClassTransformationImpl.java:1043)
Has anyone else had any luck using .class?
I think, in my situation, I'll be able to work around this using the $type production.