Skip to content

Not working with Java 9 #202

@jamesdbaker

Description

@jamesdbaker

The following code works fine on Java 8, but is throwing a warning on Java 9 and returning no results:

Reflections reflections = new Reflections();
Set<?> components = reflections.getSubTypesOf(componentClazz);

The warning is:

WARN  org.reflections.Reflections - given scan urls are empty. set urls in the configuration

When trying to modify the code above to provide an explicit configuration and work with Java 9, the following code:

Reflections reflections = new Reflections(ClasspathHelper.forClass(Object.class));
Set<?> components = reflections.getSubTypesOf(componentClazz);

Returned this error:

WARN  org.reflections.Reflections - could not create Vfs.Dir from url. ignoring the exception and continuing
org.reflections.ReflectionsException: could not create Vfs.Dir from url, no matching UrlType was found [jrt:/java.base/]
either use fromURL(final URL url, final List<UrlType> urlTypes) or use the static setDefaultURLTypes(final List<UrlType> urlTypes) or addDefaultURLTypes(UrlType urlType) with your specialized UrlType.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions