Suppress Warning "Field May Be Final" for Serializable
Asked Answered
P

0

8

In IntelliJ I activated the "Field May Be Final" inspection because of the project's coding guidelines.

But this makes no sense for Serializable classes, where final fields would cause serialization problems. Is there a possibility to automatically suppress this warning for classes that implement the Serializable interface? My current workaround is to use @SuppressWarnings("FieldMayBeFinal").

As a reaction to Kayaman's comment: Serialization of final fields is an issue here as this does not work with the GWT framework. Sorry, I should have mentioned that.

enter image description here

Portal answered 25/1, 2017 at 14:46 Comment(6)
No problem with serialization.Humism
Thank you for your hint but serialization of final fields is an issue here as this does not work with the GWT framework. Sorry, I should have mentioned that earlier.Portal
Yes you should have. I can "dupehammer" this singlehandedly, but apparently I can't reopen this without 4 other votes. What the hell.Humism
@Humism That's because OP removed the java tag where you have the dupehammer.Leptospirosis
@Leptospirosis Ah, I thought it behaved differently than I remembered.Humism
Re-added it... what an adventure ;-)Portal

© 2022 - 2024 — McMap. All rights reserved.