Java Compile Error: The code of method is exceeding the 65535 bytes limit

Issue:

When you compile your java class, you may got following error.

The code of method is exceeding the 65535 bytes limit

 

Reason:

According Java specification, one Java method size must be less than 65535 Bytes (64k). In most cases you encounter this error is because you want to init a big data or your java class is generated by some toolkit.

Solution:

One workaround is divide your big size method into some pieces of small size methods.

For example,

public static Float[][] getSMatrix()
{
    initSMatrixPart1() ;
    initSMatrixPart2() ;
    initSMatrixPart3() ;
    initSMatrixPart4() ;
    initSMatrixPart5() ;
        
    return sMatrix;
        
}

你可能感兴趣的:(java,less,Class,float,Data,big)