pjfanning opened a new pull request, #1374: URL: https://github.com/apache/poi/pull/1374
SpotBugs flags public/protected static fields that callers can change (MS_SHOULD_BE_FINAL / MS_PKGPROTECT / MS_MUTABLE_ARRAY). This PR fixes them without breaking any API that shipped in 5.5.1. ### Made private These are safe to narrow: - **`HwmfBitmapDib.MAX_HEIGHT_WIDTH`**: added after 5.5.1, and `setMaxHeightWidth`/`getMaxHeightWidth` already exist. - **`FunctionEval.functions`**: the class is `final` with a private constructor, so `protected` gave no extra access. ### POI uses a private copy; the old field is deprecated For these arrays, changing an element changed POI's behaviour globally. POI now reads its own private array, and the existing field is a deprecated copy, `@Removal(version = "7.0.0")`: - **`VariantSupport.SUPPORTED_TYPES`**: the replacement is `isSupportedType(int)`. - **`XSSFPictureData.RELATIONS`** and **`XWPFPictureData.RELATIONS`**: POI uses a new package-private `getRelationForType(int)`. - **`HSLFSimpleShape.ADJUST_VALUES`**: POI uses a new package-private `getAdjustValueProperty(int)`. The only behaviour change is for code that wrote into one of these arrays to change POI's behaviour; that no longer has any effect. ### Deprecated only - **`HwmfPicture.MAX_RECORD_LENGTH`** (public) and **`EscherRecord.MAX_NUMBER_OF_CHILDREN`** (protected) hold the live limit, so making them private would break code that sets them directly. They are deprecated for removal in 7.0.0 in favour of the setters/getters that already exist. The Escher subclasses now read the limit through `getMaxNumberOfChildren()`. ### Not changed - **`DocumentSummaryInformation.FORMAT_ID`**: its elements are the same mutable `ClassID` instances that `ClassIDPredefined` hands out, so copying the array wouldn't protect anything. Fixing it needs `ClassID` itself to change. - **`PropertyIDMap`** getters and **`RandomSingleton.getInstance()`**: these are false positives. The maps are unmodifiable, and returning the instance is the point of a singleton. - **`Insets2D`**: the public fields are instance fields, like `java.awt.Insets`. Tests: the hpsf, ddf and formula-eval tests in poi; the picture-data, `TestXSSFWorkbook` and xwpf usermodel tests in poi-ooxml; and the HSLF shape, HWMF and Escher tests in scratchpad all pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
