Repository navigation
Declare Framingham stroke points as int arrays - #1718
Open
namespaceMarcello wants to merge 1 commit into
Open
namespaceMarcello wants to merge 1 commit into
namespaceMarcello wants to merge 1 commit into
Conversation
The diabetes, coronary heart disease and atrial fibrillation stroke points were declared as double[] although they are whole numbers and are added to the int strokePoints, so each += narrowed a double to an int. CodeQL reports this as java/implicit-cast-in-compound-assignment. The values are unchanged, so the computed stroke risk and the generated patients stay the same. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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.
Problem
In
Framingham.stroke10Year(), the diabetes, coronary heart disease and atrial fibrillation points are stored indouble[]arrays (diabetes_stroke,chd_stroke_points,atrial_fibrillation_stroke_points) and added toint strokePointswith+=, which silently narrows adoubleto anint. CodeQL flags the three lines asjava/implicit-cast-in-compound-assignment(high).Everything else added to
strokePointsin the method is already anint: the points for smoking and left ventricular hypertrophy, and the indexes returned bygetIndexForValueInRangelist.Solution
Declare the three arrays as
int[]. Their values ({2, 3},{4, 2},{4, 6}) are whole numbers, so the points, the stroke risk and the generated patients are unchanged.Tests
No behavior changes, so there is no new test.
./gradlew testsuite passes locally (JDK 21), and checkstyle reports no warnings on the changed file.masterreports these three alerts and nothing else in the Java code.This PR was written by Claude Code (AI assistant) on behalf of @namespaceMarcello, who directs this work.
🤖 Generated with Claude Code