Closed GoogleCodeExporter closed 8 years ago
Interesting, I could have the chance to try mockito on JDK8 yet
Original comment by brice.du...@gmail.com
on 4 Dec 2013 at 2:08
Yeah, we need to make Mockito working with java 1.8 which is due March 2014.
Original comment by szcze...@gmail.com
on 19 Jan 2014 at 9:03
Indeed, just to emphasise that this problem is actually more of a showstopper
than it might sound because many classes in a Java 8 codebase will directly or
indirectly implement an interface with default methods
Original comment by Jose.Llarena@gmail.com
on 20 Jan 2014 at 10:49
Don't forget that in mocking theory you shouldn't type you don't own, which is
usually a golden rule for several reasons beyond Java 8 ;)
Nevertheless I agree the whole Java community needs to work on a new proxy lib,
spring, hibernate, achilles, ejb containes, hikaricp, etc... will need a new
proxy lib.
Original comment by brice.du...@gmail.com
on 22 Jan 2014 at 5:48
Hmm, this particular issue might be easy to solve. Jose, can you build Mockito
with one little modification and try it out? You could remove the "Cannot call
real method on java interface" check as this is something that lives in our
code. Not sure how exactly default methods are implemented but maybe cglib will
deal with this.
Original comment by szcze...@gmail.com
on 27 Jan 2014 at 8:59
"Cannot call real method on java interface" check reside in mockito:
InvocationImpl#callRealMethod
AnswersValidator#validateMockingConcreteClass
if (methodInfo.isDeclaredOnInterface()) {
reporter.cannotCallRealMethodOnInterface();
}
JDK 8 add "isDefault" operation to the Method class that checks if method is:
- declared in an interface
- public
- not abstract
- not static (instance)
I think that we should not only checking (at mentioned places) whether method
is declared in interface but also whether it is not default.
Original comment by albers...@gmail.com
on 24 Feb 2014 at 11:07
Interesting. However if we add this check mockito won't compile anymore on
previous version of the JDK right ?
Original comment by brice.du...@gmail.com
on 4 Mar 2014 at 9:02
I think that the best idea will be not to used isDefaultMethod provided in jdk8
but use mentioned checks
Original comment by albers...@gmail.com
on 4 Mar 2014 at 10:19
I like this idea, but the code should be self explanotry on this one :)
Original comment by brice.du...@gmail.com
on 4 Mar 2014 at 11:10
So this is the single biggest issue blocking my team from Java-8 gents, I would
really appreciate a fix :(
Original comment by Groostav
on 3 Jun 2014 at 6:10
@Groostav did you tried our latest snapshots, with the help of another talented
dev we have tackled this issue while keeping the code compilable from Java 5 ?
You may have to build from source though.
Original comment by brice.du...@gmail.com
on 27 Jun 2014 at 4:03
Original comment by szcze...@gmail.com
on 24 Aug 2014 at 3:13
Original comment by szcze...@gmail.com
on 24 Aug 2014 at 3:50
Original issue reported on code.google.com by
Jose.Llarena@gmail.com
on 11 Oct 2013 at 10:24