You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I was trying to speed up model building process by building only outdated files, and probably I found some bug.
Here is the code, that I use to build the model:
So, as far as I understand, in order to build only outdated files we need to save spoon-generated source files, and then spoon will compare their modification time with actual source files.
When I run this code at the first time, it works fine (when it builds model from scratch).
But then, if I run this code again, I will get:
Exception in thread "main" java.lang.UnsupportedOperationException
at java.util.Collections$UnmodifiableCollection.remove(Collections.java:1058)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.keepOutdatedFiles(JDTBasedSpoonCompiler.java:546)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildUnits(JDTBasedSpoonCompiler.java:412)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildUnitsAndModel(JDTBasedSpoonCompiler.java:377)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.buildSources(JDTBasedSpoonCompiler.java:353)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:124)
at spoon.support.compiler.jdt.JDTBasedSpoonCompiler.build(JDTBasedSpoonCompiler.java:107)
at spoon.Launcher.buildModel(Launcher.java:705)
at com.pvsstudio.pvsjava.analyzer.Main.buildModel(Main.java:80)
at com.pvsstudio.pvsjava.analyzer.Main.main(Main.java:138)
protected void keepOutdatedFiles(List<SpoonFile> files, Collection<File> outputFiles) {
....
File f = sf.toFile();
for (String s : relativeOutputPaths) {
if (f.getAbsolutePath().endsWith(s)) {
if (f.lastModified() <= new File(outputDirectory, s).lastModified()) {
files.remove(sf); // <== But files is unmodifiable list!
}
}
}
}
So, as you can see, exception is thrown because of .remove(sf) call on unmodifiable list.
I'm pretty sure, that sourceFiles should not be an unmodifiableList.
I really want some fix, because without it I can not use incremental model build.
In addition, I've got one more question about model building. Is it possible to use multiple CPU-cores to speed up the build?
Thank you.
The text was updated successfully, but these errors were encountered:
Hi. I was trying to speed up model building process by building only outdated files, and probably I found some bug.
Here is the code, that I use to build the model:
So, as far as I understand, in order to build only outdated files we need to save spoon-generated source files, and then spoon will compare their modification time with actual source files.
When I run this code at the first time, it works fine (when it builds model from scratch).
But then, if I run this code again, I will get:
I looked through the spoon code, and found this:
So, as you can see, exception is thrown because of .remove(sf) call on unmodifiable list.
I'm pretty sure, that sourceFiles should not be an unmodifiableList.
I really want some fix, because without it I can not use incremental model build.
In addition, I've got one more question about model building. Is it possible to use multiple CPU-cores to speed up the build?
Thank you.
The text was updated successfully, but these errors were encountered: