Commit c0cd1207 authored by Guus der Kinderen's avatar Guus der Kinderen Committed by GitHub

Merge pull request #626 from guusdk/OF-1116_Java_compat_issue

OF-1116: Apply workaround for Java 7/8 compatibility issue
parents 8f77927e cb920e30
......@@ -5,6 +5,7 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.xmpp.packet.JID;
......@@ -119,7 +120,7 @@ public class ConcurrentGroupMap<K, V> extends ConcurrentHashMap<K, V> implement
if (result == null) {
result = new HashSet<>();
// add all the groups into the group set
Iterator<K> iterator = keySet().iterator();
Iterator<K> iterator = ((ConcurrentMap) this).keySet().iterator(); // Cast prevents Java compatibility issue as described in OF-1116. Remove the cast when Java 7 support is dropped from Openfire.
while (iterator.hasNext()) {
K key = iterator.next();
Group group = Group.resolveFrom(key);
......
......@@ -33,6 +33,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.jivesoftware.database.JiveID;
import org.jivesoftware.openfire.PresenceManager;
......@@ -78,12 +79,12 @@ public class Roster implements Cacheable, Externalizable {
/**
* Roster item cache - table: key jabberid string; value roster item.
*/
protected ConcurrentHashMap<String, RosterItem> rosterItems = new ConcurrentHashMap<>();
protected ConcurrentMap<String, RosterItem> rosterItems = new ConcurrentHashMap<>();
/**
* Contacts with subscription FROM that only exist due to shared groups
* key: jabberid string; value: groups why the implicit roster item exists (aka invisibleSharedGroups).
*/
protected ConcurrentHashMap<String, Set<String>> implicitFrom = new ConcurrentHashMap<>();
protected ConcurrentMap<String, Set<String>> implicitFrom = new ConcurrentHashMap<>();
private RosterItemProvider rosterItemProvider;
private String username;
......
......@@ -22,6 +22,7 @@ package org.jivesoftware.util;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
* This class implements the <tt>Set</tt> interface, backed by a ConcurrentHashMap instance.
......@@ -34,7 +35,7 @@ public class ConcurrentHashSet<E> extends AbstractSet<E> implements Set<E>, Clon
java.io.Serializable
{
private transient ConcurrentHashMap<E,Object> map;
private transient ConcurrentMap<E,Object> map;
// Dummy value to associate with an Object in the backing Map
private static final Object PRESENT = new Object();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment