eclipse-jdt / eclipse-jdt/eclipse.jdt.core

Type mismatch: cannot convert from...

Open
#5,053 11 comments 0 reactions 1 assignee Claimed by @stephan-herrmann View on GitHub
javac
Dominant language
Java
Stars
237
Forks
195
Avg merge
1d 10h
Merged PRs (30d)
49

Description

Hi,

Currently on 4.40M2 I have an issue with the following code:
```
public static void main(String[] args) throws Exception {
Stream.of(MyInterface.class.getName()).map(className -> {
try {
return Class.forName(className).asSubclass(MyInterface.class);
} catch (Exception e) {
throw new RuntimeException(e);
}
});
}

interface MyInterface {
}
```

It fails with:
Type mismatch: cannot convert from Class to Class Test2.java /test2/src/test line 13 Java Problem

Code compiles OK with javac

Not entirely sure whether it's a regression or not, because the code is new on our base code and I did not try it with previous eclipse versions

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.