Program: 175384
Project: 175384
Buggy source:
@Override public void adapt(EarthGenerationSettings settings,RegionData data,int x,int z,int width,int height){
  OverpassTileAccess overpassTile=data.getOverpassTile();
  short[] heightBuffer=data.getHeights();
  GlobType[] globBuffer=data.getGlobcover();
  List<OverpassSource.Element> coastlines=overpassTile.getElements().stream().filter(element -> element.isType("String_Node_Str","String_Node_Str")).collect(Collectors.toList());
  if (!coastlines.isEmpty()) {
    int[] landmap=new int[width * height];
    for (int i=0; i < landmap.length; i++) {
      landmap[i]=globBuffer[i] == GlobType.WATER ? OCEAN : LAND;
    }
    Object2IntMap<FloodFill.Point> floodPoints=new Object2IntOpenHashMap<>();
    for (    OverpassSource.Element coastline : coastlines) {
      List<OverpassSource.Element> nodes=coastline.collectNodes(overpassTile);
      for (int nodeIndex=1; nodeIndex < nodes.size(); nodeIndex++) {
        OverpassSource.Element current=nodes.get(nodeIndex - 1);
        OverpassSource.Element next=nodes.get(nodeIndex);
        Coordinate currentCoordinate=Coordinate.fromLatLng(settings,current.getLatitude(),current.getLongitude());
        double originX=currentCoordinate.getBlockX();
        double originZ=currentCoordinate.getBlockZ();
        Coordinate nextCoordinate=Coordinate.fromLatLng(settings,next.getLatitude(),next.getLongitude());
        while (Math.abs(nextCoordinate.getBlockX() - originX) < 3.0 && Math.abs(nextCoordinate.getBlockZ() - originZ) < 3.0) {
          if (++nodeIndex >= nodes.size()) {
            break;
          }
          OverpassSource.Element node=nodes.get(nodeIndex);
          nextCoordinate=Coordinate.fromLatLng(settings,node.getLatitude(),node.getLongitude());
        }
        double targetX=nextCoordinate.getBlockX();
        double targetZ=nextCoordinate.getBlockZ();
        int lineType=this.getLineType(currentCoordinate,nextCoordinate);
        int coastType=lineType & 252;
        List<Point> points=new ArrayList<>();
        Interpolation.interpolateLine(originX,originZ,targetX,targetZ,false,point -> {
          int localX=point.x - x;
          int localZ=point.y - z;
          if (localX >= 0 && localZ >= 0 && localX < width && localZ < height) {
            landmap[localX + localZ * width]=lineType;
            this.freeNeighbours(width,height,landmap,localX,localZ);
            points.add(point);
          }
        }
);
        if (points.size() > 2) {
          for (int i=1; i < points.size() - 1; i++) {
            Point point=points.get(i);
            int localX=point.x - x;
            int localZ=point.y - z;
            if (coastType != 0) {
              if (localX > 0) {
                int left=coastType == COAST_UP ? LAND : OCEAN;
                floodPoints.put(new FloodFill.Point(localX - 1,localZ),left);
              }
              if (localX < width - 1) {
                int right=coastType == COAST_UP ? OCEAN : LAND;
                floodPoints.put(new FloodFill.Point(localX + 1,localZ),right);
              }
            }
          }
        }
      }
    }
    for (    Map.Entry<FloodFill.Point,Integer> entry : floodPoints.entrySet()) {
      FloodFill.Point point=entry.getKey();
      int floodType=entry.getValue();
      int sampled=landmap[point.getX() + point.getZ() * width];
      FillVisitor visitor=new FillVisitor(floodType);
      if (visitor.canVisit(sampled)) {
        FloodFill.floodVisit(landmap,width,height,point,visitor);
      }
    }
    List<FloodFill.Point> unselectedPoints=new LinkedList<>();
    for (int i=0; i < globBuffer.length; i++) {
      GlobType glob=globBuffer[i];
      int landType=landmap[i] & 3;
      if (landType == OCEAN) {
        globBuffer[i]=GlobType.WATER;
        heightBuffer[i]=1;
      }
 else       if (glob == GlobType.WATER) {
        globBuffer[i]=GlobType.UNSELECTED;
        unselectedPoints.add(new FloodFill.Point(i % width,i / width));
      }
    }
    for (    FloodFill.Point point : unselectedPoints) {
      GlobSelectVisitor visitor=new GlobSelectVisitor();
      FloodFill.floodVisit(globBuffer,width,height,point,visitor);
      globBuffer[point.getX() + point.getZ() * width]=visitor.getResult();
    }
  }
}

Fixed version (ground truth):
@Override public void adapt(EarthGenerationSettings settings,RegionData data,int x,int z,int width,int height){
  OverpassTileAccess overpassTile=data.getOverpassTile();
  short[] heightBuffer=data.getHeights();
  GlobType[] globBuffer=data.getGlobcover();
  List<OverpassSource.Element> coastlines=overpassTile.getElements().stream().filter(element -> element.isType("String_Node_Str","String_Node_Str")).collect(Collectors.toList());
  if (!coastlines.isEmpty()) {
    int[] landmap=new int[width * height];
    for (int i=0; i < landmap.length; i++) {
      landmap[i]=globBuffer[i] == GlobType.WATER ? OCEAN : LAND;
    }
    Object2IntMap<FloodFill.Point> floodPoints=new Object2IntOpenHashMap<>();
    for (    OverpassSource.Element coastline : coastlines) {
      List<OverpassSource.Element> nodes=coastline.collectNodes(overpassTile);
      for (int nodeIndex=1; nodeIndex < nodes.size(); nodeIndex++) {
        OverpassSource.Element current=nodes.get(nodeIndex - 1);
        OverpassSource.Element next=nodes.get(nodeIndex);
        Coordinate currentCoordinate=Coordinate.fromLatLng(settings,current.getLatitude(),current.getLongitude());
        double originX=currentCoordinate.getBlockX();
        double originZ=currentCoordinate.getBlockZ();
        Coordinate nextCoordinate=Coordinate.fromLatLng(settings,next.getLatitude(),next.getLongitude());
        while (Math.abs(nextCoordinate.getBlockX() - originX) < 3.0 && Math.abs(nextCoordinate.getBlockZ() - originZ) < 3.0) {
          if (++nodeIndex >= nodes.size()) {
            break;
          }
          OverpassSource.Element node=nodes.get(nodeIndex);
          nextCoordinate=Coordinate.fromLatLng(settings,node.getLatitude(),node.getLongitude());
        }
        double targetX=nextCoordinate.getBlockX();
        double targetZ=nextCoordinate.getBlockZ();
        int lineType=this.getLineType(currentCoordinate,nextCoordinate);
        int coastType=lineType & 252;
        List<Point> points=new ArrayList<>();
        Interpolation.interpolateLine(originX,originZ,targetX,targetZ,false,point -> {
          int localX=point.x - x;
          int localZ=point.y - z;
          if (localX >= 0 && localZ >= 0 && localX < width && localZ < height) {
            landmap[localX + localZ * width]=lineType;
            this.freeNeighbours(width,height,landmap,localX,localZ);
            points.add(point);
          }
        }
);
        if (points.size() > 2) {
          for (int i=1; i < points.size() - 1; i++) {
            Point point=points.get(i);
            int localX=point.x - x;
            int localZ=point.y - z;
            if (coastType != 0) {
              if (localX > 0) {
                int left=coastType == COAST_UP ? LAND : OCEAN;
                floodPoints.put(new FloodFill.Point(localX - 1,localZ),left);
              }
              if (localX < width - 1) {
                int right=coastType == COAST_UP ? OCEAN : LAND;
                floodPoints.put(new FloodFill.Point(localX + 1,localZ),right);
              }
            }
          }
        }
      }
    }
    for (    Map.Entry<FloodFill.Point,Integer> entry : floodPoints.entrySet()) {
      FloodFill.Point point=entry.getKey();
      int floodType=entry.getValue();
      int sampled=landmap[point.getX() + point.getZ() * width];
      FillVisitor visitor=new FillVisitor(floodType);
      if (visitor.canVisit(sampled)) {
        FloodFill.floodVisit(landmap,width,height,point,visitor);
      }
    }
    List<FloodFill.Point> unselectedPoints=new LinkedList<>();
    for (int i=0; i < globBuffer.length; i++) {
      GlobType glob=globBuffer[i];
      int landType=landmap[i] & 3;
      if (landType == OCEAN) {
        if (globBuffer[i] != GlobType.WATER) {
          globBuffer[i]=GlobType.WATER;
          heightBuffer[i]=1;
        }
      }
 else       if (glob == GlobType.WATER) {
        globBuffer[i]=GlobType.UNSELECTED;
        unselectedPoints.add(new FloodFill.Point(i % width,i / width));
      }
    }
    for (    FloodFill.Point point : unselectedPoints) {
      GlobSelectVisitor visitor=new GlobSelectVisitor();
      FloodFill.floodVisit(globBuffer,width,height,point,visitor);
      globBuffer[point.getX() + point.getZ() * width]=visitor.getResult();
    }
  }
}