Skip to content

Commit

Permalink
refactor: Move @Nullable method annotations to the return type
Browse files Browse the repository at this point in the history
  • Loading branch information
jkschneider and TeamModerne committed Jul 16, 2024
1 parent 6309fee commit 0e147e3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,7 @@ private SharedDataHolder extractData(Xml.Tag puNode) {
return sdh;
}

@Nullable
private String getAttributeValue(String attrName, Xml.Tag node) {
private @Nullable String getAttributeValue(String attrName, Xml.Tag node) {
for (Xml.Attribute attribute : node.getAttributes()) {
if (attribute.getKeyAsString().equals(attrName)) {
return attribute.getValue().getValue();
Expand Down Expand Up @@ -272,8 +271,7 @@ private void getDataCacheProps(Xml.Tag puNode, SharedDataHolder sdh) {
}
}

@Nullable
private String getTextContent(@Nullable Xml.Tag node) {
private @Nullable String getTextContent(@Nullable Xml.Tag node) {
if (node != null) {
String textContent = null;
Optional<String> optionalValue = node.getValue();
Expand All @@ -285,8 +283,7 @@ private String getTextContent(@Nullable Xml.Tag node) {
return null;
}

@Nullable
private String interpretOpenJPAPropertyValue(@Nullable String propVal) {
private @Nullable String interpretOpenJPAPropertyValue(@Nullable String propVal) {
if (propVal != null) {
if ("false".equalsIgnoreCase(propVal)) {
return "NONE";
Expand All @@ -303,8 +300,7 @@ private String interpretOpenJPAPropertyValue(@Nullable String propVal) {

// convert the scmValue to either true or false.
// return null for complex values.
@Nullable
private String convertScmValue(String scmValue) {
private @Nullable String convertScmValue(String scmValue) {
if ("NONE".equals(scmValue)) {
return "false";
} else if ("ALL".equals(scmValue)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ public Xml.Document visitDocument(Xml.Document document, ExecutionContext ctx) {
* @param artifactId The artifact ID of the dependency
* @return The highest scope of the given dependency or null if the dependency does not exist.
*/
@Nullable
private Scope getTransitiveDependencyScope(MavenResolutionResult mavenModel, String groupId, String artifactId) {
private @Nullable Scope getTransitiveDependencyScope(MavenResolutionResult mavenModel, String groupId, String artifactId) {
Scope maxScope = null;
for (Map.Entry<Scope, List<ResolvedDependency>> entry : mavenModel.getDependencies().entrySet()) {
for (ResolvedDependency dependency : entry.getValue()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ public J.MethodInvocation visitMethodInvocation(J.MethodInvocation method, Execu
/**
* @return the param index position of the HttpServletRequest parameter object
*/
@Nullable
private Integer getServletRequestIndex(J.MethodDeclaration parentMethod) {
private @Nullable Integer getServletRequestIndex(J.MethodDeclaration parentMethod) {
List<JavaType> params = parentMethod.getMethodType().getParameterTypes();
for (int i = 0; i < params.size(); ++i) {
if (httpServletRequestTypeMatcher.matches(params.get(i))) {
Expand Down

0 comments on commit 0e147e3

Please sign in to comment.