[WIP] REPO-3918 java 11 (#32)

* REPO-3918 use java 11 + Added CompoundEnumeration manually because it was removed in Java 9
This commit is contained in:
Martin Muller
2018-10-30 15:46:28 +00:00
committed by GitHub
parent 23e0eb478b
commit c6f1deab29
2 changed files with 37 additions and 4 deletions

View File

@@ -4,7 +4,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-super-pom</artifactId>
<version>9</version>
<version>10</version>
</parent>
<artifactId>alfresco-data-model</artifactId>
@@ -31,7 +31,7 @@
</distributionManagement>
<properties>
<dependency.alfresco-core.version>7.4</dependency.alfresco-core.version>
<dependency.alfresco-core.version>7.5</dependency.alfresco-core.version>
<!-- Files to exclude from SonarQube analysis -->
<sonar.exclusions>

View File

@@ -32,6 +32,7 @@ import java.util.Arrays;
import java.util.Enumeration;
import java.util.LinkedList;
import java.util.List;
import java.util.NoSuchElementException;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
@@ -42,8 +43,6 @@ import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.web.context.support.ServletContextResourcePatternResolver;
import sun.misc.CompoundEnumeration;
/**
* Helper class to provide static and common access to the Spring
* {@link org.springframework.context.ApplicationContext application context}.
@@ -302,3 +301,37 @@ public abstract class BaseApplicationContextHelper
}
}
}
/*
* A utility class that will enumerate over an array of enumerations.
* was removed in version JDK 1.9
*/
final class CompoundEnumeration<E> implements Enumeration<E> {
private final Enumeration<E>[] enums;
private int index;
public CompoundEnumeration(Enumeration<E>[] enums) {
this.enums = enums;
}
private boolean next() {
while (index < enums.length) {
if (enums[index] != null && enums[index].hasMoreElements()) {
return true;
}
index++;
}
return false;
}
public boolean hasMoreElements() {
return next();
}
public E nextElement() {
if (!next()) {
throw new NoSuchElementException();
}
return enums[index].nextElement();
}
}