Bug 1171817 - Hello example incompatible with java-1.6
Summary: Hello example incompatible with java-1.6
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: Release_Notes
Version: Development
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: 3.2
: ---
Assignee: Scott Mumford
QA Contact: Petr Matousek
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-08 16:34 UTC by Petr Matousek
Modified: 2015-10-13 13:00 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Known Issue
Doc Text:
An issue with the Hello example not being compatible with java-1.6 because of "try-with-resources" (introduced in java-1.7) caused compilation errors when building with java-1.6. Using Java qpid client applications and examples require java-1.7 or higher, therefore it is mandatory to upgrade your java environment to prevent compilation and execution problems.
Clone Of:
Environment:
Last Closed: 2015-10-13 13:00:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1172127 1 None None None 2025-02-10 03:43:42 UTC

Internal Links: 1172127

Description Petr Matousek 2014-12-08 16:34:57 UTC
Description of problem:

Hello example is not compatible with java-1.6 due to use of "try-with-resources" (introduced in java-1.7).

Other examples may be compiled with the following warning:
major version 51 is newer than 50, the highest major version supported by this compiler.

QE understanding is that the JMS client code shall be currently compatible with all RHEL6.6 supported java versions (1.6, 1.7 and 1.8).
Note: MRG/M 3.0.0 (Vienna) JMS client/examples code required java-1.6 for build and java-1.5 for runtime.

If there will be a decision to not support java-1.6 version, please change this bug to documentation bug and properly describe the java version compatibility in the related guide.

Version-Release number of selected component (if applicable):
qpid-java-*-0.30-3
java-1.6.0-openjdk-*-1.6.0.33-1.13.5.1

How reproducible:
100%

Steps to Reproduce:
1. try to compile Hello.java example with java-1.6
2. Error

Actual results:
Examples can't be compiled with java-1.6

Expected results:
Examples compatible with java-1.6 or Documentation update

Additional info:

# java -version
java version "1.6.0_33"
OpenJDK Runtime Environment (IcedTea6 1.13.5) (rhel-1.13.5.1.el6_6-i386)
OpenJDK Client VM (build 23.25-b01, mixed mode)

# rpm -qa | egrep "openjdk|qpid-java"
qpid-java-example-0.30-3.el6.noarch
java-1.6.0-openjdk-devel-1.6.0.33-1.13.5.1.el6_6.i686
java-1.6.0-openjdk-1.6.0.33-1.13.5.1.el6_6.i686
qpid-java-common-0.30-3.el6.noarch
qpid-java-client-0.30-3.el6.noarch

#  javac -cp ${CLASSPATH} /usr/share/doc/qpid-java-0.30/examples/src/main/java/org/apache/qpid/example/Hello.java
/usr/share/doc/qpid-java-0.30/examples/src/main/java/org/apache/qpid/example/Hello.java:53: '{' expected
        try (InputStream resourceAsStream = this.getClass().getResourceAsStream("hello.properties"))
           ^
/usr/share/doc/qpid-java-0.30/examples/src/main/java/org/apache/qpid/example/Hello.java:53: ')' expected
        try (InputStream resourceAsStream = this.getClass().getResourceAsStream("hello.properties"))
                        ^
/usr/share/doc/qpid-java-0.30/examples/src/main/java/org/apache/qpid/example/Hello.java:53: ';' expected
        try (InputStream resourceAsStream = this.getClass().getResourceAsStream("hello.properties"))
                                                                                                   ^
/usr/share/doc/qpid-java-0.30/examples/src/main/java/org/apache/qpid/example/Hello.java:78: 'catch' without 'try'
        catch (Exception exp) 
        ^
/usr/share/doc/qpid-java-0.30/examples/src/main/java/org/apache/qpid/example/Hello.java:78: ')' expected
        catch (Exception exp) 
                        ^
/usr/share/doc/qpid-java-0.30/examples/src/main/java/org/apache/qpid/example/Hello.java:78: not a statement
        catch (Exception exp) 
              ^
/usr/share/doc/qpid-java-0.30/examples/src/main/java/org/apache/qpid/example/Hello.java:78: ';' expected
        catch (Exception exp) 
                            ^
/usr/share/doc/qpid-java-0.30/examples/src/main/java/org/apache/qpid/example/Hello.java:53: 'try' without 'catch' or 'finally'
        try (InputStream resourceAsStream = this.getClass().getResourceAsStream("hello.properties"))
        ^
/usr/share/doc/qpid-java-0.30/examples/src/main/java/org/apache/qpid/example/Hello.java:83: reached end of file while parsing
}
 ^
9 errors

#  javac -cp ${CLASSPATH} /usr/share/doc/qpid-java-0.30/examples/src/main/java/org/apache/qpid/example/Drain.java
warning: /usr/share/java/qpid-client-0.30.redhat-1.jar(org/apache/qpid/client/AMQAnyDestination.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: ./org/apache/qpid/example/OptionParser.class: major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: ./org/apache/qpid/example/OptionParser$Option.class: major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: /usr/share/java/qpid-common-0.30.redhat-1.jar(org/apache/qpid/framing/AMQShortString.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: /usr/share/java/qpid-common-0.30.redhat-1.jar(org/apache/qpid/messaging/Address.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: /usr/share/java/qpid-common-0.30.redhat-1.jar(org/apache/qpid/url/BindingURL.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
warning: /usr/share/java/qpid-client-0.30.redhat-1.jar(org/apache/qpid/client/AMQDestination.class): major version 51 is newer than 50, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
7 warnings

Comment 5 Irina Boverman 2014-12-17 20:49:37 UTC
I do not think we can require "any-of-the-above", but we can use Conflicts to exclude 1.6:
--
$ brew search package java-1.6*
java-1.6.0-bea
java-1.6.0-ibm
java-1.6.0-sun
java-1.6.0-openjdk
--
Conflicts: java-1.6.0-bea, java-1.6.0-ibm, java-1.6.0-sun, java-1.6.0-openjdk
--
What do you think?

Comment 6 Frantisek Reznicek 2014-12-18 08:25:03 UTC
(In reply to Irina Boverman from comment #5)
> I do not think we can require "any-of-the-above", but we can use Conflicts
> to exclude 1.6:
> --
> $ brew search package java-1.6*
> java-1.6.0-bea
> java-1.6.0-ibm
> java-1.6.0-sun
> java-1.6.0-openjdk
> --
> Conflicts: java-1.6.0-bea, java-1.6.0-ibm, java-1.6.0-sun, java-1.6.0-openjdk
> --
> What do you think?

One one hand this looks like the way (if we add also java-1.5.0-* ones) but digging more into detail java JDKs are coexisting RPMS installable into system in different directories as kernel does. So it looks we need to check with some packages in the same situation and possibly need to remove all rpm JVM/JDK deps and document it as JDK/JVM requirement.

The problem with above approach is that we will force our customers/users to uninstall all above mackages listed in Conflicts. This may be unacceptable for at least two reasons:
 * some older java tools may want specific JVM/JDK playing with JAVA/JDK_HOME
 * some customers may want to have installed 1.6.0 and 1.7.0 and use earlier as default and play with JAVA/JDK_HOME for qpid-java

Both reasons are rather corner ones and I think we need to discuss with someone who knows the guideline here (mikeb for instance)?

Comment 23 Petr Matousek 2015-10-07 13:01:23 UTC
Release note added, content approved.

-> VERIFIED


Note You need to log in before you can comment on or make changes to this bug.