| Summary: | [content assist] Enclosing CompleteOnMessageSend is returned if next argument expression is empty | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Timo Kinnunen <timo.kinnunen> |
| Component: | Core | Assignee: | Srikanth Sankaran <srikanth_sankaran> |
| Status: | VERIFIED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | jarthana, manoj.palat, srikanth_sankaran, stephan.herrmann |
| Version: | 4.4 | ||
| Target Milestone: | 4.5 M2 | ||
| Hardware: | PC | ||
| OS: | Windows 8 | ||
| Whiteboard: | |||
(In reply to Timo Kinnunen from comment #0) > PROBLEM FOUND while reconciling : a cannot be resolved to a variable This gives an ever so slight hint at resurrection of bug 426996. Should check, if CompletionOnMessageSend failed to resolve, because it lacks calls to the dubious unresolve(). ... (please not :) ) I see separately a <CompleteOnName:> AST node so that's valid at least. So that answers a "could" part of my question. I'm a bit puzzled about the kind of attention this report is receiving. I didn't anticipate that this would be directly related to inference or even Java 8 support, but be a parsing issue or similar that might be present in <4.3.1 as well. I didn't mark the usual 1.8 milestones and such for this reason. Of course if there's reasons something else might be going on I'm not going to argue those, I'm just being a little surprised. Admittedly I didn't look very closely at the example, just saw a symptom similar to an inference issue I'm currently looking at. Looking closer this connection was a red herring :) This is by design. In the absence of a prefix, suggestion for completion proposals would be new numerous to be of any use. (In reply to Srikanth Sankaran from comment #5) > This is by design. In the absence of a prefix, suggestion for completion > proposals would be new numerous to be of any use. This means that things like: - local variables (fastest to find) - fields in enclosing classes (fast to find) - class or instance methods in enclosing classes (probably speedy enough) also can't be proposed for completion. Please reconsider this. I initially thought the rationale was something akin to https://bugs.eclipse.org/bugs/show_bug.cgi?id=174001 and a few others, but the observed behavior is by design from day 1: I did some time travel and discovered that the behavior has been there from commit be6c0d208933ac936a6ccb6c66b03d3da13e3796 Author: Philipe Mulet <pmulet> 2001-06-05 21:47:58 Committer: Philipe Mulet <pmulet> 2001-06-05 21:47:58 which is very first version of file per CVS history imported into git. If there was a revision control system in use before, I don't know of it and have no way of knowing for which bug this was introduced. The behavior I am talking about is in CompletionParser.checkInvocation() boolean isEmptyNameCompletion = false; boolean isEmptyAssistIdentifier = false; if (isEmptyNameCompletion && topKnownElementKind(COMPLETION_OR_ASSIST_PARSER) == K_SELECTOR_QUALIFIER && ((isEmptyNameCompletion = topExpression == this.assistNode && isEmptyNameCompletion()) // e.g. it is something like "this.fred([cursor]" but it is not something like "this.fred(1 + [cursor]" || (isEmptyAssistIdentifier = this.indexOfAssistIdentifier() >= 0 && this.identifierStack[this.identifierPtr].length == 0))) { // e.g. it is something like "this.fred(1 [cursor]" // pop empty name completion if (isEmptyNameCompletion) { this.expressionPtr--; this.expressionLengthStack[this.expressionLengthPtr]--; } else if (isEmptyAssistIdentifier) { this.identifierPtr--; this.identifierLengthPtr--; } Control falls through and builds CompletionOnMessageSend For fun, I disabled this block and the completion node is now <CompleteOnName:> This causes 348 tests to "fail" Bottom line, I don't expect progress here. I think you would rather we fix your inference problems :) Verified for Mars 4.5 M2. |
Testing completion with this method and completing on the second argument to poll(): @SuppressWarnings("unused") static void notfixed( WatchService w) throws InterruptedException { /* Does not find TimeUnit.SECOND etc. without prefix */ w.poll(1, ); } This gives completion a debug message and AST like this: PROBLEM FOUND while reconciling : Syntax error on token ",", Expression expected after this token static @SuppressWarnings("unused") void notfixed(WatchService w) throws InterruptedException { <CompleteOnMessageSend:w.poll(1)>; } If a single character is added for the expression, the debug message no longer uses the word error and AST becomes this much more useful result: PROBLEM FOUND while reconciling : a cannot be resolved to a variable static @SuppressWarnings("unused") void notfixed(WatchService w) throws InterruptedException { w.poll(1, <CompleteOnName:a>); } Shouldn't the earlier completion also be like this, for example one or the other of these: w.poll(1, <CompleteOnName:*>); w.poll(1, <CompleteOnName:>);