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

"class redefinition failed" while overriding an Enum static (or not) method on JDK17 (correto) #116

Open
rjunqueira opened this issue Mar 30, 2023 · 5 comments
Assignees

Comments

@rjunqueira
Copy link

  • Version of JMockit that was used: 1.49.4

  • Description of the problem or enhancement request:

Hello,

I have this UnsupportedOpEx : class redefinition failed: attempted to change the class NestHost, NestMembers, Record, or PermittedSubclasses attribute

The stack:
image

extracted and cleaned sample code :
private void mockEnumEquitySwapCodificationMethodologyNone() {
new MockUp() {
@mockit.Mock
public final EnumEquitySwapCodificationMethodology getCodificationGlobalConfig() {
return EnumEquitySwapCodificationMethodology.EESCM_NONE;
}
};
}

public enum EnumEquitySwapCodificationMethodology {
EESCM_NONE,
EESCM_ROOT_CONTRACT;

@nonnull
static public final EnumEquitySwapCodificationMethodology getCodificationGlobalConfig() {
return EESCM_ROOT_CONTRACT;
}
}

Thx

@rjunqueira rjunqueira changed the title "class redefinition failed" while overriding an Enum static method on JDK17 (correto) "class redefinition failed" while overriding an Enum static (or not) method on JDK17 (correto) Mar 30, 2023
@hazendaz hazendaz self-assigned this Apr 14, 2023
@MERGHOOB
Copy link

MERGHOOB commented May 5, 2023

Hi I am also seeing this issue in version jmockit version 1.44. I am trying to move the project to Java 17

@hazendaz
Copy link
Owner

hazendaz commented May 5, 2023 via email

@MERGHOOB
Copy link

MERGHOOB commented May 11, 2023

In your fork version, My project will not compile as there is no De-encapsulation class and Concrete class (lots of test are depending on that). I would love to see your fix for Class Redefinition if possible.
Original is working fine with jdk11

@hazendaz
Copy link
Owner

hazendaz commented May 12, 2023 via email

@hazendaz
Copy link
Owner

hazendaz commented Dec 2, 2023

@MERGHOOB De-encapsulation is now restored and will be in upcoming release, if possibly maybe you can compile our master or pull our snapshot from sonatype and see. However this sounds like issue #135 so you may want to look there to see if same issue so we can close one of these. There is a link over there to mockito when they had same issue.

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