I have the following code, very simple:
package com.enrosz;
import java.util.HashMap;
import com.plaid.client.ApiClient;
public class MyPlaid {
public static void main(String[] args) {
HashMap<String, String> apiKeys = new HashMap<String, String>();
apiKeys.put("clientId", "REDACTED");
apiKeys.put("secret", "REDACTED");
apiKeys.put("plaidVersion", "2020-09-14");
ApiClient plaidApiClient = new ApiClient(apiKeys);
}
}
When executed, the very last line immediately fails with this error:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by retrofit2.Platform (file:/Users/enroiv/.m2/repository/com/squareup/retrofit2/retrofit/2.9.0/retrofit-2.9.0.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of retrofit2.Platform
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "main" java.lang.NoSuchMethodError: 'byte[] kotlin.collections.ArraysKt.copyInto(byte[], byte[], int, int, int)'
at okio.Segment.writeTo(Segment.kt:169)
at okio.Segment.compact(Segment.kt:152)
at okio.Buffer.write(Buffer.kt:1842)
at okio.Buffer.read(Buffer.kt:1854)
at okio.Buffer.writeAll(Buffer.kt:1642)
at okio.Options$Companion.buildTrieRecursive(Options.kt:187)
at okio.Options$Companion.buildTrieRecursive(Options.kt:174)
at okio.Options$Companion.buildTrieRecursive$default(Options.kt:113)
at okio.Options$Companion.of(Options.kt:72)
at okhttp3.internal.Util.<clinit>(Util.kt:70)
at okhttp3.HttpUrl$Builder.parse$okhttp(HttpUrl.kt:1239)
at okhttp3.HttpUrl$Companion.get(HttpUrl.kt:1633)
at okhttp3.HttpUrl.get(HttpUrl.kt)
at retrofit2.Retrofit$Builder.baseUrl(Retrofit.java:506)
at com.plaid.client.ApiClient.createDefaultAdapter(ApiClient.java:156)
at com.plaid.client.ApiClient.<init>(ApiClient.java:45)
at com.plaid.client.ApiClient.<init>(ApiClient.java:92)
at com.enrosz.MyPlaid.main(MyPlaid.java:16)
This seems to be an issue with the underlying libraries used by Plaid, specifically okhttp. I have not been able to resolve this issue. Contacted Plaid support but no response yet.
This is odd since this exact same code had been working until recently. Not sure if a breaking change was somehow introduced.
These are my POM dependencies, by the way:
<dependency>
<groupId>com.plaid</groupId>
<artifactId>plaid-java</artifactId>
<version>16.2.0</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.11.0</version>
</dependency>