Skip to content

Classfiles getting lost in case-insensitive filesystems #4119

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

Closed
nicolasstucki opened this issue Mar 15, 2018 · 2 comments
Closed

Classfiles getting lost in case-insensitive filesystems #4119

nicolasstucki opened this issue Mar 15, 2018 · 2 comments

Comments

@nicolasstucki
Copy link
Contributor

Compiling

class Foo { def a = 1 }
object Foo { def b = 1 }

produces

public final class Foo$ {
    public static final Foo$ MODULE$;

    static {
        new Foo$();
    }

    public Foo$() {
        MODULE$ = this;
    }

    public int b() {
        return 1;
    }
}
public class Foo {
    public static int b() {
        return Foo$.MODULE$.b();
    }

    public Foo() {
    }

    public int a() {
        return 1;
    }
}

Compiling

object Foo { def b = 1 }

produces

public final class Foo$ {
    public static final Foo$ MODULE$;

    static {
        new Foo$();
    }

    public Foo$() {
        MODULE$ = this;
    }

    public int b() {
        return 1;
    }
}
public final class Foo {
    public static int b() {
        return Foo$.MODULE$.b();
    }
}

Compiling

class Foo { def a = 1 }
object foo { def b = 1 }

produces

public final class foo$ {
    public static final foo$ MODULE$;

    static {
        new foo$();
    }

    public foo$() {
        MODULE$ = this;
    }

    public int b() {
        return 1;
    }
}
public class Foo {
    public Foo() {
    }

    public int a() {
        return 1;
    }
}

Note that in a case-insensitive filesystem we will try to emit Foo.cass and foo.class and one will overwrite the other.

@nicolasstucki
Copy link
Contributor Author

nicolasstucki commented Mar 15, 2018

tests/pos/test4a.scala and tests/pos/test4refine.scala fail FromTastyTests on Mac. Fix in #4120

@smarter
Copy link
Member

smarter commented Mar 15, 2018

If you do:

class Foo
class foo

we warn:

  |Class Foo differs only in case from foo. Such classes will overwrite one another on case-insensitive filesystems.

Apparently we're missing a similar warning when doing:

class Foo
object foo

But otherwise there's nothing we can do, the tests should be fixed by using different names.

@nicolasstucki nicolasstucki self-assigned this Mar 15, 2018
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 15, 2018
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 15, 2018
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 16, 2018
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants