V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
thetydead
V2EX  ›  Java

Java 内部类最多可以有多少层?

  •  
  •   thetydead ·
    thetydead · Oct 11, 2018 · 4037 views
    This topic created in 2762 days ago, the information mentioned may be changed or developed.

    一个内部类里面还有个内部类,无限循环。。。那么最多可以有多少层呢?

    5 replies    2018-10-11 17:55:05 +08:00
    jmc891205
        1
    jmc891205  
       Oct 11, 2018
    我没试过 但我不觉得有个最大值
    lirau
        2
    lirau  
       Oct 11, 2018
    用 javaassist 是不是能构造一下试试?
    BlueMeow
        3
    BlueMeow  
       Oct 11, 2018 via iPhone
    可能会被文件系统的路径长度限制

    .class 文件的名字长度越来越长,until...
    BlueMeow
        4
    BlueMeow  
       Oct 11, 2018 via iPhone
    如果用 Janino 动态生成的话,可以试试
    ebingtel
        5
    ebingtel  
       Oct 11, 2018
    @jmc891205 虚拟机对字符串长度应该有限制吧?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   733 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 20:45 · PVG 04:45 · LAX 13:45 · JFK 16:45
    ♥ Do have faith in what you're doing.