Changeset 14782 in josm


Ignore:
Timestamp:
2019-02-11T22:52:05+01:00 (5 weeks ago)
Author:
Don-vip
Message:

replace reflections library (unmaintained) by classgraph.

This allows us to update Guava to current version (27.0.1) with its only dependency (failureaccess 1.0.1).

Location:
trunk
Files:
3 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/.classpath

    r14604 r14782  
    4343                </attributes>
    4444        </classpathentry>
    45         <classpathentry kind="lib" path="test/lib/reflections/reflections-0.9.11.jar">
     45        <classpathentry kind="lib" path="test/lib/classgraph-4.6.32.jar" sourcepath="C:/Users/vippy/.m2/repository/io/github/classgraph/classgraph/4.6.32/classgraph-4.6.32-sources.jar">
    4646                <attributes>
    4747                        <attribute name="test" value="true"/>
    4848                </attributes>
    4949        </classpathentry>
    50         <classpathentry kind="lib" path="test/lib/reflections/guava-21.0.jar">
    51                 <attributes>
    52                         <attribute name="test" value="true"/>
    53                 </attributes>
    54         </classpathentry>
    55         <classpathentry kind="lib" path="test/lib/reflections/javassist-3.21.0-GA.jar">
     50        <classpathentry kind="lib" path="tools/guava.jar">
    5651                <attributes>
    5752                        <attribute name="test" value="true"/>
  • trunk/build.xml

    r14695 r14782  
    4343        <property name="error_prone_core.jar" location="${tools.dir}/error_prone_core.jar"/>
    4444        <property name="error_prone_javac.jar" location="${tools.dir}/error_prone_javac.jar"/>
     45        <property name="failureaccess.jar" location="${tools.dir}/failureaccess.jar"/>
     46        <property name="guava.jar" location="${tools.dir}/guava.jar"/>
    4547        <property name="jformatstring.jar" location="${spotbugs.dir}/jFormatString-3.0.0.jar"/>
    4648        <property name="dist.jar" location="${dist.dir}/josm-custom.jar"/>
     
    9395        <path id="processor.path">
    9496            <pathelement location="${error_prone_core.jar}"/>
     97            <pathelement location="${failureaccess.jar}"/>
     98            <pathelement location="${guava.jar}"/>
    9599            <pathelement location="${jformatstring.jar}"/>
    96100        </path>
  • trunk/netbeans/nbproject/project.properties

    r14093 r14782  
    3232endorsed.classpath=
    3333excludes=org/apache/commons/compress/compressors/CompressorException.java,org/apache/commons/compress/compressors/CompressorStreamFactory.java,org/apache/commons/compress/compressors/CompressorStreamProvider.java,org/apache/commons/compress/compressors/FileNameUtil.java,org/apache/commons/compress/compressors/brotli/**,org/apache/commons/compress/compressors/bzip2/BZip2Utils.java,org/apache/commons/compress/compressors/deflate/**,org/apache/commons/compress/compressors/gzip/**,org/apache/commons/compress/compressors/lz4/**,org/apache/commons/compress/compressors/lz77support/**,org/apache/commons/compress/compressors/lzma/**,org/apache/commons/compress/compressors/pack200/**,org/apache/commons/compress/compressors/snappy/**,org/apache/commons/compress/compressors/xz/XZUtils.java,org/apache/commons/compress/compressors/z/**,org/apache/commons/compress/compressors/zstandard/**,org/apache/commons/compress/utils/ArchiveUtils.java,org/apache/commons/jcs/JCS.java,org/apache/commons/jcs/access/GroupCacheAccess.java,org/apache/commons/jcs/access/PartitionedCacheAccess.java,org/apache/commons/jcs/access/behavior/IGroupCacheAccess.java,org/apache/commons/jcs/access/exception/InvalidGroupException.java,org/apache/commons/jcs/admin/servlet/**,org/apache/commons/jcs/auxiliary/AbstractAuxiliaryCacheMonitor.java,org/apache/commons/jcs/auxiliary/disk/jdbc/**,org/apache/commons/jcs/auxiliary/lateral/**,org/apache/commons/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java,org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheListener.java,org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java,org/apache/commons/jcs/auxiliary/remote/RemoteCache.java,org/apache/commons/jcs/auxiliary/remote/RemoteCacheFactory.java,org/apache/commons/jcs/auxiliary/remote/RemoteCacheFailoverRunner.java,org/apache/commons/jcs/auxiliary/remote/RemoteCacheListener.java,org/apache/commons/jcs/auxiliary/remote/RemoteCacheManager.java,org/apache/commons/jcs/auxiliary/remote/RemoteCacheMonitor.java,org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java,org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWaitFacade.java,org/apache/commons/jcs/auxiliary/remote/RemoteCacheRestore.java,org/apache/commons/jcs/auxiliary/remote/http/**,org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheStartupServlet.java,org/apache/commons/jcs/auxiliary/remote/server/TimeoutConfigurableRMISocketFactory.java,org/apache/commons/jcs/engine/CacheAdaptor.java,org/apache/commons/jcs/engine/CacheGroup.java,org/apache/commons/jcs/engine/CacheWatchRepairable.java,org/apache/commons/jcs/engine/ZombieCacheService.java,org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java,org/apache/commons/jcs/engine/ZombieCacheWatch.java,org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java,org/apache/commons/jcs/utils/access/**,org/apache/commons/jcs/utils/discovery/**,org/apache/commons/jcs/utils/net/**,org/apache/commons/jcs/utils/props/**,org/apache/commons/jcs/utils/servlet/**,org/apache/commons/logging/impl/AvalonLogger.java,org/apache/commons/logging/impl/Jdk13LumberjackLogger.java,org/apache/commons/logging/impl/Log4JLogger.java,org/apache/commons/logging/impl/LogKitLogger.java,org/apache/commons/logging/impl/ServletContextCleaner.java,org/openstreetmap/gui/jmapviewer/Demo.java,org/openstreetmap/gui/jmapviewer/JMapViewerTree.java,org/openstreetmap/gui/jmapviewer/checkBoxTree/**,org/apache/commons/compress/archivers/**,org/apache/commons/compress/changes/**,org/apache/commons/compress/parallel/**,org/apache/commons/compress/PasswordRequiredException.java
    34 file.reference.commons-lang-3.7.jar=../tools/pmd/commons-lang-3.7.jar
     34file.reference.commons-lang-3.8.1.jar=../tools/pmd/commons-lang-3.8.1.jar
    3535file.reference.commons-testing-2.1.0.jar=../test/lib/commons-testing/commons-testing-2.1.0.jar
    3636file.reference.core-src=../src
    37 file.reference.equalsverifier-2.5.1.jar=../test/lib/equalsverifier-2.5.1.jar
     37file.reference.equalsverifier-3.1.2.jar=../test/lib/equalsverifier-3.1.2.jar
    3838file.reference.spotbugs.jar=../tools/spotbugs/spotbugs.jar
    39 file.reference.guava-21.0.jar=../test/lib/reflections/guava-21.0.jar
     39file.reference.guava.jar=../tools/guava.jar
    4040file.reference.hamcrest-core-1.3.jar=../test/lib/junit/hamcrest-core-1.3.jar
    41 file.reference.javassist-3.21.0-GA.jar=../test/lib/reflections/javassist-3.21.0-GA.jar
    4241file.reference.jfcunit.jar=../test/lib/jfcunit.jar
    43 file.reference.jmockit-1.41.jar=../test/lib/jmockit-1.41.jar
     42file.reference.jmockit.jar=../test/lib/jmockit.jar
    4443file.reference.junit-4.12.jar=../test/lib/junit/junit-4.12.jar
    45 file.reference.reflections-0.9.10.jar=../test/lib/reflections/reflections-0.9.10.jar
     44file.reference.classgraph.jar=../test/lib/classgraph-4.6.32.jar
    4645file.reference.test-functional=../test/functional
    4746file.reference.test-performance=../test/performance
    4847file.reference.test-unit=../test/unit
    49 file.reference.system-rules-1.16.1.jar=../test/lib/system-rules-1.16.1.jar
    50 file.reference.wiremock-standalone-2.18.0.jar=../test/lib/wiremock-standalone-2.18.0.jar
    51 file.reference.awaitility-3.1.2.jar=../test/lib/awaitility-3.1.2.jar
     48file.reference.system-rules-1.19.0.jar=../test/lib/system-rules-1.19.0.jar
     49file.reference.wiremock-standalone-2.20.0.jar=../test/lib/wiremock-standalone-2.20.0.jar
     50file.reference.awaitility-3.1.5.jar=../test/lib/awaitility-3.1.5.jar
    5251includes=**/*.java
    5352jar.compress=false
     
    6564    ${build.classes.dir}:\
    6665    ${file.reference.junit-4.12.jar}:\
    67     ${file.reference.jmockit-1.41.jar}:\
     66    ${file.reference.jmockit.jar}:\
    6867    ${file.reference.jfcunit.jar}:\
    69     ${file.reference.equalsverifier-2.5.1.jar}:\
     68    ${file.reference.equalsverifier-3.1.2.jar}:\
    7069    ${file.reference.hamcrest-core-1.3.jar}:\
    71     ${file.reference.guava-21.0.jar}:\
    72     ${file.reference.javassist-3.21.0-GA.jar}:\
    73     ${file.reference.reflections-0.9.11.jar}:\
    74     ${file.reference.commons-lang-3.7.jar}:\
    75     ${file.reference.system-rules-1.16.1.jar}:\
    76     ${file.reference.wiremock-standalone-2.18.0.jar}:\
    77     ${file.reference.awaitility-3.1.2.jar}:\
     70    ${file.reference.guava.jar}:\
     71    ${file.reference.classgraph.jar}:\
     72    ${file.reference.commons-lang-3.8.1.jar}:\
     73    ${file.reference.system-rules-1.19.0.jar}:\
     74    ${file.reference.wiremock-standalone-2.20.0.jar}:\
     75    ${file.reference.awaitility-3.1.5.jar}:\
    7876    ${file.reference.spotbugs.jar}:\
    7977    ${file.reference.commons-testing-2.1.0.jar}
  • trunk/test/unit/org/openstreetmap/josm/TestUtils.java

    r14528 r14782  
    3030import java.util.concurrent.ExecutionException;
    3131import java.util.concurrent.ThreadPoolExecutor;
     32import java.util.function.Function;
    3233import java.util.stream.Collectors;
    3334import java.util.stream.Stream;
     
    5556import org.openstreetmap.josm.tools.Utils;
    5657import org.openstreetmap.josm.tools.WikiReader;
    57 import org.reflections.Reflections;
    5858
    5959import com.github.tomakehurst.wiremock.WireMockServer;
     
    6262
    6363import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     64import io.github.classgraph.ClassGraph;
     65import io.github.classgraph.ClassInfoList;
     66import io.github.classgraph.ScanResult;
    6467import mockit.integration.TestRunnerDecorator;
    6568
     
    571574     */
    572575    public static <T> Set<Class<? extends T>> getJosmSubtypes(Class<T> superClass) {
    573         return new Reflections("org.openstreetmap.josm").getSubTypesOf(superClass);
     576        try (ScanResult scan = new ClassGraph().whitelistPackages("org.openstreetmap.josm").ignoreClassVisibility().scan()) {
     577            Function<String, ClassInfoList> lambda = superClass.isInterface() ? scan::getClassesImplementing : scan::getSubclasses;
     578            return lambda.apply(superClass.getName())
     579                    .asMap().values().stream().map(x -> x.loadClass(superClass)).collect(Collectors.toSet());
     580        }
    574581    }
    575582
Note: See TracChangeset for help on using the changeset viewer.