Java7Default

Differences between revisions 5 and 6
Revision 5 as of 2011-12-09 17:00:52
Size: 3896
Editor: james-page
Comment:
Revision 6 as of 2012-05-16 14:25:22
Size: 5324
Editor: james-page
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
== Encoding == == Overview ==
Line 3: Line 3:
40 As part of the Ubuntu Quantal Quetzal release cycle, the Ubuntu archive will be transitioned from OpenJDK6 to OpenJDK7.

Default Java (i.e the default-jdk et al packages) will provide OpenJDK7 instead of OpenJDK6 from opening of the archive.

== Trouble Shooting FTBFS ==

=== Overview ===

FTBFS issues are likely to be the main focus of work during this transition. This is due to the fact that new version of Java are backwards binary compatible, i.e. you can run code built on Java 6 on a Java 7 runtime, but not backwards source compatible.

Hence any API of language changes in Java 7 will cause issues when re-compiling with source.

The other issue is consider is that code built with default flags on OpenJDK7 will not be compatible with older version of Java UNLESS a source/target version is provided. Maven does this by default but ant and javahelper packages may need nudging in the right way.

This type of issue looks like this:

{{{
java.lang.UnsupportedClassVersionError: [CLASSNAME] : Unsupported major.minor version 51.0
 at java.lang.ClassLoader.defineClass1(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
}}}

As OpenJDK6 will be retained in the archive for 12.10 (albeit in universe) backwards compatibility is still important. A lintian check to detect this is in progress.

=== Encoding ===
Line 11: Line 36:
=== Fixes === ==== Fixes ====
Line 13: Line 38:
==== ant ==== ===== ant =====
Line 29: Line 54:
==== maven ==== ===== maven =====
Line 40: Line 65:
==== javahelper ==== ===== javahelper =====
Line 48: Line 73:
== Public API Changes ==

14
=== Public API Changes ===
Line 56: Line 79:
== Language Handling Changes ==

10
=== Language Handling Changes ===
Line 61: Line 82:
Line 73: Line 93:
== Maven2 ==

6
=== Maven2 ==-
Line 87: Line 105:
== Private API ==

4
=== Private API ===
Line 95: Line 111:
== JAVA_HOME ==

4
=== JAVA_HOME ===
Line 103: Line 117:
== Test Failures == === Test Failures ===
Line 106: Line 120:
(3)
Line 110: Line 123:
== Fop/Font Handling == === Fop/Font Handling ===
Line 113: Line 126:
(3)

Overview

As part of the Ubuntu Quantal Quetzal release cycle, the Ubuntu archive will be transitioned from OpenJDK6 to OpenJDK7.

Default Java (i.e the default-jdk et al packages) will provide OpenJDK7 instead of OpenJDK6 from opening of the archive.

Trouble Shooting FTBFS

Overview

FTBFS issues are likely to be the main focus of work during this transition. This is due to the fact that new version of Java are backwards binary compatible, i.e. you can run code built on Java 6 on a Java 7 runtime, but not backwards source compatible.

Hence any API of language changes in Java 7 will cause issues when re-compiling with source.

The other issue is consider is that code built with default flags on OpenJDK7 will not be compatible with older version of Java UNLESS a source/target version is provided. Maven does this by default but ant and javahelper packages may need nudging in the right way.

This type of issue looks like this:

java.lang.UnsupportedClassVersionError: [CLASSNAME] : Unsupported major.minor version 51.0
 at java.lang.ClassLoader.defineClass1(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

As OpenJDK6 will be retained in the archive for 12.10 (albeit in universe) backwards compatibility is still important. A lintian check to detect this is in progress.

Encoding

https://bugs.launchpad.net/ubuntu/+bugs?search=Search&field.bug_reporter=james-page&field.tags_combinator=ALL&field.tag=java7-ftbfs+encoding

error: unmappable character for encoding ASCII.

This issue constitutes that largest number of build failures; Java 7 treats source file encoding issues as errors rather than warnings - this can effect both javac and javadoc operations.

Fixes

ant

Ensure appropriate encoding is passed to javac and javadoc commands; this will normally need to be patched into the build.xml file:

<javac ...  encoding="ISO-8859-1">...

OR the source and target can be set explicitly for all javac and javadoc commands using:

# Ensure that source and target are 1.5
# For backwards compat on Java 7
ant.build.javac.source=1.5
ant.build.javac.target=1.5

maven

Defaults to source/target 1.5.

specify the source file encoding in debian/maven.properties (when in use) using:

# Set encoding for compatibilty with Java 7
project.build.sourceEncoding=ISO-8859-1

javahelper

Override/update debian/rules to specify source/target 1.5

    jh_build --javacopts="-source 1.5 -target 1.5" --javadoc-opts="-source 1.5"

Public API Changes

https://bugs.launchpad.net/ubuntu/+bugs?search=Search&field.bug_reporter=james-page&field.tags_combinator=ALL&field.tag=java7-ftbfs+api

Package does not implement new public API requirements for Java 7; normally something JDBC related and relatively easy to fix.

Language Handling Changes

https://bugs.launchpad.net/ubuntu/+bugs?search=Search&field.bug_reporter=james-page&field.tags_combinator=ALL&field.tag=java7-ftbfs+lang

Some sort of language handling change (typically generics handling) causes the build failure e.g:

error: name clash: boxedFor(Class<? extends Boxed>,long) in
org.gnome.gdk.Plumbing and boxedFor(Class<?>,long) in
org.gnome.glib.Plumbing have the same erasure, yet neither hides the other

Again needs fixing upstream - I suspect that these again will follow specific patterns with stock fixes.

=== Maven2 ==-

https://bugs.launchpad.net/ubuntu/+bugs?search=Search&field.bug_reporter=james-page&field.tags_combinator=ALL&field.tag=java7-ftbfs+maven

Maven 2 not parsing warning error message causing failure

could not parse error message: warning: [options] bootstrap class path not set in conjunction with -source 1.5

Bug in Maven 2; needs to handle new Java 7 warning message (see http://blogs.oracle.com/darcy/entry/bootclasspath_older_source for explanation of what it means)

Private API

https://bugs.launchpad.net/ubuntu/+bugs?search=Search&field.bug_reporter=james-page&field.tags_combinator=ALL&field.tag=java7-ftbfs+priv-api

Package makes use of private API no longer present or changed in Java 7; harder to fix as requires use of different API or significant refactoring; best worked out with upstream.

JAVA_HOME

https://bugs.launchpad.net/ubuntu/+bugs?search=Search&field.bug_reporter=james-page&field.tags_combinator=ALL&field.tag=java7-ftbfs+java-home

Problems with JAVA_HOME in rules not matching default-java i.e. using openjdk6 explicitly, fixable in packaging

Test Failures

https://bugs.launchpad.net/ubuntu/+bugs?search=Search&field.bug_reporter=james-page&field.tags_combinator=ALL&field.tag=java7-ftbfs+test

Failure in test suite caused build failure.

Fop/Font Handling

https://bugs.launchpad.net/ubuntu/+bugs?search=Search&field.bug_reporter=james-page&field.tags_combinator=ALL&field.tag=java7-ftbfs+fop

[exec] org.apache.fop.apps.FOPException: Can't load standard profile: sRGB.pf

I think this is related to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=641530 in openjdk-6

JavaTeam/Java7Default (last edited 2012-07-29 22:05:54 by 180)