Open cal101 opened 8 years ago
Did it still do not work? My test does.
Could you provide me the list of different "capture" methods the class has?
I will try to build a standalone test case. This has one: https://github.com/rpau/javalang-compiler/issues/12 ;-)
I am able to reproduce the issue using EasyMock 3.1. Look at the javadoc I copied. That explains the problems to do a test case ...
Maybe walkmod should be able to deal with that because libraries may have this. But maybe it is an edge case that is seldom.
The class contains
/**
* Expect any object but captures it for later use.
*
* @param <T>
* Type of the captured object
* @param captured
* Where the parameter is captured
* @return <code>null</code>
*/
public static <T> T capture(final Capture<T> captured) {
reportMatcher(new Captures<T>(captured));
return null;
}
/**
* Expect any boolean but captures it for later use.
*
* @param captured
* Where the parameter is captured
* @return <code>0</code>
*
* @deprecated Because of harder erasure enforcement, doesn't compile in
* Java 7
*/
@Deprecated
public static boolean capture(final Capture<Boolean> captured) {
return captureBoolean(captured);
}
/**
* Expect any int but captures it for later use.
*
* @param captured
* Where the parameter is captured
* @return <code>0</code>
*
* @deprecated Because of harder erasure enforcement, doesn't compile in
* Java 7
*/
@Deprecated
public static int capture(final Capture<Integer> captured) {
return captureInt(captured);
}
/**
* Expect any long but captures it for later use.
*
* @param captured
* Where the parameter is captured
* @return <code>0</code>
*
* @deprecated Because of harder erasure enforcement, doesn't compile in
* Java 7
*/
@Deprecated
public static long capture(final Capture<Long> captured) {
return captureLong(captured);
}
/**
* Expect any float but captures it for later use.
*
* @param captured
* Where the parameter is captured
* @return <code>0</code>
*
* @deprecated Because of harder erasure enforcement, doesn't compile in
* Java 7
*/
@Deprecated
public static float capture(final Capture<Float> captured) {
return captureFloat(captured);
}
/**
* Expect any double but captures it for later use.
*
* @param captured
* Where the parameter is captured
* @return <code>0</code>
*
* @deprecated Because of harder erasure enforcement, doesn't compile in
* Java 7
*/
@Deprecated
public static double capture(final Capture<Double> captured) {
return captureDouble(captured);
}
/**
* Expect any byte but captures it for later use.
*
* @param captured
* Where the parameter is captured
* @return <code>0</code>
*
* @deprecated Because of harder erasure enforcement, doesn't compile in
* Java 7
*/
@Deprecated
public static byte capture(final Capture<Byte> captured) {
return captureByte(captured);
}
/**
* Expect any char but captures it for later use.
*
* @param captured
* Where the parameter is captured
* @return <code>0</code>
*
* @deprecated Because of harder erasure enforcement, doesn't compile in
* Java 7
*/
@Deprecated
public static char capture(final Capture<Character> captured) {
return captureChar(captured);
}
Another Easymock issue where the type parameter is lost:
Results in: