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

Truncate file timestamp in AttributedPath to milliseconds #1776

Merged
merged 1 commit into from
Aug 16, 2022

Conversation

oyvindberg
Copy link
Contributor

  • this makes it consistent between old and new JVMs, and makes a bunch of tests happy which among other things diff file timestamps

@keynmol
Copy link
Collaborator

keynmol commented Aug 16, 2022

Haha, I thought I was going crazy :D https://github.com/scalacenter/bloop/pull/1749/files#r912112085

@oyvindberg
Copy link
Contributor Author

Haha, I thought I was going crazy :D https://github.com/scalacenter/bloop/pull/1749/files#r912112085

I guess everybody meets this error for the first time, it's certainly very confusing!

- this makes it consistent between old and new JVMs, and makes a bunch of tests happy which among other things diff file timestamps
@oyvindberg oyvindberg force-pushed the truncate-file-timestamp branch from 83fabd0 to e443755 Compare August 16, 2022 09:09
@@ -80,7 +82,24 @@ object Paths {
out.toList
}

case class AttributedPath(path: AbsolutePath, lastModifiedTime: FileTime, size: Long)
// sealed abstract is an abomination for scala 2.12 to get private which actually works
sealed abstract case class AttributedPath(
Copy link
Contributor

Choose a reason for hiding this comment

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

Why change it to an abstract class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What the comment says really. To force all usage to go through the of constructor method.

Older scala versions and private case class constructors is a surprisingly complex topic. For instance this article touches on it https://tuleism.github.io/blog/2020/scala-smart-constructors/

That said, now that the compiler showed me all usage i can change it back to something more normal if this is too weird. I just like having the guarantee

Copy link
Contributor

Choose a reason for hiding this comment

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

Ach, sorry! I saw that previously when checking and then forgot 😓

@tgodzik tgodzik merged commit 9e4671e into scalacenter:main Aug 16, 2022
@oyvindberg oyvindberg deleted the truncate-file-timestamp branch August 16, 2022 17:11
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.

None yet

3 participants