aws-cloudformation / aws-cloudformation/cloudformation-cli-java-plugin

[Proposal] Use unboxed boolean types in ResourceHandlerRequest

Offen
#341 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement good first issue
Vorherrschende Sprache
Java
Sterne
30
Forks
48
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

There are 2 recent changes that landed in `ResourceHandlerRequest`: https://github.com/aws-cloudformation/cloudformation-cli-java-plugin/commit/ebca1dc12e187b484ed599db65d726a6b23a14c0#diff-adfb207dac8dff5107b68b36280ccad4525f92176184ad2ffff9aa7e591b2e8a and https://github.com/aws-cloudformation/cloudformation-cli-java-plugin/commit/e34f0472d0bc67953f41d4ceb666a175d0a7fb2d#diff-adfb207dac8dff5107b68b36280ccad4525f92176184ad2ffff9aa7e591b2e8a.

Both changes favor boxed Boolean over primitive types.

As a result, the usage of this class implies on importing BooleanUtils or a similar helper in order to avoid constructions like: `if (request.getSnapshotRequested() != null && request.getSnapshotRequested() == true) { ... }`.

And the code that is performing a "naive" boolean comparison like: `if (request.getSnapshotRequested()) { ... }` will fail with a null-pointer exception.

The same stands for the rollback flag.

I wonder if var type boxing was done for some specific reasons? If there are no strict reasons, I would vote for unboxing them to simplify condition checking.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.