don't duplicate @Delegated methods (IDEA-78066)

This commit is contained in:
peter
2011-12-04 23:08:36 +01:00
parent 753521e192
commit 3a529caaa9
2 changed files with 41 additions and 0 deletions
@@ -57,6 +57,7 @@ public class DelegatedMethodsContributor extends AstTransformContributor {
for (PsiMethod method : methods) {
if (method.isConstructor()) continue;
if (!deprecated && PsiImplUtil.getAnnotation(method, "java.lang.Deprecated") != null) continue;
if (clazz.findCodeMethodsBySignature(method, false).length > 0) continue;
collector.add(generateDelegateMethod(method, clazz, resolveResult.getSubstitutor()));
}
}
@@ -9,6 +9,10 @@ class DelegateBarImpl {
private @Delegate(interfaces=false) Runnable zoo;
private @Delegate Doo doo;
}
class Del2 implements DelegateFoo {
@Delegate DelegateFoo foo;
def foo() {}
}
-----
public interface DelegateFoo {
public java.lang.Object foo() ;
@@ -79,4 +83,40 @@ private DelegateFoo foo = null;
private java.lang.Runnable zoo = null;
private Doo doo = null;
}
---
public class Del2 extends groovy.lang.GroovyObjectSupport implements DelegateFoo, groovy.lang.GroovyObject {
public java.lang.Object foo() {
return null;
}
public DelegateFoo getFoo() {
return null;
}
public void setFoo(DelegateFoo foo) {
return ;
}
public java.lang.Object getProperty(java.lang.String property) {
return null;
}
public void setProperty(java.lang.String property, java.lang.Object newValue) {
return ;
}
public java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args) {
return null;
}
public groovy.lang.MetaClass getMetaClass() {
return null;
}
public void setMetaClass(groovy.lang.MetaClass metaClass) {
return ;
}
private DelegateFoo foo = null;
}
---