eclipse-jdt/eclipse.jdt.core

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

Open

#347 创建于 2022年8月26日

在 GitHub 查看
 (2 评论) (0 反应) (0 负责人)Java (183 fork)auto 404
help wanted

仓库指标

Star
 (233 star)
PR 合并指标
 (PR 指标待抓取)

描述

@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); }

贡献者指南