Skip to content

Commit

Permalink
Fix "OperatorPrecedence" warnings in :model-core
Browse files Browse the repository at this point in the history
  • Loading branch information
mlopatkin committed Apr 26, 2024
1 parent 73c6540 commit ca0b55c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion platforms/core-configuration/model-core/build.gradle.kts
Expand Up @@ -10,7 +10,6 @@ errorprone {
"AnnotateFormatMethod", // 1 occurrence, needs errorprone annotations
"GetClassOnEnum", // 4 occurrences
"ImmutableEnumChecker", // 1 occurrences
"OperatorPrecedence", // 5 occurrences
"ReferenceEquality", // 3 occurrences
"UndefinedEquals", // 2 occurrences
"UnusedMethod", // 8 occurrences
Expand Down
Expand Up @@ -275,7 +275,7 @@ private void visitFields(Class<?> type, ValidationProblemCollector collector) {
// Disallow instance fields. This doesn't guarantee that the object is immutable, just makes it less likely
// We might tighten this constraint to also disallow any _code_ on immutable types that reaches out to static state
for (Field field : type.getDeclaredFields()) {
if (Modifier.isStatic(field.getModifiers()) || GroovyObject.class.isAssignableFrom(type) && field.getName().equals("metaClass")) {
if (Modifier.isStatic(field.getModifiers()) || (GroovyObject.class.isAssignableFrom(type) && field.getName().equals("metaClass"))) {
continue;
}
collector.add(field, "A Named implementation class must not define any instance fields.");
Expand Down
Expand Up @@ -1198,8 +1198,8 @@ void visitProperty(PropertyMetadata property) {
// For ConfigurableFileCollection we generate setters just for readonly properties,
// since we want to support += for mutable FileCollection properties, but we don't support += for ConfigurableFileCollection (yet).
// And if we generate setter override for ConfigurableFileCollection, it's difficult to distinguish between these two cases in setFromAnyValue method.
if (property.isReadable() && hasPropertyType(property) ||
property.isReadOnly() && isConfigurableFileCollectionType(property.getType())) {
if ((property.isReadable() && hasPropertyType(property)) ||
(property.isReadOnly() && isConfigurableFileCollectionType(property.getType()))) {
lazyGroovySupportTyped.add(property);
}
}
Expand Down
Expand Up @@ -167,8 +167,8 @@ private Type unwrapTypeVariable(Type type) {
}

private static boolean isAssignableFromType(Class<?> clazz, Type type) {
return type instanceof Class && clazz.isAssignableFrom((Class<?>) type)
|| type instanceof ParameterizedType && clazz.isAssignableFrom((Class<?>) ((ParameterizedType) type).getRawType());
return (type instanceof Class && clazz.isAssignableFrom((Class<?>) type))
|| (type instanceof ParameterizedType && clazz.isAssignableFrom((Class<?>) ((ParameterizedType) type).getRawType()));
}

/**
Expand Down

0 comments on commit ca0b55c

Please sign in to comment.