text: Eclipse ecj problems
  April 19, 2010 Leave a comment
  Eclipse is one fine IDE. It has it’s great features, it’ fast and has a lot of plugins, and it uses ecj compiler instead of plain old javac from Sun, oops Oracle ;).
  I’m not sure if you know, but ecj uses quite specific compilation process. Regular compilers build tree of dependencies before starting anything. Then, they do bottom up compilation process for every dependency. So if you have classes:
  /* File: com/a.java */
  package com;
  import com.b.*;
  public class a {
  public void doSth() {
  b var = new b();
  }
  }
  /* File: com/b/b.java */
  package com.b;
  import com.c.d;
  public class b {
  }
  and you have NO c.java file, thus your b.java file will not compile. Then javac compiler will give you an error about c package, and no class file will be generated. But Eclipse ecj works different. It of course gives you an error, but this does not prevent it from creating a.class. It does a top down compilation process and it will create class files for code that will never work. It just assumes that classes used in code in classes depend at is right.
  Now what does it change in real life? I’m using Netbeans and can’t compile some other guys code because it uses classes that fails on compilation. Eclipse woks fine, classes are generated, everybody is happy. Until you launch the code ant try to run methods that use this failed code. I wonder what will happen…