use of org.jetbrains.jps.intellilang.model.JpsIntelliLangConfiguration in project intellij-community by JetBrains.
the class PatternValidatorBuilder method instrument.
@Nullable
@Override
protected BinaryContent instrument(CompileContext context, CompiledClass compiled, ClassReader reader, ClassWriter writer, InstrumentationClassFinder finder) {
final JpsIntelliLangConfiguration config = JpsIntelliLangExtensionService.getInstance().getConfiguration(context.getProjectDescriptor().getModel().getGlobal());
final PatternInstrumenter instrumenter = new PatternInstrumenter(config.getPatternAnnotationClass(), writer, config.getInstrumentationType(), finder);
try {
reader.accept(instrumenter, 0);
if (instrumenter.instrumented()) {
return new BinaryContent(writer.toByteArray());
}
} catch (InstrumentationException e) {
context.processMessage(new CompilerMessage(getPresentableName(), BuildMessage.Kind.ERROR, e.getMessage()));
}
return null;
}
Aggregations