Friday, April 29, 2011

In the JDK 1.6 compiler, what does "-source 1.6" enable, if anything?

I'm aware of the class file format change using -target 1.6 (which is required when you use -source 1.6). But does the source option specifically change anything or enable any new features?

From stackoverflow
  • From the javac documentation:

    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.

    paxdiablo : First three answers identical (including my now deleted one) - I guess the fastest gun wins :-) +1.
    Mark Renouf : I found one additional difference which is not well documented: In JDK 1.6, the @Override annotation became valid to apply to methods which implement interfaces (which do not override a superclass method).
  • From Sun's javac documentation:

    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.

0 comments:

Post a Comment