Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Warning on line 121 of GeofenceTransitionsIntentService.java #17

Open
positivelymade opened this issue Jun 2, 2015 · 4 comments
Open
Labels
migrated googlesamples Migrated from old googlesamples repos

Comments

@positivelymade
Copy link

Unchecked call to 'add(E)' as a member of raw type 'java.util.ArrayList'

I am using Android Studi0 1.2.1.1, what's the best way to fix this?

warning

@shailen
Copy link
Contributor

shailen commented Jun 23, 2015

The warning triggers because triggeringGeofencesIdsList is not defined with a parameter.

Changing

ArrayList triggeringGeofencesIdsList = new ArrayList();

to

ArrayList triggeringGeofencesIdsList = new ArrayList<>();

gets rid of the warning.

I'll submit a patch to fix this.

@positivelymade
Copy link
Author

I made the following changes and I am still getting the warning.

ArrayList triggeringGeofencesIdsList = new ArrayList<>();
or
ArrayList triggeringGeofencesIdsList = new ArrayList();

Please double check and let me know what you come up with.

@chayawit
Copy link

Changing
ArrayList triggeringGeofencesIdsList = new ArrayList();
to
ArrayList<String> triggeringGeofencesIdsList = new ArrayList<>();
fixes the warning.

We are using triggeringGeofencesIdsList to add only String, so it is safer to specify the ArrayList as ArrayList<String>.

@chayawit
Copy link

I think @shailen was suggesting the same solution but had problem with markdown.
We have to type <String> to get

@codingjeremy codingjeremy added the migrated googlesamples Migrated from old googlesamples repos label Sep 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
migrated googlesamples Migrated from old googlesamples repos
Projects
None yet
Development

No branches or pull requests

4 participants