Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.UnsupportedOperationException: can't load this type of class file (in android) #214

Closed
chancyWu opened this issue Jul 26, 2021 · 6 comments · Fixed by #218
Closed

Comments

@chancyWu
Copy link
Contributor

When i use the enforce(sub, obj, act) in android, there will be some Error thrown from the aviator.
Detailed log is as below:

java.lang.ExceptionInInitializerError
        at com.googlecode.aviator.AviatorEvaluator$StaticHolder.access$000(AviatorEvaluator.java:90)
        at com.googlecode.aviator.AviatorEvaluator.getInstance(AviatorEvaluator.java:101)
        at com.googlecode.aviator.AviatorEvaluator.<clinit>(AviatorEvaluator.java:61)
        at com.googlecode.aviator.AviatorEvaluator.newInstance(AviatorEvaluator.java:87)
        at org.casbin.jcasbin.main.CoreEnforcer.enforce(CoreEnforcer.java:423)
        at org.casbin.jcasbin.main.CoreEnforcer.enforce(CoreEnforcer.java:549)
        At xxxxxx…..
        at android.os.AsyncTask$3.call(AsyncTask.java:394)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)
     Caused by: com.googlecode.aviator.exception.CompileExpressionErrorException: define class error
        at com.googlecode.aviator.code.asm.ASMCodeGenerator.getResult(ASMCodeGenerator.java:849)
        at com.googlecode.aviator.code.OptimizeCodeGenerator.getResult(OptimizeCodeGenerator.java:440)
        at com.googlecode.aviator.code.LambdaGenerator.getResult(LambdaGenerator.java:424)
        at com.googlecode.aviator.code.LambdaGenerator.getLmabdaBootstrap(LambdaGenerator.java:189)
        at com.googlecode.aviator.code.OptimizeCodeGenerator.onLambdaBodyEnd(OptimizeCodeGenerator.java:785)
        at com.googlecode.aviator.code.LambdaGenerator.onLambdaBodyEnd(LambdaGenerator.java:472)
        at com.googlecode.aviator.parser.ExpressionParser.ifStatement(ExpressionParser.java:1916)
        at com.googlecode.aviator.parser.ExpressionParser.statement(ExpressionParser.java:1627)
        at com.googlecode.aviator.parser.ExpressionParser.statements(ExpressionParser.java:1853)
        at com.googlecode.aviator.parser.ExpressionParser.forStatement(ExpressionParser.java:1789)
        at com.googlecode.aviator.parser.ExpressionParser.statement(ExpressionParser.java:1634)
        at com.googlecode.aviator.parser.ExpressionParser.statements(ExpressionParser.java:1853)
        at com.googlecode.aviator.parser.ExpressionParser.lambda(ExpressionParser.java:793)
        at com.googlecode.aviator.parser.ExpressionParser.fnStatement(ExpressionParser.java:1265)
        at com.googlecode.aviator.parser.ExpressionParser.statement(ExpressionParser.java:1656)
        at com.googlecode.aviator.parser.ExpressionParser.statements(ExpressionParser.java:1835)
        at com.googlecode.aviator.parser.ExpressionParser.parse(ExpressionParser.java:1106)
        at com.googlecode.aviator.parser.ExpressionParser.parse(ExpressionParser.java:1120)
        at com.googlecode.aviator.AviatorEvaluatorInstance.innerCompile(AviatorEvaluatorInstance.java:1494)
        at com.googlecode.aviator.AviatorEvaluatorInstance.compile(AviatorEvaluatorInstance.java:1455)
        at com.googlecode.aviator.AviatorEvaluatorInstance.compile(AviatorEvaluatorInstance.java:1413)
        at com.googlecode.aviator.AviatorEvaluatorInstance.loadInternalLibs(AviatorEvaluatorInstance.java:1029)
        at com.googlecode.aviator.AviatorEvaluatorInstance.loadLib(AviatorEvaluatorInstance.java:898)
        at com.googlecode.aviator.AviatorEvaluatorInstance.<init>(AviatorEvaluatorInstance.java:1072)
        at com.googlecode.aviator.AviatorEvaluator$StaticHolder.<clinit>(AviatorEvaluator.java:91)
        at com.googlecode.aviator.AviatorEvaluator$StaticHolder.access$000(AviatorEvaluator.java:90) 
        at com.googlecode.aviator.AviatorEvaluator.getInstance(AviatorEvaluator.java:101) 
        at com.googlecode.aviator.AviatorEvaluator.<clinit>(AviatorEvaluator.java:61) 
        at com.googlecode.aviator.AviatorEvaluator.newInstance(AviatorEvaluator.java:87) 
        at org.casbin.jcasbin.main.CoreEnforcer.enforce(CoreEnforcer.java:423) 
        at org.casbin.jcasbin.main.CoreEnforcer.enforce(CoreEnforcer.java:549) 
        At xxxxxx…..
        at android.os.AsyncTask$3.call(AsyncTask.java:394) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:923) 
     Caused by: java.lang.UnsupportedOperationException: can't load this type of class file
        at java.lang.ClassLoader.defineClass(ClassLoader.java:517)
        at com.googlecode.aviator.parser.AviatorClassLoader.defineClass(AviatorClassLoader.java:32)
@hsluoyz
Copy link
Member

hsluoyz commented Jul 26, 2021

Asked here: killme2008/aviatorscript#403

@hsluoyz hsluoyz self-assigned this Jul 26, 2021
@hsluoyz
Copy link
Member

hsluoyz commented Sep 12, 2021

@tangyang9464

@tangyang9464
Copy link
Member

@chancyWu Can you test your application by using this version feat/android. You just need to use mvn install to package

@chancyWu
Copy link
Contributor Author

@tangyang9464 android can use the release, the issue is also fixed with the feat/android branch.

@tangyang9464
Copy link
Member

@chancyWu thanks.I'll make a PR to update version.

@github-actions
Copy link

🎉 This issue has been resolved in version 1.13.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants