{"record":{"id":"4fce595ce4bb8d81","repo":"apache/flink","slug":"unsupported-bitmap-type-s","errorCode":null,"errorMessage":"Unsupported bitmap type: %s.","messagePattern":"Unsupported bitmap type: (.+?)\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/types/bitmap/RoaringBitmapData.java","lineNumber":82,"sourceCode":"            throws DeserializationException {\n        RoaringBitmapData rb32 = new RoaringBitmapData();\n        try {\n            rb32.roaringBitmap.deserialize(ByteBuffer.wrap(bytes));\n        } catch (Exception e) {\n            throw new DeserializationException(\"Failed to deserialize bitmap from bytes.\", e);\n        }\n        return rb32;\n    }\n\n    public static RoaringBitmapData fromArray(@Nonnull int[] values) {\n        RoaringBitmapData rb32 = new RoaringBitmapData();\n        rb32.roaringBitmap.add(values);\n        return rb32;\n    }\n\n    public static RoaringBitmapData toRoaringBitmapData(Bitmap bm) throws IllegalArgumentException {\n        if (!(bm instanceof RoaringBitmapData)) {\n            throw new IllegalArgumentException(\"Unsupported bitmap type: \" + bm.getClass() + \".\");\n        }\n        return (RoaringBitmapData) bm;\n    }\n\n    // ~ Bitmap Interface Implementations ------------------------------------------------\n\n    @Override\n    public void add(int value) {\n        roaringBitmap.add(value);\n    }\n\n    /**\n     * @throws IllegalArgumentException if rangeStart or rangeEnd is out of range.\n     */\n    @Override\n    public void add(long rangeStart, long rangeEnd) throws IllegalArgumentException {\n        roaringBitmap.add(rangeStart, rangeEnd);\n    }","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/types/bitmap/RoaringBitmapData.java#L64-L100","documentation":"Thrown by RoaringBitmapData.toRoaringBitmapData(Bitmap) when the passed Bitmap is not a RoaringBitmapData instance. The method is an identity-ish cast helper: it only accepts the RoaringBitmapData implementation of the Bitmap interface, and any other implementation (e.g. a future BashBitmap-style type or a user-defined Bitmap) is rejected with the concrete class name in the message.","triggerScenarios":"Calling toRoaringBitmapData(other) or the from(Bitmap) factory with a Bitmap implementation that is not RoaringBitmapData — user-defined Bitmap subclasses, mocks in tests, or new Bitmap implementations added to the codebase.","commonSituations":"Custom Bitmap implementations passed into code paths that only support RoaringBitmapData (the sole in-tree implementation); test doubles implementing Bitmap; adding a new bitmap type without updating conversion call sites.","solutions":["Pass a RoaringBitmapData (construct via fromArray, fromBytes, or new RoaringBitmapData) instead of a custom Bitmap implementation.","If you own a custom Bitmap type, convert its contents into a RoaringBitmapData (e.g. iterate set values and add them) before calling this API.","In tests, build real RoaringBitmapData instances rather than mocking the Bitmap interface."],"exampleFix":"// before\nBitmap custom = new MyCustomBitmap();\nRoaringBitmapData rb = RoaringBitmapData.from(custom); // throws\n\n// after\nRoaringBitmapData rb = new RoaringBitmapData();\nfor (int v : customValues) {\n    rb.add(v);\n}","handlingStrategy":"type-guard","validationCode":"if (!(bitmap instanceof RoaringBitmapData)) {\n    throw new IllegalArgumentException(\"Unsupported bitmap type: \" + bitmap.getClass());\n}","typeGuard":"static boolean isRoaringBitmapData(Bitmap bm) {\n    return bm instanceof RoaringBitmapData;\n}","tryCatchPattern":null,"preventionTips":["Type-check Bitmap inputs before conversion APIs when implementations may vary.","Keep Bitmap-typed APIs backed exclusively by RoaringBitmapData unless you add converters.","Avoid mocking the Bitmap interface in tests; build real instances."],"tags":["bitmap","type-check","illegalargument","flink-core"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}