Failed
org.eclipse.jdt.core.tests.compiler.regression.LambdaExpressionsTest.test449063a - 1.8 (from org.eclipse.jdt.core.tests.compiler.regression.TestAll)
Error Message
test449063a - Eclipse/Javac standard output mismatch. ----------- Expected ------------ Test$Tuple<java.lang.Integer, java.lang.String>\n Test$Tuple<java.lang.String, java.lang.Double> ------------ but was ------------ class Test$Tuple\n class Test$Tuple --------- Difference is ---------- expected:<[Test$Tuple<java.lang.Integer, java.lang.String>\n Test$Tuple<java.lang.String, java.lang.Double>]> but was:<[class Test$Tuple\n class Test$Tuple]>
Stacktrace
junit.framework.ComparisonFailure: test449063a - Eclipse/Javac standard output mismatch. ----------- Expected ------------ Test$Tuple<java.lang.Integer, java.lang.String>\n Test$Tuple<java.lang.String, java.lang.Double> ------------ but was ------------ class Test$Tuple\n class Test$Tuple --------- Difference is ---------- expected:<[Test$Tuple<java.lang.Integer, java.lang.String>\n Test$Tuple<java.lang.String, java.lang.Double>]> but was:<[class Test$Tuple\n class Test$Tuple]> at org.eclipse.jdt.core.tests.junit.extension.TestCase.assertStringEquals(TestCase.java:260) at org.eclipse.jdt.core.tests.junit.extension.TestCase.assertEquals(TestCase.java:236) at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runJavac(AbstractRegressionTest.java:2068) at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runTest(AbstractRegressionTest.java:2814) at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runTest(AbstractRegressionTest.java:2539) at org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.runConformTest(AbstractRegressionTest.java:1441) at org.eclipse.jdt.core.tests.compiler.regression.LambdaExpressionsTest.test449063a(LambdaExpressionsTest.java:5206)
Standard Output
org.eclipse.jdt.core.tests.compiler.regression.LambdaExpressionsTest#test449063a - 1.8 Test.java [ import java.io.Serializable; import java.lang.invoke.SerializedLambda; import java.lang.reflect.Method; import java.lang.reflect.Type; public class Test { public static interface Map<IN, OUT> extends Serializable { public OUT map(IN in); } public static class Tuple<T1, T2> { private T1 field1; private T2 field2; } public static void main(String[] strings) throws Exception { Map<Tuple<String, Double>, Tuple<Integer, String>> map = (in) -> new Tuple<>(); SerializedLambda sl = getSerializedLambda(map); Method m = getLambdaMethod(sl); // Use the type information stored in signature System.out.println(m.getGenericReturnType()); for (Type t : m.getGenericParameterTypes()) { System.out.println(t); } } public static Method getLambdaMethod(SerializedLambda lambda) throws Exception { String implClassName = lambda.getImplClass().replace('/', '.'); Class<?> implClass = Class.forName(implClassName); String lambdaName = lambda.getImplMethodName(); for (Method m : implClass.getDeclaredMethods()) { if (m.getName().equals(lambdaName)) { return m; } } throw new Exception("Lambda Method not found"); } public static SerializedLambda getSerializedLambda(Object function) throws Exception { if (function == null || !(function instanceof java.io.Serializable)) { throw new IllegalArgumentException(); } for (Class<?> clazz = function.getClass(); clazz != null; clazz = clazz.getSuperclass()) { try { Method replaceMethod = clazz.getDeclaredMethod("writeReplace"); replaceMethod.setAccessible(true); Object serializedForm = replaceMethod.invoke(function); if (serializedForm instanceof SerializedLambda) { return (SerializedLambda) serializedForm; } } catch (NoSuchMethodError e) { // fall through the loop and try the next class } catch (Throwable t) { throw new RuntimeException("Error while extracting serialized lambda", t); } } throw new Exception("writeReplace method not found"); } } ] Full results sent to /tmp/comptest/run.1514610271420/1.8.0_131_20171230_000432.txt
Standard Error
----------------------------------------