ahmaddarawshi / powermock

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

java.lang.IllegalAccessError: ... cannot access its superinterface ..... #87

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. try to mock a static class with a private interface

What is the expected output? What do you see instead?
It should return void

What version of the product are you using? On what operating system?
powermock 1.1.1. on XP

Please provide any additional information below.
here's the stack trace:
java.lang.IllegalAccessError: class XXXX$4 cannot access its superinterface
XXXXX$PRIVATEINFTERFACE

    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
    at
org.powermock.core.classloader.MockClassLoader.loadMockClass(MockClassLoader.jav
a:201)
    at
org.powermock.core.classloader.MockClassLoader.loadModifiedClass(MockClassLoader
.java:140)
    at
org.powermock.core.classloader.DeferSupportingClassLoader.loadClass(DeferSupport
ingClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
    at java.lang.Class.getDeclaredMethods(Class.java:1763)
    at org.powermock.core.WhiteboxImpl.getAllMethods(WhiteboxImpl.java:873)
    at org.powermock.core.WhiteboxImpl.getMethods(WhiteboxImpl.java:1038)
    at org.powermock.Whitebox.getMethods(Whitebox.java:412)
    at org.powermock.PowerMock.mockStaticPartial(PowerMock.java:579)

Original issue reported on code.google.com by leon.oos...@gmail.com on 16 Dec 2008 at 11:26

GoogleCodeExporter commented 9 years ago
Could you please join our mailing-list (go to
http://groups.google.com/group/powermock) and post questions there instead? 
Then I
would have discovered this much faster. 

Anyway I don't quite understand what you mean by "try to mock a static class 
with a
private interface". Are you saying that you're trying to mock an inner class 
that is
static that implements some interface?

Please respond on the mailing list instead of here. 

Original comment by johan.ha...@gmail.com on 17 Dec 2008 at 3:33

GoogleCodeExporter commented 9 years ago
The reason was that inner classes/interface didn't work well with PowerMock. It 
has
been improved in trunk and the above use case should now work.

Original comment by johan.ha...@gmail.com on 24 Dec 2008 at 8:55