| Summary: | Improve the way how code assist detect variable types with lambdas | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Cristiano Gaviao <cvgaviao> |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | CLOSED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 4.20 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
I'm working with some scenarios using lambdas and sometimes I can't have the right type for variables with the code assist. In the example below, the type of 'prov' should be Optional<Provider<WebHandlerProvider>> but code assist is creating a local variable as Optional<Object>. ServiceLoader<WebHandlerProvider> loader = ServiceLoader.load(WebHandlerProvider.class); for (ConfigWebHandler wh : pRouteConfig.getHandlers()) { try { Optional<Object> prov = loader .stream() .filter(t -> { WebHandlerTag ann = t.type() .getAnnotation(WebHandlerTag.class); return ann != null && ann.id().equals(wh.getId()) && Version.parseVersion(ann.version()) .equals(wh.getVersion()); }) .findFirst() .map(Provider::get); providers.add(prov.); }