gordonad / powermock

Automatically exported from code.google.com/p/powermock
0 stars 0 forks source link

java.lang.VerifyError when trying to use uispec4j #102

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create simple test case that use uispec4j and powermock (the test shall
invoke UISpec4J.init() in static initializer).
2. Run test case.

What is the expected output? What do you see instead?
Successful start of test case execution.

What version of the product are you using? On what operating system?
powermock 1.2.5 or 1.2
uispec4j 2.0 RC3 for JDK6.x (uispec4j-jdk6-2.0-RC3.jar)

Please provide any additional information below.

java.lang.VerifyError: (class: javax/swing/plaf/metal/MetalLookAndFeel,
method: getLayoutStyle signature: ()Ljavax/swing/LayoutStyle;) Wrong return
type in function    at
javax.swing.UIManager.setLookAndFeel(UIManager.java:581)    at
javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1343)     at
javax.swing.UIManager.initialize(UIManager.java:1432)   at
javax.swing.UIManager.maybeInitialize(UIManager.java:1420)  at
javax.swing.UIManager.getDefaults(UIManager.java:660)   at
javax.swing.UIManager.put(UIManager.java:989)   at
org.uispec4j.interception.ui.UISpecLF.init(UISpecLF.java:11)    at
org.uispec4j.UISpec4J.init(UISpec4J.java:32)    at
com.mot.ios.atia.ui.BinaryInputPanelTest.setUpClass(BinaryInputPanelTest.java:44
)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
    at java.lang.reflect.Method.invoke(Method.java:597)     at
org.junit.internal.runners.ClassRoadie.runBefores(ClassRoadie.java:56)  at
org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:43) 
at
org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl.ru
n(PowerMockJUnit44RunnerDelegateImpl.java:128)
    at
org.powermock.modules.junit4.common.internal.impl.JUnit4TestSuiteChunkerImpl.run
(JUnit4TestSuiteChunkerImpl.java:112)
    at
org.powermock.modules.junit4.common.internal.impl.AbstractCommonPowerMockRunner.
run(AbstractCommonPowerMockRunner.java:44)
    at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReferen
ce.java:45)
    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.jav
a:196)

Original issue reported on code.google.com by manie...@googlemail.com on 11 May 2009 at 8:41

GoogleCodeExporter commented 9 years ago
Could you try to "ignore" the UISpec framework by using the @PowerMockIgnore
annotation to see if it makes any difference? (e.g. 
@PowerMockIgnore("org.x.y.uispec"))

Original comment by johan.ha...@gmail.com on 11 May 2009 at 10:34

GoogleCodeExporter commented 9 years ago
Hi Johan,

It seems that using @PowerMockIgnore as you suggested solved the problem. 
Thanks for
help. However, the problem was due to "javax" package which I had to add as a 
value
to @PowerMockIgnore annotation. Do you know if this is an intended behavior of 
PowerMock?

Original comment by manie...@googlemail.com on 12 May 2009 at 2:10

GoogleCodeExporter commented 9 years ago
Well I wouldn't say its the intended behavior but it's a known side-effect when 
using
PowerMock in cases where a class instantiates a class that is prepared for test 
using
reflection. Then the class is instantiated by the wrong classloader if not 
ignored
(there are other ways of getting around the problem as well but using 
PowerMockIgnore
is the easiest in most cases I think). 

Btw, I would encourage you to please use our mailing list next time instead of 
filing
a bug directly. That way we can discuss if it's really a bug or not and also 
more
people can see the outcome of the discussion. 

Thanks for using PowerMock and taking the time to bring this up. Glad you got 
it working.

Original comment by johan.ha...@gmail.com on 12 May 2009 at 2:38