• Javassist编译报错:Type long_2nd (current frame, stack[2]) is not assignable to 'java/lang/Long'


    Caused by: compile error: invalid types for >
        at javassist.compiler.CodeGen.badTypes(CodeGen.java:1365)
        at javassist.compiler.CodeGen.convertOprandTypes(CodeGen.java:1426)
        at javassist.compiler.CodeGen.compareExpr(CodeGen.java:1316)
        at javassist.compiler.CodeGen.booleanExpr(CodeGen.java:1209)
        at javassist.compiler.CodeGen.compileBooleanExpr(CodeGen.java:261)
        at javassist.compiler.CodeGen.atIfStmnt(CodeGen.java:414)
        at javassist.compiler.CodeGen.atStmnt(CodeGen.java:385)
        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.atWhileStmnt(CodeGen.java:467)
        at javassist.compiler.CodeGen.atStmnt(CodeGen.java:387)
        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)
        ... 4 more
    Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
    Exception Details:
      Location:
        demo/service/DemoService$Proxy.<init>()V @8: putfield
      Reason:
        Type long_2nd (current frame, stack[2]) is not assignable to 'java/lang/Long'
      Current Frame:
        bci: @8
        flags: { }
        locals: { 'demo/service/DemoService$Proxy' }
        stack: { 'demo/service/DemoService$Proxy', long, long_2nd }
      Bytecode:
        0x0000000: 2ab7 00a4 2a14 00a5 b500 47b1   

    原因,我一段代码如下:

    long start = System.currentTimeMillis();
    Long timeout = 3000L;
    if (System.currentTimeMillis() - start > timeout){
        // TODO
    }

    long是基本类型,Long是long的包装类型,是个对象。基本类型和对象是不能直接比较的,问题就出在这里。

    小LUA 面对敌人的严刑逼供,我一个字也没说,而是一五一十写了下来。
  • 相关阅读:
    ECSHOP给分类添加图
    windows2008一键安装环境的配置说明
    在css中定义滚动条样式
    登录不到phpmyadmin
    dedecms程序给栏目增加缩略图的方法
    httpd.conf
    关于 equals() 与 hashCode() 个人理解总结
    postman 安装失败 Failed to install the .NET Framework, try installingthe latest version manully
    docker 私有仓库The push refers to repository [x:5000/test] Get https://x:5000/v2/: dial tcp x:5000: conn
    Redis window 和 Linux 环境下的搭建
  • 原文地址:https://www.cnblogs.com/LUA123/p/15405790.html
Copyright © 2020-2023  润新知