Open yarix opened 2 years ago
same error, does anyone know how to fix it?
Upgrade the version of JMockit will effectively resolve this.
And I'm pretty sure you were not using the version 1.49 because there is already no importing for the type IORHelper, this type has been removed from JAVA 11.
This is the code of MockingBridgeFields.createSyntheticFieldsInJREClassToHoldMockingBridges()
in JMockit 1.22
static void createSyntheticFieldsInJREClassToHoldMockingBridges(@Nonnull Instrumentation inst) {
ClassFileTransformer trans = new FieldAdditionTransformer();
inst.addTransformer(trans);
try {
IORHelper.id();
} finally {
inst.removeTransformer(trans);
}
setMockingBridgeFields();
}
And this is the code of ClassLoadingBridgeFields.createSyntheticFieldsInJREClassToHoldClassLoadingBridges()
in JMockit 1.49
static void createSyntheticFieldsInJREClassToHoldClassLoadingBridges(@Nonnull Instrumentation instrumentation) {
FieldAdditionTransformer fieldAdditionTransformer = new FieldAdditionTransformer(instrumentation);
instrumentation.addTransformer(fieldAdditionTransformer);
NegativeArraySizeException.class.getName();
String hostClassName = fieldAdditionTransformer.hostClassName;
if (hostClassName == null) {
Provider.class.getName();
hostClassName = fieldAdditionTransformer.hostClassName;
}
ClassLoadingBridge.hostJREClassName = hostClassName;
}
same error, does anyone know how to fix it?
Upgrade the version of JMockit will effectively resolve this. And I'm pretty sure you were not using the version 1.49 because there is already no importing for the type IORHelper, this type has been removed from JAVA 11. This is the code of
MockingBridgeFields.createSyntheticFieldsInJREClassToHoldMockingBridges()
in JMockit 1.22static void createSyntheticFieldsInJREClassToHoldMockingBridges(@Nonnull Instrumentation inst) { ClassFileTransformer trans = new FieldAdditionTransformer(); inst.addTransformer(trans); try { IORHelper.id(); } finally { inst.removeTransformer(trans); } setMockingBridgeFields(); }
And this is the code of
ClassLoadingBridgeFields.createSyntheticFieldsInJREClassToHoldClassLoadingBridges()
in JMockit 1.49static void createSyntheticFieldsInJREClassToHoldClassLoadingBridges(@Nonnull Instrumentation instrumentation) { FieldAdditionTransformer fieldAdditionTransformer = new FieldAdditionTransformer(instrumentation); instrumentation.addTransformer(fieldAdditionTransformer); NegativeArraySizeException.class.getName(); String hostClassName = fieldAdditionTransformer.hostClassName; if (hostClassName == null) { Provider.class.getName(); hostClassName = fieldAdditionTransformer.hostClassName; } ClassLoadingBridge.hostJREClassName = hostClassName; }
Thanks!! Upgrading worked for me
Please provide the following information:
Version of JMockit that was used: 1.49
Description of the problem or enhancement request: while upgrading existing code from Java 8, Jmockit 1.22 to Java 11 and jmockit 1.49 - i get the following when running the test from intellij (...yes - with -javaagent:/root/.m2/repository/org/jmockit/jmockit/1.49/jmockit-1.49.jar)
any idea how to solve?
Check the following:
[x] If a defect or unexpected result, JMockit project members should be able to reproduce it. For that, include an example test (perhaps accompanied by a Maven/Gradle build script) which can be executed without changes and reproduces the failure.
[ ] If an enhancement or new feature request, it should be justified by an example test demonstrating the validity and usefulness of the desired enhancement or new feature.
[ ] The issue does not fall outside the scope of the project (for example, attempting to use JMockit APIs from Groovy or Scala code, or with an Android runtime).
[x] The JDK where the problem occurs is a final release, not a development build.