| Summary: | [navigation] Open Declared Type hyperlink should not show up when the variable type is primitive | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Markus Keller <markus.kell.r> |
| Component: | UI | Assignee: | Raksha Vasisht <raksha.vasisht> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | trivial | ||
| Priority: | P3 | CC: | daniel_megert, rthakkar |
| Version: | 3.7 | ||
| Target Milestone: | 3.7 M5 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Markus Keller
Fixed in HEAD in org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlinkDeclaredTypeDetector. The fix works, however, we should avoid the duplication of isPrimitive(...) either by adding a helper to JavaElementHyperlinkDetector or to JavaModelUtil. (In reply to comment #2) > The fix works, however, we should avoid the duplication of isPrimitive(...) > either by adding a helper to JavaElementHyperlinkDetector or to JavaModelUtil. Added the helper method to JavaElementHyperlinkDetector. (In reply to comment #3) > Added the helper method to JavaElementHyperlinkDetector. Reopening, I don't see that in HEAD. (In reply to comment #4) > (In reply to comment #3) > > Added the helper method to JavaElementHyperlinkDetector. > > Reopening, I don't see that in HEAD. Oops, my bad. I had fixed the duplication of check inside isPrimitive(..) but had not moved it to the util class. Now fixed by moving isPrimitive(..) to JavaModelUtil as it might be more useful in a util class. The fix is still not good as it can cause NPEs: take a closer look at JavaModelUtil.isPrimitive(getTypeSignature(element)) in JavaElementHyperlinkDeclaredTypeDetector. (In reply to comment #6) > The fix is still not good as it can cause NPEs: take a closer look at > JavaModelUtil.isPrimitive(getTypeSignature(element)) > in JavaElementHyperlinkDeclaredTypeDetector. No it cant cause an NPE since we already check for the element to be either a IJavaElement.FIELD or a IJavaElement.LOCAL_VARIABLE and the javadoc for these element types say that "A Java element with this type can be safely cast to IField/ILocalVariable" respectively. Pls reopen if you do see a NPE. > Pls reopen if you do see a NPE.
It's my pleasure.
Mea culpa! I somehow had an old version of JavaElementHyperlinkDeclaredTypeDetector.getTypeSignature(IJavaElement) in my workspace which caught the exception and hence returned 'null'. Having said that, we should improve getTypeSignature(...) and never return 'null': since we already specify that only field and local variable are allowed - I've done that in HEAD. Sorry again! Verified for 3.7 M5 with I20110124-1800. |