Hmm. Seems like methodBodyVisitor is needed to complete the codegen for the static initializer. Instead of a null check, a call to getMethodBodyVisitor() might be the right answer, but a simple test case that verifies correct codegen would be helpful. There might be something unique to TextFlowUtil's static APIs that is tripping up Falcon.
-Alex On 9/23/13 6:23 AM, "erikdebr...@apache.org" <erikdebr...@apache.org> wrote: >Updated Branches: > refs/heads/develop f7956f9a4 -> 78cbff9f0 > > >FLEX-33713: An NPE is thrown by this code when compiling 'spark.swc' from >the SDK. The null check bypasses the issue, it doesn't do anything to fix >the root cause... > >Signed-off-by: Erik de Bruin <e...@ixsoftware.nl> > > >Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo >Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/78cbff9f >Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/78cbff9f >Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/78cbff9f > >Branch: refs/heads/develop >Commit: 78cbff9f0342e2de9f28abb88dab6c656e061e95 >Parents: f7956f9 >Author: Erik de Bruin <e...@ixsoftware.nl> >Authored: Mon Sep 23 15:22:03 2013 +0200 >Committer: Erik de Bruin <e...@ixsoftware.nl> >Committed: Mon Sep 23 15:22:03 2013 +0200 > >---------------------------------------------------------------------- > .../as/codegen/ClassDirectiveProcessor.java | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) >---------------------------------------------------------------------- > > >http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/78cbff9f/compiler/ >src/org/apache/flex/compiler/internal/as/codegen/ClassDirectiveProcessor.j >ava >---------------------------------------------------------------------- >diff --git >a/compiler/src/org/apache/flex/compiler/internal/as/codegen/ClassDirective >Processor.java >b/compiler/src/org/apache/flex/compiler/internal/as/codegen/ClassDirective >Processor.java >index dae7ebc..29d2a7b 100644 >--- >a/compiler/src/org/apache/flex/compiler/internal/as/codegen/ClassDirective >Processor.java >+++ >b/compiler/src/org/apache/flex/compiler/internal/as/codegen/ClassDirective >Processor.java >@@ -533,9 +533,19 @@ class ClassDirectiveProcessor extends >DirectiveProcessor > > cinit_insns.addInstruction(OP_returnvoid); > >- >this.classStaticScope.methodBodyVisitor.visitInstructionList(cinit_insns); >- this.classStaticScope.methodBodyVisitor.visitEnd(); >- this.classStaticScope.methodVisitor.visitEnd(); >+ /* >+ * FIXME: NPE while compiling 'spark.swc' >+ * >+ * erikdebruin: I'm just bypassing that with this null >check. Someone >+ * who knows what's going on here should >probably take a >+ * look WHY this was failing... >+ */ >+ if (this.classStaticScope.methodBodyVisitor != null) >+ { >+ >this.classStaticScope.methodBodyVisitor.visitInstructionList(cinit_insns); >+ this.classStaticScope.methodBodyVisitor.visitEnd(); >+ this.classStaticScope.methodVisitor.visitEnd(); >+ } > } > else > { >