Silence the AvoidGlobalModifier warning in @RestResource Apex controller
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;
up vote
5
down vote
favorite
I have a simple Apex Controller annotated with @RestResource
. According to the documentation, this must be declared global
, but the static analysis complains due to the AvoidGlobalModifier
PMD rule.
Is there some other annotation I need to use to avoid the warning when my code goes through static analysis?
apex restresource pmd
New contributor
add a comment |Â
up vote
5
down vote
favorite
I have a simple Apex Controller annotated with @RestResource
. According to the documentation, this must be declared global
, but the static analysis complains due to the AvoidGlobalModifier
PMD rule.
Is there some other annotation I need to use to avoid the warning when my code goes through static analysis?
apex restresource pmd
New contributor
add a comment |Â
up vote
5
down vote
favorite
up vote
5
down vote
favorite
I have a simple Apex Controller annotated with @RestResource
. According to the documentation, this must be declared global
, but the static analysis complains due to the AvoidGlobalModifier
PMD rule.
Is there some other annotation I need to use to avoid the warning when my code goes through static analysis?
apex restresource pmd
New contributor
I have a simple Apex Controller annotated with @RestResource
. According to the documentation, this must be declared global
, but the static analysis complains due to the AvoidGlobalModifier
PMD rule.
Is there some other annotation I need to use to avoid the warning when my code goes through static analysis?
apex restresource pmd
apex restresource pmd
New contributor
New contributor
New contributor
asked 42 mins ago
Jon Wolski
1262
1262
New contributor
New contributor
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
4
down vote
Your use case needs you to expose a web service. A web service should be always global. I wont worrry much about that warning, as its informative more than obstructing your work. That being said you can change that rule.
The source code of that rule is present here:
https://github.com/pmd/pmd/blob/master/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/bestpractices/AvoidGlobalModifierRule.java
You can alter that rule's java file to not trigger if class contains RestResource
or webservice
keyword.
Meanwhile, I have submitted it as an issue to PMD. Src: https://github.com/pmd/pmd/issues/1348
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
Your use case needs you to expose a web service. A web service should be always global. I wont worrry much about that warning, as its informative more than obstructing your work. That being said you can change that rule.
The source code of that rule is present here:
https://github.com/pmd/pmd/blob/master/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/bestpractices/AvoidGlobalModifierRule.java
You can alter that rule's java file to not trigger if class contains RestResource
or webservice
keyword.
Meanwhile, I have submitted it as an issue to PMD. Src: https://github.com/pmd/pmd/issues/1348
add a comment |Â
up vote
4
down vote
Your use case needs you to expose a web service. A web service should be always global. I wont worrry much about that warning, as its informative more than obstructing your work. That being said you can change that rule.
The source code of that rule is present here:
https://github.com/pmd/pmd/blob/master/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/bestpractices/AvoidGlobalModifierRule.java
You can alter that rule's java file to not trigger if class contains RestResource
or webservice
keyword.
Meanwhile, I have submitted it as an issue to PMD. Src: https://github.com/pmd/pmd/issues/1348
add a comment |Â
up vote
4
down vote
up vote
4
down vote
Your use case needs you to expose a web service. A web service should be always global. I wont worrry much about that warning, as its informative more than obstructing your work. That being said you can change that rule.
The source code of that rule is present here:
https://github.com/pmd/pmd/blob/master/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/bestpractices/AvoidGlobalModifierRule.java
You can alter that rule's java file to not trigger if class contains RestResource
or webservice
keyword.
Meanwhile, I have submitted it as an issue to PMD. Src: https://github.com/pmd/pmd/issues/1348
Your use case needs you to expose a web service. A web service should be always global. I wont worrry much about that warning, as its informative more than obstructing your work. That being said you can change that rule.
The source code of that rule is present here:
https://github.com/pmd/pmd/blob/master/pmd-apex/src/main/java/net/sourceforge/pmd/lang/apex/rule/bestpractices/AvoidGlobalModifierRule.java
You can alter that rule's java file to not trigger if class contains RestResource
or webservice
keyword.
Meanwhile, I have submitted it as an issue to PMD. Src: https://github.com/pmd/pmd/issues/1348
answered 25 mins ago
Pranay Jaiswal
8,89931848
8,89931848
add a comment |Â
add a comment |Â
Jon Wolski is a new contributor. Be nice, and check out our Code of Conduct.
Jon Wolski is a new contributor. Be nice, and check out our Code of Conduct.
Jon Wolski is a new contributor. Be nice, and check out our Code of Conduct.
Jon Wolski is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f232446%2fsilence-the-avoidglobalmodifier-warning-in-restresource-apex-controller%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password