Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ nb-configuration.xml
.mvn/.develocity
.mvn/.gradle-enterprise/
.quarkus

.goosehints
.goose
Original file line number Diff line number Diff line change
Expand Up @@ -849,10 +849,18 @@ private void checkForClassFilesChangesInModule(DevModeContext.ModuleInfo module,
.collect(Collectors.toSet());

for (Path classFilePath : classFilePaths) {
final Path sourceFilePath = retrieveSourceFilePathForClassFile(classFilePath, moduleChangedSourceFiles,
module, cuf, timestampSet);

Path sourceFilePath = retrieveSourceFilePathForClassFile(classFilePath, moduleChangedSourceFiles,
module, cuf, timestampSet, false);
if (sourceFilePath != null) {
if (!sourceFilePath.toFile().exists()) {
// We need to refresh this in case the source file has changed
// This can happen if you rename a kotlin file, the same class will now be provided by a new file
var updated = retrieveSourceFilePathForClassFile(classFilePath, moduleChangedSourceFiles,
module, cuf, timestampSet, true);
if (updated != null) {
sourceFilePath = updated;
}
}
if (!sourceFilePath.toFile().exists()) {
// Source file has been deleted. Delete class and restart
cleanUpClassFile(classFilePath, timestampSet);
Expand Down Expand Up @@ -888,9 +896,9 @@ private void checkForClassFilesChangesInModule(DevModeContext.ModuleInfo module,

private Path retrieveSourceFilePathForClassFile(Path classFilePath, List<Path> moduleChangedSourceFiles,
DevModeContext.ModuleInfo module, Function<DevModeContext.ModuleInfo, DevModeContext.CompilationUnit> cuf,
TimestampSet timestampSet) {
TimestampSet timestampSet, boolean forceRefresh) {
Path sourceFilePath = timestampSet.classFilePathToSourceFilePath.get(classFilePath);
if (sourceFilePath == null || moduleChangedSourceFiles.contains(sourceFilePath)) {
if (sourceFilePath == null || moduleChangedSourceFiles.contains(sourceFilePath) || forceRefresh) {
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't !Files.exists(sourceFilePath) instead of forceRefresh achieve the same?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, because this could result in the function returning null when previously it would have returned the non-existant file.

sourceFilePath = compiler.findSourcePath(classFilePath, cuf.apply(module).getSourcePaths(),
cuf.apply(module).getClassesPath());
}
Expand Down
Loading