Adds annotation support for Policy#296
Merged
muditchaudhary merged 9 commits intocedar-policy:mainfrom Feb 25, 2025
Merged
Conversation
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
Signed-off-by: Mudit Chaudhary <chmudit@amazon.com>
| * | ||
| * @throws InternalException if there is an error loading or parsing the annotations | ||
| */ | ||
| private void ensureAnnotationsLoaded() throws InternalException { |
Contributor
There was a problem hiding this comment.
Is there any reason we can't include this snippet of code that should be run once per instance in the constructor?
Contributor
Author
There was a problem hiding this comment.
This snippet throws an InternalException, but the current constructor doesn't declare this exception. Moving this code into the constructor would require us to either add throws InternalException to the constructor signature, which would be a breaking change for existing users.
Contributor
There was a problem hiding this comment.
Ah, good reason for this major version at least 👍
mark-creamer-amazon
approved these changes
Feb 24, 2025
mark-creamer-amazon
approved these changes
Feb 24, 2025
john-h-kastner-aws
approved these changes
Feb 24, 2025
Contributor
john-h-kastner-aws
left a comment
There was a problem hiding this comment.
looks reasonable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements annotation getters for the
Policyclass, providing access to both static policy and template policy annotations.Key Changes
CedarJavaFFIfor annotation management and JNI communicationPolicyclass:getAnnotation(String key)getAnnotations()CedarJavaFFIHashMap implementationPolicyannotation gettersImplementation Details
Handling Static Policies and Templates
errorMessage.contains("expected a static policy"))ParseError(tracking in #979)ParseErrorfor static policies (as in PR Exposes policy effect for static policies and templates #275)PolicyandTemplateclass separationLazy Loading Strategy
Policyconstructor to preserve backward compatibility by avoiding addition ofInternalExceptionin constructor signature.