问题
If I write something like this in Eclipse
UnexistentClass foo = new UnexistentClass();
foo.unexistenMethod();
first line is highlighted as an error (the class does not exists), but second line is not highlighted, even if I'm calling a method which does not exists on an object which belongs to a class which does not exists, too...
Why is sthat?
Thanks
回答1:
I would assume that it's because Eclipse doesn't know anything about the class you're calling the method on. Only once it knows which class you are referring to can it be sure that the method doesn't exist.
回答2:
The class is not existed so eclipse gives error at that point. After that it assuems that class but it does not have information about properties and behaviors of that class so it ignores.
来源:https://stackoverflow.com/questions/27799014/error-highlight-in-eclipse-only-partially-works