Skip to content
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

Include Java version on generating classes jar file to resolve UnsupportedClassVersion #155

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,20 @@ public void setUp(StfCoreExtension test, StfSharedClassesExtension sharedClasses
// See whether the test data (20000 classes and jars) already exist.
// If not, create them in the first -systemtest-prereqs directory (or the default location if no -systemtest-prereqs were supplied).
DirectoryRef sharedClassesDataDir = null; // This will be initialised when we find it.
int javaVersion = test.env().primaryJvm().getJavaVersion();
String dataSubdir = "sharedClassesTestData/v1";
ArrayList<DirectoryRef> prereqRoots = test.env().getPrereqRoots();
String classFileName = "classes_jdk" + javaVersion + ".jar";
FileRef sharedClassesJar = null;
int found = 0;
for (int i = 0 ; (i < prereqRoots.size()) && ( found == 0 ); i++ ) {
sharedClassesDataDir = prereqRoots.get(i).childDirectory(dataSubdir);
if (!sharedClassesDataDir.exists()) {
System.out.println(sharedClassesDataDir.getSpec() + " does not exist");
sharedClassesJar = sharedClassesDataDir.childFile(classFileName);
if (!sharedClassesJar.exists()) {
System.out.println(sharedClassesJar.getSpec() + " does not exist");
}
else {
System.out.println(sharedClassesDataDir.getSpec() + " exists");
System.out.println(sharedClassesJar.getSpec() + " exists");
found = 1;
}
}
Expand All @@ -211,7 +215,8 @@ public void setUp(StfCoreExtension test, StfSharedClassesExtension sharedClasses
.addProjectToClasspath("openj9.test.sharedClasses")
.runClass(JavaGen.class)
.addArg(sharedClassesDataDir.getSpec())
.addArg("10000"));
.addArg("10000")
.addArg(String.valueOf(javaVersion)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add javaVersion as an arg?

Copy link
Contributor Author

@annaibm annaibm Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am passing the javaVersion as an argument to be used by JavaGen.class file, or should we set it as environment Variable or as a static field ?

}

// Copy the shared classes jar/s from the systemtest_prereqs directory to /tmp.
Expand All @@ -221,7 +226,7 @@ public void setUp(StfCoreExtension test, StfSharedClassesExtension sharedClasses
DirectoryRef localSharedClassesJarsDir = test.doCpDir("Copy sharedClasses jars", appsSharedClassesJarsDir, test.env().getTmpDir().childDirectory("jars"));
localSharedClassesResources = localSharedClassesJarsDir.getSpec();
} else {
FileRef sharedClassesJar = sharedClassesDataDir.childFile("classes.jar");
sharedClassesJar = sharedClassesDataDir.childFile(classFileName);
FileRef localSharedClassesJar = test.doCp("Copy sharedClasses jar", sharedClassesJar, test.env().getTmpDir());
localSharedClassesResources = localSharedClassesJar.getSpec();
}
Expand Down
Loading