Bug 37382 - Failed to return default constructor for SourceType
Summary: Failed to return default constructor for SourceType
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M3   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 372192 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-05-08 09:51 EDT by Daniel Berg CLA
Modified: 2012-02-22 06:24 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Berg CLA 2003-05-08 09:51:43 EDT
I use the getMethods()on an ISourceType to get all the methods for a type.  The 
problem is that it is not returning the default constructor for a public 
class.  This causes a problem for us since we switch between JDOM reflection 
and JDK reflection and in the JDK Class.getDeclaredConstructors(), the default 
constructor will be returned.  Is there a mechanism that we are missing to 
return all methods including the default constructors for a SourceType?
Comment 1 Olivier Thomann CLA 2003-05-08 12:20:57 EDT
A ISourceType is a type "from source". The default constructors doesn't appear
in source. If you want all the methods (including synthetics, default
constructors,...), use a binary type. The API on java.lang.Class is not using
the source. It is using the binary type.
Comment 2 Daniel Berg CLA 2003-05-08 14:24:19 EDT
Can you get the binaryType from the SourceType so I could get the correct level 
of reflection?
Comment 3 Olivier Thomann CLA 2003-05-08 14:28:25 EDT
What are you trying to do exactly?
Comment 4 Daniel Berg CLA 2003-05-08 14:32:42 EDT
I am trying to reflect all of the methods (including all default constructors) 
from a type in the workbench (I don't care if it is just binary or source).
Comment 5 Olivier Thomann CLA 2003-05-08 17:14:58 EDT
The maximum of default constructor is one. The default constructor is by
definition a constructor without any argument provided by the compiler when the
class doesn't define any constructor. If you have a source type and it doesn't
contain any constructor, then simply add a default constructor to your
collection of methods. If you have a binary type, it will expose the default
constructor.
Comment 6 Philipe Mulet CLA 2003-07-24 08:09:52 EDT
The source model strictly reflects sources. If sources did not contain a 
constructor, then it is not available in the model. The fact it is generated, 
and thus available in corresponding binaries is a compiler artifact. 

No plan to change this assumption.
Comment 7 Dani Megert CLA 2012-02-22 06:24:43 EST
*** Bug 372192 has been marked as a duplicate of this bug. ***