mbien commented on code in PR #8206:
URL: https://github.com/apache/netbeans/pull/8206#discussion_r1933106162


##########
ide/parsing.indexing/src/org/netbeans/modules/parsing/spi/indexing/ErrorsCache.java:
##########
@@ -82,6 +94,62 @@ public static interface Convertor<T> {
         public String    getMessage(T t);
     }
 
+    /**Position in a text expressed as 1-based line and character offset.
+     * @since 9.39
+     */
+     public static final class Position {

Review Comment:
   record candidate



##########
ide/parsing.indexing/src/org/netbeans/modules/parsing/spi/indexing/ErrorsCache.java:
##########
@@ -82,6 +94,62 @@ public static interface Convertor<T> {
         public String    getMessage(T t);
     }
 
+    /**Position in a text expressed as 1-based line and character offset.
+     * @since 9.39
+     */
+     public static final class Position {
+        private int line;
+        private int column;
+
+        public Position(int line, int column) {
+            this.line = line;
+            this.column = column;
+        }
+
+        public int getLine() {
+            return line;
+        }
+
+        public int getColumn() {
+            return column;
+        }
+    }
+
+    /**Range in a text expressed as (1-based) start and end positions.
+     * @since 9.39
+     */
+    public static final class Range {
+        private Position start;
+        private Position end;
+
+        public Range(Position start, Position end) {
+            this.start = start;
+            this.end = end;
+        }
+
+        public Position getStart() {
+            return start;
+        }
+
+        public Position getEnd() {
+            return end;
+        }
+    }
+
+    /**Getter for properties of the given error description including the 
range.
+     * @since 9.39
+     */
+    public static interface Convertor2<T> extends Convertor<T> {
+        public Range getRange(T t);
+    }

Review Comment:
   is the `Convertor2` vs `Convertor` type difference important? If not this 
could be a default method in `Convertor` returning null?
   
   there is one `instanceof Convertor2` in `TaskCache` which could potentially 
be a null check.



##########
ide/parsing.indexing/src/org/netbeans/modules/parsing/impl/indexing/errors/TaskCache.java:
##########
@@ -200,6 +229,7 @@ public <T> void dumpErrors(final URL root, final Indexable 
i, final Iterable<? e
                 }
             });
         } catch (IOException ex) {
+            Exceptions.attachMessage(ex, "can't dump errors for: " + 
String.valueOf(i));
             Exceptions.printStackTrace(ex);
         }

Review Comment:
   I know that we added the `attachMessage()` as last-minute change during last 
RC phase - but this has the side effect or repeating the line, example:
   ```
   SEVERE [org.openide.util.Exceptions]
   can't dump errors for: FileObjectIndexable@58aff7c0 
[file:/home/mbien/NetBeansProjects/netbeans/contrib/j2ee.weblogic9/src//org/netbeans/modules/j2ee/weblogic9/dd/ejb1030/package-info.java]
   can't dump errors for: FileObjectIndexable@58aff7c0 
[file:/home/mbien/NetBeansProjects/netbeans/contrib/j2ee.weblogic9/src//org/netbeans/modules/j2ee/weblogic9/dd/ejb1030/package-info.java]
   Caused: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for 
length 47
   ```
   
   does anything speak against solving this the classic way of wrap + rethrow?
   ```java
       throw new IOException("can't dump errors for: " + String.valueOf(i), ex);
   ```
   
   cc @lahodaj  



##########
ide/parsing.indexing/src/org/netbeans/modules/parsing/impl/indexing/errors/TaskCache.java:
##########
@@ -77,6 +82,8 @@ public class TaskCache {
     
     private static final Logger LOG = 
Logger.getLogger(TaskCache.class.getName());
     
+    private static final Pattern PATTERN = 
Pattern.compile("(\\d*),(\\d*)(?:-(\\d*),(\\d*))?");

Review Comment:
   comment + example string would be good as spec to immediately see what this 
is supposed to match



##########
ide/parsing.indexing/src/org/netbeans/modules/parsing/spi/indexing/ErrorsCache.java:
##########
@@ -82,6 +94,62 @@ public static interface Convertor<T> {
         public String    getMessage(T t);
     }
 
+    /**Position in a text expressed as 1-based line and character offset.
+     * @since 9.39
+     */
+     public static final class Position {
+        private int line;
+        private int column;
+
+        public Position(int line, int column) {
+            this.line = line;
+            this.column = column;
+        }
+
+        public int getLine() {
+            return line;
+        }
+
+        public int getColumn() {
+            return column;
+        }
+    }
+
+    /**Range in a text expressed as (1-based) start and end positions.
+     * @since 9.39
+     */
+    public static final class Range {

Review Comment:
   record candidate



-- 
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: notifications-unsubscr...@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org
For additional commands, e-mail: notifications-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to