Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 508056 - =dev-java/commons-collections-3.2.1 with JDK 1.8 error: remove(Object,Object) in MultiHashMap cannot implement remove(Object,Object) in Map
Summary: =dev-java/commons-collections-3.2.1 with JDK 1.8 error: remove(Object,Object)...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Java (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Java team
URL: https://forums.gentoo.org/viewtopic-t...
Whiteboard:
Keywords:
: 516942 557858 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-04-19 01:45 UTC by Tom Wijsman (TomWij) (RETIRED)
Modified: 2015-08-15 23:35 UTC (History)
4 users (show)

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


Attachments
build.log extract (file_508056.txt,3.14 KB, text/plain)
2014-04-19 01:45 UTC, Tom Wijsman (TomWij) (RETIRED)
Details
java8-compatibility.patch (java8-compatibility.patch,6.74 KB, patch)
2014-05-14 11:04 UTC, Constantine E. Kozlov
Details | Diff
commons-collections-revdep-rebuild.log (commons-collections-revdep-rebuild.tar.bz2,26.52 KB, application/x-bzip2)
2015-06-21 00:40 UTC, Patrice Clement
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2014-04-19 01:45:08 UTC
Created attachment 375260 [details]
build.log extract

We'll need to investigate this as we proceed with JDK 1.8 introduction; from a quick thought, just from what I heard, it might need to be a virtual.

Explanation by advocate:

java.util.Map in jdk8 gained a function boolean remove(Object key, Object value); which clashes with several functions introduced in commons-collections.

`emerge --info` output of the forum user:

Portage 2.2.10 (default/linux/amd64/13.0, gcc-4.8.2, glibc-2.19, 3.10.15-gentoo x86_64) 
================================================================= 
                         System Settings 
================================================================= 
System uname: Linux-3.10.15-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_E5-2620_0_@_2.00GHz-with-gentoo-2.2 
KiB Mem:    32897432 total,   6314700 free 
KiB Swap:    8388604 total,   8388604 free 
Timestamp of tree: Tue, 01 Apr 2014 17:00:01 +0000 
ld GNU ld (GNU Binutils) 2.24 
ccache version 3.1.9 [disabled] 
app-shells/bash:          4.2_p46 
dev-java/java-config:     2.2.0 
dev-lang/python:          2.7.6, 3.2.5-r3, 3.3.5, 3.4.0 
dev-util/ccache:          3.1.9-r3 
dev-util/cmake:           2.8.12.2 
dev-util/pkgconfig:       0.28-r1 
sys-apps/baselayout:      2.2 
sys-apps/openrc:          0.12.4 
sys-apps/sandbox:         2.6-r1 
sys-devel/autoconf:       2.13, 2.69 
sys-devel/automake:       1.10.3, 1.11.6, 1.13.4, 1.14.1 
sys-devel/binutils:       2.24-r2 
sys-devel/gcc:            4.7.3-r1, 4.8.2 
sys-devel/gcc-config:     1.8 
sys-devel/libtool:        2.4.2 
sys-devel/make:           4.0-r1 
sys-kernel/linux-headers: 3.14 (virtual/os-headers) 
sys-libs/glibc:           2.19 
Repositories: science nbigaouette seden bitcoin drevilt betagarden emacs sunrise qt gentoo x-portage 
ACCEPT_KEYWORDS="amd64 ~amd64" 
ACCEPT_LICENSE="* -@EULA" 
CBUILD="x86_64-pc-linux-gnu" 
CFLAGS="-march=native -O2 -pipe" 
CHOST="x86_64-pc-linux-gnu" 
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" 
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" 
CXXFLAGS="-march=native -O2 -pipe" 
DISTDIR="/usr/portage/distfiles" 
FCFLAGS="-O2 -pipe" 
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch usersandbox usersync" 
FFLAGS="-O2 -pipe" 
GENTOO_MIRRORS="http://distfiles.gentoo.org" 
LANG="en_US.UTF-8" 
LDFLAGS="-Wl,-O1 -Wl,--as-needed" 
MAKEOPTS="-j13" 
PKGDIR="/usr/portage/packages" 
PORTAGE_CONFIGROOT="/" 
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages" 
PORTAGE_TMPDIR="/var/tmp" 
PORTDIR="/usr/portage" 
PORTDIR_OVERLAY="/var/lib/layman/science /var/lib/layman/nbigaouette /var/lib/layman/seden /var/lib/layman/bitcoin /var/lib/layman/drevilt /var/lib/layman/betagarden /var/lib/layman/emacs /var/lib/layman/sunrise /var/lib/layman/qt /usr/portage /usr/local/portage" 
USE="X \ acl amd64 berkdb bzip2 cli consolekit cracklib crypt cxx dri fortran gdbm iconv ipv6 mmx modules multilib ncurses nls nptl openmp pam pcre readline session sse sse2 ssl tcpd truetype unicode zlib" ABI_X86="64 32" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_3 python3_2" RUBY_TARGETS="ruby19 ruby20" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
USE_PYTHON="2.7 3.2 3.3" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, SYNC
Comment 1 Constantine E. Kozlov 2014-05-14 11:04:18 UTC
Created attachment 376896 [details, diff]
java8-compatibility.patch

Add support for jdk-1.8.

With this patch, commons-collections successfully builds and works under jdk-1.8.
Comment 2 tman 2014-07-12 09:27:24 UTC
does this patch not work:

>>> Emerging (1 of 11) dev-java/commons-collections-3.2.1::gentoo
 * commons-collections-3.2.1-src.tar.gz SHA256 SHA512 WHIRLPOOL size ;-) ...                                    [ ok ]
 * Using: oracle-jdk-bin-1.8
>>> Unpacking source...
>>> Unpacking commons-collections-3.2.1-src.tar.gz to /var/tmp/portage/dev-java/commons-collections-3.2.1/work
tar: A lone zero block at 9524
>>> Source unpacked in /var/tmp/portage/dev-java/commons-collections-3.2.1/work
>>> Compiling source in /var/tmp/portage/dev-java/commons-collections-3.2.1/work/commons-collections-3.2.1-src ...
Rewriting attributes
Rewriting ./build.xml
 * Disabling all optional ANT_TASKS
Buildfile: /var/tmp/portage/dev-java/commons-collections-3.2.1/work/commons-collections-3.2.1-src/build.xml

init:
     [echo] -------- commons-collections 3.2.1 --------

prepare:
    [mkdir] Created dir: /var/tmp/portage/dev-java/commons-collections-3.2.1/work/commons-collections-3.2.1-src/build

compile:
    [mkdir] Created dir: /var/tmp/portage/dev-java/commons-collections-3.2.1/work/commons-collections-3.2.1-src/build/classes
    [javac] Compiling 273 source files to /var/tmp/portage/dev-java/commons-collections-3.2.1/work/commons-collections-3.2.1-src/build/classes
    [javac] /var/tmp/portage/dev-java/commons-collections-3.2.1/work/commons-collections-3.2.1-src/src/java/org/apache/commons/collections/MultiHashMap.java:334: error: remove(Object,Object) in MultiHashMap cannot implement remove(Object,Object) in Map
    [javac]     public Object remove(Object key, Object item) {
    [javac]                   ^
    [javac]   return type Object is not compatible with boolean
    [javac] /var/tmp/portage/dev-java/commons-collections-3.2.1/work/commons-collections-3.2.1-src/src/java/org/apache/commons/collections/MultiMap.java:69: error: remove(Object,Object) in MultiMap clashes with remove(Object,Object) in Map
    [javac]     public Object remove(Object key, Object item);
    [javac]                   ^
    [javac]   return type Object is not compatible with boolean
    [javac] /var/tmp/portage/dev-java/commons-collections-3.2.1/work/commons-collections-3.2.1-src/src/java/org/apache/commons/collections/map/MultiKeyMap.java:200: error: remove(Object,Object) in MultiKeyMap cannot implement remove(Object,Object) in Map
    [javac]     public Object remove(Object key1, Object key2) {
    [javac]                   ^
    [javac]   return type Object is not compatible with boolean
    [javac] /var/tmp/portage/dev-java/commons-collections-3.2.1/work/commons-collections-3.2.1-src/src/java/org/apache/commons/collections/map/MultiValueMap.java:156: error: remove(Object,Object) in MultiValueMap cannot implement remove(Object,Object) in Map
    [javac]     public Object remove(Object key, Object value) {
    [javac]                   ^
    [javac]   return type Object is not compatible with boolean
    [javac] 4 errors

BUILD FAILED
/var/tmp/portage/dev-java/commons-collections-3.2.1/work/commons-collections-3.2.1-src/build.xml:106: Compile failed; see the compiler error output for details.

Total time: 2 seconds
 * ERROR: dev-java/commons-collections-3.2.1::gentoo failed (compile phase):
 *   eant failed
 * 
 * Call stack:
 *     ebuild.sh, line   93:  Called src_compile
 *   environment, line 3875:  Called eant 'jar'
 *   environment, line  576:  Called die
 * The specific snippet of code:
 *       ant ${antflags} "${@}" || die "eant failed"
 * 
 * If you need support, post the output of `emerge --info '=dev-java/commons-collections-3.2.1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=dev-java/commons-collections-3.2.1::gentoo'`.
!!! When you file a bug report, please include the following information:
GENTOO_VM=oracle-jdk-bin-1.8  CLASSPATH="" JAVA_HOME="/opt/oracle-jdk-bin-1.8.0.5"
JAVACFLAGS="-source 1.4 -target 1.4" COMPILER="javac"
and of course, the output of emerge --info =commons-collections-3.2.1
 * The complete build log is located at '/var/tmp/portage/dev-java/commons-collections-3.2.1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-java/commons-collections-3.2.1/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-java/commons-collections-3.2.1/work/commons-collections-3.2.1-src'
 * S: '/var/tmp/portage/dev-java/commons-collections-3.2.1/work/commons-collections-3.2.1-src'

>>> Failed to emerge dev-java/commons-collections-3.2.1, Log file:

>>>  '/var/tmp/portage/dev-java/commons-collections-3.2.1/temp/build.log'

 * Messages for package dev-java/commons-collections-3.2.1:
Comment 3 Constantine E. Kozlov 2014-07-12 11:11:58 UTC
I can be wrong, but I don't see 'src-prepare' phase and message like:
 * Applying java8-compatibility.patch ... 
Are you sure you added this patch into your ebuild?

PS. Just merged it again... using jdk 1.8. There was patching message and all built just great.

PPS. I used --binary key to epatch, if I remember right - there is problem with it with line endings, this key allows it to ignore them. Not sure, but I think it can be fixed somehow except for this key...
Comment 4 Austin English (RETIRED) gentoo-dev 2014-08-08 05:02:51 UTC
The patch allows compiling commons-collections with jdk-1.8, however it breaks compiling json-lib with (at least) jdk-1.7:

>>> Compiling source in /var/tmp/portage/dev-java/json-lib-2.4/work ...
ejavac -d target/classes -encoding UTF-8 -classpath /usr/share/ezmorph/lib/ezmorph.jar:/usr/share/commons-beanutils-1.7/lib/commons-beanutils.jar:/usr/share/commons-beanutils-1.7/lib/commons-beanutils-core.jar:/usr/share/commons-beanutils-1.7/lib/commons-beanutils-bean-collections.jar:/usr/share/commons-lang-2.1/lib/commons-lang.jar:/usr/share/commons-collections/lib/commons-collections.jar:/usr/share/commons-logging/lib/commons-logging.jar:/usr/share/commons-logging/lib/commons-logging-api.jar:/usr/share/commons-logging/lib/commons-logging-adapters.jar:/usr/share/jakarta-oro-2.0/lib/jakarta-oro.jar @sources.lst
warning: [options] bootstrap class path not set in conjunction with -source 1.5
net/sf/json/JsonConfig.java:1367: error: no suitable method found for remove(Class,Class)
         beanTypeMap.remove( beanClass, propertyType );
                    ^
    method MultiKeyMap.remove(Object) is not applicable
      (actual and formal argument lists differ in length)
    method MultiKeyMap.remove(Object,Object,Object,Object,Object) is not applicable
      (actual and formal argument lists differ in length)
    method MultiKeyMap.remove(Object,Object,Object,Object) is not applicable
      (actual and formal argument lists differ in length)
    method MultiKeyMap.remove(Object,Object,Object) is not applicable
      (actual and formal argument lists differ in length)
net/sf/json/JsonConfig.java:1380: error: no suitable method found for remove(Class,String)
         beanKeyMap.remove( beanClass, key );
                   ^
    method MultiKeyMap.remove(Object) is not applicable
      (actual and formal argument lists differ in length)
    method MultiKeyMap.remove(Object,Object,Object,Object,Object) is not applicable
      (actual and formal argument lists differ in length)
    method MultiKeyMap.remove(Object,Object,Object,Object) is not applicable
      (actual and formal argument lists differ in length)
    method MultiKeyMap.remove(Object,Object,Object) is not applicable
      (actual and formal argument lists differ in length)
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
1 warning

reverting the patch and rebuilding commons-collections, then rebuilding json-lib allows json-lib to build.
Comment 5 Patrice Clement gentoo-dev 2015-06-19 07:40:00 UTC
*** Bug 516942 has been marked as a duplicate of this bug. ***
Comment 6 Patrice Clement gentoo-dev 2015-06-19 07:41:02 UTC
We ought to merge this patch at some point. :/
Comment 7 Markus Rathgeb 2015-06-19 18:13:27 UTC
I checked why this packages should be installed on my system.
If dev-java/ant is installed (ant sets +bfs themselves, so depends on ant-apache-bsf) and python USE flag is set, this package needs to be build.

 dev-java/ant-apache-bsf-1.9.2::gentoo  USE="python* -javascript -tcl" 0 KiB
  dev-java/bsf-2.4.0-r1:2.3::gentoo  USE="python* -doc -examples -javascript -source -tcl" 0 KiB
   dev-java/jython-2.2.1-r2::gentoo  USE="mysql readline -doc -examples -oracle -postgres -servletapi -source" 0 KiB
    dev-java/jdbc-mysql-5.1.26::gentoo  USE="-c3p0 -log4j -source" 0 KiB
     dev-java/ant-contrib-1.0_beta3-r1::gentoo  USE="-doc -source" 0 KiB
      dev-java/ant-ivy-1.4.1-r1::gentoo  USE="-doc -examples -source {-test}" 0 KiB
       dev-java/commons-vfs-1.0::gentoo  USE="-doc -source" 0 KiB
        dev-java/commons-collections-3.2.1::gentoo  USE="-doc -source {-test} -test-framework" 0 KiB
Comment 8 Patrice Clement gentoo-dev 2015-06-21 00:38:45 UTC
I have done some testing wrt this patch. Here's the sum up:

0) Which version of the JVM do we use?
monsieurp@epsilon ~ $ eselect java-vm show
Current system-vm
  oracle-jdk-bin-1.8
Current user-vm
  oracle-jdk-bin-1.8

1) Let's install the patched version of commons-collections.

>>> Regenerating /etc/ld.so.cache...
>>> Original instance of package unmerged safely.
>>> dev-java/commons-collections-3.2.1-r1 merged.
monsieurp@epsilon ~/gentoo-x86/dev-java/commons-collections $ 

2) I have rebuilt all reverse dependencies and logged the output in a log file. Not a single package failed during compiling. The only package that I have removed from my list is netbeans (cause it pulls in a wad of deps). I doubt this patch will affect netbeans build process though.
Comment 9 Patrice Clement gentoo-dev 2015-06-21 00:40:10 UTC
Created attachment 405452 [details]
commons-collections-revdep-rebuild.log
Comment 10 Patrice Clement gentoo-dev 2015-06-21 11:20:26 UTC
+*commons-collections-3.2.1-r1 (21 Jun 2015)
+
+  21 Jun 2015; Patrice Clement <monsieurp@gentoo.org>
+  +commons-collections-3.2.1-r1.ebuild,
+  +files/commons-collections-3.2.1-Java-8.patch:
+  Add patch to allow commons-collections to compile nicely with JDK >= 1.8
+  courtesy of Constantine E. Kozlov <tempor.demonius@gmail.com>. Fix bug 508056.
+

Thanks a lot for the patch.
Comment 11 Patrice Clement gentoo-dev 2015-08-15 23:35:34 UTC
*** Bug 557858 has been marked as a duplicate of this bug. ***