AI-assisted issue. Filed by agent driven by @soloturn via GDD.
Context
Wiring up the AnimalSniffer + gummy-bears-api-24 Android-suitability check (#83) surfaced 21 real violations across two modules — genuine gaps between NUI's API surface and what's available on Android, not signature-set false positives. Concrete motivation: DestinationSol's engine module depends directly on nui, nui-libgdx, nui-gestalt, and nui-reflect, and targets Android via libGDX.
Problem / Current State
nui-reflect: ReflectionUtil — 6 violations. resolvedMethodToString took a java.lang.reflect.Executable parameter and called getTypeParameters()/getName()/getDeclaringClass()/getGenericParameterTypes()/isVarArgs() on it directly. Executable itself isn't available before API 26, even though Method and Constructor each declare these same methods directly and have since long before API 24. typeToString also called Class.getTypeName() (API 26+).
nui: ObjectLayoutBuilder — 2 violations. Used Constructor.getParameters() (returns Parameter[]) and Parameter.getParameterizedType() to build the argument-type list. java.lang.reflect.Parameter itself isn't available before API 26.
nui: UIText clipboard — 13 violations. getClipboardContents()/setClipboardContents() use java.awt.Toolkit/Clipboard/DataFlavor/StringSelection/Transferable/UnsupportedFlavorException directly. Unlike the above two, this isn't fixable by calling a different method — AWT genuinely doesn't exist on Android at all.
Acceptance Criteria
Technical Notes
The last item is a real design decision, deliberately left out of #83 to keep that PR focused on the suitability check rather than a clipboard-abstraction redesign: likely a pluggable Clipboard strategy on UIText, defaulting to the current AWT-backed behavior on desktop, with nui-libgdx supplying a Gdx.app.getClipboard()-backed implementation for platforms (including Android) that have it.
Full violation reports (pre-fix, from #83's initial run): nui/build/reports/animalsniffer/main.text, nui-reflect/build/reports/animalsniffer/main.text.
Related
#83
Context
Wiring up the AnimalSniffer +
gummy-bears-api-24Android-suitability check (#83) surfaced 21 real violations across two modules — genuine gaps between NUI's API surface and what's available on Android, not signature-set false positives. Concrete motivation: DestinationSol'senginemodule depends directly onnui,nui-libgdx,nui-gestalt, andnui-reflect, and targets Android via libGDX.Problem / Current State
nui-reflect:ReflectionUtil— 6 violations.resolvedMethodToStringtook ajava.lang.reflect.Executableparameter and calledgetTypeParameters()/getName()/getDeclaringClass()/getGenericParameterTypes()/isVarArgs()on it directly.Executableitself isn't available before API 26, even thoughMethodandConstructoreach declare these same methods directly and have since long before API 24.typeToStringalso calledClass.getTypeName()(API 26+).nui:ObjectLayoutBuilder— 2 violations. UsedConstructor.getParameters()(returnsParameter[]) andParameter.getParameterizedType()to build the argument-type list.java.lang.reflect.Parameteritself isn't available before API 26.nui:UITextclipboard — 13 violations.getClipboardContents()/setClipboardContents()usejava.awt.Toolkit/Clipboard/DataFlavor/StringSelection/Transferable/UnsupportedFlavorExceptiondirectly. Unlike the above two, this isn't fixable by calling a different method — AWT genuinely doesn't exist on Android at all.Acceptance Criteria
ReflectionUtilviolations fixed by calling through the concreteMethod/Constructortype instead of the sharedExecutablesupertype, and reimplementingClass.getTypeName()'s behavior — no public API change (build: check API surface for Android suitability #83)ObjectLayoutBuilderviolations fixed by usingConstructor.getGenericParameterTypes()instead of going throughParameter— no public API change (build: check API surface for Android suitability #83)UITextclipboard calls isolated into a private nested class (UIText.AwtClipboard) withLinkageErrorcaught by the caller, so invoking copy/paste on a platform withoutjava.awtdegrades to a no-op with a logged warning instead of crashing (build: check API surface for Android suitability #83)UITextactually has a working clipboard on platforms without AWT (e.g. Android vianui-libgdx, since libGDX'sGdx.app.getClipboard()is a cross-platform abstraction that works there), not just a graceful no-op — left open, see Technical NotesTechnical Notes
The last item is a real design decision, deliberately left out of #83 to keep that PR focused on the suitability check rather than a clipboard-abstraction redesign: likely a pluggable
Clipboardstrategy onUIText, defaulting to the current AWT-backed behavior on desktop, withnui-libgdxsupplying aGdx.app.getClipboard()-backed implementation for platforms (including Android) that have it.Full violation reports (pre-fix, from #83's initial run):
nui/build/reports/animalsniffer/main.text,nui-reflect/build/reports/animalsniffer/main.text.Related
#83