From fd59090296c5ac703c580144fee6b62ae2360ad1 Mon Sep 17 00:00:00 2001
From: Lukas Stadler <lukas.stadler@oracle.com>
Date: Fri, 9 Mar 2018 15:46:57 +0100
Subject: [PATCH] use ArrayList in OptionsFunctions to avoid issues with
 generics

---
 .../truffle/r/nodes/builtin/base/OptionsFunctions.java     | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/OptionsFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/OptionsFunctions.java
index df9b8b4509..84d9a738cc 100644
--- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/OptionsFunctions.java
+++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/OptionsFunctions.java
@@ -30,7 +30,7 @@ import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.INTERNAL;
 
 import java.text.Collator;
 import java.util.ArrayList;
-import java.util.Arrays;
+import java.util.Collections;
 import java.util.Comparator;
 import java.util.Locale;
 import java.util.Map;
@@ -80,11 +80,10 @@ public class OptionsFunctions {
             Object[] data = new Object[optionSettings.size()];
             String[] names = new String[data.length];
 
-            @SuppressWarnings("unchecked")
-            Map.Entry<String, Object>[] entries = optionSettings.toArray(new Map.Entry[optionSettings.size()]);
+            ArrayList<Map.Entry<String, Object>> entries = new ArrayList<>(optionSettings);
             Locale locale = RContext.getInstance().stateRLocale.getLocale(RLocale.COLLATE);
             Collator collator = locale == Locale.ROOT || locale == null ? null : RLocale.getOrderCollator(locale);
-            Arrays.sort(entries, new Comparator<Map.Entry<String, Object>>() {
+            Collections.sort(entries, new Comparator<Map.Entry<String, Object>>() {
                 @Override
                 public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) {
                     return RLocale.compare(collator, o1.getKey(), o2.getKey());
-- 
GitLab