github-advanced-security[bot] commented on code in PR #873:
URL: 
https://github.com/apache/incubator-baremaps/pull/873#discussion_r1637249420


##########
baremaps-openstreetmap/src/test/java/org/apache/baremaps/openstreetmap/OsmTestData.java:
##########
@@ -127,7 +127,7 @@
     }
   }
 
-  private class OsmTest implements Comparable<OsmTest> {
+  static class OsmTest implements Comparable<OsmTest> {

Review Comment:
   ## Inconsistent compareTo
   
   This class declares [compareTo](1) but inherits equals; the two could be 
inconsistent.
   
   [Show more 
details](https://github.com/apache/incubator-baremaps/security/code-scanning/1458)



##########
baremaps-core/src/main/java/org/apache/baremaps/database/function/ChangeElementsImporter.java:
##########
@@ -49,14 +49,14 @@
   /** {@inheritDoc} */
   @Override
   public void accept(Change change) {
-    switch (change.getType()) {
+    switch (change.type()) {

Review Comment:
   ## Missing enum case in switch
   
   Switch statement does not have a case for [MODIFY](1).
   
   [Show more 
details](https://github.com/apache/incubator-baremaps/security/code-scanning/1459)



##########
baremaps-core/src/main/java/org/apache/baremaps/database/function/PutChangeImporter.java:
##########
@@ -57,23 +57,23 @@
   /** {@inheritDoc} */
   @Override
   public void accept(Change change) {
-    var nodes = change.getEntities().stream()
+    var nodes = change.entities().stream()
         .filter(entity -> entity instanceof Node)
         .map(entity -> (Node) entity)
         .toList();
     var nodeIds = nodes.stream().map(Node::getId).toList();
-    var ways = change.getEntities().stream()
+    var ways = change.entities().stream()
         .filter(entity -> entity instanceof Way)
         .map(entity -> (Way) entity)
         .toList();
     var wayIds = ways.stream().map(Way::getId).toList();
-    var relations = change.getEntities().stream()
+    var relations = change.entities().stream()
         .filter(entity -> entity instanceof Relation)
         .map(entity -> (Relation) entity)
         .toList();
     var relationIds = relations.stream().map(Relation::getId).toList();
     try {
-      switch (change.getType()) {
+      switch (change.type()) {

Review Comment:
   ## Missing enum case in switch
   
   Switch statement does not have a case for [MODIFY](1).
   
   [Show more 
details](https://github.com/apache/incubator-baremaps/security/code-scanning/1460)



##########
baremaps-maplibre/src/main/java/org/apache/baremaps/maplibre/vectortile/VectorTileEncoder.java:
##########
@@ -183,18 +183,18 @@
    * @param encoding The consumer of commands and parameters.
    */
   protected void encodeGeometry(Geometry geometry, Consumer<Integer> encoding) 
{
-    if (geometry instanceof Point) {
-      encodePoint((Point) geometry, encoding);
-    } else if (geometry instanceof MultiPoint) {
-      encodeMultiPoint((MultiPoint) geometry, encoding);
-    } else if (geometry instanceof LineString) {
-      encodeLineString((LineString) geometry, encoding);
-    } else if (geometry instanceof MultiLineString) {
-      encodeMultiLineString((MultiLineString) geometry, encoding);
-    } else if (geometry instanceof Polygon) {
-      encodePolygon((Polygon) geometry, encoding);
-    } else if (geometry instanceof MultiPolygon) {
-      encodeMultiPolygon((MultiPolygon) geometry, encoding);
+    if (geometry instanceof Point point) {

Review Comment:
   ## Chain of 'instanceof' tests
   
   This if block performs a chain of 7 type tests - consider alternatives, e.g. 
polymorphism or the visitor pattern.
   
   [Show more 
details](https://github.com/apache/incubator-baremaps/security/code-scanning/1452)



##########
baremaps-core/src/main/java/org/apache/baremaps/database/function/CopyChangeImporter.java:
##########
@@ -56,23 +56,23 @@
   /** {@inheritDoc} */
   @Override
   public void accept(Change change) {
-    var nodes = change.getEntities().stream()
+    var nodes = change.entities().stream()
         .filter(entity -> entity instanceof Node)
         .map(entity -> (Node) entity)
         .toList();
     var nodeIds = nodes.stream().map(Node::getId).toList();
-    var ways = change.getEntities().stream()
+    var ways = change.entities().stream()
         .filter(entity -> entity instanceof Way)
         .map(entity -> (Way) entity)
         .toList();
     var wayIds = ways.stream().map(Way::getId).toList();
-    var relations = change.getEntities().stream()
+    var relations = change.entities().stream()
         .filter(entity -> entity instanceof Relation)
         .map(entity -> (Relation) entity)
         .toList();
     var relationIds = relations.stream().map(Relation::getId).toList();
     try {
-      switch (change.getType()) {
+      switch (change.type()) {

Review Comment:
   ## Missing enum case in switch
   
   Switch statement does not have a case for [MODIFY](1).
   
   [Show more 
details](https://github.com/apache/incubator-baremaps/security/code-scanning/1461)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to