public static @NotNull JpsSdk<JpsDummyElement> ensureModuleHasJdk(JpsModule module, CompileContext context, final @Nls String compilerName) throws ProjectBuildException {
    JpsSdkReference<JpsDummyElement> reference = module.getSdkReference(JpsJavaSdkType.INSTANCE);
    if (reference == null) {
      context.processMessage(new CompilerMessage(compilerName, BuildMessage.Kind.ERROR,
                                                 JpsBuildBundle.message("build.message.jdk.isn.t.specified.for.module.0", module.getName())));
      throw new StopBuildException();
    }

    JpsTypedLibrary<JpsSdk<JpsDummyElement>> sdkLibrary = reference.resolve();
    if (sdkLibrary == null) {
      JpsLibrary library = context.getProjectDescriptor().getModel().getGlobal().getLibraryCollection().findLibrary(reference.getSdkName());
      JpsSdkType sdkType = library != null ? ObjectUtils.tryCast(library.getType(), JpsSdkType.class) : null;
      String errorMessage;
      if (sdkType == null) {
        errorMessage = JpsBuildBundle.message("build.message.cannot.find.jdk.0.for.module.1", reference.getSdkName(), module.getName());
      }
      else {
        errorMessage = JpsBuildBundle.message("build.message.cannot.find.jdk.for.module.0.1.points.to.2", module.getName(), reference.getSdkName(),
                                              sdkType.getPresentableName());
      }
      context.processMessage(new CompilerMessage(compilerName, BuildMessage.Kind.ERROR, errorMessage));
      throw new StopBuildException();
    }
    return sdkLibrary.getProperties();
  }
public static @NotNull JpsSdk<JpsDummyElement> ensureModuleHasJdk(JpsModule module, CompileContext context, final @Nls String compilerName)