mapbox / mapbox/mapbox-maps-android

literal with array or listOf does not work

Open
#2,379 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle: feature :green_apple:
Dominant language
Kotlin
Stars
578
Forks
161
PR merge metrics
No merged PRs in 30d

Description

Environment

Android SDK 11.3.1

Observed behavior and steps to reproduce

iconTranslate(
   Expression.switchCase(
   Expression.eq(Expression.get("has-icon"), Expression.literal(true)),
   Expression.literal(listOf(7.0,7.0)),
   Expression.literal(listOf(7.0,7.0))
))

Notes / preliminary analysis

This code gives me the error: Cannot access 'literal': it is internal in 'Companion'
It makes sense, but how else should I do it then?

Apparently this has been a bug in SDK 10 before (there is a Github bug ticket) and it is supposed to be fixed.

Any help?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the reported Expression.switchCase reproduction with Expression.literal(listOf(7.0, 7.0)) in the Android SDK. Inspect the public Expression.literal entry point and related expression API behavior; the issue is resolved when an array or list literal can be used in this expression without the internal-access error, with coverage for the reported case.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.