Java Compile error: Parameter x is exceeding the limit of 255 words

前端 未结 3 1190
粉色の甜心
粉色の甜心 2021-01-18 15:32

I have a constructor (for an auto generated class) that has 255 paremeters. Using ant on linux with javac 1.6.0_02. The class compiles fine and everything is good.

H

3条回答
  •  野的像风
    2021-01-18 16:09

    There are 2 options to resolve this problem:

    1. Generate your class with no or some constructor arguments and then set rest parameters via setters. Like using builder pattern.
    2. Make simpler classes each holding 3 or 4 variables and set those simpler objects in 1 master class.

提交回复
热议问题