| Summary: | inference with diamond error in records in two files | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Manoj N Palat <manoj.palat> |
| Component: | Core | Assignee: | Srikanth Sankaran <srikanth.sankaran> |
| Status: | CLOSED MOVED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | forax, manoj.palat, srikanth.sankaran |
| Version: | 4.22 | ||
| Target Milestone: | 4.24 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
Bulk move out of 4.23 Bulk move out of 4.23 Bulk move out of 4.23 Bulk move out of 4.23 The PR posted at https://github.com/eclipse-jdt/eclipse.jdt.core/pull/1089 for https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1085 fixes this problem also. I have added a regression test from this ticket to that PR for verification purposes. Closing this as a duplicate of https://github.com/eclipse-jdt/eclipse.jdt.core/issues/1085 |
--- import java.util.Objects; public final class TimeSeries<T> { public record Data<T>(long timestamp, T element) { public Data { Objects.requireNonNull(element); } @Override public String toString() { return timestamp + " | " + element; } } } --- import static org.junit.jupiter.api.Assertions.assertThrows; public class TimeSeriesTest { @org.junit.jupiter.api.Test public void test() { assertThrows(NullPointerException.class, () -> new TimeSeries.Data<>(0, null)); } } Thanks to Remi Forax for providing the test case two classes in two separate files. in the method test(), the inference using the diamond syntax fails but it should not.