[Objective-C][S1767] False Positive report of "Pointers should not be cast to integral types"

  • What language is this for?
    • Objective-C
  • Which rule?
    • S1767 - Pointers should not be cast to integral types
  • Are you using
    • SonarQube - I think it’s 8.x, will try to get precision on this from devops.
  • How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
@interface MyClass

@property (nonatomic, assign) CGContextRef renderedContext;


@implementation MyClass

-(void)updateRenderedContext:(CGContextRef)newContext {
    _renderedContext = newContext; // (1)

  • Why do you believe it’s a false-positive/false-negative?
    Both newContext and _renderedContext are the same CGContextRef type.

Hey there.

Thanks for the report. We won’t be able to comment on it further until we know exactly what version of SonarQube is being used.

We’re using 8.9.10 (build 61542)

Hey there.

Can you please upgrade to SonarQube v9.9 LTS and see if the false-positive persists? There have been efforts to suppress false-positives on this rule in the v9.x series.