Bug 460761 - java-1.5.0-gcj's javac can use wrong class libraries
Summary: java-1.5.0-gcj's javac can use wrong class libraries
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: java-1.5.0-gcj
Version: 13
Hardware: All
OS: Linux
medium
high
Target Milestone: ---
Assignee: Deepak Bhole
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-08-31 08:43 UTC by Ville Skyttä
Modified: 2010-06-21 17:49 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2010-06-21 17:49:05 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Ville Skyttä 2008-08-31 08:43:41 UTC
java-1.5.0-gcj's javac can use wrong class libraries installed on the system.

To reproduce, install java-1.5.0-gcj, java-1.5.0-gcj-devel, and java-1.6.0-openjdk, and make sure java-1.6.0-openjdk-devel is NOT installed.  Then, compile for example this simple test class with "javac test.java":

----
import java.sql.NClob;
public class test
{
    public static void main(String[] args)
    {
        System.out.println("Hello world: " + NClob.class.getSimpleName());
    }
}
----

The compilation succeeds.  It should not succeed, because java.sql.NClob was introduced in Java SE 6 (JDBC 4) and is not available in Java SE 5.  libgcj's class libs are correct in the sense that they do not contain java.sql.NClob.  So javac from java-1.5.0-gcj ended up using java-1.6.0-openjdk's class libraries.

This is apparently because /usr/bin/ecj just invokes "java" (pathless, from $PATH), which when both java-1.5.0-gcj and java-1.6.0-openjdk are installed, by default is java-1.6.0-openjdk's java.  I suppose either the simplistic approach of directly symlinking /usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/bin/javac to /usr/bin/ecj should be replaced with a wrapper script that sets $PATH so that the pathless java invoked by ecj corresponds to the javac ecj is being invoked as, or /usr/bin/ecj should resolve a full path to java that corresponds to javac it is being invoked as, and invoke that with a full path.

I have not checked, but other executables from java-1.5.0-gcj-devel may have the same problem.

Current Rawhide is affected too.

Comment 1 Bug Zapper 2009-06-10 02:35:22 UTC
This message is a reminder that Fedora 9 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 9.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '9'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 9's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 9 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 2 Bug Zapper 2009-07-14 14:26:44 UTC
Fedora 9 changed to end-of-life (EOL) status on 2009-07-10. Fedora 9 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 3 Ville Skyttä 2010-06-02 05:35:18 UTC
This is still an issue in F-13 as described in initial comment, reopening.

Comment 4 Andrew John Hughes 2010-06-07 14:56:15 UTC
I've seen this issue as well when building IcedTea.  This is the correct behaviour for /usr/bin/ecj.  However, it is not the correct behaviour for gcj's javac (usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/bin/javac) which should be running ecj using gij and benefiting from AOT compilation.  It will actually run slower as currently configured.

Comment 5 Andrew John Hughes 2010-06-07 14:58:50 UTC
On a slightly off-topic note, gcj may supply NClob at some point in the future and it is not incorrect for it to do so.  gcj does not comply exactly to any JDK version and already has some 1.6 features. It doesn't help that the specifications and TCK remain legally inaccessible for use by gcj.

Comment 6 Ville Skyttä 2010-06-07 15:53:52 UTC
NClob presence with gcj is not actually a problem for me per se, it's just a semi-random class I used to demonstrate the issue.

Comment 7 Deepak Bhole 2010-06-21 17:49:05 UTC
Fixed in rawhide. javac is now a wrapper that sets the path first. With the RPM now in rawhide, the build fails as expected:

$ javac Test.java 
----------
1. ERROR in Test.java (at line 1)
        import java.sql.NClob;
               ^^^^^^^^^^^^^^
The import java.sql.NClob cannot be resolved
----------
2. ERROR in Test.java (at line 6)
        System.out.println("Hello world: " + NClob.class.getSimpleName());
                                             ^^^^^
NClob cannot be resolved to a type
----------
2 problems (2 errors)


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