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

Add targetPackage property to the @Introspected annotation #9105

Merged
merged 3 commits into from
Apr 17, 2023

Conversation

andriy-dmytruk
Copy link
Contributor

The property can be used in the following manner:

@Introspected(introspectionPackage="my.package.introspections")
class SomeClass {}

This can be used when SomeClass was built externally but the class was processed by an annotation processor as sources to create introspection metadata (and avoid "signer information does not match signer information of other classes in the same package" error). It can be also used in combination with the classes property of the annotation.

* @since 3.9.0
*/
@Experimental
String introspectionPackage() default "";
Copy link
Contributor

Choose a reason for hiding this comment

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

rename to targetPackage

@@ -180,6 +180,8 @@ private void processIntrospected(ClassElement element, VisitorContext context, A
Introspected.AccessKind[] accessKinds = introspected.enumValues("accessKind", Introspected.AccessKind.class);
Introspected.Visibility[] visibilities =
introspected.enumValues("visibility", Introspected.Visibility.class);
final String introspectionPackage = introspected.stringValue("introspectionPackage").orElse(element.getPackageName());
Copy link
Contributor

Choose a reason for hiding this comment

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

If this package names differ we need to change the default visibility to only public members (see Visibility.PUBLIC) since package private and protected members will no longer be visible from different packages. In the 4.0.x branch we support reflection as a fall back but not here.

@graemerocher graemerocher added this to the 3.9.0 milestone Apr 14, 2023
@andriy-dmytruk andriy-dmytruk changed the title Add introspectionPackage property to the @Introspected annotation Add targetPackage property to the @Introspected annotation Apr 14, 2023
@sdelamo sdelamo requested a review from graemerocher April 17, 2023 08:55
@sdelamo
Copy link
Contributor

sdelamo commented Apr 17, 2023

@andriy-dmytruk should I move this PR to ready for review?

@sdelamo sdelamo modified the milestones: 3.9.0, 3.10.0 Apr 17, 2023
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@graemerocher graemerocher marked this pull request as ready for review April 17, 2023 09:56
@graemerocher graemerocher merged commit 8fae07c into 3.9.x Apr 17, 2023
@graemerocher graemerocher deleted the introspection-package-property branch April 17, 2023 09:57
@graemerocher graemerocher modified the milestones: 3.10.0, 3.9.0 Apr 17, 2023
@sdelamo sdelamo mentioned this pull request Apr 18, 2023
timyates added a commit that referenced this pull request Apr 20, 2023
This got dropped in the merge by mistake...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants