Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #22461 Empty ClassPath attribute in one or more classpath jars causes crash #22462

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

philwalk
Copy link
Contributor

@philwalk philwalk commented Jan 26, 2025

Change to how an empty or null jar manifest ClassPath: property is handled:

in dotty.tools.dotc.classpath.ClassPathFactory:

  • classesInExpandedPath(...) returns and empty IndexedSeq rather than crash
  • isJarOrZip returns false on a null reference rather than crash

in dotty.tools.dotc.classpath.FileUtils:

  • createSourcePath fails with an error message on a null file parameter.

In the context of #22461, this causes an empty ClassPath: property to be treated the same as a mispelled or missing classpath entry, which are silently ignored, matching the behaviour of legacy scripts.

@som-snytt
Copy link
Contributor

I was interested in trying it out because this is more-or-less shared code with Scala 2. I did not yet reproduce.

I would not expect to handle a possible null in more than one place. Dotty is usually complaining to me that such-and-such might be null, I have to sprinkle | Null if I think that is desired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants