Why do I keep getting “Evaluations must contain either an expression or a block of well-formed statements”?

后端 未结 6 1510

In my code, I am trying to output the value of src in the expressions window.

public void doIt() {
    String src = \"test\";
    System.out.pri         


        
6条回答
  •  感情败类
    2021-01-17 11:40

    I just spent TONS of time to figure out that if you will create a package "Foo" and inside this package you'll create class called "Foo", like this:

    package Foo;
    
    public class Foo{
        public Foo () {};
    }
    

    After the point when you use this class first time in your program, you will not be able to use expressions anymore:

    import Foo.Foo; //this is the devil i think
    
    public static void main(String[] args){
        EventQueue.invokeLater(new Runnable(){
            public void run(){
                //debug expressions works fine
                Foo tmp = new Foo();
                //debug expressions wouldn't work anymore
            }
        });
    }
    

    This bug can be reprodused up to current Eclipse Neon 4.7.

提交回复
热议问题