Repository navigation
fix(common): handle classes without a superclass - #22
Open
Hanabi9248 wants to merge 1 commit into
Open
Hanabi9248 wants to merge 1 commit into
Hanabi9248 wants to merge 1 commit into
Conversation
Compare from Number.class before the existing wrapper and primitive clauses. Genuine primitive, Object and interface Class values then evaluate instead of throwing NullPointerException. Cover ten JDK class inputs through the complete CommonUtil class. Keep the existing classification clauses and null-Class policy. Signed-off-by: Hanabi <317387557+Hanabi9248@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CommonUtil.isNumber(Class)dereferencesgetSuperclass()before reaching its existing primitive-type branch. Primitive classes, Object.class and interfaces have no superclass, so these ordinary inputs throw NullPointerException.Call
equalson Number.class instead. A missing superclass becomes a non-match and evaluation continues through the existing wrapper/primitive clauses. The classification clauses and null-Class policy are unchanged. This is a public utility fix; no deployed service incident is claimed.Validated the complete actual CommonUtil and unchanged DateHelper support on Windows, JDK 25.0.4.101 with
--release 8, using real commons-lang 2.4, slf4j-api 1.7.30 and Lombok 1.18.42. Baseline: eight NullPointerExceptions and two passing controls. Candidate: all ten pass, covering six numeric primitive classes, Object.class, CharSequence.class, Integer.class and String.class.The project's commons-lang 2.6 and Lombok 1.18.20, a Java 8 runtime, Linux and the full Maven/backend suite were not tested. The standalone Java regression is manual; hosted CI coverage is not claimed. This branch contains only the class-predicate change, independently of #15's UTC conversion fix.