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

Java 17 Support with Sigtest 2.2 from JakartaEE TCK Tools #7117

Merged
merged 1 commit into from
Mar 24, 2024

Conversation

lkishalmi
Copy link
Contributor

I've tried to upgrade Sigtest to the latest available version 1.7, and that still fails on Java 17.
@mbien pionted out that there is a fork in JakartaEE TCK that could work. It did the job.

This is needed when a module is on Java 17 and exposes some API.

@lkishalmi lkishalmi added Upgrade Library Library (Dependency) Upgrade Upgrade JDK Upgrade to the JDK requirements of a module. labels Feb 27, 2024
@lkishalmi lkishalmi added this to the NB22 milestone Feb 27, 2024
@lkishalmi
Copy link
Contributor Author

Well, this version seems to fail on plarfom/libs.osgi which shall generate an empty report.
The new tool has some specific handling for Java 17.

The old tool does something somehow not match any package with the following patterns info.dmtree.**, org.osgi.**

The new version does. Unfortunately osgi.cmpn-7.0.0.jar has references some javax.servlet classes which are not on the classpath.

Adding sigtest.public.packages=- to the project.properties helped, but there are other classloader issues after that.

I'm out of ideas here.

@jtulach ?

@matthiasblaesing
Copy link
Contributor

Not sure if it helps, but I think this causes the "error" in libs.osgi:

eclipse-ee4j/jakartaee-tck-tools@56e3e33

If I read the summary of the commit correctly, before this commit recursive definitions like info.dmtree.**, org.osgi.** were not handled correctly. If I'm not mistaken, only the first level was considered.

The commit was added between 1.5 and 1.6 and indeed using 1.5 I can run the sigtest generator in libs.osgi and 1.6 fails. And for some unknown reason that also matches the fact, that NetBeans itself stayed with sigtest 1.4.

Channeling my bash deamons I came up with this list of modules that might be affected:

find . -name project.xml | xargs grep -l subpackages | cut --delimiter "/" -f 2-3
extide/libs.gradle
webcommon/libs.nashorn
java/j2ee.eclipselink
java/maven.embedder
enterprise/web.jsf12
enterprise/web.jsf20
enterprise/j2eeapis
ide/servletapi
ide/libs.lucene
ide/libs.jcodings
ide/o.apache.xml.resolver
ide/libs.snakeyaml_engine
ide/libs.xerces
ide/libs.flexmark
platform/libs.asm
platform/libs.osgi

@ebarboni
Copy link
Contributor

ebarboni commented Mar 6, 2024

I think 1.4 was needed to build on jdk 11. As it was "working" did'nt think on upgrading.

I'm always puzzled with sigtest as on jenkins we have issue
In one there is 24 test failing: https://ci-builds.apache.org/job/Netbeans/job/netbeans-apisigcheck/lastCompletedBuild/testReport/
with ga checker we swallow them.

In both case there are a bunch of java.lang.ClassFormatError: Index out of the constant pool bounds during sig phase.

@lkishalmi lkishalmi force-pushed the sigtest-2.2-jakartaee-tck-tools branch from 96ed3bc to 7a90a0d Compare March 19, 2024 00:16
@lkishalmi
Copy link
Contributor Author

Well the last commit forces to use sigtest to generate signatures without recursion.

That behavior was fixed in the commit mentioned above, so that commit is just keeping the same wrong way of doing the things as before.

Copy link
Member

@mbien mbien left a comment

Choose a reason for hiding this comment

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

thanks for updating this dependency! Its interesting that it went full circle, I believe the jakarta lib is a fork of the netbeans fork - and we would use it now again ;)

tests are green, couldn't find any regressions while browsing through the log (the familiar java.lang.ClassFormatError: Index out of the constant pool bounds traces are still there)

+1 from me, but someone who has more experience with the sig tests and public API requirements should take a look too.

@@ -17,3 +17,5 @@

is.autoload=true
release.external/deployment-api-1.2-rev-1.jar=modules/ext/jsr88javax.jar

sigtest.public.packages=javax.enterprise.deploy
Copy link
Member

Choose a reason for hiding this comment

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

this restricts the sig test to only the listed package prefix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. That's the idea, as the recursive behavior was not working prior 1.6. They checked only the listed part of the package hierarchy. So adding these mimics the former behavior.

@ebarboni
Copy link
Contributor

LGTM with my limited understanding

@lkishalmi
Copy link
Contributor Author

Anyone, a word? I'm about to merge this one today or tomorrow, as #7024 is depending on this one.

Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

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

I would not go down the sigtest.public.packages property route. It is doomed to fail because in the future nobody will remember why on earth these broken declarations were made. In most cases I saw the packages would need to be declared as package.** (i.e. cover all subpackages) and then the original errors reappear.

I wrote it inline already and would suggest to recreate the sigfile where it works and where not disable sigtest with a comment explaining why it is deactivated.

@@ -20,3 +20,5 @@ javac.source=1.8
release.external/javax.faces-2.3.9.jar=modules/ext/jsf-2_2/javax.faces.jar
release.external/javax.faces-2.3.9-license.txt=modules/ext/jsf-2_2/license.txt
spec.version.base=1.57.0

sigtest.public.packages=javax.faces,com.sun.faces
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you are looking for sigtest.public.packages=javax.faces.**,com.sun.faces.** (the API is declared base on the subpackages element).

This needs a deeper look. For example Groovy is being looked for because there is com.sun.faces.scripting.groovy.GroovyHelperImpl. The API declaration of this module is ugly/lazy/wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Strangely, this did not occur to me.

Though I think these definitions web.jsf* are there for providing libraries to Ant based projects. So technically they should not provide any public api to any NB modules. Also JSF 1.2 is soon 18 years old. Probably it would be better not to include the jars in NB.

web.jsf20 hide JSF 2.3 we seem to be built our JSF support on that.

I'm going to file separate PR-s to remove the JSF 1.2 libraries.

enterprise/j2eeapis/nbproject/project.properties Outdated Show resolved Hide resolved
enterprise/web.jsf12/nbproject/project.properties Outdated Show resolved Hide resolved
extide/libs.gradle/nbproject/project.properties Outdated Show resolved Hide resolved
@@ -20,3 +20,5 @@ javac.compilerargs=-Xlint -Xlint:-serial

release.external/osgi.core-8.0.0.jar=modules/ext/osgi.core-8.0.0.jar
release.external/osgi.cmpn-7.0.0.jar=modules/ext/osgi.cmpn-7.0.0.jar

sigtest.public.packages=org.osgi,info.dmtree
Copy link
Contributor

Choose a reason for hiding this comment

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

Same reasoning as libs.gradle. The approach might work for OSGI if all packages would be listed here and only packages with problematic references are excluded and commented acordingly.

@@ -38,3 +38,5 @@ release.external/jakarta.persistence-2.2.3.jar=modules/ext/eclipselink/jakarta.p
release.build/jakarta.persistence-2.2.3-doc.zip=modules/ext/docs/jakarta.persistence-2.2.3-doc.zip

extra.module.files=modules/ext/docs/jakarta.persistence-2.2.3-doc.zip

sigtest.public.packages=org.eclipse,javax.persistence
Copy link
Contributor

Choose a reason for hiding this comment

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

Strange error here when generating signature file.

@lkishalmi lkishalmi force-pushed the sigtest-2.2-jakartaee-tck-tools branch from 7a90a0d to 4ec1ef3 Compare March 23, 2024 00:42
@lkishalmi
Copy link
Contributor Author

@matthiasblaesing thanks for your feedback!

@lkishalmi lkishalmi force-pushed the sigtest-2.2-jakartaee-tck-tools branch from 4ec1ef3 to 48fec4e Compare March 23, 2024 03:19
@mbien
Copy link
Member

mbien commented Mar 23, 2024

would it make sense to open a meta issue afterwards which has a list of all mods where sig tests are turned off so that we can look that up when needed?

Copy link
Contributor

@matthiasblaesing matthiasblaesing left a comment

Choose a reason for hiding this comment

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

In general looks good. I don't agree with all comments, but not to problematic, I left a few inline suggestions.

ide/libs.flexmark/nbproject/project.properties Outdated Show resolved Hide resolved

# This is an very old library, the complete dependencies were never explored.
# Since subpackage-s are working in new sigtest version, generation of the
# signature file fails. Disabling that now.
Copy link
Contributor

Choose a reason for hiding this comment

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

Disabling is fine, the comment though does not match the reason (from my POV). The reported error is:

/home/matthias/src/netbeans/nbbuild/templates/projectized.xml:765: 
java.lang.AssertionError: org.apache.lucene.search.CachingWrapperFilter$FilterCache<org.apache.lucene.search.DocIdSet>
	at com.sun.tdk.signaturetest.loaders.BinaryClassDescrLoader.load(BinaryClassDescrLoader.java:225)
	at com.sun.tdk.signaturetest.core.ClassHierarchyImpl.load(ClassHierarchyImpl.java:180)
	at com.sun.tdk.signaturetest.core.ClassHierarchyImpl.getClassInfo(ClassHierarchyImpl.java:292)
	at com.sun.tdk.signaturetest.core.ClassHierarchyImpl.isInterface(ClassHierarchyImpl.java:272)
	at com.sun.tdk.signaturetest.core.ClassCorrector.fixType(ClassCorrector.java:315)
	at com.sun.tdk.signaturetest.core.ClassCorrector.fixMethods(ClassCorrector.java:298)

So I would say this is the same as in other cases: sigtest fails to parse the API classes.

java/j2ee.eclipselink/nbproject/project.properties Outdated Show resolved Hide resolved
enterprise/web.jsf20/nbproject/project.properties Outdated Show resolved Hide resolved
Disabled sigtest where it does not work, fixed signature files/dependencies where it does.

Update enterprise/web.jsf20/nbproject/project.properties
Update java/j2ee.eclipselink/nbproject/project.properties
Co-authored-by: Matthias Bläsing <mblaesing@doppel-helix.eu>
@lkishalmi lkishalmi force-pushed the sigtest-2.2-jakartaee-tck-tools branch from 57bc43c to a9489d5 Compare March 23, 2024 23:11
@lkishalmi lkishalmi merged commit a74ce3b into apache:master Mar 24, 2024
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Upgrade JDK Upgrade to the JDK requirements of a module. Upgrade Library Library (Dependency) Upgrade
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants