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

Fail build if potentially missing types found in method signatures #2559

Closed
shakuzen opened this issue Apr 12, 2021 · 1 comment
Closed

Fail build if potentially missing types found in method signatures #2559

shakuzen opened this issue Apr 12, 2021 · 1 comment
Labels
build A change in our build-system type: task A general task
Milestone

Comments

@shakuzen
Copy link
Member

Sorry this keeps coming up. You'd think I would remember. I tried looking into tools/build plugins we could use to catch this but I haven't found something so far. Checkstyle and Forbidden APIs didn't seem to have the feature of disallowing a method parameter or return type that matches a package pattern.

You can do these kinds of checks with ArchUnit I believe.

Originally posted by @ThomHurks in #2557 (comment)

Indeed it seems we can. I prototyped something like the following:

ArchRule noSunManagementInMethodSignatures = methods()
        .should().notHaveRawReturnType(resideInAPackage("com.sun.management.."))
        .andShould().notHaveRawParameterTypes(DescribedPredicate.anyElementThat(resideInAPackage("com.sun.management..")));

Thanks for the suggestions @ThomHurks.

@shakuzen shakuzen added build A change in our build-system type: task A general task labels Apr 12, 2021
@shakuzen shakuzen added this to the 1.3.x milestone Apr 12, 2021
@ThomHurks
Copy link

Glad to help!

@shakuzen shakuzen modified the milestones: 1.3.x, 1.5.x Jun 22, 2021
@shakuzen shakuzen modified the milestones: 1.5.x, 1.6.x Aug 12, 2021
@shakuzen shakuzen modified the milestones: 1.6.x, 1.6.11 Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build A change in our build-system type: task A general task
Projects
None yet
Development

No branches or pull requests

2 participants