4

What are the downsides to using the -parameters argument to javac (with Java 8)?

I'm wanting to use it to remove a bit more boilerplate in some Jackson data classes and this seems like a good way to do it. The main disadvantage I see is that it makes the compiled classes larger. Though not by much. One project I've been working with:

  • jar size without -parameters: 107k
  • jar size with -parameters: 110k

Are there other known downsides?

Jay Anderson
  • 937
  • 1
  • 8
  • 18
  • 3
    I can't see how there would be - it's simply keeping the variable names of the parameters in the constructors / methods rather than replacing them with synthetic versions. That's not going to affect speed, reliability or anything else I can think of - it just takes a bit more space to store them. – Michael Berry Sep 09 '15 at 21:23
  • I found one more: https://jira.spring.io/browse/DATAJPA-758. If you use `-parameters` and are using an older version of spring data jpa (1.8.1 and earlier it appears) and use offset based query parameter (e.g. `?1`) then it throws an error. So there may be libraries out there which don't play nice with it. – Jay Anderson Sep 09 '15 at 21:58
  • 3
    well that's not the fault of `-parameters` – ZhongYu Sep 09 '15 at 22:23

0 Answers0