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

Allow to silently ignore signatures if the class is not found #164

Merged
merged 6 commits into from
Apr 23, 2020

Conversation

uschindler
Copy link
Member

(e.g., multi-module builds with common signatures). The old setting failOnUnresolvableSignatures was deprecated in favour of ignoreSignaturesOfMissingClasses. This closes #83

…multi-module builds with common signatures). The old setting failOnUnresolvableSignatures was deprecated in favour of ignoreSignaturesOfMissingClasses. This closes #83
@@ -170,6 +174,9 @@ private void addSignature(final String line, final String defaultMessage, final
try {
c = lookup.getClassFromClassLoader(clazz);
} catch (ClassNotFoundException cnfe) {
if (this.ignoreSignaturesOfMissingClasses) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the main point doing the magic!

@uschindler uschindler merged commit fb656e1 into master Apr 23, 2020
@uschindler uschindler deleted the dev/issue83-milestone3.0 branch April 23, 2020 18:21
@asdf2014
Copy link

Hi @uschindler . We found that after replacing the failOnUnresolvableSignatures old parameter with this ignoreSignaturesOfMissingClasses new parameter, it did not work well with Maven's Shade plugin. After adding the old parameters back, everything works fine. You can got more details from here. PTAL, thanks a lot.

@uschindler
Copy link
Member Author

Hi @asdf2014,
Thanks for reporting. I have not yet looked into your code and why this does not work with renamed classes. I have no idea about the setup (so it looks like you shade one version of a library and then refer to the shaded version from source code?).

ignoreSignaturesOfMissingClasses only ignores missing classes, but failOnUnresolvableSignatures ignores any wrongly written signature (but it is deprecated now).

ignoreSignaturesOfMissingClasses works well when you have a subproject where a dependency is missing and you still want to use the same signatures file. In that case it just ignores all signatures where the class was not found. This should work also for shaded jars.

Do you have a simple example or maybe can you tell me how to trigger that after checking out Druid?

@uschindler
Copy link
Member Author

Ah now I understand the problem:

[2022-01-15 05:49:23] [build-stdout] [2022-01-15 05:49:23] [autobuild] [ERROR] Failed to execute goal de.thetaphi:forbiddenapis:3.1:check (compile) on project opentelemetry-emitter: Parsing signatures failed: Method not found while parsing signature: com.google.common.util.concurrent.MoreExecutors#sameThreadExecutor() -> [Help 1]

So the class is there, but the method is missing (because it is another version of Google Guava). This of course fails. The idea behind the ignoreSignaturesOfMissingClasses is to just ignore signatures where class is missing. But this is not the case here.

The old setting was deprecated because it makes parsing signatures files a bit errorprone: If you have a typo in signatures file it won't fail the build.

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

Successfully merging this pull request may close these issues.

Add option to suppress warning about unresolved signature
2 participants