Skip to content

Commit

Permalink
fix sonarcloud bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
CSchulz authored and ArneLimburg committed Apr 26, 2018
1 parent 71d29da commit c39730f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private boolean match(VersionProperty property, VersionProperty previousProperty
}

private boolean match(VersionType<?> versionType, VersionType<?> previousVersionType, Set<Pair<VersionType<?>, VersionType<?>>> visited) {
ImmutablePair<?, ?> pair = ImmutablePair.of(versionType, previousVersionType);
Pair<?, ?> pair = ImmutablePair.of(versionType, previousVersionType);
if (visited.contains(pair)) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private Type getVersionType(Type type, String version) {
Type sourceType = getVersionType(getTypeArgument(type), version);
return new DefaultParameterizedType(((ParameterizedType)type).getOwnerType(), rawType, sourceType);
}
SupportedVersion supportedVersion = toClass(type).getAnnotation(SupportedVersion.class);
SupportedVersion supportedVersion = extractSupportedVersion(type);
if (supportedVersion == null) {
throw new IllegalVersionException(version);
}
Expand All @@ -129,6 +129,15 @@ private Type getVersionType(Type type, String version) {
}
}

private SupportedVersion extractSupportedVersion(Type type) {
Class<?> clz = toClass(type);
if (clz != null) {
return clz.getAnnotation(SupportedVersion.class);
}

return null;
}

private Class<?> toClass(Type type) {
if (type instanceof Class) {
return (Class<?>)type;
Expand Down

0 comments on commit c39730f

Please sign in to comment.