Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/java/groovy/lang/MetaClassImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -2118,6 +2118,9 @@ public void setProperty(Object object, Object newValue) {
//----------------------------------------------------------------------
if (!useSuper && !isStatic && GroovyCategorySupport.hasCategoryInCurrentThread()) {
method = getCategoryMethodGetter(sender, "get", true);
if (null == method) {
method = getCategoryMethodGetter(sender, PROPERTY_MISSING, true);
}
if (method != null) {
return new GetMethodMetaProperty(name, VM_PLUGIN.transformMetaMethod(this, method));
}
Expand Down
15 changes: 14 additions & 1 deletion src/test/groovy/CategoryTest.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ package groovy
import groovy.test.GroovyTestCase

import static groovy.test.GroovyAssert.isAtLeastJdk
import static org.junit.Assume.assumeTrue

final class CategoryTest extends GroovyTestCase {

Expand Down Expand Up @@ -358,6 +357,20 @@ final class CategoryTest extends GroovyTestCase {
}
}

// GROOVY-10783
void testPropertyMissing2() {
assertScript '''\
class X{ def bar(){1}}
class XCat4{ static propertyMissing(X x, String name) {"works"}}

def x = new X()

use(XCat4) {
assert x.baz == "works"
}
'''
}

// GROOVY-3867
void testMethodMissing() {
def x = new X()
Expand Down