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

Need a gson-2.10.1 jar build without module-info.class #2488

Open
1 of 4 tasks
shubham-takale-sp opened this issue Sep 11, 2023 · 4 comments
Open
1 of 4 tasks

Need a gson-2.10.1 jar build without module-info.class #2488

shubham-takale-sp opened this issue Sep 11, 2023 · 4 comments

Comments

@shubham-takale-sp
Copy link

shubham-takale-sp commented Sep 11, 2023

Gson version

2.10.1

Java / Android version

SAP JVM8

Used tools

  • Maven; version:
  • Gradle; version:
  • ProGuard (attach the configuration file please); version:
  • ...

Description

We are having a custom java application which is using gson-2.10.1 as a dependency. This application is deployed on SAP Server which uses SAP's JVM8. During deployment, the server is not able to parse the module-info.class available in gson jar. So we need a gson-2.10.1.jar in non-JPMS format(without the module-info.class file).

Expected behavior

Our custom application gets successfully deployed on SAP Server using gson-2.10.1.jar.

Actual behavior

Custom application deployment is failing.

Reproduction steps

NA

Exception stack trace

Caused by: com.sap.engine.library.bytecode.cf.CFException: Invalid constant pool tag, 19 at index 4.
	at com.sap.engine.library.bytecode.cf.CFParser.parse0(CFParser.java:386)
	at com.sap.engine.library.bytecode.cf.CFParser.parse(CFParser.java:307)
	at com.sap.lib.javalang.tool.impl.ClassInfoReaderImpl.parseClassInformation(ClassInfoReaderImpl.java:336)
	at com.sap.lib.javalang.tool.impl.ClassInfoReaderImpl.traverseZipFile(ClassInfoReaderImpl.java:287)
	at com.sap.lib.javalang.tool.impl.ClassInfoReaderImpl.readInternal(ClassInfoReaderImpl.java:105)
	at com.sap.lib.javalang.tool.impl.ClassInfoReaderImpl.traverseFolder(ClassInfoReaderImpl.java:175)
	at com.sap.lib.javalang.tool.impl.ClassInfoReaderImpl.readInternal(ClassInfoReaderImpl.java:103)
	at com.sap.lib.javalang.tool.impl.ClassInfoReaderImpl.traverseFolder(ClassInfoReaderImpl.java:175)
	at com.sap.lib.javalang.tool.impl.ClassInfoReaderImpl.readInternal(ClassInfoReaderImpl.java:103)
	at com.sap.lib.javalang.tool.impl.ClassInfoReaderImpl.traverseWarFile(ClassInfoReaderImpl.java:196)
	at com.sap.lib.javalang.tool.impl.ClassInfoReaderImpl.traverseFolder(ClassInfoReaderImpl.java:165)
	at com.sap.lib.javalang.tool.impl.ClassInfoReaderImpl.readInternal(ClassInfoReaderImpl.java:103)
	at com.sap.lib.javalang.tool.impl.ClassInfoReaderImpl.traverseFolder(ClassInfoReaderImpl.java:173)
	at com.sap.lib.javalang.tool.impl.ClassInfoReaderImpl.readInternal(ClassInfoReaderImpl.java:103)
	at com.sap.lib.javalang.tool.impl.ClassInfoReaderImpl.read(ClassInfoReaderImpl.java:95)
	at com.sap.engine.services.deploy.ear.jar.DplArchiveReader.parseAnnotations(DplArchiveReader.java:62)
	at com.sap.engine.services.deploy.ear.jar.EARReader.read(EARReader.java:243)
	at com.sap.engine.services.deploy.server.application.DeployUtilTransaction.prepareNewDeploymentInfo(DeployUtilTransaction.java:251)
	at com.sap.engine.services.deploy.server.application.DeploymentTransaction.begin(DeploymentTransaction.java:199)
	at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:423)
	... 16 more
@Marcono1234
Copy link
Collaborator

Marcono1234 commented Sep 11, 2023

Gson intentionally already places the module-info.class file in the JAR under META-INF/versions/9 to reduce the risk of causing issues for Java 8 and Android users. This approach seems to be somewhat common and is for example also used by Jackson and Log4j 2.

By now a lot of tools with Java 8 support have been adjusted to ignore the module-info.class file. Could you please check if there is a newer version of com.sap.engine.library.bytecode.cf.CFParser (respectively the library which contains this class) which ignores the module-info.class file?

@shubham-takale-sp
Copy link
Author

I checked with SAP team, they do not have such release available as of now. So, in this situation would you help us in getting the gson-2.10.1 jar not in JPMS format i.e., without module-info.class file.

@eamonnmcmanus
Copy link
Member

Do you have the option of using an older version of Gson? Any version earlier than 2.8.6 would work.

Alternatively you might be able to make a modified 2.10.1 jar yourself, by starting with the released gson-2.10.1.jar and running this:

zip -d gson-2.10.1.jar META-INF/versions/9/module-info.class

I think it's unlikely that we're going to make a separate release artifact for your situation. 2.8.6 was released four years ago with module-info.class and we haven't needed that separate artifact so far.

@Marcono1234
Copy link
Collaborator

Have changed the label from "bug" to "enhancement" since the module-info.class file is intentionally included in the JAR, so this is not really a bug but rather a feature request.
However, what Éamonn wrote above still applies I think; it is unlikely that a separate JAR without module-info.class file will be published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants