Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » [Eclipse Compiler] Differences IDE vs headless build
icon5.gif  [Eclipse Compiler] Differences IDE vs headless build [message #644398] Fri, 10 December 2010 17:01 Go to next message
Eclipse UserFriend
Hi,

We have a strange issue regarding warnings that the Eclipse Java Compiler generates in the IDE and when executing a headless build. I will show you a snippet that produces the warning:

package pkg;

public interface Foo {

    @Target(ElementType.TYPE)
    @Retention(RetentionPolicy.RUNTIME)
    public static @interface Bar {
      ....
     }
}

package pkg2;
import pkg.Foo.Bar;

@Bar
public class TestClass {
}


The compiler in the IDE is not complaining about anything but during the headless build we are getting a "unused import" warning: The import pkg.Foo.Bar is never used. But thats actually not true, because the import is used and when removed causes a compile error Smile

We are using Eclipse 3.6 for development and in the nightly build, so the versions are matching. Can anybody explain the differences and what we can do to avoid the warning?

Best regards,
Michael

Re: [Eclipse Compiler] Differences IDE vs headless build [message #644555 is a reply to message #644398] Mon, 13 December 2010 04:32 Go to previous message
Eclipse UserFriend
I don't see any problem if I use the following command line
%java -jar c:\ecj.jar -source 5 -classpath "." pkg2\TestClass.java

Note the options 'source 5' tells to assume the source code is in 1.5 mode and by specifying the 'classpath', the compiler knows where to search for the packages.
Previous Topic:Why does eclipse try to compile all other open projects when I run a unit test
Next Topic:Java extension and java.g file grammar
Goto Forum:
  


Current Time: Wed Jul 02 10:31:19 EDT 2025

Powered by FUDForum. Page generated in 0.03776 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top