Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.NoSuchMethodError on Toothpick.reset() on Instrumentation Tests #186

Closed
kelsos opened this issue Jan 6, 2017 · 14 comments
Closed
Assignees
Milestone

Comments

@kelsos
Copy link
Contributor

kelsos commented Jan 6, 2017

Hi,

I had an issue while running a couple of instrumentation tests on Android with Toothpick 1.0.3.
The issue is the following and doesn't appear to happen with v1.0.2:

java.lang.NoSuchMethodError: No virtual method keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView; in class Ljava/util/concurrent/ConcurrentH
ashMap; or its super classes (declaration of 'java.util.concurrent.ConcurrentHashMap' appears in /system/framework/core-libart.jar)
        at toothpick.Toothpick.reset(Toothpick.java:125)...

This always happens when the tear down method calls the Toothpick.reset() method.

@dlemures dlemures added this to the 1.0.4 milestone Jan 10, 2017
@dlemures dlemures self-assigned this Jan 10, 2017
@dlemures dlemures added the bug label Jan 10, 2017
@dlemures
Copy link
Collaborator

@efung
Copy link
Contributor

efung commented Jan 10, 2017

@kelsos Are you compiling with sourceCompatibility JavaVersion.VERSION_1_8? We're using Retrolambda and ran into this also.

There's some discussion of this issue in https://code.google.com/p/android/issues/detail?id=215828 as well as in https://gist.github.com/AlainODea/1375759b8720a3f9f094

However, it sounds like in the Android API, the return type of keySet() is still Set<K>?

@kelsos
Copy link
Contributor Author

kelsos commented Jan 10, 2017

@efung No the source code and tests are all in kotlin.

@efung
Copy link
Contributor

efung commented Jan 10, 2017

Hmm. I don't get it: why is this happening then? Is it because the toothpick artifacts were compiled against Java 1.8? (But I see source compatibility of 1.7 in the project.)

@kelsos
Copy link
Contributor Author

kelsos commented Jan 10, 2017

@stephanenicolas
Copy link
Owner

The problem is related to a different implementation in jdk 8 and Android SDK which is based on java 5/7.

We think we got a workaround

@efung
Copy link
Contributor

efung commented Jan 11, 2017

Ah, so is the issue that you compiled the artifacts for Toothpick with JDK 1.8? I'm trying to make sense of this comment against the sourceCompatibility of 1.7 in Toothpick's build.gradle

@dlemures
Copy link
Collaborator

Yes, we are compiling with JDK 1.8.

PR with workaround: #190

@stephanenicolas
Copy link
Owner

stephanenicolas commented Jan 19, 2017 via email

@dlemures
Copy link
Collaborator

PR merged.

@kelsos Could you update the issue once 1.0.4 is released?

@kelsos
Copy link
Contributor Author

kelsos commented Jan 19, 2017

@dlemures Yes I will update it after the release.

@dlemures
Copy link
Collaborator

@kelsos I released a snapshot with the changes: 1.0.4-SNAPSHOT

Can you try it?

@kelsos
Copy link
Contributor Author

kelsos commented Jan 19, 2017

@dlemures I tried the snapshot and it seems to work fine. The error is gone.

@dlemures
Copy link
Collaborator

Awesome. Thx for the help!
Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants