You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2019/05/20 07:32:08 UTC
[jira] [Closed] (GROOVY-9035) config script: unexpected NPE when
processing compiler config DSL
[ https://issues.apache.org/jira/browse/GROOVY-9035?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-9035.
-----------------------------
> config script: unexpected NPE when processing compiler config DSL
> -----------------------------------------------------------------
>
> Key: GROOVY-9035
> URL: https://issues.apache.org/jira/browse/GROOVY-9035
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 2.5.6
> Reporter: Eric Milles
> Assignee: Paul King
> Priority: Minor
> Fix For: 3.0.0-beta-1, 2.5.7
>
>
> I started experimenting with using config script to enable static compilation by default. I ran into GROOVY-7856 pretty much right away. So I decided to comment out my config script like this:
> {code:groovy}
> withConfig(configuration) {
> source(classValidator: { !it.isInterface() }) { ->
> //ast(groovy.transform.CompileStatic)
> }
> }
> {code}
> Now I get this NPE because there is no delegate CompilationCustomizer found for the SourceAwareCustomizer.
> {code}
> java.lang.NullPointerException
> at org.codehaus.groovy.control.customizers.DelegatingCustomizer.<init>(DelegatingCustomizer.java:36)
> at org.codehaus.groovy.control.customizers.SourceAwareCustomizer.<init>(SourceAwareCustomizer.java:50)
> at org.codehaus.groovy.control.customizers.builder.SourceAwareCustomizerFactory.postCompleteNode(SourceAwareCustomizerFactory.java:95)
> at org.codehaus.groovy.control.customizers.builder.CompilerCustomizationBuilder.postNodeCompletion(CompilerCustomizationBuilder.groovy:48)
> at groovy.util.FactoryBuilderSupport.dispatchNodeCall(FactoryBuilderSupport.java:903)
> at groovy.util.FactoryBuilderSupport.doInvokeMethod(FactoryBuilderSupport.java:787)
> at groovy.util.FactoryBuilderSupport.invokeMethod(FactoryBuilderSupport.java:507)
> at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeOnDelegationObjects(ClosureMetaClass.java:413)
> at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:337)
> at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:64)
> at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
> at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:156)
> at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:176)
> at config$_run_closure1.doCall(config.groovy:4)
> at config$_run_closure1.doCall(config.groovy)
> ...
> {code}
> Could the SourceAwareCustomizerFactory be more forgiving and supply a "no-op" CompilationCustomizer in newInstance?
> {code}
> public Object newInstance(final FactoryBuilderSupport builder, final Object name, final Object value, final Map attributes) throws InstantiationException, IllegalAccessException {
> SourceOptions data = new SourceOptions();
> if (value instanceof CompilationCustomizer) {
> data.delegate = (CompilationCustomizer) value;
> }
> // add
> else {
> data.delegate = new CompilationCustomizer(0) {};
> }
> // end
> return data;
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)