error highlight in eclipse only partially works

无人久伴 提交于 2019-12-13 22:12:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!