-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
StringIndexOutOfBoundsException in findClassesInPackage - Surefire/Maven - JDK 11 fails, JDK 8 succeeds. #2308
Comments
@john-snell - I dont think TestNG is yet officially certified to work fine without any issues using JDK11. |
When (if) will TestNG be Java 11 compatible? Java 11 has been LTS for almost 2 years |
@Randgalt - I don't have a definitive timeline that I can share with you. But TestNG needs to keep in account backward compatibility when we do such upgrades. The upgrade from JDK7 to JDK8 being the Default JDK itself took a lot of time (because a lot of our users still use older JDKs and upgrading TestNG to a newer JDK essentially means that we cause problems for them). |
In fact, the target of the TestNG sources is supposed to be the previous Java LTS version. The current LTS version is Java 11 and the previous one is Java 8). I think there is a real issue if TestNG is failing at runtime with Java 11. |
It fails for us when we use a testng.xml file. We're completely blocked right now. We're going to try to remove the testng.xml if we can and hopefully that will work. |
The |
build-helper-maven-plugin appears to resolve the issue. |
TestNG Version
7.1.0
Expected behavior
TestNG reads the package name correctly, succeeds in doing a substring
Actual behavior
TestNG keeps the package name from another class when doing a substring on current class, fails with error.
Having instrumented a copy of TestNG jar with print statements, I can see that this fails when a Jar has its files enumerated. Specifically jaxb-api-2.3.1.jar, which include a file 'module-info.class', which lacks a package. PackageUtils then tries to do a substring based on the wrong package, with a class name that has no package, and fails.
This does not occur during the JDK 8 build, as Java 8 doesn't cause the JAXB jars to be referenced in this part of the build, but Java 11 does.
My simple print statement:
org.testng.internal.PackageUtils#findClassesInPackage
With Java 8:
With Java 11:
Is the issue reproductible on runner?
Completely reproducible with Maven test case using attached source.
See output:
testng.failure.output.txt
Test case sample
testng-failure-case.zip
The text was updated successfully, but these errors were encountered: