By "didn't notice any behavior changes" does that include bytecode
generated by your examples before and after?

On Thu, Sep 12, 2019 at 7:44 AM Milles, Eric (TR Tech, Content & Ops) <
eric.mil...@thomsonreuters.com> wrote:

> What I am finding is for class definitions (instead of just simple
> references) the flag gets set for any occurrence of generics throughout the
> AST of the class.  For example this class C would return true for
> isUsingGenerics() even though the class itself is not parameterized.
>
> class C {
>   void meth(List<String> list) {
>   }
> }
>
>
> and this as well
>
> class D extends ArrayList<String> {
> }
>
>
> In ResolveVisitor's resolveGenerics... methods, I dropped the setting of
> the flag and didn't notice any behavior changes.
> ------------------------------
> *From:* Paul King <pa...@asert.com.au>
> *Sent:* Wednesday, September 11, 2019 12:48 PM
> *To:* Groovy_Developers <dev@groovy.apache.org>
> *Subject:* Re: ClassNode.isUsingGenerics() -- what is it for?
>
> My understanding is similar to yours. If isUsingGenerics() returns true it
> means that calling getGenericsTypes() is safe and should return a useful
> value. If ResolveVisitor finds any occurrence of generics then I believe it
> sets the flag and ensures the generics types are set correctly. It means
> that processing can be more efficient in some places for nodes with no
> generics. As to whether the efficiency saving is worth it these days or
> whether it is used consistently everywhere, I couldn't be sure without
> checking all usages.
>
>
> On Thu, Sep 12, 2019 at 2:33 AM Milles, Eric (TR Tech, Content & Ops) <
> eric.mil...@thomsonreuters.com> wrote:
>
> I was looking into a few bugs related to generics (and inner classes) and
> ran into ClassNode.isUsingGenerics() not behaving as expected.  I thought
> it was an indicator that ClassNode.getGenericsTypes() would not return null
> or that the class itself is a generics placeholder type.  However,
> ResolveVisitor is setting this flag for any appearance of generics within
> the class definition.
>
> Is there a known purpose of ClassNode.isUsingGenerics()?  Or is it
> outdated and should not be called anymore?
>
>

Reply via email to