javanetbeans

NetBeans IDE Java 1.4 compatibility: compiler not warning on JDK 5+ classes/methods


When NetBeans 7 (or NetBeans 3.6) is compiling with -source 1.4 enabled, why doesn't it warn when compiling with methods (or classes) introduced @since 1.5 or @since 1.6?


Solution

  • The javac docs imply that the -source option is about language features, not library features.

    -source release
    Specifies the version of source code accepted. The following values for release are allowed:

    • 1.3 The compiler does not support assertions, generics, or other language features introduced after JDK 1.3.

    • 1.4 The compiler accepts code containing assertions, which were introduced in JDK 1.4.

    • 1.5 The compiler accepts code containing generics and other language features introduced in JDK 5.

    • 5 Synonym for 1.5.

    • 1.6 This is the default value. No language changes were introduced in Java SE 6. However, encoding errors in source files are now reported as errors, instead of warnings, as previously.

    • 6 Synonym for 1.6.