| IMethodBinding.isSynthetic: propper behaviour? [message #14530] | 
Mon, 05 May 2003 21:54   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
I've created an AST visitor, and upon visiting a ClassInstanceCreation 
node I want to determine whether or not the invoked constructor is 
explicitly declared in the source code, or if it is a default 
constructor. 
 
I thought the IBinding.isSynthetic() method would give me that info, but 
it is returning "false" even for classes which do not have explicit 
constructor declarations.  The javadoc states for isSynthetic: 
"Returns whether this binding is synthetic. A synthetic binding is one 
that was made up by the compiler, rather than something declared in the 
source code." 
 
Is this a bug, or am I misinterpreting the javadoc?  If it is not a bug, 
is there some other way to determine if the constructor is default? 
 
Cheers, 
Ryan
 |  
 |  
  | 
| Re: IMethodBinding.isSynthetic: propper behaviour? [message #14709 is a reply to message #14530] | 
Tue, 06 May 2003 05:22    | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Synthetic is a special modifier bit used for certain constructs generated by 
the compiler (innerclass emulation support, access methods, ...). 
This modifier got introduced around 1.1 version, and thus default 
constructors were already out. 
Also see discussion in bug 
http://bugs.eclipse.org/bugs/show_bug.cgi?id=36819 
 
"Ryan Wannop" <wannop@cs.ubc.ca> wrote in message 
news:3EB715CB.1A3FF7F1@cs.ubc.ca... 
> I've created an AST visitor, and upon visiting a ClassInstanceCreation 
> node I want to determine whether or not the invoked constructor is 
> explicitly declared in the source code, or if it is a default 
> constructor. 
> 
> I thought the IBinding.isSynthetic() method would give me that info, but 
> it is returning "false" even for classes which do not have explicit 
> constructor declarations.  The javadoc states for isSynthetic: 
> "Returns whether this binding is synthetic. A synthetic binding is one 
> that was made up by the compiler, rather than something declared in the 
> source code." 
> 
> Is this a bug, or am I misinterpreting the javadoc?  If it is not a bug, 
> is there some other way to determine if the constructor is default? 
> 
> Cheers, 
> Ryan 
> 
> 
>
 |  
 |  
  | 
| Re: IMethodBinding.isSynthetic: propper behaviour? [message #15048 is a reply to message #14530] | 
Tue, 06 May 2003 09:52   | 
 
Eclipse User  | 
 | 
 | 
   | 
 
Originally posted by: Olivier_Thomann.ca.ibm.comNOSPAM 
 
On Mon, 05 May 2003 18:54:19 -0700, Ryan Wannop <wannop@cs.ubc.ca> 
wrote: 
>Is this a bug, or am I misinterpreting the javadoc?  If it is not a bug, 
>is there some other way to determine if the constructor is default? 
If the related ITypeBinding is from an anonymous class, then you know 
for sure that its constructor is a default constructor. 
In fact, we should update the javadoc to state that isSynthetic() is 
returning if the corresponding info in the .class file has a synthetic 
attribute. 
-- 
Olivier
 |  
 |  
  | 
Powered by 
FUDForum. Page generated in 0.05815 seconds