Bug#906785: version warping patch is overly aggressive

Emmanuel Bourg ebourg at apache.org
Wed Aug 22 01:47:47 BST 2018


Hi Bdale,

On 21/08/2018 03:02, Bdale Garbee wrote:

> The Debian ant package is built with a patch "0013-auto-adjust-target.patch"
> that forces the Java target version number to 7.  The utterly breaks the
> ability to use Debian ant for building Java applications that get wrapped up
> in installer packages targeting other operating systems, including non-Debian 
> Linux, Windows, and Mac OS X.  Specifically, many Mac OS X users apparently
> are still being given Java 1.6 as the most recent version certified on their
> operating system, and while in theory it's possible for them to move to 
> Java 1.8 through a download from Oracle, this apparently takes most Apple
> customers way outside their comfort zone.

Humm a Debian package using Ant to build an installer for a Mac OS X
application running on an unmaintained version of Java 6... I admit I
didn't see that one coming ;)

The Ant patch bumping the source/target level is only triggered when
building a Debian package. A normal usage of the ant package from the
command line won't be affected. The detection is based on the presence
of the DEB_BUILD_ARCH variable, maybe we could refine it or add a
mechanism to disable it?


> If the javac delivered by our default-jdk actually had such a version 
> restriction, we'd tell our customers to just cope with it.  But it turns out
> that even openjdk-11-jdk's javac will take -source and -target assertions
> of 1.6 and correctly emit compiled classes that assert major version 50, 
> which is compatible with Java 1.6.  Any package built with ant, however, is
> forced to version 7 which results in compiled classes that assert major
> version 51, which will not run on Java 1.6!

Keep in mind that emitting version 50 bytecode is *not* a guarantee to
work with Java 6. If you are serious about preserving the compatibility
with Java 6 you should set the 'release' attribute on the <javac> tasks
to preserve the compatibility. Once the release attribute is set the
values of the source/target attributes are ignored.


> Frankly, I'm not sure having this patch in the Debian package at all is a 
> good idea.  Isn't it better to let javac itself emit an error message if/when
> a version actually becomes supported, and let the developer learn about
> versions and how to update their ancient assertions when needed rather than
> hide this problem?

I find this a bit harsh to claim we are hiding a problem. We are just a
handful of volunteers maintaining over 1000 packages. We don't have the
resources to patch all Ant/Maven based packages manually to bump the
source/target level once per release cycle, that's just insane (future
JDK releases will continuously drop older language levels from now on,
this burden will never stop). The only reasonable solution is to patch
the build system. If someone thinks otherwise I expect him to find a
better solution or to contribute his own time to fix all the Java packages.

That said, I don't mind lowering the minimum Java level to 6 since we
are now sure that Java 11 will support it. But we'll have to revert to
Java 7 to transition to Java 12 after the Buster release.

Emmanuel Bourg



More information about the pkg-java-maintainers mailing list