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

Feature: Warn against creating packages and classes with file names illegal on Windows #11721

Open
Sciss opened this issue Sep 2, 2019 · 1 comment

Comments

@Sciss
Copy link

commented Sep 2, 2019

On Windows, there are reserved file names, including, among others, aux, Aux, aux.*, Aux.*, con, ... (full list). Thus when building on a Windows machine, you probably run into an OS error when scalac tries to write these files. See #4781.

However, you can perfectly create those files on other OS such as Linux or macOS. But when trying to extract those files on a Windows computer, it fails.

I would thus suggest, perhaps in conjunction with #4781, to warn or even error on those file names on any operating system. That way you prevent somebody from building an entire library based on com.foo.aux.Aux (which I just did) and finding out much later that it causes problems (example: extracting the scaladoc jar).

@som-snytt

This comment has been minimized.

Copy link

commented Sep 2, 2019

Maybe -Xlint:special-names, where the new -Wconf will make it easy to suppress in case Aux is a pattern.

-d artifact.jar avoids writing Aux.class to the file system. Scaladoc could do the same (if it doesn't already). My expectation is that a user on Windows never extracts Scaladoc but configs the IDE to use the doc.jar or src.jar.

Alternatively, encode Aux as $I$hate$windows$Aux. No one is put out by + as $plus.

Alternatively, a Scalafix that rewrites Aux to Auks and adds type Aux = Auks to your custom Predef.

@SethTisue SethTisue added this to the Backlog milestone Sep 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.