use of org.jetbrains.jps.builders.storage.BuildDataCorruptedException in project intellij-community by JetBrains.
the class ClassRepr method save.
@Override
public void save(final DataOutput out) {
try {
super.save(out);
DataInputOutputUtil.writeINT(out, myFileName);
mySuperClass.save(out);
RW.save(myInterfaces, out);
RW.save(myFields, out);
RW.save(myMethods, out);
RW.save(myAnnotationTargets, UsageRepr.AnnotationUsage.elementTypeExternalizer, out);
RW.writeUTF(out, myRetentionPolicy == null ? "" : myRetentionPolicy.toString());
DataInputOutputUtil.writeINT(out, myOuterClassName);
DataInputOutputUtil.writeINT(out, (myIsLocal ? LOCAL_MASK : 0) | (myIsAnonymous ? ANONYMOUS_MASK : 0));
RW.save(myUsages, UsageRepr.externalizer(myContext), out);
} catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
use of org.jetbrains.jps.builders.storage.BuildDataCorruptedException in project intellij-community by JetBrains.
the class IntIntPersistentMultiMaplet method remove.
@Override
public void remove(final int key) {
try {
myCache.remove(key);
myMap.remove(key);
} catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
use of org.jetbrains.jps.builders.storage.BuildDataCorruptedException in project intellij-community by JetBrains.
the class Proto method save.
@Override
public void save(final DataOutput out) {
try {
DataInputOutputUtil.writeINT(out, access);
DataInputOutputUtil.writeINT(out, signature);
DataInputOutputUtil.writeINT(out, name);
RW.save(annotations, out);
} catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
use of org.jetbrains.jps.builders.storage.BuildDataCorruptedException in project intellij-community by JetBrains.
the class RW method save.
public static <X extends Savable> void save(final Collection<X> x, final DataOutput out) {
try {
final int size = x.size();
DataInputOutputUtil.writeINT(out, size);
for (X s : x) {
s.save(out);
}
} catch (IOException e) {
throw new BuildDataCorruptedException(e);
}
}
use of org.jetbrains.jps.builders.storage.BuildDataCorruptedException in project intellij-community by JetBrains.
the class JavaBuilder method doBuild.
public ExitCode doBuild(@NotNull CompileContext context, @NotNull ModuleChunk chunk, @NotNull DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder, @NotNull OutputConsumer outputConsumer, @NotNull JavaCompilingTool compilingTool) throws ProjectBuildException, IOException {
try {
final Set<File> filesToCompile = new THashSet<>(FileUtil.FILE_HASHING_STRATEGY);
dirtyFilesHolder.processDirtyFiles(new FileProcessor<JavaSourceRootDescriptor, ModuleBuildTarget>() {
@Override
public boolean apply(ModuleBuildTarget target, File file, JavaSourceRootDescriptor descriptor) throws IOException {
if (JAVA_SOURCES_FILTER.accept(file) && ourCompilableModuleTypes.contains(target.getModule().getModuleType())) {
filesToCompile.add(file);
}
return true;
}
});
if ((!filesToCompile.isEmpty() || dirtyFilesHolder.hasRemovedFiles()) && JpsJavaSdkType.parseVersion(getLanguageLevel(ContainerUtil.getFirstItem(chunk.getModules()))) >= 9) {
// at the moment, there is no incremental compilation for module-info files, so they should be rebuilt on every change
JavaModuleIndex index = getJavaModuleIndex(context);
for (JpsModule module : chunk.getModules()) {
ContainerUtil.addIfNotNull(filesToCompile, index.getModuleInfoFile(module));
}
}
if (JavaBuilderUtil.isCompileJavaIncrementally(context)) {
ProjectBuilderLogger logger = context.getLoggingManager().getProjectBuilderLogger();
if (logger.isEnabled() && !filesToCompile.isEmpty()) {
logger.logCompiledFiles(filesToCompile, BUILDER_NAME, "Compiling files:");
}
}
return compile(context, chunk, dirtyFilesHolder, filesToCompile, outputConsumer, compilingTool);
} catch (BuildDataCorruptedException | PersistentEnumeratorBase.CorruptedException | ProjectBuildException e) {
throw e;
} catch (Exception e) {
LOG.info(e);
String message = e.getMessage();
if (message == null) {
final ByteArrayOutputStream out = new ByteArrayOutputStream();
final PrintStream stream = new PrintStream(out);
try {
e.printStackTrace(stream);
} finally {
stream.close();
}
message = "Internal error: \n" + out;
}
context.processMessage(new CompilerMessage(BUILDER_NAME, BuildMessage.Kind.ERROR, message));
throw new StopBuildException();
}
}
Aggregations