ssacher-tgm / mockito

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

can't mock package-private classes when running in OSGi #189

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
... moving from mailing list
http://groups.google.com/group/mockito/browse_thread/thread/60a424a83af88eb7

I'm attaching the stacktrace I got.

Haven't investigated much yet, just wanted to make sure this was logged.

(I've only tested in Equinox so far)

Original issue reported on code.google.com by lukewpat...@gmail.com on 17 May 2010 at 12:41

Attachments:

GoogleCodeExporter commented 8 years ago
notes:

was looking to see if any other frameworks did anything special in this 
scenario,
looks like guice does: (search for OSGi)
http://www.google.com/codesearch/p?hl=en#vY65eMZAf-c/src/com/google/inject/inter
nal/BytecodeGen.java&q=bytecodegen%20package:http://google-guice\.googlecode\.co
m&d=5

Original comment by lukewpat...@gmail.com on 18 May 2010 at 12:01

GoogleCodeExporter commented 8 years ago
I'm ok with adding extra code to handle this case. Would take a stab at
implementation? :)

Original comment by szcze...@gmail.com on 18 May 2010 at 1:00

GoogleCodeExporter commented 8 years ago

Original comment by szcze...@gmail.com on 30 May 2010 at 6:21

GoogleCodeExporter commented 8 years ago
In the little time I've had to investigate this further, I've only seen signs 
that this could be quite a big task.

http://www.eclipse.org/virgo/documentation/2.1.0.M01/programmer-guide/ch09s03.ht
ml
http://code.google.com/p/google-guice/issues/detail?id=400

IMO, this issue should remain open, but for now the "limitations" section of 
the FAQ should be updated.

Original comment by lukewpat...@gmail.com on 3 Jul 2010 at 8:31

GoogleCodeExporter commented 8 years ago
We're also seeing this issue in sbt, which just uses vanilla URLClassloaders to 
run things locally.

Original comment by Joshua.S...@gmail.com on 11 Feb 2014 at 7:10

GoogleCodeExporter commented 8 years ago
Is this with fragments and the interface in the bundle host?

Original comment by gun...@wagenknecht.org on 18 Jul 2014 at 4:15

GoogleCodeExporter commented 8 years ago
Note, there is a subtle difference when using fragments. Although fragments 
share the same class loader with their host bundle, there is something 
different. Unfortunately, I haven't found the place yet where I read about it. 
But I'm investigating this to see if there is a solution possible in CGLIB.

Original comment by gun...@wagenknecht.org on 18 Jul 2014 at 4:26

GoogleCodeExporter commented 8 years ago
See https://github.com/mockito/mockito/pull/82 for a way to reproduce the 
issue. It's not just OSGi which is affected but also environments where the 
class/interface to mock is in a different jar than the class defining the mock.

Original comment by eclipseguru@gmail.com on 19 Sep 2014 at 10:51