code: private Geometry nodePolygon(Polygon polygon) {
          LinearRing exteriorRing = (LinearRing) polygon.getExteriorRing();
          Geometry geom = getArealGeometryFromLinearRing(exteriorRing);
          // geom can be a GeometryCollection
          // extract polygonal areas because symDifference cannot process GeometryCollections
          List<Geometry> polys = new ArrayList<>();
          List<Geometry> lines = new ArrayList<>();
          List<Geometry> points = new ArrayList<>();
          geom.apply(new PolygonExtracter(polys));
          geom.apply(new LineStringExtracter(lines));
          geom.apply(new PointExtracter(points));
          geom = geom.getFactory().buildGeometry(polys);
          for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
              LinearRing interiorRing = (LinearRing) polygon.getInteriorRingN(i);
              // extract polygonal areas because symDifference cannot process GeometryCollections
              polys.clear();
              getArealGeometryFromLinearRing(interiorRing).apply(new PolygonExtracter(polys));
              // TODO avoid the use of difference operator
              geom = geom.symDifference(geom.getFactory().buildGeometry(polys));
          }
          List<Geometry> result = new ArrayList<>();
          result.add(geom);
          result.addAll(lines);
          result.addAll(points);
          return geom.getFactory().buildGeometry(result);
      }
docs: Computes a valid Geometry from a Polygon which may not be valid
  (auto-intersecting ring or overlapping holes).
  <ul>
  <li>creates a Geometry from the <em>noded</em> exterior boundary</li>
  <li>remove Geometries computed from noded interior boundaries</li>
  </ul>