File tree Expand file tree Collapse file tree
main/java/com/jaipilot/cli
test/java/com/jaipilot/cli/service Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2929
3030 <properties >
3131 <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
32- <revision >0.3.21 </revision >
32+ <revision >0.3.22 </revision >
3333 <maven .compiler.release>17</maven .compiler.release>
3434 <picocli .version>4.7.7</picocli .version>
3535 <javaparser .version>3.27.1</javaparser .version>
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ public static String resolveVersion() {
1313 Package commandPackage = JaiPilotCli .class .getPackage ();
1414 String version = commandPackage == null ? null : commandPackage .getImplementationVersion ();
1515 if (version == null || version .isBlank ()) {
16- version = "0.3.21 " ;
16+ version = "0.3.22 " ;
1717 }
1818 return version ;
1919 }
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public List<String> read(Path absoluteClassPath) {
3434 }
3535
3636 public void write (Path absoluteClassPath , List <String > usedContextClassPaths ) {
37- Map <String , List <String >> entries = readAll ();
37+ Map <String , List <String >> entries = new LinkedHashMap <> ();
3838 entries .put (cacheKey (absoluteClassPath ), normalizeValues (usedContextClassPaths ));
3939 writeAll (entries );
4040 }
Original file line number Diff line number Diff line change @@ -21,4 +21,17 @@ void writeOverwritesExistingEntryWithoutMerging() {
2121
2222 assertEquals (List .of ("com/example/Pet.java" ), cache .read (classPath ));
2323 }
24+
25+ @ Test
26+ void writeReplacesCacheAcrossDifferentClassPaths () {
27+ UsedContextClassPathCache cache = new UsedContextClassPathCache (tempDir .resolve ("used-context-cache.json" ));
28+ Path firstClassPath = tempDir .resolve ("src/main/java/com/example/CrashController.java" );
29+ Path secondClassPath = tempDir .resolve ("src/main/java/com/example/PetController.java" );
30+
31+ cache .write (firstClassPath , List .of ("com/example/First.java" ));
32+ cache .write (secondClassPath , List .of ("com/example/Second.java" ));
33+
34+ assertEquals (List .of (), cache .read (firstClassPath ));
35+ assertEquals (List .of ("com/example/Second.java" ), cache .read (secondClassPath ));
36+ }
2437}
You can’t perform that action at this time.
0 commit comments