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

Bug 345017

Summary: [recovery] $missing$ appears in status line on Add Type
Product: [Eclipse Project] JDT Reporter: John Arthorne <john.arthorne>
Component: CoreAssignee: Ayushman Jain <amj87.iitr>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, daniel_megert, markus.kell.r, Olivier_Thomann
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug
Attachments:
Description Flags
Screen shot
none
Proposed fix none

Description John Arthorne CLA 2011-05-06 15:17:59 EDT
I20110428-0200

- In Java editor, enter the name of a type that does not exist.
- Hit Ctrl+Shift+M or Source > Add Import

On the status line it says, "$missing$ could not be found or is not visible.

Obviously this should say the name of the type.
Comment 1 John Arthorne CLA 2011-05-06 15:18:21 EDT
Created attachment 194977 [details]
Screen shot
Comment 2 John Arthorne CLA 2011-05-06 15:19:19 EDT
Marking as potential polish item.
Comment 3 Dani Megert CLA 2011-05-07 03:07:59 EDT
John, I cannot reproduce this in 3.7 M7, 4.1 M7 and I20110505-0800.

Can you provide more detailed steps that reproduce it for you?
Comment 4 Dani Megert CLA 2011-05-09 02:52:45 EDT
It probably depends on your exact code and location/selection.

Moving to JDT Core where the string (org.eclipse.jdt.internal.compiler.parser.RecoveryScanner.FAKE_IDENTIFIER) is defined. Maybe they can say more.
Comment 5 Markus Keller CLA 2011-05-09 08:29:01 EDT
I can reproduce in HEAD and in 3.6.2 with this CU:

public class Try {
    private void startHelpSystem() {
        Blort
    }
}

- caret after "Blort"
- Ctrl+Shift+M


Statement Recovery turns the method into an Assignment node with LHS "Blort" and RHS "$missing$". The invented name comes from bug 127395.

A better recovery would be just a SimpleName instead of the Assignment.

I wouldn't touch this for 3.7.
Comment 6 Dani Megert CLA 2011-05-10 03:24:42 EDT
>- caret after "Blort"
This is the important part. I probably had the caret before 'B', inside "Blort" or a selection in which case the problem doesn't show up.
Comment 7 Olivier Thomann CLA 2011-05-10 14:48:58 EDT
(In reply to comment #5)
> A better recovery would be just a SimpleName instead of the Assignment.
That can't be. A simple name followed by a ';' is not a valid statement.

Is it possible to skip recovered nodes from the UI?
Comment 8 Olivier Thomann CLA 2011-05-10 14:55:58 EDT
Created attachment 195262 [details]
Proposed fix

I would propose the following patch in the UI. Other locations might need the same patch.
Comment 9 Markus Keller CLA 2011-05-10 15:46:57 EDT
> > A better recovery would be just a SimpleName instead of the Assignment.
> That can't be. A simple name followed by a ';' is not a valid statement.

Recovered nodes don't have to be grammatically correct. E.g. here, I already get the recovery I would also expect without the ';' after the name:

public class Try {
    private void startHelpSystem() {
        Blort;
    }
}

> Is it possible to skip recovered nodes from the UI?

It would be possible, but a better recovery would help all clients. An advantage of the better recovery would e.g. be that "Add Import" would actually work in that situation (if Blort is a valid type name).
Comment 10 Dani Megert CLA 2011-05-11 02:42:35 EDT
-1 for a UI only fix.
Comment 11 Eclipse Genie CLA 2020-01-20 20:13:14 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.