PRE-PROPOSAL: Source and Encoding keyword
jeremy.manson at gmail.com
Sat Mar 7 14:33:55 PST 2009
On Sat, Mar 7, 2009 at 12:13 PM, Reinier Zwitserloot
<reinier at zwitserloot.com> wrote:
> Replies to Neal Gafter, Jeremy Manson, Igor Karp, Vilya Harvey, and
> Stefan Schultz.
> Jeremy Manson:
> We don't discuss the API compatibilty because that's not what source
> does. That's what jigsaw might help with at some point. I don't really
> understand your complaint - it applies today as well - the "-source"
> parameter isn't a new invention, it's been part of javac for years. -
> source won't even set the class file format properly, that's what -
> target does. The "-source" parameter just doesn't guarantee producing
> a class file that works on old systems, and it also doesn't guarantee
> that the source file will compile on old systems. It's never done
> that. This proposal does not aim to solve that problem. After all,
> this is project coin. Not project Franklin, as Neal is so apt to
> remind us.
I agree that -source doesn't do this now, and I think -source ends up
not being a solution to the problem it thinks it is solving. There
are many people out there who think that -source will ensure that
their code will run on earlier versions of Java, when it won't.
Instead, those people will get mysterious runtime errors when they try
to use older JDKs.
This has happened to me when trying to migrate a large source base
from Java 5 to Java 6; once we started to compile with Java 6, people
started using the Java 6 APIs in spite of the fact that we used
-source 5. This was especially a problem in shared libraries; when
people wanted to deploy with 1.5, they thought that -source would
protect them. Instead, they found out after the fact, with a loud
crash and a bang, that they couldn't use 1.5.
Fundamentally, you can't realistically separate the Java language from
the APIs (at least, the core APIs: lang, util, and probably net and
io/nio). That's why if you want to solve this problem, it has to
include a solution for the APIs as well. I think this makes it a
fairly large project, outside the "small change" scope.
More information about the coin-dev