This type of check makes an unsafe assumption.  If you need a parser, the 
factory is there to supply one to you.  That is the purpose of the factory 
pattern.

            boolean oldParserEnabled = 
compilationUnit.getConfiguration().getPluginFactory() instanceof 
AntlrParserPluginFactory;
            ClassNode parsedNode = oldParserEnabled ?
                    Antlr2Utils.parse("DummyNode<" + option + ">") :
                    Antlr4Utils.parse("DummyNode<" + option + ">", 
compilationUnit.getConfiguration());
________________________________
From: Milles, Eric (TR Tech, Content & Ops) <eric.mil...@thomsonreuters.com>
Sent: Tuesday, October 22, 2019 11:27 AM
To: dev@groovy.apache.org <dev@groovy.apache.org>
Subject: Re: [VOTE] Release Apache Groovy 3.0.0-rc-1 (take 2)

Even if Ivy 2.5.0 is released soon, we have not tested with that version.  I 
would not pick it up until Groovy 4.


The recent change to GenericsUtils.parseClassNodesFromString assumes that you 
have a specific type of ParserPluginFactory set.  However the 
CompilerConfiguration allows the user to set any type of their choosing.

java.lang.ClassCastException: org.codehaus.groovy.control.ParserPluginFactory$1 
cannot be cast to org.apache.groovy.parser.antlr4.Antlr4PluginFactory
    at org.codehaus.groovy.ast.tools.Antlr4Utils.parse(Antlr4Utils.java:32)
    at 
org.codehaus.groovy.ast.tools.GenericsUtils.parseClassNodesFromString(GenericsUtils.java:613)



Also, I agree with Cedric.  This should be a beta unless it was considered 
fully ready for release when voting began.

________________________________
From: Daniel.Sun <sun...@apache.org>
Sent: Tuesday, October 22, 2019 11:02 AM
To: d...@groovy.incubator.apache.org <d...@groovy.incubator.apache.org>
Subject: Re: [VOTE] Release Apache Groovy 3.0.0-rc-1 (take 2)

FYI. Ivy 2.5.0 is coming soon too:
https://urldefense.proofpoint.com/v2/url?u=http-3A__ant.1045680.n5.nabble.com_VOTE-2DRelease-2DIvy-2D2-2D5-2D0-2Dbased-2Don-2DRC1-2Dtd5719982.html&d=DwICAg&c=4ZIZThykDLcoWk-GVjSLmy8-1Cr1I4FWIvbLFebwKgY&r=tPJuIuL_GkTEazjQW7vvl7mNWVGXn3yJD5LGBHYYHww&m=RrPMdNH7KeZs00DbUIxGQSgb9zzxoFvrijMiZOSsmNk&s=7E3Y2DczHAZN6ly0Us4VKcRZOY6lDFqt8VCknlLXiXY&e=

Cheers,
Daniel.Sun




-----
Apache Groovy committer & PMC member
Blog: 
https://urldefense.proofpoint.com/v2/url?u=http-3A__blog.sunlan.me&d=DwICAg&c=4ZIZThykDLcoWk-GVjSLmy8-1Cr1I4FWIvbLFebwKgY&r=tPJuIuL_GkTEazjQW7vvl7mNWVGXn3yJD5LGBHYYHww&m=RrPMdNH7KeZs00DbUIxGQSgb9zzxoFvrijMiZOSsmNk&s=1g6tlhiTrpLdeuDpcwvgCcMNRdq4pda6s9D44IbU1u8&e=
Twitter: @daniel_sun

--
Sent from: 
https://urldefense.proofpoint.com/v2/url?u=http-3A__groovy.329449.n5.nabble.com_Groovy-2DDev-2Df372993.html&d=DwICAg&c=4ZIZThykDLcoWk-GVjSLmy8-1Cr1I4FWIvbLFebwKgY&r=tPJuIuL_GkTEazjQW7vvl7mNWVGXn3yJD5LGBHYYHww&m=RrPMdNH7KeZs00DbUIxGQSgb9zzxoFvrijMiZOSsmNk&s=s-MaME5hycNHaMUTLiD4v3_uFU0fpKCBShstVL-kci0&e=

Reply via email to