commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Bourg (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (JCI-53) Stack overflow on cross imports in commons-jci-janino
Date Sun, 18 Aug 2013 11:21:48 GMT

     [ https://issues.apache.org/jira/browse/JCI-53?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Emmanuel Bourg updated JCI-53:
------------------------------

          Description: 
A stack overflow occurs when trying to compile classes with cross references using commons-jci-janino,
because an infinite recursion. The simple presence of cross reference import is enough to
cause the problem.

Example: the following classes will recreate the problem:

{code}
package test;

import static test.Func2.func2;

public class Func1 {
   public static boolean func1() throws Exception {
       return true;
   }
}
{code}

{code}
package test;

import static test.Func1.func1;

public class Func2 {
   public static boolean func2() throws Exception {
       return true;
   }
} 
{code}

The exception stack is:

{code}
java.lang.StackOverflowError
	at org.codehaus.janino.Parser.parseAndExpression(Parser.java)
	at org.codehaus.janino.Parser.parseExclusiveOrExpression(Parser.java)
	at org.codehaus.janino.Parser.parseInclusiveOrExpression(Parser.java)
	at org.codehaus.janino.Parser.parseConditionalAndExpression(Parser.java)
	at org.codehaus.janino.Parser.parseConditionalOrExpression(Parser.java)
	at org.codehaus.janino.Parser.parseConditionalExpression(Parser.java)
	at org.codehaus.janino.Parser.parseAssignmentExpression(Parser.java)
	at org.codehaus.janino.Parser.parseExpression(Parser.java)
	at org.codehaus.janino.Parser.parseReturnStatement(Parser.java)
	at org.codehaus.janino.Parser.parseStatement(Parser.java)
	at org.codehaus.janino.Parser.parseBlockStatement(Parser.java)
	at org.codehaus.janino.Parser.parseBlockStatements(Parser.java)
	at org.codehaus.janino.Parser.parseBlock(Parser.java)
	at org.codehaus.janino.Parser.parseMethodBody(Parser.java)
	at org.codehaus.janino.Parser.parseMethodDeclarationRest(Parser.java)
	at org.codehaus.janino.Parser.parseClassBodyDeclaration(Parser.java)
	at org.codehaus.janino.Parser.parseClassBody(Parser.java)
	at org.codehaus.janino.Parser.parseClassDeclarationRest(Parser.java)
	at org.codehaus.janino.Parser.parsePackageMemberTypeDeclaration(Parser.java)
	at org.codehaus.janino.Parser.parseCompilationUnit(Parser.java)
	at org.drools.commons.jci.compilers.JaninoJavaCompiler$CompilingIClassLoader.findIClass(JaninoJavaCompiler.java:90)
	at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java)
	at org.codehaus.janino.UnitCompiler.loadFullyQualifiedClass(UnitCompiler.java)
	at org.codehaus.janino.UnitCompiler.import2(UnitCompiler.java)
	at org.codehaus.janino.UnitCompiler.access$2(UnitCompiler.java)
	at org.codehaus.janino.UnitCompiler$1.visitSingleStaticImportDeclaration(UnitCompiler.java)
	at org.codehaus.janino.Java$CompilationUnit$SingleStaticImportDeclaration.accept(Java.java)
	at org.codehaus.janino.UnitCompiler.<init>(UnitCompiler.java)
	at org.drools.commons.jci.compilers.JaninoJavaCompiler$CompilingIClassLoader.findIClass(JaninoJavaCompiler.java:91)
	at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java)
	at org.codehaus.janino.UnitCompiler.loadFullyQualifiedClass(UnitCompiler.java)
	at org.codehaus.janino.UnitCompiler.import2(UnitCompiler.java)
	at org.codehaus.janino.UnitCompiler.access$2(UnitCompiler.java)
	at org.codehaus.janino.UnitCompiler$1.visitSingleStaticImportDeclaration(UnitCompiler.java)
	at org.codehaus.janino.Java$CompilationUnit$SingleStaticImportDeclaration.accept(Java.java)
	at org.codehaus.janino.UnitCompiler.<init>(UnitCompiler.java)
	at org.drools.commons.jci.compilers.JaninoJavaCompiler$CompilingIClassLoader.findIClass(JaninoJavaCompiler.java:91)
	at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java)
	at org.codehaus.janino.UnitCompiler.loadFullyQualifiedClass(UnitCompiler.java)
	at org.codehaus.janino.UnitCompiler.import2(UnitCompiler.java)
	at org.codehaus.janino.UnitCompiler.access$2(UnitCompiler.java)
	at org.codehaus.janino.UnitCompiler$1.visitSingleStaticImportDeclaration(UnitCompiler.java)
	at org.codehaus.janino.Java$CompilationUnit$SingleStaticImportDeclaration.accept(Java.java)
	at org.codehaus.janino.UnitCompiler.<init>(UnitCompiler.java)
	at org.drools.commons.jci.compilers.JaninoJavaCompiler$CompilingIClassLoader.findIClass(JaninoJavaCompiler.java:91)
	at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java)
	at org.codehaus.janino.UnitCompiler.loadFullyQualifiedClass(UnitCompiler.java)
        (... and the loop continues ... )
{code}

Please note that the problem does not occur when using commons-jci-eclipse or when using JANINO
from command line:

{code}
[etirelli@localhost test]$ ../janino-2.5.9/bin/janinoc test/*.java
[etirelli@localhost test]$ 
{code}

This problem is affecting JANINO support in the Drools project as described in ticket:

http://jira.jboss.com/jira/browse/JBRULES-1013

Thanks,
Edson

  was:
A stack overflow occurs when trying to compile classes with cross references using commons-jci-janino,
because an infinite recursion. The simple presence of cross reference import is enough to
cause the problem.

Example: the following classes will recreate the problem:

package test;

import static test.Func2.func2;

public class Func1 {
   public static boolean func1() throws Exception {
   return true;
   }
}

package test;

import static test.Func1.func1;

public class Func2 {
   public static boolean func2() throws Exception {
   return true;
   }
} 

The exception stack is:

java.lang.StackOverflowError
	at org.codehaus.janino.Parser.parseAndExpression(Parser.java)
	at org.codehaus.janino.Parser.parseExclusiveOrExpression(Parser.java)
	at org.codehaus.janino.Parser.parseInclusiveOrExpression(Parser.java)
	at org.codehaus.janino.Parser.parseConditionalAndExpression(Parser.java)
	at org.codehaus.janino.Parser.parseConditionalOrExpression(Parser.java)
	at org.codehaus.janino.Parser.parseConditionalExpression(Parser.java)
	at org.codehaus.janino.Parser.parseAssignmentExpression(Parser.java)
	at org.codehaus.janino.Parser.parseExpression(Parser.java)
	at org.codehaus.janino.Parser.parseReturnStatement(Parser.java)
	at org.codehaus.janino.Parser.parseStatement(Parser.java)
	at org.codehaus.janino.Parser.parseBlockStatement(Parser.java)
	at org.codehaus.janino.Parser.parseBlockStatements(Parser.java)
	at org.codehaus.janino.Parser.parseBlock(Parser.java)
	at org.codehaus.janino.Parser.parseMethodBody(Parser.java)
	at org.codehaus.janino.Parser.parseMethodDeclarationRest(Parser.java)
	at org.codehaus.janino.Parser.parseClassBodyDeclaration(Parser.java)
	at org.codehaus.janino.Parser.parseClassBody(Parser.java)
	at org.codehaus.janino.Parser.parseClassDeclarationRest(Parser.java)
	at org.codehaus.janino.Parser.parsePackageMemberTypeDeclaration(Parser.java)
	at org.codehaus.janino.Parser.parseCompilationUnit(Parser.java)
	at org.drools.commons.jci.compilers.JaninoJavaCompiler$CompilingIClassLoader.findIClass(JaninoJavaCompiler.java:90)
	at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java)
	at org.codehaus.janino.UnitCompiler.loadFullyQualifiedClass(UnitCompiler.java)
	at org.codehaus.janino.UnitCompiler.import2(UnitCompiler.java)
	at org.codehaus.janino.UnitCompiler.access$2(UnitCompiler.java)
	at org.codehaus.janino.UnitCompiler$1.visitSingleStaticImportDeclaration(UnitCompiler.java)
	at org.codehaus.janino.Java$CompilationUnit$SingleStaticImportDeclaration.accept(Java.java)
	at org.codehaus.janino.UnitCompiler.<init>(UnitCompiler.java)
	at org.drools.commons.jci.compilers.JaninoJavaCompiler$CompilingIClassLoader.findIClass(JaninoJavaCompiler.java:91)
	at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java)
	at org.codehaus.janino.UnitCompiler.loadFullyQualifiedClass(UnitCompiler.java)
	at org.codehaus.janino.UnitCompiler.import2(UnitCompiler.java)
	at org.codehaus.janino.UnitCompiler.access$2(UnitCompiler.java)
	at org.codehaus.janino.UnitCompiler$1.visitSingleStaticImportDeclaration(UnitCompiler.java)
	at org.codehaus.janino.Java$CompilationUnit$SingleStaticImportDeclaration.accept(Java.java)
	at org.codehaus.janino.UnitCompiler.<init>(UnitCompiler.java)
	at org.drools.commons.jci.compilers.JaninoJavaCompiler$CompilingIClassLoader.findIClass(JaninoJavaCompiler.java:91)
	at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java)
	at org.codehaus.janino.UnitCompiler.loadFullyQualifiedClass(UnitCompiler.java)
	at org.codehaus.janino.UnitCompiler.import2(UnitCompiler.java)
	at org.codehaus.janino.UnitCompiler.access$2(UnitCompiler.java)
	at org.codehaus.janino.UnitCompiler$1.visitSingleStaticImportDeclaration(UnitCompiler.java)
	at org.codehaus.janino.Java$CompilationUnit$SingleStaticImportDeclaration.accept(Java.java)
	at org.codehaus.janino.UnitCompiler.<init>(UnitCompiler.java)
	at org.drools.commons.jci.compilers.JaninoJavaCompiler$CompilingIClassLoader.findIClass(JaninoJavaCompiler.java:91)
	at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java)
	at org.codehaus.janino.UnitCompiler.loadFullyQualifiedClass(UnitCompiler.java)
        (... and the loop continues ... )

Please note that the problem does not occur when using commons-jci-eclipse or when using JANINO
from command line:

[etirelli@localhost test]$ ../janino-2.5.9/bin/janinoc test/*.java
[etirelli@localhost test]$ 

This problem is affecting JANINO support in the Drools project as described in ticket:

http://jira.jboss.com/jira/browse/JBRULES-1013

Thanks,
Edson

    Affects Version/s:     (was: 1.1)
                       1.0
        Fix Version/s:     (was: 1.1RC1)
                       1.1
    
> Stack overflow on cross imports in commons-jci-janino
> -----------------------------------------------------
>
>                 Key: JCI-53
>                 URL: https://issues.apache.org/jira/browse/JCI-53
>             Project: Commons JCI
>          Issue Type: Bug
>          Components: compiler janino
>    Affects Versions: 1.0
>            Reporter: Edson Tirelli
>            Assignee: Torsten Curdt
>            Priority: Blocker
>             Fix For: 1.1
>
>
> A stack overflow occurs when trying to compile classes with cross references using commons-jci-janino,
because an infinite recursion. The simple presence of cross reference import is enough to
cause the problem.
> Example: the following classes will recreate the problem:
> {code}
> package test;
> import static test.Func2.func2;
> public class Func1 {
>    public static boolean func1() throws Exception {
>        return true;
>    }
> }
> {code}
> {code}
> package test;
> import static test.Func1.func1;
> public class Func2 {
>    public static boolean func2() throws Exception {
>        return true;
>    }
> } 
> {code}
> The exception stack is:
> {code}
> java.lang.StackOverflowError
> 	at org.codehaus.janino.Parser.parseAndExpression(Parser.java)
> 	at org.codehaus.janino.Parser.parseExclusiveOrExpression(Parser.java)
> 	at org.codehaus.janino.Parser.parseInclusiveOrExpression(Parser.java)
> 	at org.codehaus.janino.Parser.parseConditionalAndExpression(Parser.java)
> 	at org.codehaus.janino.Parser.parseConditionalOrExpression(Parser.java)
> 	at org.codehaus.janino.Parser.parseConditionalExpression(Parser.java)
> 	at org.codehaus.janino.Parser.parseAssignmentExpression(Parser.java)
> 	at org.codehaus.janino.Parser.parseExpression(Parser.java)
> 	at org.codehaus.janino.Parser.parseReturnStatement(Parser.java)
> 	at org.codehaus.janino.Parser.parseStatement(Parser.java)
> 	at org.codehaus.janino.Parser.parseBlockStatement(Parser.java)
> 	at org.codehaus.janino.Parser.parseBlockStatements(Parser.java)
> 	at org.codehaus.janino.Parser.parseBlock(Parser.java)
> 	at org.codehaus.janino.Parser.parseMethodBody(Parser.java)
> 	at org.codehaus.janino.Parser.parseMethodDeclarationRest(Parser.java)
> 	at org.codehaus.janino.Parser.parseClassBodyDeclaration(Parser.java)
> 	at org.codehaus.janino.Parser.parseClassBody(Parser.java)
> 	at org.codehaus.janino.Parser.parseClassDeclarationRest(Parser.java)
> 	at org.codehaus.janino.Parser.parsePackageMemberTypeDeclaration(Parser.java)
> 	at org.codehaus.janino.Parser.parseCompilationUnit(Parser.java)
> 	at org.drools.commons.jci.compilers.JaninoJavaCompiler$CompilingIClassLoader.findIClass(JaninoJavaCompiler.java:90)
> 	at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java)
> 	at org.codehaus.janino.UnitCompiler.loadFullyQualifiedClass(UnitCompiler.java)
> 	at org.codehaus.janino.UnitCompiler.import2(UnitCompiler.java)
> 	at org.codehaus.janino.UnitCompiler.access$2(UnitCompiler.java)
> 	at org.codehaus.janino.UnitCompiler$1.visitSingleStaticImportDeclaration(UnitCompiler.java)
> 	at org.codehaus.janino.Java$CompilationUnit$SingleStaticImportDeclaration.accept(Java.java)
> 	at org.codehaus.janino.UnitCompiler.<init>(UnitCompiler.java)
> 	at org.drools.commons.jci.compilers.JaninoJavaCompiler$CompilingIClassLoader.findIClass(JaninoJavaCompiler.java:91)
> 	at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java)
> 	at org.codehaus.janino.UnitCompiler.loadFullyQualifiedClass(UnitCompiler.java)
> 	at org.codehaus.janino.UnitCompiler.import2(UnitCompiler.java)
> 	at org.codehaus.janino.UnitCompiler.access$2(UnitCompiler.java)
> 	at org.codehaus.janino.UnitCompiler$1.visitSingleStaticImportDeclaration(UnitCompiler.java)
> 	at org.codehaus.janino.Java$CompilationUnit$SingleStaticImportDeclaration.accept(Java.java)
> 	at org.codehaus.janino.UnitCompiler.<init>(UnitCompiler.java)
> 	at org.drools.commons.jci.compilers.JaninoJavaCompiler$CompilingIClassLoader.findIClass(JaninoJavaCompiler.java:91)
> 	at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java)
> 	at org.codehaus.janino.UnitCompiler.loadFullyQualifiedClass(UnitCompiler.java)
> 	at org.codehaus.janino.UnitCompiler.import2(UnitCompiler.java)
> 	at org.codehaus.janino.UnitCompiler.access$2(UnitCompiler.java)
> 	at org.codehaus.janino.UnitCompiler$1.visitSingleStaticImportDeclaration(UnitCompiler.java)
> 	at org.codehaus.janino.Java$CompilationUnit$SingleStaticImportDeclaration.accept(Java.java)
> 	at org.codehaus.janino.UnitCompiler.<init>(UnitCompiler.java)
> 	at org.drools.commons.jci.compilers.JaninoJavaCompiler$CompilingIClassLoader.findIClass(JaninoJavaCompiler.java:91)
> 	at org.codehaus.janino.IClassLoader.loadIClass(IClassLoader.java)
> 	at org.codehaus.janino.UnitCompiler.loadFullyQualifiedClass(UnitCompiler.java)
>         (... and the loop continues ... )
> {code}
> Please note that the problem does not occur when using commons-jci-eclipse or when using
JANINO from command line:
> {code}
> [etirelli@localhost test]$ ../janino-2.5.9/bin/janinoc test/*.java
> [etirelli@localhost test]$ 
> {code}
> This problem is affecting JANINO support in the Drools project as described in ticket:
> http://jira.jboss.com/jira/browse/JBRULES-1013
> Thanks,
> Edson

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message