Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #413: Handle inner classes based on content, not names.
Previously, we assumed that if there is a file `Foo` and a file `Foo$Bar`, that the latter must be an inner class (or companion) of `Foo`, and that it must therefore be ignored. As #413 shows, and as the new `JavaDefined$Evil` test shows, this is not always valid. The only true test of a class being top-level can only be found in its content, either through the `Scala` attribute or the `InnerClasses` attribute. We completely rewrite `Loaders`. We now systematically try to load every file that is requested, except when we *already* know that it is a Java inner class. This means that we will read the contents of more files than before, but still each file at most once in the common case. A file *may* be read multiple times if it is a Java non-top-level class that gets requested by its name as if it were a top-level class. The loading will fail but we have to keep the file in case it is loaded later on as an inner class. When reading *all* the declarations of a package, we always try outer classes before potential inner classes so that no double reading happens.
- Loading branch information