Skip to content

Unexpected problem during inference #4866

@stephan-herrmann

Description

@stephan-herrmann

This program

			import java.util.function.Function;
			interface C<A> { }
			interface S<T> {
				<A> A m1(C<A> c);
			}
			public abstract class X {
				void foo2(S<String> s) {
					s.m1(m2(String::toUpperCase, xyz -> "NODATA"));
				}
				public abstract <T, K, U>
					C<?> m2(Function<? super T, ? extends K> keyMapper,
							Function<? super T, ? extends U> valueMapper);
			}

triggers these errors:

----------\n
1. ERROR in X.java (at line 8)\n
	s.m1(m2(String::toUpperCase, xyz -> "NODATA"));\n
	     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
Problem detected during type inference: Unknown error at invocation of m2(Function<? super Object,? extends Object>, Function<? super Object,? extends Object>)\n
----------\n
2. ERROR in X.java (at line 8)\n
	s.m1(m2(String::toUpperCase, xyz -> "NODATA"));\n
	        ^^^^^^^^^^^^^^^^^^^\n
The type String does not define toUpperCase(Object) that is applicable here\n
----------\n

The first message should of course never be seen.

Metadata

Metadata

Labels

bugSomething isn't workingcompilerEclipse Java Compiler (ecj) related issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions