jmock is opinionated software and and they don't want you to mock concrete classes or 3rd party apis, so stripping the final from other people's classes and methods isn't relevant to their interests. consequently there will be no unfinalizing in jmock.
there is however unfinalizing in jdave. you can run the unfinalizer separately of jdave if you like. it works right now (see the acceptance spec), you just need to put -javaagent:/path/to/unfinalizerjar as a VM argument.
my friendly colleague even fixed the POM so that it includes Premain-Class: automatically.
Tuesday, September 25, 2007
Subscribe to:
Post Comments (Atom)
4 kommenttia:
Ou jeah! Truly great. Does it unfinalize everything, or only specified classes? If the latter, then this is really something remarkable. When will there be a release?
now it finalizes everything it can. can you please explain the situation where you would only want to unfinalize specific classes?
Hi ,
I am loading Jdave-unfinalizer like following in my test class.
static {
try {
List vms = VirtualMachine.list();
for (VirtualMachineDescriptor vmd : vms) {
VirtualMachine vm = VirtualMachine.attach(vmd.id());
String agent = "D:/jdave-unfinalizer-1.2-SNAPSHOT.jar";
vm.loadAgent(agent, null);
}
} catch (Exception e) {
e.printStackTrace();
}
}
I am getting following exception.
com.sun.tools.attach.AgentLoadException: Agent JAR not found or no Agent-Class attribute
at sun.tools.attach.HotSpotVirtualMachine.loadAgent(HotSpotVirtualMachine.java:99)
at com.gehc.ce.interop.ccg.CCGInteropQueueSendIntegTest.clinit(CCGInteropQueueSendIntegTest.java:68)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:171)
at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:216)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:213)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
please suggest....
Thanks,
Jay
Jay,
Thanks for trying/using unfinalizer. I accidentally found your comment on this old post :D Luckily you only posted it yesterday.
It seems the jdave-unfinalizer-1.2-SNAPSHOT.jar at
http://www.laughingpanda.org/maven2/snapshots/org/jdave/jdave-unfinalizer/1.2-SNAPSHOT/
is from february 9th. I only wrote the new stuff last weekend, so that snapshot does not have the Agent-Class attribute.
If you can build the jar yourself from sources and let me know how it works for you that would be great.
I will look into the snapshot building schedule for the laughingpanda repository.
Best regards,
Miaubiz
Post a Comment