You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #544, it was asked to remove the need for the -Djdk.attach.allowAttachSelf parameter, which appears on JMockit 1.41 and Java 9+. The response was that this would be replaced with -javaagent on JMockit 1.42 (and the discussion was frustratingly locked so that no further clarification questions could be asked).
The same underlying problem remains though: it is very inconvenient to have to add a flag to every run in Maven (and Gradle?), as well as IDE runs for individual tests. It is also a common newbie mistake to forget to add these flags, and we've already had several closed issues where that was what people forgot to do. In other words, having a mandatory flag is making JMockit harder to use than it should be.
The best solution would be to create a workaround, like ByteBuddy did, so that neither a -Djdk.attach.allowAttachSelf parameter nor a -javaagent parameter needs to be added. If this is not possible, then please explain what the obstacles are (in the hopes that someone else can figure out how to overcome the obstacles and submit a PR).
The text was updated successfully, but these errors were encountered:
There are several technical difficulties in getting dynamic Java agent loading (through use of the Attach API) to work. It requires several hacks, and it's ultimately not reliable (for example, in certain cases Maven/Gradle ends up loading Expectations subclasses before the agent gets loaded, preventing JMockit's ClassFileTransformer from doing its job).
"-javaagent", on the other hand, is the standard way to get a Java agent loaded. With a good IDE (for example, IntelliJ), all you need to do is add the parameter in the test execution command line (for example, in Maven Surefire plugin configuration); the IDE should automatically add it to the command line whenever a test is executed (with IntelliJ, which I use, it's working fine - I imagine Netbeans should be ok too as it uses Maven for test execution).
In #544, it was asked to remove the need for the
-Djdk.attach.allowAttachSelf
parameter, which appears on JMockit 1.41 and Java 9+. The response was that this would be replaced with-javaagent
on JMockit 1.42 (and the discussion was frustratingly locked so that no further clarification questions could be asked).The same underlying problem remains though: it is very inconvenient to have to add a flag to every run in Maven (and Gradle?), as well as IDE runs for individual tests. It is also a common newbie mistake to forget to add these flags, and we've already had several closed issues where that was what people forgot to do. In other words, having a mandatory flag is making JMockit harder to use than it should be.
The best solution would be to create a workaround, like ByteBuddy did, so that neither a
-Djdk.attach.allowAttachSelf
parameter nor a-javaagent
parameter needs to be added. If this is not possible, then please explain what the obstacles are (in the hopes that someone else can figure out how to overcome the obstacles and submit a PR).The text was updated successfully, but these errors were encountered: