Skip to content
\n

But this is matching all classes with a @Controller decorator, even those that also have a @RequireRole decorator.

\n

Any help would be really appreciated!

","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

Your code works for me for simple examples. Can you provide a code example that exhibits the problem?

\n

One thing to watch out for: toString is abbreviated for AST nodes that would naturally consume more than 20 characters, so e.g. @RequireRole(\"Looooong\") might turn into \"@Requir ... ooong)\". If that's the problem, you may need to use getADecorator().getExpression().(InvokeExpr).getCalleeName() or similar (depending on the exact nature of the decorator) to extract the decorator's full function name.

","upvoteCount":2,"url":"https://github.com/github/codeql/discussions/20942#discussioncomment-15127075"}}}
Discussion options

You must be logged in to vote

Your code works for me for simple examples. Can you provide a code example that exhibits the problem?

One thing to watch out for: toString is abbreviated for AST nodes that would naturally consume more than 20 characters, so e.g. @RequireRole("Looooong") might turn into "@Requir ... ooong)". If that's the problem, you may need to use getADecorator().getExpression().(InvokeExpr).getCalleeName() or similar (depending on the exact nature of the decorator) to extract the decorator's full function name.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Giardi77
Comment options

Answer selected by Giardi77
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants