Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eclipse Java-Compiler fails to interfere wildcard type #1053

Open
HannesWell opened this issue May 11, 2023 · 4 comments
Open

Eclipse Java-Compiler fails to interfere wildcard type #1053

HannesWell opened this issue May 11, 2023 · 4 comments
Labels
bug Something isn't working compiler Eclipse Java Compiler (ecj) related issues

Comments

@HannesWell
Copy link
Contributor

HannesWell commented May 11, 2023

The Eclipse Java compiler fails to compile the following Java code snippet:

public static Stream<Class<? extends Annotation>> function(Stream<Annotation> annotations) {
	return annotations.map(Annotation::annotationType).filter(a -> true);
}

with the following error message

Type mismatch: cannot convert from Stream<Class<capture#31-of ? extends Annotation>> to Stream<Class<? extends Annotation>>

But javac compiles it successfully, in the Guice framework:
https://github.com/google/guice/blob/654032a954d55a00fc5ee90da815da98cb6676a1/core/src/com/google/inject/spi/BindingSourceRestriction.java#L348-L350

When you check out the guice git-repository that leads to one error in the project.

@iloveeclipse
Copy link
Member

Which ECJ version?

@iloveeclipse iloveeclipse added the compiler Eclipse Java Compiler (ecj) related issues label May 11, 2023
@HannesWell
Copy link
Contributor Author

Which ECJ version?

Version of org.eclipse.jdt.core.compiler.batch is 3.34.0.v20230405-0323.
I hope that's the right one.

@iloveeclipse
Copy link
Member

OK, still broken on latest master, here is complete snippet:

import java.lang.annotation.Annotation;
import java.util.stream.Stream;

public class X {
	public static Stream<Class<? extends Annotation>> function(Stream<Annotation> annotations) {
		return annotations.map(Annotation::annotationType).filter(a -> true);
	}
}

We report: Type mismatch: cannot convert from Stream<Class<capture#1-of ? extends Annotation>> to Stream<Class<? extends Annotation>>

@srikanth-sankaran : FYI.

@iloveeclipse iloveeclipse added the bug Something isn't working label May 12, 2023
@trancexpress
Copy link
Contributor

See also #366, #837. I think there might be a few more about wildcards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler Eclipse Java Compiler (ecj) related issues
Projects
None yet
Development

No branches or pull requests

3 participants