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

Bug 362922

Summary: References finds invalid @param with same name
Product: [Eclipse Project] JDT Reporter: Peter Larsen <peblpebl>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: amj87.iitr
Version: 3.7.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug

Description Peter Larsen CLA 2011-11-04 12:41:20 EDT
Build Identifier: M20110909-1335

I have a class that (simplyfied) looks like this

class XmlExchangeLocalConnection implements XmlExchange {
  private XmlReceiver receiver;
  ...
}

If I ask for references for the "receiver" field, I get those I expected, and 1 completely unrelated:

         /**
         * ...
	 * @param receiver
	 *   This callback will be called when a HTTP request for this address
	 *   has been received.
	 * @return
         * ...
         */
	public HttpServerSocket listen(final SocketSystem socksys) {
        ...

Why am I getting a result pointing to an invalid java doc @param with the same name? (invalid as the parameter is not mentioned in the method).

I have seen this indirectly for a long time (since 3.1 atleast), when doing major refactoring and afterwards looked at the patch.

Reproducible: Always
Comment 1 Ayushman Jain CLA 2011-11-04 14:42:14 EDT
I see it listed as a "potential match", which doesn't look that bad since the @param tag may have been referring to the field receiver. This is because 'receiver'in the javadoc gets resolved to the field. So doesn't look like a bug to me.

class XmlExchangeLocalConnection {
  private XmlExchangeLocalConnection receiver;
  
  /**
   * @param receiver
   */
  public void foo() {
	  
  }
}

Satyam, what do you say?
Comment 2 Peter Larsen CLA 2011-11-04 15:36:07 EDT
>> This is because 'receiver'in the javadoc gets resolved to the field.

Hmm, the provided example was not good enough. It is more like

foo.java:
class foo implements X {
  private XmlReceiver receiver;
  ...
}

bar.java:
class bar {
  /**
   * @param receiver
   */
  public void foo() {

  }
}

where foo.java and bar.java are in diferent package hierarchic.
There is no 'receiver' in scope in foo().
Comment 3 Satyam Kandula CLA 2011-11-06 23:37:19 EST
Search is reporting potential matches whenever it cannot resolve the element. I think it should not report even a potential match when there are no missing types in the element resolution.
Comment 4 Eclipse Genie CLA 2020-05-15 13:21:21 EDT
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.