google/auto

Is there a limit on the number of parameters or abstract methods we can have for the AutoValue class?

WillWcchan opened this issue · 2 comments

Currently working on a Foreign Exchange currency class - where one Foreign Exchange currency can map to several 150+ currencies exchange rates. (i.e. 'USD' mapping to {'EURO'. 'GLB', 'CNY', 'JPY', etc ... })

Here is my sample code (had problems formatting the code on GitHub):

Screen Shot 2022-09-26 at 2 37 15 PM

When I compiled, I get an error message stating:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project plugins-all-connectors: Compilation failure
[ERROR] /Users/....FX.java:[386,11] too many parameters

I decided to comment out some of those abstract get and set calls and the error completely went away. I'm wondering what is the limit or is there an AutoValue annotation that I'm not aware of?

Java JDK:

openjdk version "11.0.15" 2022-04-19
OpenJDK Runtime Environment Homebrew (build 11.0.15+0)
OpenJDK 64-Bit Server VM Homebrew (build 11.0.15+0, mixed mode)

Maven Build:
com.google.auto.value (artifactId - auto-value and auto-value-annotations) - all running on version 1.8

Java in general has a cap of 256 parameters to a method, having nothing to do with AutoValue. You may have encountered this limit. (Separately, I might advise not using separate methods for each currency code, but e.g. using enums or other objects to represent each currency.)

Thank you!