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 #97: Avoid spurious recompilations when unrelated constructor changes #288

Merged
merged 1 commit into from
May 5, 2017

Conversation

smarter
Copy link
Contributor

@smarter smarter commented Apr 6, 2017

The name hashing algorithm is designed to take implicit conversions into
account: when a name "foo" is changed somewhere in a dependency of X,
you have to recompile X if it uses the name "foo", even if the usage of
"foo" in X is completely unrelated, just because this might have an
effect on available implicit conversions. However, there is one case
where we can be sure that implicit conversions will not kick in: when we
call a constructor. A constructor name is always "<init>", this PR now
replaces this name by "pkgA;pkgB;className;init;", this mean that we no
longer recompile classes when an unrelated constructor in a used class
changed (see the new test constructors-unrelated for an example).

@eed3si9n eed3si9n added the ready label Apr 6, 2017
@smarter smarter force-pushed the fix/overcompile-constructor branch 7 times, most recently from 044e71b to 1bd0158 Compare April 6, 2017 17:34
Copy link
Member

@jvican jvican left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. This is a great change!

Thank you for the docs, too. Let's request another review from the Ligthbend team. In the meanwhile, I'll try to see the interaction of this PR with potential corner cases, just to be sure this is ready to go!

Copy link
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change itself looks good.
I wonder if we should start a markdown file documenting mangling rules.

@jvican
Copy link
Member

jvican commented Apr 7, 2017

@smarter Give me until next Monday to think about potential interactions, and we merge 😉. I just want to be sure.

@smarter
Copy link
Contributor Author

smarter commented Apr 26, 2017

Ping for review.

@eed3si9n
Copy link
Member

I already gave my 👍 so we're waiting on @jvican?

@jvican
Copy link
Member

jvican commented Apr 26, 2017

Yes @eed3si9n, I told @smarter in person that I'll be reviewing this by the end of the week. Sorry for the delay.

@jvican
Copy link
Member

jvican commented May 5, 2017

This change looks great, I've confirmed this will not have a bad interaction with anything. I was worried about the format representation and wanted to double check that it was unique.

I am resolving the conflicts caused by the formatting PR manually, and when the light is green I'm merging.

@jvican jvican force-pushed the fix/overcompile-constructor branch from 1bd0158 to a3f26d8 Compare May 5, 2017 13:25
@jvican jvican closed this May 5, 2017
@jvican jvican reopened this May 5, 2017
@eed3si9n eed3si9n added in progress and removed ready labels May 5, 2017
@jvican
Copy link
Member

jvican commented May 5, 2017

Travis was blocked, that's why I closed and opened again. I'll merge this when it's green.

@jvican jvican force-pushed the fix/overcompile-constructor branch from a3f26d8 to 60d7978 Compare May 5, 2017 16:27
…changes

The name hashing algorithm is designed to take implicit conversions into
account: when a name "foo" is changed somewhere in a dependency of X,
you have to recompile X if it uses the name "foo", even if the usage of
"foo" in X is completely unrelated, just because this might have an
effect on available implicit conversions. However, there is one case
where we can be sure that implicit conversions will not kick in: when we
call a constructor. A constructor name is always "<init>", this PR now
replaces this name by "pkgA;pkgB;className;init;", this mean that we no
longer recompile classes when an unrelated constructor in a used class
changed (see the new test `constructors-unrelated` for an example).
@jvican jvican force-pushed the fix/overcompile-constructor branch from 60d7978 to aca8dfa Compare May 5, 2017 22:48
@jvican jvican merged commit 131bc6d into sbt:1.0 May 5, 2017
allanrenucci added a commit to dotty-staging/dotty that referenced this pull request Mar 13, 2018
Use a different encoding for constructor:
constructor.enclosingClass.fullName ++ ";init;"
eed3si9n pushed a commit to eed3si9n/scala that referenced this pull request May 14, 2019
Use a different encoding for constructor:
constructor.enclosingClass.fullName ++ ";init;"
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.

3 participants