Skip to content

Show a module's timestamp whether or not it has a source directory - #779

Closed
lagergren wants to merge 2 commits into
masterfrom
lagergren/module-description-timestamp
Closed

lagergren wants to merge 2 commits into
masterfrom
lagergren/module-description-timestamp

Conversation

@lagergren

@lagergren lagergren commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Bumped into this when recompiling in the LSP. There are modules without source directories, temporarily and I ran into this. The ModuleStructure has checked the source directory instead of the timestamp before printing the timestamp since it was written in 2021. In practice in the known existing XTC ecosystem, we haven't bumped into this since nothing has created this kind of modules.

This is obviously a cut and paste typo, so we should just merge it.

--

ModuleStructure.getDescription(), which toString() uses, has checked the source directory instead of the timestamp before printing the timestamp, since both were added in 019524e (2021).

  • A module with a timestamp but no source directory was described as timestamp=none.
    • Every module the compiler makes has a timestamp.
    • It has no source directory when its source has no file, for example a module that the embedding API's ModuleCompiler compiles from a string.
  • A module with a source directory but no timestamp made it throw a NullPointerException.
    • No code makes such a module today. The timestamp is null only for imported (fingerprint) modules and for modules read from a file that recorded none, and those have no source directory either.
    • setTimestamp(null) allows such a module, though.

Testing

  • FileStructureTest and ModuleStructureTest pass, and spotlessCheck is clean.

@lagergren
lagergren marked this pull request as ready for review November 18, 2026 09:15
ModuleStructure.getDescription(), which toString() uses, checked the
source directory instead of the timestamp before printing the timestamp.
A module with a timestamp but no source directory, such as one compiled
from a source with no file, was described as "timestamp=none". A module
with a source directory but no timestamp made it throw a
NullPointerException.
@lagergren
lagergren force-pushed the lagergren/module-description-timestamp branch from 3477651 to 87e2284 Compare November 18, 2026 11:41
@lagergren

Copy link
Copy Markdown
Contributor Author

Superseded by #778, which rewrites the same lines in ModuleStructure.getDescription(). There the timestamp is checked on its own before it is printed, and it is printed only when a time was set with the new xtc build --timestamp; otherwise a module carries the epoch, which says nothing. That covers both cases fixed here: a module with a timestamp but no source directory, and one with a source directory but no timestamp. The two changes would conflict, so this one is closed.

@lagergren lagergren closed this Nov 18, 2026
@lagergren
lagergren deleted the lagergren/module-description-timestamp branch November 18, 2026 14:15
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.

1 participant