INRIA / INRIA/spoon

[Bug]: When I use IncrementalLauncher, if I set setShouldCompile to false, it will always rebuild

Open
#5,510 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
2k
Forks
392
Avg merge
11h 24m
Merged PRs (30d)
36

Description

### Describe the bug

When I use IncrementalLauncher, if I set setShouldCompile to false, it will always rebuild and not use cache;

### reason:
When setShouldCompile is false, the class file will not be filled into class-files, resulting in an empty folder
![image](https://github.com/INRIA/spoon/assets/51260721/e4e1b617-8ef1-4eaf-b994-0d53fc496c92)

Finally, the class-files folder will be deleted
![image](https://github.com/INRIA/spoon/assets/51260721/95699fa6-1d47-481d-b65a-edca6d643899)

When analyzed again, the class-files folder doesn't exist, Leading to a constant rebuild
![image](https://github.com/INRIA/spoon/assets/51260721/3656c14f-2a12-47fe-81c1-0a5c4efdda7c)

### Source code you are trying to analyze/transform

_No response_

### Source code for your Spoon processing

```Java
FilteringFolder filteringFolder = filteringFolder.addFolder(new FileSystemFolder(projectPath));
List allSpoonFiles = filteringFolder.getAllFiles();
Set allFiles = allSpoonFiles.stream().map(file -> file.toFile()).collect(Collectors.toSet());
IncrementalLauncher incrementalLauncher = new IncrementalLauncher(allFiles, Collections.EMPTY_SET, new File(dataCollector.project.getOutDirStr()));
incrementalLauncher.getEnvironment().setComplianceLevel(11);
incrementalLauncher.getEnvironment().setAutoImports(true);
incrementalLauncher.getEnvironment().setIgnoreDuplicateDeclarations(true);
incrementalLauncher.buildModel();

// This bug occurs only when false is set
incrementalLauncher.getEnvironment().setShouldCompile(false);
incrementalLauncher.saveCache()
```

### Actual output

_No response_

### Expected output

_No response_

### Spoon Version

10.4.0

### JVM Version

11

### What operating system are you using?

windows

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.