eclipse-ee4j / openmq

OpenMQ
https://projects.eclipse.org/projects/ee4j.openmq/
Other
48 stars 33 forks source link

MQ source won't compile using Java 8 #373

Closed glassfishrobot closed 7 years ago

glassfishrobot commented 8 years ago

If I try to compile the MQ source using Java 8 it fails with this message:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.4:compile (default-compile) on project mqdisk-io: Compilation failure
[ERROR] C:\src\mq5.1.1\main\persist\disk-io\src\main\java\com\sun\messaging\jmq\io\disk\PHashMap.java:[394,15] error: keySet() in PHashMap cannot over
ride keySet() in ConcurrentHashMap

The cause is that this class subclasses ConcurrentHashMap.

In Java 7 ConcurrentHashMap#keySet() returns a Set In Java 8 ConcurrentHashMap#keySet() returns a KeySetView<K, V> (which implements Set)

We therefore need to change PHashMap#keySet() so that it returns a KeySetView<K, V>.

There is no requirement to be able to compile the MQ 5.1.1 source using Java 8. However this will doubtless be a requirement of a future version of MQ.

Affected Versions

[5.1.1]

glassfishrobot commented 6 years ago
glassfishrobot commented 8 years ago

@glassfishrobot Commented Reported by @nigeldeakin

glassfishrobot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA MQ-373

glassfishrobot commented 7 years ago

@amykang2020 Commented This has been resolved in #381