Skip to content

LinkageError when mocking certain classes #373

Description

Hello together,

since EasyMock 5.1.0, I get a LinkageError when I try to create a mock for certain classes. I saw it first for javax.security classes such as LoginContext. In version 5.0.1, this worked without an issue.

Step to reproduce:
It could be reproduced by the following dummy test:

@Test
void test() {
    EasyMock.mock(javax.security.auth.login.LoginContext.class);
}

Expected behaviour:
A mock for the class LoginContext gets created.

Actual behaviour
An exception with the following cause is thrown:

java.lang.LinkageError: bad field type alias: class org.easymock.internal.ClassMockingData not visible from class javax.security.auth.login.LoginContext$$$EasyMock$1

EasyMock Version: 5.1.0
Java version: Temurin 11 for macOS (OpenJDK11U-jdk_aarch64_mac_hotspot_11.0.18_10)

Activity

  1. henri-tremblay commented on Feb 6, 2023

    @henri-tremblay
    Contributor

    Yes. It's fixed with #356. Should release soon when I have 2 minutes.

  2. added this to the 5.2.0 milestone on Feb 8, 2023
  3. dmatej commented on Mar 7, 2023

    @dmatej

    Just FYI, I have the same issue with the InitialContext on 5.1.0.

            mockSupport = new EasyMockSupport();
            initialContext = mockSupport.createMock(InitialContext.class);
    

    I can confirm that with 5.2.0-SNAPSHOT ( 264a75d ) works well. When can we expect the release?

  4. arjantijms commented on Mar 7, 2023

    @arjantijms

    A release would be great indeed, thanks in advance!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions