Program: 762
Project: 762
Buggy source:
@Override public void initialise(){
  metaDownloader=new ModuleListDownloader(config.getNetwork().getMasterServer());
  resolver=new DependencyResolver(moduleManager.getRegistry());
  modulesLookup=Maps.newHashMap();
  sortedModules=Lists.newArrayList();
  final UIList<ModuleSelectionInfo> moduleList=find("String_Node_Str",UIList.class);
  if (moduleList != null) {
    moduleList.setList(sortedModules);
    moduleList.setItemRenderer(new AbstractItemRenderer<ModuleSelectionInfo>(){
      public String getString(      ModuleSelectionInfo value){
        return value.getMetadata().getDisplayName().toString();
      }
      @Override public void draw(      ModuleSelectionInfo value,      Canvas canvas){
        if (isSelectedGameplayModule(value)) {
          canvas.setMode("String_Node_Str");
        }
 else         if (value.isSelected() && value.isExplicitSelection()) {
          canvas.setMode("String_Node_Str");
        }
 else         if (value.isSelected()) {
          canvas.setMode("String_Node_Str");
        }
 else         if (value.isValidToSelect()) {
          canvas.setMode("String_Node_Str");
        }
 else {
          canvas.setMode("String_Node_Str");
        }
        canvas.drawText(getString(value),canvas.getRegion());
      }
      @Override public Vector2i getPreferredSize(      ModuleSelectionInfo value,      Canvas canvas){
        String text=getString(value);
        return new Vector2i(canvas.getCurrentStyle().getFont().getWidth(text),canvas.getCurrentStyle().getFont().getLineHeight());
      }
    }
);
    moduleList.subscribe(new ItemActivateEventListener<ModuleSelectionInfo>(){
      @Override public void onItemActivated(      UIWidget widget,      ModuleSelectionInfo item){
        if (item.isSelected() && moduleList.getSelection().isExplicitSelection()) {
          deselect(item);
        }
 else         if (item.isValidToSelect()) {
          select(item);
        }
      }
    }
);
    final Binding<ModuleMetadata> moduleInfoBinding=new ReadOnlyBinding<ModuleMetadata>(){
      @Override public ModuleMetadata get(){
        if (moduleList.getSelection() != null) {
          return moduleList.getSelection().getMetadata();
        }
        return null;
      }
    }
;
    UILabel name=find("String_Node_Str",UILabel.class);
    if (name != null) {
      name.bindText(new ReadOnlyBinding<String>(){
        @Override public String get(){
          if (moduleInfoBinding.get() != null) {
            return moduleInfoBinding.get().getDisplayName().toString();
          }
          return "String_Node_Str";
        }
      }
);
    }
    UILabel installedVersion=find("String_Node_Str",UILabel.class);
    if (installedVersion != null) {
      installedVersion.bindText(new ReadOnlyBinding<String>(){
        @Override public String get(){
          ModuleSelectionInfo sel=moduleList.getSelection();
          if (sel == null) {
            return "String_Node_Str";
          }
          return sel.isPresent() ? sel.getMetadata().getVersion().toString() : "String_Node_Str";
        }
      }
);
    }
    UILabel onlineVersion=find("String_Node_Str",UILabel.class);
    if (onlineVersion != null) {
      onlineVersion.bindText(new ReadOnlyBinding<String>(){
        @Override public String get(){
          ModuleSelectionInfo sel=moduleList.getSelection();
          if (sel == null) {
            return "String_Node_Str";
          }
          return (sel.getOnlineVersion() != null) ? sel.getOnlineVersion().getVersion().toString() : "String_Node_Str";
        }
      }
);
    }
    UILabel description=find("String_Node_Str",UILabel.class);
    if (description != null) {
      description.bindText(new ReadOnlyBinding<String>(){
        @Override public String get(){
          if (moduleInfoBinding.get() != null) {
            return moduleInfoBinding.get().getDescription().toString();
          }
          return "String_Node_Str";
        }
      }
);
    }
    UILabel status=find("String_Node_Str",UILabel.class);
    if (status != null) {
      status.bindText(new ReadOnlyBinding<String>(){
        @Override public String get(){
          ModuleSelectionInfo info=moduleList.getSelection();
          if (info != null) {
            if (isSelectedGameplayModule(info)) {
              return "String_Node_Str";
            }
 else             if (info.isSelected() && info.isExplicitSelection()) {
              return "String_Node_Str";
            }
 else             if (info.isSelected()) {
              return "String_Node_Str";
            }
 else             if (info.isValidToSelect()) {
              return "String_Node_Str";
            }
 else {
              return "String_Node_Str";
            }
          }
          return "String_Node_Str";
        }
      }
);
    }
    UIButton toggleActivate=find("String_Node_Str",UIButton.class);
    if (toggleActivate != null) {
      toggleActivate.subscribe(new ActivateEventListener(){
        @Override public void onActivated(        UIWidget button){
          ModuleSelectionInfo info=moduleList.getSelection();
          if (info != null) {
            if (info.isSelected() && info.isExplicitSelection()) {
              deselect(info);
            }
 else             if (info.isValidToSelect()) {
              select(info);
            }
          }
        }
      }
);
      toggleActivate.bindEnabled(new ReadOnlyBinding<Boolean>(){
        @Override public Boolean get(){
          ModuleSelectionInfo info=moduleList.getSelection();
          return info != null && info.isPresent() && (info.isSelected() || info.isValidToSelect());
        }
      }
);
      toggleActivate.bindText(new ReadOnlyBinding<String>(){
        @Override public String get(){
          if (moduleList.getSelection() != null) {
            if (moduleList.getSelection().isExplicitSelection()) {
              return "String_Node_Str";
            }
 else {
              return "String_Node_Str";
            }
          }
          return "String_Node_Str";
        }
      }
);
    }
    UIButton downloadButton=find("String_Node_Str",UIButton.class);
    if (downloadButton != null) {
      downloadButton.subscribe(new ActivateEventListener(){
        @Override public void onActivated(        UIWidget button){
          if (moduleList.getSelection() != null) {
            ModuleSelectionInfo info=moduleList.getSelection();
            startDownload(info);
          }
        }
      }
);
      Predicate<ModuleSelectionInfo> canDownload=info -> info != null && !info.isPresent();
      Predicate<ModuleSelectionInfo> canUpdate=info -> {
        if (info != null) {
          Module online=info.getOnlineVersion();
          if (online != null) {
            return online.getVersion().compareTo(info.getLatestVersion().getVersion()) > 0;
          }
          return false;
        }
        return false;
      }
;
      downloadButton.bindEnabled(new ReadOnlyBinding<Boolean>(){
        @Override public Boolean get(){
          ModuleSelectionInfo info=moduleList.getSelection();
          if (canDownload.test(info)) {
            return true;
          }
          return canUpdate.test(info);
        }
      }
);
      downloadButton.bindText(new ReadOnlyBinding<String>(){
        @Override public String get(){
          ModuleSelectionInfo info=moduleList.getSelection();
          if (canDownload.test(info)) {
            return "String_Node_Str";
          }
          if (canUpdate.test(info)) {
            return "String_Node_Str";
          }
          return "String_Node_Str";
        }
      }
);
    }
    UIButton disableAll=find("String_Node_Str",UIButton.class);
    if (disableAll != null) {
      disableAll.subscribe(new ActivateEventListener(){
        @Override public void onActivated(        UIWidget button){
          for (          ModuleSelectionInfo info : sortedModules) {
            if (info.isSelected() && info.isExplicitSelection()) {
              deselect(info);
            }
          }
        }
      }
);
    }
  }
  WidgetUtil.trySubscribe(this,"String_Node_Str",new ActivateEventListener(){
    @Override public void onActivated(    UIWidget button){
      getManager().popScreen();
    }
  }
);
}

Fixed version (ground truth):
@Override public void initialise(){
  metaDownloader=new ModuleListDownloader(config.getNetwork().getMasterServer());
  resolver=new DependencyResolver(moduleManager.getRegistry());
  modulesLookup=Maps.newHashMap();
  sortedModules=Lists.newArrayList();
  for (  Name moduleId : moduleManager.getRegistry().getModuleIds()) {
    Module latestVersion=moduleManager.getRegistry().getLatestModuleVersion(moduleId);
    if (!latestVersion.isOnClasspath()) {
      ModuleSelectionInfo info=ModuleSelectionInfo.local(latestVersion);
      modulesLookup.put(info.getMetadata().getId(),info);
      sortedModules.add(info);
    }
  }
  Collections.sort(sortedModules,moduleInfoComparator);
  final UIList<ModuleSelectionInfo> moduleList=find("String_Node_Str",UIList.class);
  if (moduleList != null) {
    moduleList.setList(sortedModules);
    moduleList.setItemRenderer(new AbstractItemRenderer<ModuleSelectionInfo>(){
      public String getString(      ModuleSelectionInfo value){
        return value.getMetadata().getDisplayName().toString();
      }
      @Override public void draw(      ModuleSelectionInfo value,      Canvas canvas){
        if (isSelectedGameplayModule(value)) {
          canvas.setMode("String_Node_Str");
        }
 else         if (value.isSelected() && value.isExplicitSelection()) {
          canvas.setMode("String_Node_Str");
        }
 else         if (value.isSelected()) {
          canvas.setMode("String_Node_Str");
        }
 else         if (!value.isPresent()) {
          canvas.setMode("String_Node_Str");
        }
 else         if (!value.isValidToSelect()) {
          canvas.setMode("String_Node_Str");
        }
 else {
          canvas.setMode("String_Node_Str");
        }
        canvas.drawText(getString(value),canvas.getRegion());
      }
      @Override public Vector2i getPreferredSize(      ModuleSelectionInfo value,      Canvas canvas){
        String text=getString(value);
        return new Vector2i(canvas.getCurrentStyle().getFont().getWidth(text),canvas.getCurrentStyle().getFont().getLineHeight());
      }
    }
);
    moduleList.subscribe(new ItemActivateEventListener<ModuleSelectionInfo>(){
      @Override public void onItemActivated(      UIWidget widget,      ModuleSelectionInfo item){
        if (item.isSelected() && moduleList.getSelection().isExplicitSelection()) {
          deselect(item);
        }
 else         if (item.isValidToSelect()) {
          select(item);
        }
      }
    }
);
    final Binding<ModuleMetadata> moduleInfoBinding=new ReadOnlyBinding<ModuleMetadata>(){
      @Override public ModuleMetadata get(){
        if (moduleList.getSelection() != null) {
          return moduleList.getSelection().getMetadata();
        }
        return null;
      }
    }
;
    UILabel name=find("String_Node_Str",UILabel.class);
    if (name != null) {
      name.bindText(new ReadOnlyBinding<String>(){
        @Override public String get(){
          if (moduleInfoBinding.get() != null) {
            return moduleInfoBinding.get().getDisplayName().toString();
          }
          return "String_Node_Str";
        }
      }
);
    }
    UILabel installedVersion=find("String_Node_Str",UILabel.class);
    if (installedVersion != null) {
      installedVersion.bindText(new ReadOnlyBinding<String>(){
        @Override public String get(){
          ModuleSelectionInfo sel=moduleList.getSelection();
          if (sel == null) {
            return "String_Node_Str";
          }
          return sel.isPresent() ? sel.getMetadata().getVersion().toString() : "String_Node_Str";
        }
      }
);
    }
    UILabel onlineVersion=find("String_Node_Str",UILabel.class);
    if (onlineVersion != null) {
      onlineVersion.bindText(new ReadOnlyBinding<String>(){
        @Override public String get(){
          ModuleSelectionInfo sel=moduleList.getSelection();
          if (sel == null) {
            return "String_Node_Str";
          }
          return (sel.getOnlineVersion() != null) ? sel.getOnlineVersion().getVersion().toString() : "String_Node_Str";
        }
      }
);
    }
    UILabel description=find("String_Node_Str",UILabel.class);
    if (description != null) {
      description.bindText(new ReadOnlyBinding<String>(){
        @Override public String get(){
          if (moduleInfoBinding.get() != null) {
            return moduleInfoBinding.get().getDescription().toString();
          }
          return "String_Node_Str";
        }
      }
);
    }
    UILabel status=find("String_Node_Str",UILabel.class);
    if (status != null) {
      status.bindText(new ReadOnlyBinding<String>(){
        @Override public String get(){
          ModuleSelectionInfo info=moduleList.getSelection();
          if (info != null) {
            if (isSelectedGameplayModule(info)) {
              return "String_Node_Str";
            }
 else             if (info.isSelected() && info.isExplicitSelection()) {
              return "String_Node_Str";
            }
 else             if (info.isSelected()) {
              return "String_Node_Str";
            }
 else             if (!info.isPresent()) {
              return "String_Node_Str";
            }
 else             if (info.isValidToSelect()) {
              return "String_Node_Str";
            }
 else {
              return "String_Node_Str";
            }
          }
          return "String_Node_Str";
        }
      }
);
    }
    UIButton toggleActivate=find("String_Node_Str",UIButton.class);
    if (toggleActivate != null) {
      toggleActivate.subscribe(new ActivateEventListener(){
        @Override public void onActivated(        UIWidget button){
          ModuleSelectionInfo info=moduleList.getSelection();
          if (info != null) {
            if (info.isSelected() && info.isExplicitSelection()) {
              deselect(info);
            }
 else             if (info.isValidToSelect()) {
              select(info);
            }
          }
        }
      }
);
      toggleActivate.bindEnabled(new ReadOnlyBinding<Boolean>(){
        @Override public Boolean get(){
          ModuleSelectionInfo info=moduleList.getSelection();
          return info != null && info.isPresent() && !isSelectedGameplayModule(info) && (info.isSelected() || info.isValidToSelect());
        }
      }
);
      toggleActivate.bindText(new ReadOnlyBinding<String>(){
        @Override public String get(){
          if (moduleList.getSelection() != null) {
            if (moduleList.getSelection().isExplicitSelection()) {
              return "String_Node_Str";
            }
 else {
              return "String_Node_Str";
            }
          }
          return "String_Node_Str";
        }
      }
);
    }
    UIButton downloadButton=find("String_Node_Str",UIButton.class);
    if (downloadButton != null) {
      downloadButton.subscribe(new ActivateEventListener(){
        @Override public void onActivated(        UIWidget button){
          if (moduleList.getSelection() != null) {
            ModuleSelectionInfo info=moduleList.getSelection();
            startDownload(info);
          }
        }
      }
);
      Predicate<ModuleSelectionInfo> canDownload=info -> info != null && !info.isPresent();
      Predicate<ModuleSelectionInfo> canUpdate=info -> {
        if (info != null) {
          Module online=info.getOnlineVersion();
          if (online != null) {
            return online.getVersion().compareTo(info.getLatestVersion().getVersion()) > 0;
          }
          return false;
        }
        return false;
      }
;
      downloadButton.bindEnabled(new ReadOnlyBinding<Boolean>(){
        @Override public Boolean get(){
          ModuleSelectionInfo info=moduleList.getSelection();
          if (canDownload.test(info)) {
            return true;
          }
          return canUpdate.test(info);
        }
      }
);
      downloadButton.bindText(new ReadOnlyBinding<String>(){
        @Override public String get(){
          ModuleSelectionInfo info=moduleList.getSelection();
          if (canDownload.test(info)) {
            return "String_Node_Str";
          }
          if (canUpdate.test(info)) {
            return "String_Node_Str";
          }
          return "String_Node_Str";
        }
      }
);
    }
    UIButton disableAll=find("String_Node_Str",UIButton.class);
    if (disableAll != null) {
      disableAll.subscribe(new ActivateEventListener(){
        @Override public void onActivated(        UIWidget button){
          for (          ModuleSelectionInfo info : sortedModules) {
            if (info.isSelected() && info.isExplicitSelection()) {
              deselect(info);
            }
          }
        }
      }
);
    }
  }
  WidgetUtil.trySubscribe(this,"String_Node_Str",new ActivateEventListener(){
    @Override public void onActivated(    UIWidget button){
      getManager().popScreen();
    }
  }
);
}