Coder Social home page Coder Social logo

Comments (3)

marvec avatar marvec commented on July 19, 2024 2

You are right! Do you have any plans for support of auto-boxing?

from javassist.

chibash avatar chibash commented on July 19, 2024

Was the exception thrown here?

((httl.Template)(((ahoj) != null ? (ahoj) : (1)))).render($output);

If yes, the reason is that Javassist does not support auto boxing (it supports only Java 1.4 syntax) and hence 1 is not an Integer object. So the source code given should be:

((httl.Template)(((ahoj) != null ? (ahoj) : (new Integer(1))))).render($output);

from javassist.

Stephan972 avatar Stephan972 commented on July 19, 2024

I encoutered similar problem while generating a class with Javassist :

CtNewMethod.make(
    "public boolean compareWith(my.package.MyClass anInstance) {" + //
    "  return java.util.Objects.equals(this.primitiveBooleanField, anInstance.primitiveBooleanField);" + //
    "}" 
);

Here is the exception stacktrace :

Caused by: javassist.compiler.CompileError: equals(boolean,boolean) not found in java.util.Objects
	at javassist.compiler.TypeChecker.atMethodCallCore(TypeChecker.java:777)
	at javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:723)
	at javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:170)
	at javassist.compiler.ast.CallExpr.accept(CallExpr.java:49)
	at javassist.compiler.TypeChecker.booleanExpr(TypeChecker.java:551)
	at javassist.compiler.TypeChecker.atBinExpr(TypeChecker.java:365)
	at javassist.compiler.ast.BinExpr.accept(BinExpr.java:45)
	at javassist.compiler.TypeChecker.booleanExpr(TypeChecker.java:550)
	at javassist.compiler.TypeChecker.atBinExpr(TypeChecker.java:365)
	at javassist.compiler.ast.BinExpr.accept(BinExpr.java:45)
	at javassist.compiler.TypeChecker.booleanExpr(TypeChecker.java:550)
	at javassist.compiler.TypeChecker.atBinExpr(TypeChecker.java:365)
	at javassist.compiler.ast.BinExpr.accept(BinExpr.java:45)
	at javassist.compiler.TypeChecker.booleanExpr(TypeChecker.java:550)
	at javassist.compiler.TypeChecker.atBinExpr(TypeChecker.java:365)
	at javassist.compiler.ast.BinExpr.accept(BinExpr.java:45)
	at javassist.compiler.TypeChecker.booleanExpr(TypeChecker.java:550)
	at javassist.compiler.TypeChecker.atBinExpr(TypeChecker.java:365)
	at javassist.compiler.ast.BinExpr.accept(BinExpr.java:45)
	at javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:266)
	at javassist.compiler.CodeGen.compileExpr(CodeGen.java:253)
	at javassist.compiler.CodeGen.atReturnStmnt2(CodeGen.java:641)
	at javassist.compiler.JvstCodeGen.atReturnStmnt(JvstCodeGen.java:443)
	at javassist.compiler.CodeGen.atStmnt(CodeGen.java:393)
	at javassist.compiler.ast.Stmnt.accept(Stmnt.java:53)
	at javassist.compiler.CodeGen.atStmnt(CodeGen.java:381)
	at javassist.compiler.ast.Stmnt.accept(Stmnt.java:53)
	at javassist.compiler.CodeGen.atMethodBody(CodeGen.java:321)
	at javassist.compiler.CodeGen.atMethodDecl(CodeGen.java:303)
	at javassist.compiler.ast.MethodDecl.accept(MethodDecl.java:47)
	at javassist.compiler.Javac.compileMethod(Javac.java:175)
	at javassist.compiler.Javac.compile(Javac.java:102)
	at javassist.CtNewMethod.make(CtNewMethod.java:79)

Javassist 3.24.1-GA

We miss auto-boxing support a lot !

from javassist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.