This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new 7e95fb0bdf GROOVY-11745: check for null sender
7e95fb0bdf is described below
commit 7e95fb0bdff6419e3c07bf7d2b6d74262b649990
Author: Eric Milles <[email protected]>
AuthorDate: Fri Sep 5 11:37:47 2025 -0500
GROOVY-11745: check for null sender
---
src/main/java/groovy/lang/MetaClassImpl.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/main/java/groovy/lang/MetaClassImpl.java
b/src/main/java/groovy/lang/MetaClassImpl.java
index 836b84b28f..e5d64e2f19 100644
--- a/src/main/java/groovy/lang/MetaClassImpl.java
+++ b/src/main/java/groovy/lang/MetaClassImpl.java
@@ -2095,11 +2095,12 @@ public class MetaClassImpl implements MetaClass,
MutableMetaClass {
}
private boolean isVisibleProperty(final MetaProperty field, final
MetaMethod method, final Class<?> sender) {
- if (!(field instanceof CachedField)) return false;
+ if (field == null
+ || sender == null // GROOVY-11745
+ || field.isPrivate()
+ || !(field instanceof CachedField cachedField)) return false;
- if (field.isPrivate()) return false;
-
- Class<?> owner = ((CachedField) field).getDeclaringClass();
+ Class<?> owner = cachedField.getDeclaringClass();
// ensure access originates within the type hierarchy of the field
owner
if (owner.equals(sender) || !owner.isAssignableFrom(sender)) return
false;