Skip to content

ClassPath.getTopLevelClasses() returns empty list. #2152

Closed
@jcoeltjen

Description

@jcoeltjen

Summary
ClassPath.getTopLevelClasses() returns empty list when the path of the classloader contains special characters.

How to reproduce this error

  1. Create a packeage with three classes
  2. Create the following unit test
    @Test
    public void testMain() throws Exception {
        ClassLoader loader = this.getClass().getClassLoader();
        ClassPath p = ClassPath.from(loader);
        ImmutableSet<ClassPath.ClassInfo> list = p.getTopLevelClasses("testpackage");
        Assert.assertEquals(3, list.size());
    }
  1. Copy the whole project to a folder with special characters in its name (like % for example) and execute it.
  2. The test will fail. If you copy the project to a folder without special characters in its path the test will pass.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions