-
Notifications
You must be signed in to change notification settings - Fork 344
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
Support java 17 #456
Open
egorklimov
wants to merge
2
commits into
EvoSuite:master
Choose a base branch
from
egorklimov:java-17
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Support java 17 #456
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I also tried this solution with java19 and it hangs without any log. I'll try to debug it |
I tried it on this simple app: package org.example;
public class Main {
public boolean is2(int target) {
return target == 2;
}
public static void main(String[] args) {
System.out.println(new Main().is2(2));
System.out.println(new Main().checkObject(new Circle(1)));
}
record Human(String name, int age, String profession) {}
record Circle(int radius) {}
public String checkObject(Object obj) {
if (obj instanceof Human h) {
return "Name: %s, age: %s and profession: %s".formatted(h.name(), h.age(), h.profession());
} else if (obj instanceof Circle c) {
return "This is a circle %d".formatted(c.radius);
}
return "It is an object";
}
} And got the following tests: /*
* This file was automatically generated by EvoSuite
* Thu Jun 01 10:40:06 GMT 2023
*/
package org.example;
import org.junit.Test;
import static org.junit.Assert.*;
import org.example.Main;
import org.junit.runner.RunWith;
import shaded.org.evosuite.runtime.EvoRunner;
import shaded.org.evosuite.runtime.EvoRunnerParameters;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class Main_ESTest extends Main_ESTest_scaffolding {
@Test(timeout = 4000)
public void test0() throws Throwable {
Main main0 = new Main();
Object object0 = new Object();
String string0 = main0.checkObject(object0);
assertEquals("It is an object", string0);
}
@Test(timeout = 4000)
public void test1() throws Throwable {
Main main0 = new Main();
boolean boolean0 = main0.is2(3);
assertFalse(boolean0);
}
@Test(timeout = 4000)
public void test2() throws Throwable {
Main.Human main_Human0 = new Main.Human("", 0, "");
assertEquals("Human[name=, age=0, profession=]", main_Human0.toString());
}
@Test(timeout = 4000)
public void test3() throws Throwable {
Main main0 = new Main();
Main.Human main_Human0 = new Main.Human("", 0, "");
String string0 = main0.checkObject(main_Human0);
assertEquals("Name: , age: 0 and profession: ", string0);
}
} |
Could you restart tests? I tried them locally and it is green, maybe it is a flaky test |
Solution with |
1 similar comment
Solution with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello!
I tried to run evosuite with Java 17. But it failed due to java modules error:
module java.base does not "opens java.util" to unnamed module
.I added a library that supports opening models in runtime and updated xstream and asm versions. I also tried to add
add-opens
to jar manifest, but that didn't help. This solution is maybe not so good because it opens all modules,maybe we should choose a set of modules and only open them.
It now at least works on java 17, but maybe we need to update the instrumentation too. I'm not familiar with the evosuite instrumentation, but if I can help support java 17 please let me know what I should do ;)