8269656: The test test/langtools/tools/javac/versions/Versions.java has duplicate test cycles
Backport-of: 04b73bc4e022740122463ef70791ef276ac9b34d
diff --git a/test/langtools/tools/javac/versions/Versions.java b/test/langtools/tools/javac/versions/Versions.java
index c68112f..508707d 100644
--- a/test/langtools/tools/javac/versions/Versions.java
+++ b/test/langtools/tools/javac/versions/Versions.java
@@ -136,7 +136,7 @@
String target = st.target();
boolean dotOne = st.dotOne();
check_source_target(dotOne, List.of(classFileVer, target, target));
- for (int j = i; j > 0; j--) {
+ for (int j = i - 1; j >= 0; j--) {
String source = sourceTargets[j].target();
check_source_target(dotOne, List.of(classFileVer, source, target));
}
@@ -155,7 +155,7 @@
st.checksrc(this, List.of("-source 1." + st.target(), "-target 1." + st.target()));
}
- if (i == sourceTargets.length) {
+ if (i == sourceTargets.length - 1) {
// Can use -target without -source setting only for
// most recent target since the most recent source is
// the default.