mirror throws clauses in groovy stubs

This commit is contained in:
peter.gromov
2010-10-18 21:16:36 +04:00
parent c5dc3de867
commit b032bebe88
3 changed files with 45 additions and 0 deletions
@@ -594,6 +594,20 @@ public class GroovyToJavaGenerator {
writeParameterList(text, parameters);
final PsiReferenceList throwsList = method.getThrowsList();
final PsiClassType[] exceptions = throwsList.getReferencedTypes();
if (exceptions.length > 0) {
text.append("throws ");
for (int i = 0; i < exceptions.length; i++) {
PsiClassType exception = exceptions[i];
if (i != 0) {
text.append(",");
}
text.append(getTypeText(exception, method, false));
text.append(" ");
}
}
if (!isAbstract) {
/************* body **********/
text.append("{\n");
@@ -55,6 +55,7 @@ public void testArrayType1() throws Throwable { doTest(); }
public void testInaccessibleConstructor() throws Throwable { doTest(); }
public void testSynchronizedProperty() throws Throwable { doTest(); }
public void testVarargs() throws Throwable { doTest(); }
public void testThrowsCheckedException() throws Throwable { doTest(); }
public void testCheckedExceptionInConstructorDelegate() throws Throwable {
myFixture.addClass("package foo;" +
@@ -0,0 +1,30 @@
class Foo {
def foo() throws IOException {}
}
-----
public class Foo implements groovy.lang.GroovyObject {
public java.lang.Object foo() throws java.io.IOException {
return null;
}
public groovy.lang.MetaClass getMetaClass() {
return null;
}
public void setMetaClass(groovy.lang.MetaClass mc) {
return ;
}
public java.lang.Object invokeMethod(java.lang.String name, java.lang.Object args) {
return null;
}
public java.lang.Object getProperty(java.lang.String propertyName) {
return null;
}
public void setProperty(java.lang.String propertyName, java.lang.Object newValue) {
return ;
}
}
---