Skip to content

Avoid methods relying on default locale or charset, fixes #127#128

Merged
ato merged 16 commits into
iipc:masterfrom
sebastian-nagel:127-avoid-methods-default-locale
Nov 14, 2025
Merged

Avoid methods relying on default locale or charset, fixes #127#128
ato merged 16 commits into
iipc:masterfrom
sebastian-nagel:127-avoid-methods-default-locale

Conversation

@sebastian-nagel

@sebastian-nagel sebastian-nagel commented Nov 11, 2025

Copy link
Copy Markdown
Collaborator

This PR add the forbiddenAPIs Maven plugin and fixes many of the forbidden calls, see #127.

To run the checks, execute mvn verify

Some work is to be done.

methods relying on default locale are charset are used.
Also forbid usage of URL.equals and .hashCode which may
resolve host named per DNS lookup.
String.toLowerCase(), String.toUpperCase() and String.format(...)
PrintStream.format(...) and number formatters
@sebastian-nagel sebastian-nagel force-pushed the 127-avoid-methods-default-locale branch from 8193e92 to c013b25 Compare November 11, 2025 18:47
call String.getBytes() with charset.
to configure the charset. Use default charset for main
methods when reading from stdin.
@sebastian-nagel

Copy link
Copy Markdown
Collaborator Author

The core classes are done, test classes remaining. Staying compatible with Java 8 makes the adaption not an easy task because many IO writers do not yet accept Charset parameters.

@sebastian-nagel sebastian-nagel marked this pull request as ready for review November 12, 2025 13:19
@sebastian-nagel

Copy link
Copy Markdown
Collaborator Author

Ok. I'll look for the failing forbiddenAPIs run with Java 8.

- explicetly pass Java version
- ignore signatures of missing classes
@ato ato merged commit e90e6c0 into iipc:master Nov 14, 2025
5 checks passed
@ato

ato commented Nov 14, 2025

Copy link
Copy Markdown
Member

Nice improvement. Released as 3.0.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants