Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 562788

Summary: [code minning] On latest IBuild JDT code minings are not working.
Product: [Eclipse Project] JDT Reporter: Gayan Perera <gayanper>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: major    
Priority: P3 CC: azerr, Lars.Vogel, mistria, rgrunber
Version: 4.16   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Gayan Perera CLA 2020-05-04 14:14:22 EDT
[code minning] On latest IBuild JDT code minings are not working. 
Build id: I20200503-1800

The built in mining are not working and the minings provided by https://github.com/angelozerr/jdt-codemining are not working either.

This effects the STS4 tooling as well since it is dependent on codemining for showing bean information at runtime.
Comment 1 Mickael Istria CLA 2020-05-05 03:11:47 EDT
I'm using latest I-Build, and CodeMinings work fine for me. Can you please try with a fresh build? Did you make sure the JDT code minings are turned on?
Comment 2 Gayan Perera CLA 2020-05-05 03:39:17 EDT
Found the issue. The recent testng codemining improvement i did actually returns null for provideCodeMinings on classes which are not test. This cause the whole code ming to fail with a NPE. I don’t see any warning either saying not to return null in that API.
Comment 3 Gayan Perera CLA 2020-05-05 04:04:01 EDT
@Mickael should guard for this kind of return values. Checking at ICodeMiningProvider says can return null or empty. In testng provider retuns null result as supplyAsync. According doc i assume this is what is expects. And this worked like this for some time for some reason i guess.
Comment 4 Gayan Perera CLA 2020-05-05 12:12:07 EDT
Downgrade to major since there is a workaround for this issue.
Comment 5 Roland Grunberg CLA 2020-05-20 11:11:12 EDT
Is this still reproducible ? Is there a stacktrace of the NPE ?

Looking at https://github.com/eclipse/eclipse.platform.text/blob/master/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/codemining/CodeMiningManager.java#L190 , there seems to be a check for null.
Comment 6 Gayan Perera CLA 2020-05-20 11:42:04 EDT
Its fixed in TestNG which cause the issue. But I still think there is a chance that a rouge mining can cause all the mining to disappear.
Comment 7 Roland Grunberg CLA 2020-05-20 14:23:28 EDT
@Gayan, is there any chance that the testng provideCodeMinings(..) implementation actually threw the NPE ? What happens if you just throw an NPE there ? In that case, I could see it breaking things because the CodeMiningManager.getCodeMinings(..) seems to expect clients to handle those.

Otherwise I would probably close this as WORKSFORME until a better reproducer can be found.
Comment 8 Roland Grunberg CLA 2020-05-28 16:29:23 EDT
Marking as WORKSFORME for now. Feel free to re-open if you run into such an issue again.