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

class file for com.google.errorprone.annotations.RestrictedInheritance not found #4335

Open
TWiStErRob opened this issue Mar 20, 2024 · 3 comments

Comments

@TWiStErRob
Copy link

Just updated Google Places SDK from 3.3.0 to 3.4.0 which bumped play-services-base from 18.0.1 to 18.3.0, resulting in the following problems:

compileDebugJavaWithJavac FAILED
Z:\caches\gradle\caches\transforms-3\cafb58f4ccde6f6fe4b7ef5eb9b091ac\transformed\play-services-base-18.3.0-api.jar(/com/google/android/gms/common/GoogleApiAvailability.class): warning: Cannot find annotation method  'explanation()' in type 'RestrictedInheritance': class file for com.google.errorprone.annotations.RestrictedInheritance not found
Z:\caches\gradle\caches\transforms-3\cafb58f4ccde6f6fe4b7ef5eb9b091ac\transformed\play-services-base-18.3.0-api.jar(/com/google/android/gms/common/GoogleApiAvailability.class): warning: Cannot find annotation method  'link()' in type 'RestrictedInheritance'
Z:\caches\gradle\caches\transforms-3\cafb58f4ccde6f6fe4b7ef5eb9b091ac\transformed\play-services-base-18.3.0-api.jar(/com/google/android/gms/common/GoogleApiAvailability.class): warning: Cannot find annotation method  'allowedOnPath()' in type 'RestrictedInheritance'
Z:\caches\gradle\caches\transforms-3\cafb58f4ccde6f6fe4b7ef5eb9b091ac\transformed\play-services-base-18.3.0-api.jar(/com/google/android/gms/common/GoogleApiAvailability.class): warning: Cannot find annotation method  'allowlistAnnotations()' in type 'RestrictedInheritance'
error: warnings found and -Werror specified
1 error
4 warnings

Can you please add the RestrictedInheritance annotation and checker to the error-prone artifacts? or hide the private annotation from the public API.

@TWiStErRob
Copy link
Author

Workaround

Create a new file at src/main/java/com/google/errorprone/annotations/RestrictedInheritance.java in the module that uses play-services-base:

package com.google.errorprone.annotations;

/**
 * Workaround for <code>class file for com.google.errorprone.annotations.RestrictedInheritance not found</code>.
 *
 * <pre><code>
 * warning: Cannot find annotation method 'explanation()' in type 'RestrictedInheritance'
 * warning: Cannot find annotation method 'link()' in type 'RestrictedInheritance'
 * warning: Cannot find annotation method 'allowedOnPath()' in type 'RestrictedInheritance'
 * warning: Cannot find annotation method 'allowlistAnnotations()' in type 'RestrictedInheritance'
 * </code></pre>
 *
 * @see <a href="https://github.com/google/error-prone/issues/4335">Report</a>
 */
public @interface RestrictedInheritance {
	String explanation();
	String link();
	String allowedOnPath();
	Class<?>[] allowlistAnnotations();
}

@cushon
Copy link
Collaborator

cushon commented Mar 20, 2024

Thanks for the report!

Can you please add the RestrictedInheritance annotation and checker to the error-prone artifacts? or hide the private annotation from the public API.

We may eventually finalize the annotation to and include it in error-prone-annotations, but until that happens I have filed an internal issue against the owners of play-services-base about hiding the annotation from the API [b/330519201].

@TWiStErRob
Copy link
Author

Thanks for forwarding the issue internally!

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

No branches or pull requests

2 participants