code: private Geometry getArealGeometryFromLinearRing(LinearRing ring) {
          if (ring.isSimple()) {
              return ring.getFactory().createMultiPolygon(new Polygon[]{
                  ring.getFactory().createPolygon(ring, EMPTY_RING_ARRAY)
              });
          } else {
              // Node input LinearRing and extract unique segments
              Set<LineString> lines = nodeLineString(ring.getCoordinates(), ring.getFactory());
              lines = getSegments(lines);
  
              // Polygonize the line network
              Polygonizer polygonizer = new Polygonizer();
              polygonizer.add(lines);
  
              // Computes intersections to determine the status of each polygon
              Collection<Geometry> geoms = new ArrayList();
              for (Object object : polygonizer.getPolygons()) {
                  Polygon polygon = (Polygon) object;
                  Coordinate p = polygon.getInteriorPoint().getCoordinate();
                  int location = RayCrossingCounter.locatePointInRing(p, ring.getCoordinateSequence());
                  if (location == Location.INTERIOR) {
                      geoms.add(polygon);
                  }
              }
              Geometry unionPoly = UnaryUnionOp.union(geoms);
              Geometry unionLines = UnaryUnionOp.union(lines).difference(unionPoly.getBoundary());
              geoms.clear();
              decompose(unionPoly, geoms);
              decompose(unionLines, geoms);
              return ring.getFactory().buildGeometry(geoms);
          }
      }
docs: Node a LinearRing and return a MultiPolygon containing
  <ul>
  <li>a single Polygon if the LinearRing is simple</li>
  <li>several Polygons if the LinearRing auto-intersects</li>
  </ul>
  This is used to repair auto-intersecting Polygons