内部类Intellij IDEA错误未显示

时间:2019-04-05 09:33:27

标签: java intellij-idea

请告诉我为什么IDEA在以下情况下不显示任何错误。这个语法正确吗?当我尝试编译时,它显示错误消息Error:(24, 37) java: '(' expected

public class Outer {
    class Inner {
        Inner() {
            System.out.println("hello");
        }
    }
}

class TestLine {
    public static void main(String[] args) {
    Outer o = new Outer();
    Outer.Inner oi = o.new Outer.Inner(); //This is the line in question

    //write way to do it as I know of
    //Outer.Inner oi = o.new Inner();
    }
}

1 个答案:

答案 0 :(得分:1)

IntelliJ IDEA为我显示了正确的错误,并提供了快速修复以自动修复代码。我认为您可能正在运行IntelliJ IDEA的旧版本。看来the issue在IntelliJ IDEA 2019.1。中已修复。

"Qualified class reference is not allowed in qualified new" error highlighting