ppisl commented on code in PR #4091:
URL: https://github.com/apache/netbeans/pull/4091#discussion_r907393850


##########
groovy/groovy.editor/src/org/netbeans/modules/groovy/editor/api/GroovyIndex.java:
##########
@@ -649,38 +673,35 @@ private IndexedField createField(String signature, 
IndexResult map, boolean inhe
 
         //String fqn = map.getValue(GroovyIndexer.FQN_NAME);
 
-        int typeIndex = signature.indexOf(';');
-        String name = signature;
-        String type = "java.lang.Object";
-        if (typeIndex != -1) {
-            int endIndex = signature.indexOf(';', typeIndex + 1);
-            if (endIndex == -1) {
-                endIndex = signature.length();
-            }
-            type = signature.substring(typeIndex + 1, endIndex);
-            name = signature.substring(0, typeIndex);
-        }
-
-        int attributeIndex = signature.indexOf(';', typeIndex + 1);
-        String attributes = null;
-        int flags = 0;
-
-        if (attributeIndex != -1) {
-            flags = IndexedElement.stringToFlag(signature, attributeIndex + 1);
-
-            if (signature.length() > attributeIndex + 1) {
-                attributes = signature.substring(attributeIndex + 1, 
signature.length());
-            }
-
-            //signature = signature.substring(0, attributeIndex);
-        }
-
+        String[] parts = signature.split(";");
+        String name = parts[0];
+        String type = parts[1].isEmpty() ? "java.lang.Object" : parts[1];
+        int flags = parts[2].isEmpty() ? 0 : 
IndexedElement.stringToFlag(parts[2], 0);
+        String isProperty = parts[3];
+        String attributes = flags + ";" + isProperty;
+        OffsetRange range = createOffsetRange(parts[4]);
+        
         IndexedField m = IndexedField.create(type, name, clz, map, attributes, 
flags);
         m.setInherited(inherited);
-
+        if (range != null) {
+            m.setOffsetRange(range);
+        }   
         return m;
     }
 
+    private static OffsetRange createOffsetRange(String text) {
+        OffsetRange result = null;
+        int offsetStartIndex = text.indexOf('[');
+        int commaIndex = text.indexOf(',', offsetStartIndex + 1);
+        int offsetLastIndex = text.indexOf(']', commaIndex != -1 ? commaIndex 
: offsetStartIndex);

Review Comment:
   Changed :)



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to