Skip to content

Commit 7433fa7

Browse files
refactor: use switch expression
1 parent 7a99762 commit 7433fa7

1 file changed

Lines changed: 6 additions & 14 deletions

File tree

  • src/main/java/org/variantsync/diffdetective/variation

src/main/java/org/variantsync/diffdetective/variation/NodeType.java

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,13 @@ public static NodeType fromName(final String name) {
6868
* @return The NodeType that fits the given AnnotationType
6969
*/
7070
public static NodeType fromAnnotationType(final AnnotationType annotationType) {
71-
switch (annotationType) {
72-
case If -> {
73-
return NodeType.IF;
74-
}
75-
case Elif -> {
76-
return NodeType.ELIF;
77-
}
78-
case Else -> {
79-
return NodeType.ELSE;
80-
}
81-
case None -> {
82-
return NodeType.ARTIFACT;
83-
}
71+
return switch (annotationType) {
72+
case If -> NodeType.IF;
73+
case Elif -> NodeType.ELIF;
74+
case Else -> NodeType.ELSE;
75+
case None -> NodeType.ARTIFACT;
8476
default -> throw new IllegalArgumentException(annotationType + "has no NodeType counterpart");
85-
}
77+
};
8678
}
8779

8880
/**

0 commit comments

Comments
 (0)