History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEA-14715
Type: New Feature New Feature
Status: Open Open
Assignee: Alexey Kudravtsev
Reporter: Sascha Weinreuter
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
IDEA: Feedback

Improve error message for ambiguous field reference

Created: 03 Sep 07 23:34   Updated: 05 Sep 07 13:38
Component/s: Editor. Error Highlighting

File Attachments: None
Image Attachments:

1. screenshot-1.jpg
(48 kb)

Build: 7,255
Severity: Low


 Description  « Hide
EMPTY_ARRAY is red, saying "Cannot resolve symbol ...". However that's not completely true and it would be nice if instead a message with something like "Ambiguous reference to ..." was used.
import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiReference;

public abstract class GoodCodeRedSuper extends ASTWrapperPsiElement implements PsiReference {
    public GoodCodeRedSuper(@org.jetbrains.annotations.NotNull ASTNode node) {
        super(node);
    }

    public Object[] getVariants() {
        return EMPTY_ARRAY;
    }
}


 All   Comments   Work Log   Change History      Sort Order:
Eugene Vigdorchik - 04 Sep 07 16:07
What jdk are you using? With 1.6 I get

Information:Compilation completed with 1 error and 0 warnings
Information:1 error
Information:0 warnings
C:\work\Groovy Plugin\groovy\src\org\jetbrains\plugins\groovy\lang\psi\util\PsiUtil.java
Error:Error:line (300)reference to EMPTY_ARRAY is ambiguous, both variable EMPTY_ARRAY in com.intellij.psi.PsiElement and variable EMPTY_ARRAY in com.intellij.psi.PsiReference match


Sascha Weinreuter - 04 Sep 07 16:25
Ah, well you're right. My stripped-down example indeed does not compile, though I do have a class that does compile fine with javac from JDK 1.6.0_02. The Eclipse compiler however bails out on it with
Information:Compilation completed with 1 error and 1 warning
Information:1 error
Information:1 warning
Warning:1 problem (1 error)
C:\work\java\idea-plugins\pimf\src\pimf\psi\impl\PimfReferenceExpressionImpl.java
    Error:Error:line (125)The field EMPTY_ARRAY is ambiguous

Sascha Weinreuter - 04 Sep 07 16:29
Updated the issue with an example that compiles with javac.

Eugene Vigdorchik - 04 Sep 07 16:38
Well, that seems like a javac bug, not a bug in IDEA.

Sascha Weinreuter - 04 Sep 07 16:41
Makes sense, but then the error message in IDEA should be "reference to ... is ambiguous" instead of "cannot resolve symbol".

Eugene Vigdorchik - 04 Sep 07 16:47
Indeed. Tough Ctrl-B on this unresolved reference shows multiple choice popup as expected. So multiResolve() clearly does its job right.

Sascha Weinreuter - 04 Sep 07 16:56
Which should make changing the error message a piece of cake

Sascha Weinreuter - 04 Sep 07 21:26
OK, now it's a feature request.