Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 71636 - Log4j fails to compile with jdk 5.0 (enum keyword used as a variable)
Summary: Log4j fails to compile with jdk 5.0 (enum keyword used as a variable)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
: 73183 74187 77602 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-11-17 21:30 UTC by Elie De Brauwer
Modified: 2005-01-23 06:08 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
A new ebuild has fixed the compilation on java 5.0 (log4j-1.2.9.ebuild,1.92 KB, text/plain)
2004-11-25 01:04 UTC, Mikko Tiihonen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Elie De Brauwer 2004-11-17 21:30:53 UTC
Anyhow I'm running jdk 5.0 here and log4j fails to compile because internally 
a variable enum is being used which also is a keyword since jdk 5.0. See

http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html
or
http://java.sun.com/j2se/1.5.0/docs/relnotes/features.html#enums

The fix is simple since the compile flags as suggested by the compiler  or 
alter to code not to use enum as a veriable anymore.
(There are more errors, all are alike but I copy pasted only the beginning
and the end). 

>>> emerge (1 of 1) dev-java/log4j-1.2.8-r2 to /
>>> md5 src_uri ;-) jakarta-log4j-1.2.8.tar.gz
>>> Unpacking source...
>>> Unpacking jakarta-log4j-1.2.8.tar.gz to /var/tmp/portage/log4j-1.2.8-r2/work
tar: A lone zero block at 17013
>>> Source unpacked.
Buildfile: build.xml

init:

build.core:
    [mkdir] Created dir: /var/tmp/portage/log4j-1.2.8-r2/work/jakarta-log4j-1.2.
8/dist/classes
    [javac] Compiling 160 source files to /var/tmp/portage/log4j-1.2.8-r2/work/j
akarta-log4j-1.2.8/dist/classes
    [javac] /var/tmp/portage/log4j-1.2.8-r2/work/jakarta-log4j-1.2.8/src/java/or
g/apache/log4j/Category.java:207: as of release 1.5, 'enum' is a keyword, and ma
y not be used as an identifier
    [javac] (try -source 1.4 or lower to use 'enum' as an identifier)
    [javac]     Enumeration enum = this.getAllAppenders();
    [javac]                 ^
    [javac] /var/tmp/portage/log4j-1.2.8-r2/work/jakarta-log4j-1.2.8/src/java/or
g/apache/log4j/Category.java:208: as of release 1.5, 'enum' is a keyword, and may not be used as an identifier
    [javac] (try -source 1.4 or lower to use 'enum' as an identifier)
    [javac]     Thread t = (Thread) enum.nextElement();
    [javac]                             ^
    [javac] /var/tmp/portage/log4j-1.2.8-r2/work/jakarta-log4j-1.2.8/src/java/or
g/apache/log4j/PropertyConfigurator.java:511: as of release 1.5, 'enum' is a key
word, and may not be used as an identifier
    [javac] (try -source 1.4 or lower to use 'enum' as an identifier)
    [javac]     Enumeration enum = props.propertyNames();
    [javac]                 ^
    [javac] /var/tmp/portage/log4j-1.2.8-r2/work/jakarta-log4j-1.2.8/src/java/or
g/apache/log4j/PropertyConfigurator.java:512: as of release 1.5, 'enum' is a key
word, and may not be used as an identifier
    [javac] (try -source 1.4 or lower to use 'enum' as an identifier)
    [javac]     while(enum.hasMoreElements()) {
    [javac]           ^
    [javac] /var/tmp/portage/log4j-1.2.8-r2/work/jakarta-log4j-1.2.8/src/java/or
g/apache/log4j/PropertyConfigurator.java:513: as of release 1.5, 'enum' is a key
word, and may not be used as an identifier
    [javac] (try -source 1.4 or lower to use 'enum' as an identifier)
    [javac]       String key = (String) enum.nextElement();
    [javac]                             ^
    [javac] /var/tmp/portage/log4j-1.2.8-r2/work/jakarta-log4j-1.2.8/src/java/or
g/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeEditor.java:244: as of re
lease 1.5, 'enum' is a keyword, and may not be used as an identifier
    [javac] (try -source 1.4 or lower to use 'enum' as an identifier)
    [javac]     Enumeration enum = root.depthFirstEnumeration();
    [javac]                 ^
    [javac] /var/tmp/portage/log4j-1.2.8-r2/work/jakarta-log4j-1.2.8/src/java/or
g/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeEditor.java:245: as of re
lease 1.5, 'enum' is a keyword, and may not be used as an identifier
    [javac] (try -source 1.4 or lower to use 'enum' as an identifier)
    [javac]     while (enum.hasMoreElements()) {
    [javac]            ^
    [javac] /var/tmp/portage/log4j-1.2.8-r2/work/jakarta-log4j-1.2.8/src/java/or
g/apache/log4j/lf5/viewer/categoryexplorer/CategoryNodeEditor.java:246: as of re
lease 1.5, 'enum' is a keyword, and may not be used as an identifier
    [javac] (try -source 1.4 or lower to use 'enum' as an identifier)
    [javac]       CategoryNode node = (CategoryNode) enum.nextElement();
    [javac]                                          ^
    [javac] 13 errors

BUILD FAILED
/var/tmp/portage/log4j-1.2.8-r2/work/jakarta-log4j-1.2.8/build.xml:188: Compile 
failed; see the compiler error output for details.

Total time: 4 seconds

!!! ERROR: dev-java/log4j-1.2.8-r2 failed.
!!! Function src_compile, Line 36, Exitcode 1
!!! compilation error
!!! If you need support, post the topmost build error, NOT this status message.

Reproducible: Always
Steps to Reproduce:





The jdk i'm using according to genlop:

     Thu Oct  7 15:01:20 2004 >>> dev-java/sun-jdk-1.5.0

Or according to java -version:

java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0-b64, mixed mode)


This is a amd64 machine but this is non significant for this package.
Comment 1 Jan Brinkmann (RETIRED) gentoo-dev 2004-11-22 14:18:40 UTC
that's not the only problem. i tried to add source and target attributes to the javac notes but it still failed. will try to figure out why this happens later.
Comment 2 Mikko Tiihonen 2004-11-25 01:04:54 UTC
Created attachment 44695 [details]
A new ebuild has fixed the compilation on java 5.0

The basic packages of log4j 1.2.9 compile with java 5.0 with this ebuild.
Unfortunately it now detects that jmx is in use even though I have -jmx in USE
(the java 5.0 includes jmx) because the build.xml checks for the wrong class. I
changed the ebuild to alter the build.xml so that the compilation of the jmx
subpackage depends on internal sun classes that the code actually requires not
on some generic jmx class that comes with the java 5.0.
Comment 3 Patrizio Bassi 2004-12-01 04:00:48 UTC
not fixed with new ebuild.

i tried with or without jmx flag, nothing changed.

continues to be broken
Comment 4 Patrizio Bassi 2004-12-04 02:25:25 UTC
no news? it locks lots of packages, eclipse too!
Comment 5 Patrizio Bassi 2004-12-04 02:38:33 UTC
uu sorry!

using:
USE="-jikes -doc -javamail -jmx -jms" emerge log4j

fixed the problem.

ok :)
Comment 6 Claes Mogren 2004-12-08 23:14:39 UTC
I can't get this packet to compile either... Even 
   USE="-jikes -doc -javamail -jmx -jms" emerge log4j
fail because of jmx being detected.
  .
  .
jmx:
     [echo] JMX is present.

build.jmx:
    [javac] Compiling 7 source files to /var/tmp/portage/log4j-1.2.9/work/logging-log4j-1.2.9/dist/classes
    [javac] /var/tmp/portage/log4j-1.2.9/work/logging-log4j-1.2.9/src/java/org/apache/log4j/jmx/Agent.java:7: package com.sun.jdmk.comm does not exist
    [javac] import com.sun.jdmk.comm.HtmlAdaptorServer;
    [javac]                          ^
    [javac] /var/tmp/portage/log4j-1.2.9/work/logging-log4j-1.2.9/src/java/org/apache/log4j/jmx/Agent.java:24: cannot find symbol
    [javac] symbol  : class HtmlAdaptorServer
    [javac] location: class org.apache.log4j.jmx.Agent
    [javac]     HtmlAdaptorServer html = new HtmlAdaptorServer();
    [javac]     ^
    [javac] /var/tmp/portage/log4j-1.2.9/work/logging-log4j-1.2.9/src/java/org/apache/log4j/jmx/Agent.java:24: cannot find symbol
    [javac] symbol  : class HtmlAdaptorServer
    [javac] location: class org.apache.log4j.jmx.Agent
    [javac]     HtmlAdaptorServer html = new HtmlAdaptorServer();
    [javac]                                  ^
    [javac] /var/tmp/portage/log4j-1.2.9/work/logging-log4j-1.2.9/src/java/org/apache/log4j/jmx/AppenderDynamicMBean.java:233: warning: non-varargs call of varargs method with inexact argument type for last parameter;
    [javac] cast to java.lang.Object for a varargs call
    [javac] cast to java.lang.Object[] for a non-varargs call and to suppress this warning
    [javac]     return mu.readMethod.invoke(appender, null);
    [javac]                                               ^
    [javac] /var/tmp/portage/log4j-1.2.9/work/logging-log4j-1.2.9/src/java/org/apache/log4j/jmx/LayoutDynamicMBean.java:180: warning: non-varargs call of varargs method with inexact argument type for last parameter;
    [javac] cast to java.lang.Object for a varargs call
    [javac] cast to java.lang.Object[] for a non-varargs call and to suppress this warning
    [javac]     return mu.readMethod.invoke(layout, null);
    [javac]                                             ^
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 3 errors
    [javac] 2 warnings

BUILD FAILED
/var/tmp/portage/log4j-1.2.9/work/logging-log4j-1.2.9/build.xml:261: Compile failed; see the compiler error output for details.

Total time: 6 seconds

!!! ERROR: dev-java/log4j-1.2.9 failed.
!!! Function src_compile, Line 36, Exitcode 1
!!! compilation error

I'm using "Sun JDK 1.5.0"
Comment 7 Jan Brinkmann (RETIRED) gentoo-dev 2005-01-05 04:48:05 UTC
*** Bug 74187 has been marked as a duplicate of this bug. ***
Comment 8 Jan Brinkmann (RETIRED) gentoo-dev 2005-01-05 04:48:05 UTC
*** Bug 73183 has been marked as a duplicate of this bug. ***
Comment 9 Danny Brain 2005-01-11 21:00:40 UTC
I managed to successfully compile log4j-1.2.9 with JDK 1.5 by emerging JMX.
It seems JMX has become a dependency instead of an optional package?
Comment 10 Jan Brinkmann (RETIRED) gentoo-dev 2005-01-12 04:48:46 UTC
*** Bug 77602 has been marked as a duplicate of this bug. ***
Comment 11 Jan Brinkmann (RETIRED) gentoo-dev 2005-01-23 06:08:46 UTC
closing this one because all 'not working with jdk 1.5' are now tracked in #79206:

http://bugs.gentoo.org/show_bug.cgi?id=79206