Summary: | Incorrect behaviour of BinaryType.getMethods() for class StringBuffer (jdk1.5-6) | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Eugene Rogov <ewro> |
Component: | Core | Assignee: | Srikanth Sankaran <srikanth_sankaran> |
Status: | VERIFIED INVALID | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | david_audel, srikanth_sankaran |
Version: | 3.5 | ||
Target Milestone: | 3.5 RC1 | ||
Hardware: | PC | ||
OS: | Linux | ||
Whiteboard: |
Description
Eugene Rogov
2009-05-13 22:11:28 EDT
Will investigate this. (In reply to comment #1) > Will investigate this. Reproduced the problem with Sun JDK 1.6.0_13, Eclipse 3.5M7. Under investigation. (In reply to comment #2) > (In reply to comment #1) > > Will investigate this. > Reproduced the problem with Sun JDK 1.6.0_13, > Eclipse 3.5M7. Under investigation. OK, After analysis, it appears that this case should be closed as INVALID as actually there is no bug here. The "extra" methods that are allegedly incorrectly returned are not originating from the super class, but instead are the "bridge" methods synthesized by the compiler on behalf of the sub class (in this case StringBuffer) to implement covariant return types. That getMethods may return synthetic methods is documented on IType.getMethods(): /** * Returns the methods and constructors declared by this type. * For binary types, this may include the special <code><clinit></code>; method * and synthetic methods. ... */ A client that doesn't want to see these synthetic methods can trivially filter them by code such as : BinaryType b = ... IMethod [] methods = b.getMethods(); for (int i = 0; i < methods.length; i++) { if (org.eclipse.jdt.core.Flags.isSynthetic(methods[i].getFlags())) continue; /* process methods[i] here */ For instance, the package explorer view uses this approach to filter out the synthetic methods from the viewer. Verified for 3.5RC1 Oh, now I see. Thank you for your time. |