Bug 570650

Summary: [HyperlinkManager] handle empty array as null
Product: [Eclipse Project] Platform Reporter: Christoph Laeubrich <laeubi>
Component: TextAssignee: Platform-Text-Inbox <platform-text-inbox>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3    
Version: 4.14   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Christoph Laeubrich CLA 2021-01-26 00:03:57 EST
HyperlinkManager currently enforces that no hyperlinks -> IHyperlinkDetector.detectHyperlinks return null

but this enforcement seems of no value and complicates client code.

The code

> if (hyperlinks == null)
>	continue;
> Assert.isLegal(hyperlinks.length > 0);

can simply be rewritten to 

> if (hyperlinks == null || hyperlinks.length == 0)
>	continue;

This would allow to simply return an array e.g. from a stream operation and is semantically equivalent.