Bug 36754 - [hovering] deprecated warning hover could contain reason
Summary: [hovering] deprecated warning hover could contain reason
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P3 enhancement with 4 votes (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard: fix candidate
Keywords: helpwanted
: 73519 339325 382725 532358 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-04-22 09:54 EDT by Martin Aeschlimann CLA
Modified: 2018-03-12 14:01 EDT (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Aeschlimann CLA 2003-04-22 09:54:54 EDT
2.1

If you reference a deprecated field, the hover containing the compiler warning
that says:
'The method xx of type yy is deprecated'.

I have to open the reference to see the reason. It would be useful if the
message also contains the message after the @deprecated tag, e.g.
	/**
	 * @deprecated Use ASTNodes.asString(name) instead
	 */
Comment 1 Philipe Mulet CLA 2003-04-25 05:20:37 EDT
This would be indeed interesting to obtain, but quite expensive to compute. We 
mostly compile against binaries, for which we only have a deprecation bit set. 
Finding out some reason for the deprecation would require to find the attached 
source, parse it so as to extract the info you want. 

If classfiles were holding onto this information, then this would be quite 
easy...

Will tag as later, since it is a valid suggestion anyway.
Comment 2 Martin Aeschlimann CLA 2003-04-25 10:59:07 EDT
The other approach would be to do this in the UI. The hover is invoked on delay,
so   we can afford it to be a bit expensive.
Of course, as a side note, having Javamodel or the AST to return the Javadoc
tags would be cool.
Comment 3 Markus Keller CLA 2003-08-27 03:23:22 EDT
To alleviate the problem, I've set the Hover Key Modifier for Javadocs to
"Shift" (in Preferences > Java > Editor > Hovers).

Now, I can at least hold the Shift key to see a sensible warning when I hover
over a deprecated java element.
Comment 4 Gunnar Wagenknecht CLA 2004-09-22 02:30:27 EDT
Can this be reopend for 3.1 consideration?
Comment 5 Frederic Fusier CLA 2004-09-22 03:59:17 EDT
*** Bug 73519 has been marked as a duplicate of this bug. ***
Comment 6 Frederic Fusier CLA 2004-09-22 04:03:28 EDT
Since 3.0 Javadoc comments are not only text bug have children (JavadocTag) in
DOM AST nodes hierarchy. So, UI can "easily" get text for @deprecated tag.
Markus, ok to move this bug to JDT/UI component and let you to decide whether it
could be reopened for 3.1?
Comment 7 Markus Keller CLA 2004-09-23 05:46:30 EDT
I discussed this with JDT/Text (who implement the hovers). We won't implement
this in UI land, since it would lead to inconsistencies (hover is only available
in editor, but not in Problems view), and it would also be too expensive to
compute on demand (we would have to parse the target type and possibly
supertypes to find the message).

Why don't you add a compiler preference to let users decide whether they want to
pay a perfomance penalty for this feature?
Comment 8 Frederic Fusier CLA 2004-09-23 06:21:04 EDT
This cannot be a compiler preference as parser does not take care about text
after tags. It only verifies syntax and does not matter about description which
have no specific expected syntax...
Furthermore, JDT/Core currently provides necessary information in DOM AST
hierarchy to solve this problem.
The only question is about hover behavior: does it need to parse the file which
defines the deprecated reference and build the AST Node hierarchy to get this
piece of information?
So, I think it should be a JDT/UI or JDT/Text preference, not a compiler one.
Comment 9 Dani Megert CLA 2007-11-19 11:45:30 EST
We could do it in UI land if bug 169995 got fixed.
Comment 10 Eclipse Webmaster CLA 2009-08-30 02:35:56 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.
Comment 11 Dani Megert CLA 2010-03-19 05:42:16 EDT
.
Comment 12 Markus Keller CLA 2011-03-09 06:11:31 EST
*** Bug 339325 has been marked as a duplicate of this bug. ***
Comment 13 Dani Megert CLA 2012-06-15 07:47:39 EDT
*** Bug 382725 has been marked as a duplicate of this bug. ***
Comment 14 Ryan O'Meara CLA 2015-05-20 11:33:28 EDT
If it is expensive to compute, could we add a "link" entry (similar to the "Add suppress warnings entry") to see the deprecation Javadoc? 

The code-complete form displays Javadoc when it is being used, could that possibly be leveraged for hover? (I wouldn't be surprised if not, since they could be provided by completely separate plug-ins, for all I know - just a suggestion)
Comment 15 Gerard Weatherby CLA 2015-07-02 09:37:06 EDT
Eclipse currently displays javadoc when hovering over fields / methods that are not deprecated, so adding the @Deprecated annotation actually loses functionality.
Comment 16 Marvin Fröhlich CLA 2015-08-06 02:30:11 EDT
Are there any plans to follow this after all these years?
Comment 17 Dani Megert CLA 2015-08-06 05:17:21 EDT
(In reply to Marvin  Fröhlich from comment #16)
> Are there any plans to follow this after all these years?

High quality patches are welcome.
Comment 18 Noopur Gupta CLA 2018-03-12 14:01:28 EDT
*** Bug 532358 has been marked as a duplicate of this bug. ***