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

Failig to mock Interfaces with Java 14 #204

Closed
blaszczyk opened this issue Sep 24, 2020 · 4 comments
Closed

Failig to mock Interfaces with Java 14 #204

blaszczyk opened this issue Sep 24, 2020 · 4 comments
Assignees
Milestone

Comments

@blaszczyk
Copy link

When using Mockery with ByteBuddyClassImportiser (version 2.12.0) to mock any interface with java 14, it fails with an error like:

java.lang.IllegalStateException: No code generation strategy available
	at org.jmock.imposters.ByteBuddyClassImposteriser.proxyClass(ByteBuddyClassImposteriser.java:167)
	at org.jmock.imposters.ByteBuddyClassImposteriser.access$000(ByteBuddyClassImposteriser.java:41)
	at org.jmock.imposters.ByteBuddyClassImposteriser$1.apply(ByteBuddyClassImposteriser.java:100)
	at org.jmock.imposters.ByteBuddyClassImposteriser$1.apply(ByteBuddyClassImposteriser.java:96)
	at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1740)
	at org.jmock.imposters.ByteBuddyClassImposteriser.proxy(ByteBuddyClassImposteriser.java:95)
	at org.jmock.imposters.ByteBuddyClassImposteriser.imposterise(ByteBuddyClassImposteriser.java:66)
	at org.jmock.Mockery.mock(Mockery.java:167)
	at org.jmock.Mockery.mock(Mockery.java:143)

With java 13 and below mocking classes and interfaces worked well using ByteBuddyClassImportiser. Also Mockery with default Importiser can still mock interfaces in java 14.

@olibye
Copy link
Member

olibye commented Sep 24, 2020 via email

@blaszczyk
Copy link
Author

Actually, updating byte buddy manually to the current version (1.10.16) resolved the issue.

@olibye olibye self-assigned this Mar 26, 2021
@osparking
Copy link

I added latest bytebuddy dependency into pom.xml and the problem is gone.
(from the default 1.9.? to

		<dependency>
			<groupId>net.bytebuddy</groupId>
			<artifactId>byte-buddy</artifactId>
			<version>1.14.10</version>
		</dependency>

)

@olibye
Copy link
Member

olibye commented Mar 16, 2024

Fixed #252

@olibye olibye added this to the 2.13.1 milestone Mar 16, 2024
@olibye olibye closed this as completed Mar 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants