mbien opened a new pull request, #7631:
URL: https://github.com/apache/netbeans/pull/7631

   `LazySortText` implements `CharSequence` but misses a `toString()` method.
   
   It would use `Object#toString() `before and since it is used as comparator 
input, it lead to undesired results.
   
   This was the case with 'List.of' for example. ('List' must not have an 
import yet)
   
   before
   
![completion-sort-issue_before](https://github.com/user-attachments/assets/fbbcce90-4522-4239-b2da-0d546f7e82dc)
   
   after
   
![completion-sort-issue_fixed](https://github.com/user-attachments/assets/908f14e5-e38b-401a-ac61-7565865bab2a)
   
   test
   ```java
   public class Mavenproject1 {
       public static void main(String[] args) {
           // use completion after 'of'
           java.util.Set.of; // sort works
           List.of;          // sort fails
       }
   }
   ```
   
   - - -
   
   assignment (`enclSortText` can be of type `String` or `LazySortText`):
   
https://github.com/apache/netbeans/blob/03aa32d15aba53f980e095b1a8efa6700c515331/java/java.editor/src/org/netbeans/modules/editor/java/JavaCompletionItem.java#L1564-L1568
   
   search token:
   
https://github.com/apache/netbeans/blob/03aa32d15aba53f980e095b1a8efa6700c515331/java/java.editor/src/org/netbeans/modules/editor/java/JavaCompletionItem.java#L1913
   
   comparator:
   
https://github.com/apache/netbeans/blob/03aa32d15aba53f980e095b1a8efa6700c515331/ide/editor.completion/src/org/netbeans/modules/editor/completion/CompletionItemComparator.java#L59-L60
   


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