You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by OC <oc...@ocs.cz> on 2016/07/11 21:26:34 UTC

looks like a missing exception harness in a typechecker somewhere?

Hi there,

with a pretty complex and heavily AST-transformed code, which, nevertheless, *without typechecking builds and runs all right*, with a typechecker compilation crashes in the following way (Groovy 2.4.7).

The problem might well be caused by a mistake in my own typechecking extension script (which, essentially, turns all typechecker errors to warnings); still, though, I think the compiler should not crash this way (instead, it might report a reasonable error):

===
>>> a serious error occurred: BUG! exception in phase 'instruction selection' in source unit '/Users/ocs/Projects/WO_XC_ProBOIS/SberDat2/../OCShared/src/scomponents/DFEOList.groovy' unexpected NullpointerException
>>> stacktrace:
BUG! exception in phase 'instruction selection' in source unit '/Users/ocs/Projects/WO_XC_ProBOIS/SberDat2/../OCShared/src/scomponents/DFEOList.groovy' unexpected NullpointerException
	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1058)
	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:525)
	at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:61)
	at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:217)
	at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:150)
	at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:180)
	at org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:164)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
	at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
Caused by: java.lang.NullPointerException
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:237)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:211)
	at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:250)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:211)
	at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:163)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.popAssignmentTracking(StaticTypeCheckingVisitor.java:3256)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitIfElse(StaticTypeCheckingVisitor.java:3215)
	at org.codehaus.groovy.ast.stmt.IfStatement.visit(IfStatement.java:43)
	at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
	at org.codehaus.groovy.ast.CodeVisitorSupport.visitTryCatchFinally(CodeVisitorSupport.java:84)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitTryCatchFinally(ClassCodeVisitorSupport.java:231)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitTryCatchFinally(StaticTypeCheckingVisitor.java:3361)
	at org.codehaus.groovy.ast.stmt.TryCatchStatement.visit(TryCatchStatement.java:44)
	at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:104)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitConstructorOrMethod(StaticTypeCheckingVisitor.java:1784)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.startMethodInference(StaticTypeCheckingVisitor.java:2119)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethod(StaticTypeCheckingVisitor.java:2078)
	at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1078)
	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
	at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClass(StaticTypeCheckingVisitor.java:249)
	at org.codehaus.groovy.transform.StaticTypesTransformation.visit(StaticTypesTransformation.java:66)
	at org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:134)
	at org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:178)
	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1053)
===

All the best,
OC


Re: looks like a missing exception harness in a typechecker somewhere?

Posted by OC <oc...@ocs.cz>.
Jochen,

On 12. 7. 2016, at 12:43, Jochen Theodorou <bl...@gmx.org> wrote:
> On 11.07.2016 23:26, OC wrote:
>> Hi there,
>> 
>> with a pretty complex and heavily AST-transformed code, which, nevertheless, *without typechecking builds and runs all right*, with a typechecker compilation crashes in the following way (Groovy 2.4.7).
>> 
>> The problem might well be caused by a mistake in my own typechecking extension script (which, essentially, turns all typechecker errors to warnings); still, though, I think the compiler should not crash this way (instead, it might report a reasonable error):
> 
> the reasonable error would have been crashing with a BUG exception once you did set the genericstypes of that ClassNode to null?

I do not think I did that. Definitely the only genericstypes-related thing in my whole project is one line in my typechecking script, which makes sure the first of genericstypes is used instead of the classnode itself for lookups, namely,

===
def lookupMethods(ClassNode cln,String name,argtypes=[]) {
    if (cln==classNodeFor(Class) && cln.isUsingGenerics() && cln.genericsTypes) cln=cln.genericsTypes[0].type // ugh... got the code from Cédric!
    ... ... ...
===

Note that the only things which changes is the local variable cln in there. For reference, the complete typechecking script (not too intelligible, I am afraid; but short enough, unlike all those ASTTs etc) is attached at the end of this message.

Thanks and all the best,
OC


Re: looks like a missing exception harness in a typechecker somewhere?

Posted by Jochen Theodorou <bl...@gmx.org>.

On 11.07.2016 23:26, OC wrote:
> Hi there,
>
> with a pretty complex and heavily AST-transformed code, which, nevertheless, *without typechecking builds and runs all right*, with a typechecker compilation crashes in the following way (Groovy 2.4.7).
>
> The problem might well be caused by a mistake in my own typechecking extension script (which, essentially, turns all typechecker errors to warnings); still, though, I think the compiler should not crash this way (instead, it might report a reasonable error):

the reasonable error would have been crashing with a BUG exception once 
you did set the genericstypes of that ClassNode to null?

bye Jochen

Re: looks like a missing exception harness in a typechecker somewhere?

Posted by OC <oc...@ocs.cz>.
Paul,

On 12. 7. 2016, at 3:29, Paul King <pa...@asert.com.au> wrote:

> I assume (given you say heavily transformed) that you don't have a
> simple way to reproduce the error?

Alas, precisely; I have tried to isolate the cause, but in vain :(

I just hope the callstack along with whatever code there is at WideningCategories.java:237 might help; if not, well, I am afraid my report would be good-for-nothing :(

Thanks and all the best,
OC

> On Tue, Jul 12, 2016 at 7:26 AM, OC <oc...@ocs.cz> wrote:
>> Hi there,
>> 
>> with a pretty complex and heavily AST-transformed code, which, nevertheless, *without typechecking builds and runs all right*, with a typechecker compilation crashes in the following way (Groovy 2.4.7).
>> 
>> The problem might well be caused by a mistake in my own typechecking extension script (which, essentially, turns all typechecker errors to warnings); still, though, I think the compiler should not crash this way (instead, it might report a reasonable error):
>> 
>> ===
>>>>> a serious error occurred: BUG! exception in phase 'instruction selection' in source unit '/Users/ocs/Projects/WO_XC_ProBOIS/SberDat2/../OCShared/src/scomponents/DFEOList.groovy' unexpected NullpointerException
>>>>> stacktrace:
>> BUG! exception in phase 'instruction selection' in source unit '/Users/ocs/Projects/WO_XC_ProBOIS/SberDat2/../OCShared/src/scomponents/DFEOList.groovy' unexpected NullpointerException
>>        at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1058)
>>        at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
>>        at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
>>        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
>>        at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:525)
>>        at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:61)
>>        at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:217)
>>        at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:150)
>>        at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:180)
>>        at org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:164)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>        at java.lang.reflect.Method.invoke(Method.java:601)
>>        at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
>>        at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
>> Caused by: java.lang.NullPointerException
>>        at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:237)
>>        at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:211)
>>        at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:250)
>>        at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:211)
>>        at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:163)
>>        at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.popAssignmentTracking(StaticTypeCheckingVisitor.java:3256)
>>        at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitIfElse(StaticTypeCheckingVisitor.java:3215)
>>        at org.codehaus.groovy.ast.stmt.IfStatement.visit(IfStatement.java:43)
>>        at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
>>        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
>>        at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
>>        at org.codehaus.groovy.ast.CodeVisitorSupport.visitTryCatchFinally(CodeVisitorSupport.java:84)
>>        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitTryCatchFinally(ClassCodeVisitorSupport.java:231)
>>        at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitTryCatchFinally(StaticTypeCheckingVisitor.java:3361)
>>        at org.codehaus.groovy.ast.stmt.TryCatchStatement.visit(TryCatchStatement.java:44)
>>        at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
>>        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
>>        at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
>>        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:104)
>>        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115)
>>        at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitConstructorOrMethod(StaticTypeCheckingVisitor.java:1784)
>>        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)
>>        at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.startMethodInference(StaticTypeCheckingVisitor.java:2119)
>>        at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethod(StaticTypeCheckingVisitor.java:2078)
>>        at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1078)
>>        at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
>>        at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClass(StaticTypeCheckingVisitor.java:249)
>>        at org.codehaus.groovy.transform.StaticTypesTransformation.visit(StaticTypesTransformation.java:66)
>>        at org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:134)
>>        at org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:178)
>>        at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1053)
>> ===
>> 
>> All the best,
>> OC
>> 


Re: looks like a missing exception harness in a typechecker somewhere?

Posted by Paul King <pa...@asert.com.au>.
I assume (given you say heavily transformed) that you don't have a
simple way to reproduce the error?

On Tue, Jul 12, 2016 at 7:26 AM, OC <oc...@ocs.cz> wrote:
> Hi there,
>
> with a pretty complex and heavily AST-transformed code, which, nevertheless, *without typechecking builds and runs all right*, with a typechecker compilation crashes in the following way (Groovy 2.4.7).
>
> The problem might well be caused by a mistake in my own typechecking extension script (which, essentially, turns all typechecker errors to warnings); still, though, I think the compiler should not crash this way (instead, it might report a reasonable error):
>
> ===
>>>> a serious error occurred: BUG! exception in phase 'instruction selection' in source unit '/Users/ocs/Projects/WO_XC_ProBOIS/SberDat2/../OCShared/src/scomponents/DFEOList.groovy' unexpected NullpointerException
>>>> stacktrace:
> BUG! exception in phase 'instruction selection' in source unit '/Users/ocs/Projects/WO_XC_ProBOIS/SberDat2/../OCShared/src/scomponents/DFEOList.groovy' unexpected NullpointerException
>         at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1058)
>         at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
>         at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
>         at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
>         at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:525)
>         at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:61)
>         at org.codehaus.groovy.tools.FileSystemCompiler.doCompilation(FileSystemCompiler.java:217)
>         at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompile(FileSystemCompiler.java:150)
>         at org.codehaus.groovy.tools.FileSystemCompiler.commandLineCompileWithErrorHandling(FileSystemCompiler.java:180)
>         at org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:164)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:601)
>         at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:109)
>         at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:131)
> Caused by: java.lang.NullPointerException
>         at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:237)
>         at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:211)
>         at org.codehaus.groovy.ast.tools.WideningCategories.parameterizeLowestUpperBound(WideningCategories.java:250)
>         at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:211)
>         at org.codehaus.groovy.ast.tools.WideningCategories.lowestUpperBound(WideningCategories.java:163)
>         at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.popAssignmentTracking(StaticTypeCheckingVisitor.java:3256)
>         at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitIfElse(StaticTypeCheckingVisitor.java:3215)
>         at org.codehaus.groovy.ast.stmt.IfStatement.visit(IfStatement.java:43)
>         at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
>         at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
>         at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
>         at org.codehaus.groovy.ast.CodeVisitorSupport.visitTryCatchFinally(CodeVisitorSupport.java:84)
>         at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitTryCatchFinally(ClassCodeVisitorSupport.java:231)
>         at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitTryCatchFinally(StaticTypeCheckingVisitor.java:3361)
>         at org.codehaus.groovy.ast.stmt.TryCatchStatement.visit(TryCatchStatement.java:44)
>         at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:37)
>         at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
>         at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
>         at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:104)
>         at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115)
>         at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitConstructorOrMethod(StaticTypeCheckingVisitor.java:1784)
>         at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)
>         at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.startMethodInference(StaticTypeCheckingVisitor.java:2119)
>         at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitMethod(StaticTypeCheckingVisitor.java:2078)
>         at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1078)
>         at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
>         at org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitClass(StaticTypeCheckingVisitor.java:249)
>         at org.codehaus.groovy.transform.StaticTypesTransformation.visit(StaticTypesTransformation.java:66)
>         at org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:134)
>         at org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:178)
>         at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1053)
> ===
>
> All the best,
> OC
>