New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix some ErrorProne issues in :model-core #28892
Changes from all commits
063b470
fdf3a69
2aee4e6
afc7f2b
408938b
fc4ac38
ca0bdcf
e163d00
367afa2
c1678a0
6e630b4
6533fa9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,7 +83,8 @@ private MappedProperty map(String propertyName, MappedPropertyImpl mapping) { | |
throw new IllegalStateException(String.format("Could not access property %s.%s", sourceType.getSimpleName(), propertyName), e); | ||
} | ||
if (!mapConventionOn(target, mapping)) { | ||
throw new IllegalStateException(String.format("Unexpected convention-supporting type used in property %s.%s", sourceType.getSimpleName(), propertyName, getter.getReturnType().getName())); | ||
throw new IllegalStateException(String.format( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💭 A real bug caught! |
||
"Unexpected convention-supporting type %s used in property %s.%s", getter.getReturnType().getName(), sourceType.getSimpleName(), propertyName)); | ||
} | ||
} else { | ||
throw DocumentedFailure.builder() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,7 +54,7 @@ public class DefaultConvention implements org.gradle.api.plugins.Convention, Ext | |
private final InstanceGenerator instanceGenerator; | ||
|
||
private Map<String, Object> plugins; | ||
private Map<Object, BeanDynamicObject> dynamicObjects; | ||
private IdentityHashMap<Object, BeanDynamicObject> dynamicObjects; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💭 ErrorProne insists that IndentityHashMap shouldn't be mixed with Map because of a different contract with regard to hashCode/equals. Fixing it doesn't look too ugly anyway. |
||
|
||
public DefaultConvention(InstanceGenerator instanceGenerator) { | ||
this.instanceGenerator = instanceGenerator; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -471,6 +471,8 @@ protected DynamicInvokeResult setOpaqueProperty(MetaClass metaClass, String name | |
return DynamicInvokeResult.notFound(); | ||
} | ||
|
||
@SuppressWarnings("MixedMutabilityReturnType") | ||
// This might be too invasive to fix properly because it is in the dynamic code. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💭 It looks like making all paths mutable is going to add overhead of allocating empty hashmaps, and making all paths immutable can actually break things. |
||
public Map<String, ?> getProperties() { | ||
if (!includeProperties) { | ||
return Collections.emptyMap(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💭 unlike MapPropery, here we can only have
List
orSet
, so using the English locale is fine.