The iOS warning census reports 4 instances of -Wobjc-method-access, covering
two selectors:
IOSNative.m instance method '-flushBufferForReadback:y:width:height:' not found (return type defaults to 'id')
CodenameOne_GLViewController.m same
CN1TapGestureRecognizer.m instance method '-foldKeyboard:' not found (return type defaults to 'id') (x2)
Both methods exist -- CodenameOne_GLViewController.m:5520 and :5661 -- but
neither is declared in a header, so every caller in another translation unit
compiles against no prototype at all.
Why this is a defect and not noise. With no declaration clang assumes the
method returns id and infers parameter types from the call. foldKeyboard:
takes a CGPoint, a struct passed by value; CN1TapGestureRecognizer.m:268
and :313 call it cross-file with no prototype, so nothing checks that the
struct is passed the way the callee reads it. Nothing warns at runtime either
-- Objective-C dispatch succeeds, because the method really is implemented.
This is also the exact diagnostic the macOS template already promotes to an
error, with a comment explaining that a receiver whose class does not declare
the selector is a default-level warning and a runtime crash. The iOS template
does not, and adopting -Werror=objc-method-access there is blocked by these
four sites and nothing else.
Scope
- Declare both methods in
CodenameOne_GLViewController.h (or whichever header
the callers already import).
- Re-run the census and confirm
-Wobjc-method-access reaches zero.
- Then adopt
WARNING_CFLAGS = ("-Werror=objc-method-access") in the iOS
template, mirroring the macOS one. Note this changes customer builds, so it
ships on its own.
Editing the iOS template pbxproj has three constraints worth reading before
touching it: never introduce a nested }; inside a buildSettings = { ... }
block (IPhoneBuilder.injectDevelopmentTeam matches it non-greedy with DOTALL
and truncates at the first one -- a parenthesised list is safe); do not move or
reformat the literal-matched anchor lines; and comments must not contain the
substring template, which replaceInFile rewrites to the application name.
Found by the native warning census (scripts/check-native-warnings.py).
The iOS warning census reports 4 instances of
-Wobjc-method-access, coveringtwo selectors:
Both methods exist --
CodenameOne_GLViewController.m:5520and:5661-- butneither is declared in a header, so every caller in another translation unit
compiles against no prototype at all.
Why this is a defect and not noise. With no declaration clang assumes the
method returns
idand infers parameter types from the call.foldKeyboard:takes a
CGPoint, a struct passed by value;CN1TapGestureRecognizer.m:268and
:313call it cross-file with no prototype, so nothing checks that thestruct is passed the way the callee reads it. Nothing warns at runtime either
-- Objective-C dispatch succeeds, because the method really is implemented.
This is also the exact diagnostic the macOS template already promotes to an
error, with a comment explaining that a receiver whose class does not declare
the selector is a default-level warning and a runtime crash. The iOS template
does not, and adopting
-Werror=objc-method-accessthere is blocked by thesefour sites and nothing else.
Scope
CodenameOne_GLViewController.h(or whichever headerthe callers already import).
-Wobjc-method-accessreaches zero.WARNING_CFLAGS = ("-Werror=objc-method-access")in the iOStemplate, mirroring the macOS one. Note this changes customer builds, so it
ships on its own.
Editing the iOS template pbxproj has three constraints worth reading before
touching it: never introduce a nested
};inside abuildSettings = { ... }block (
IPhoneBuilder.injectDevelopmentTeammatches it non-greedy with DOTALLand truncates at the first one -- a parenthesised list is safe); do not move or
reformat the literal-matched anchor lines; and comments must not contain the
substring
template, whichreplaceInFilerewrites to the application name.Found by the native warning census (
scripts/check-native-warnings.py).