ClassRealm does not override getPackage() or getPackages(), so Package#getPackage() and Package#getPackages() do not return packages that are imported from other ClassLoaders.
I discovered this because it breaks Apache JEXL's import pragma. As you can see here, it tries to verify that the package exists. That fails, so the import is ignored.