eclipse-jdt/eclipse.jdt.core

[content assist] Ordering in the completion list is not as expected

Open

#347 opened on 2022年8月26日

GitHub で見る
 (2 comments) (0 reactions) (0 assignees)Java (183 forks)auto 404
help wanted

Repository metrics

Stars
 (233 stars)
PR merge metrics
 (PR metrics pending)

説明

@SuppressWarnings("preview")public class X { public static void print(Object p) { if (p instanceof Pair(Student(Object n1, int i), Teacher(Object n)) p1) { System.out.println(n); // Remove n and try to get proposals println is listed in top list } } public static void main(String[] args) { print(new Pair( new Student("abc", 15), new Teacher("123"))); print(new Pair( new Teacher("123"), new Student("abc", 1))); } } sealed interface Person permits Student, Teacher { String name(); } record Student(String name, int id) implements Person {} record Teacher(String name) implements Person {} record Pair(Person s, Person s1) {}

Remove n and try to get proposals for , println is listed in top list Where as in similar case gives expected order: public static void printLowerRight(Rectangle r) { int res = switch(r) { case Rectangle(ColoredPoint(Point(int x, int y), Color c), ColoredPoint lr) r1 when x > 1 -> { System.out.println("one" + ); // try to get proposals yield x; } case Rectangle(ColoredPoint(Point(int x, int y), Color c), ColoredPoint lr) r1 when x <= 0 -> { System.out.println("two"); yield x;
} default -> 0; };
System.out.println("Returns: " + res); }

コントリビューターガイド