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

Ensure that sigtest -IgnoreJDKClass can ignore JDK classes (java.* and javax.transaction.xa.*) during signature check #30

Merged
merged 3 commits into from
Apr 10, 2024

Conversation

scottmarlow
Copy link
Member

@scottmarlow scottmarlow commented Mar 21, 2024

Work in progress for #20. This change eliminates the need for passing the often changing list JDK classes to exclude. Instead just set -IgnoreJDKClass

Signed-off-by: Scott Marlow <smarlow@redhat.com>
@scottmarlow scottmarlow changed the title Ensure that sigtest -IgnoreJDKClass can ignore package names as well as class names. Ensure that sigtest -IgnoreJDKClass can ignore JDK classes during signature check Mar 25, 2024
@scottmarlow scottmarlow changed the title Ensure that sigtest -IgnoreJDKClass can ignore JDK classes during signature check Ensure that sigtest -IgnoreJDKClass can ignore JDK classes (java.* and javax.transaction.xa.*) during signature check Mar 25, 2024
Signed-off-by: Scott Marlow <smarlow@redhat.com>
@scottmarlow
Copy link
Member Author

Will merge this soon so that we can start using the changes in EE 11 TCKs.

Copy link

@KyleAure KyleAure left a comment

Choose a reason for hiding this comment

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

Overall, looks great. Just left a few review comments.

private static PackageGroup excludedJdkClasses = new PackageGroup(true);

public static void enable() {
excludedJdkClasses.addPackages(new String[] {"java", "javax.transaction.xa" });
Copy link

Choose a reason for hiding this comment

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

Should we also ignore things like javax.sql?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I looked at the current https://github.com/jakartaee/platform-tck/blob/master/src/com/sun/ts/tests/signaturetest/signature-repository/jakarta.persistence.sig#L1840 file and do see that we should include javax.sql and others as well.

Perhaps we should exclude all of javax since all of the classes that we care about checking for (super-setting/sub-setting) changes should be in the jakarta package.

For reference, output of grep javax in signaturetest/signature-repository folder is attached to javax.txt

Copy link

@KyleAure KyleAure Apr 8, 2024

Choose a reason for hiding this comment

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

^^ I think it would be appropriate to ignore all javax packages assuming that they are part of the JDK since this artifact is part of jakartaee tools. But maybe put a big warning somewhere in the README that we will ignore java and javax just in case :)

if (JDKExclude.isJdkClass(baseAnnotList[requiredPos].getName()) ||
JDKExclude.isJdkClass(testAnnotList[foundPos].getName())) {
// don't check excluded Annotation classes
return;
Copy link

Choose a reason for hiding this comment

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

Should this be continue instead of return? Otherwise, you won't check the rest of the annotations.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch! Thank you!

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks again @KyleAure as this change led to a more correct checkAnnotations implementation as we made the suggested fix and also changed to validate JDK annotations by checking that the implementation uses the same JDK annotation class name.

… even if a JDK annotation is checked. checkAnnotations() should also validate JDK annotations by only comparing the JDK annotation class name.

Signed-off-by: Scott Marlow <smarlow@redhat.com>
Copy link

@KyleAure KyleAure left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍🏼. A contributor to this repo might need to review.

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

Successfully merging this pull request may close these issues.

None yet

3 participants