Merge branch 'master' of git.labs.intellij.net:idea/community

This commit is contained in:
Bas Leijdekkers
2011-06-29 08:37:32 +02:00
6 changed files with 27 additions and 5 deletions
@@ -35,7 +35,7 @@ import java.util.List;
* @author max
* @author jeka
*/
public class PersistentEnumerator<Data> implements Forceable {
public class PersistentEnumerator<Data> implements Forceable, Closeable {
private static final Logger LOG = Logger.getInstance("#com.intellij.util.io.PersistentEnumerator");
protected static final int NULL_ID = 0;
protected static final int DATA_OFFSET = 8;
@@ -36,6 +36,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrEn
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrEnumConstantList;
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil;
import org.jetbrains.plugins.groovy.lang.psi.stubs.GrTypeDefinitionStub;
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
import org.jetbrains.plugins.groovy.lang.resolve.processors.ClassHint;
import static org.jetbrains.plugins.groovy.GroovyFileType.GROOVY_LANGUAGE;
@@ -71,7 +72,7 @@ public class GrEnumTypeDefinitionImpl extends GrTypeDefinitionImpl implements Gr
@NotNull
public PsiClassType[] getExtendsListTypes() {
return new PsiClassType[]{createEnumType()};
return new PsiClassType[]{createEnumType(), createGroovyObjectSupportType()};
}
protected String[] getExtendsNames() {
@@ -94,6 +95,10 @@ public class GrEnumTypeDefinitionImpl extends GrTypeDefinitionImpl implements Gr
return TypesUtil.createTypeByFQClassName(JAVA_LANG_ENUM, this);
}
private PsiClassType createGroovyObjectSupportType() {
return TypesUtil.createTypeByFQClassName(GroovyCommonClassNames.GROOVY_OBJECT_SUPPORT, this);
}
@NotNull
public GrField[] getFields() {
GrField[] bodyFields = super.getFields();
@@ -44,8 +44,8 @@ public class GroovyHighlightingTest extends LightCodeInsightFixtureTestCase {
@Override
public void configureModule(Module module, ModifiableRootModel model, ContentEntry contentEntry) {
final Library.ModifiableModel modifiableModel = model.getModuleLibraryTable().createLibrary("GROOVY").getModifiableModel();
final VirtualFile groovyJar =
JarFileSystem.getInstance().refreshAndFindFileByPath(TestUtils.getMockGroovy1_8LibraryName()+"!/");
final VirtualFile groovyJar = JarFileSystem.getInstance().refreshAndFindFileByPath(TestUtils.getMockGroovy1_8LibraryName()+"!/");
assertTrue(groovyJar != null);
modifiableModel.addRoot(groovyJar, OrderRootType.CLASSES);
modifiableModel.commit();
}
@@ -428,4 +428,8 @@ public class GroovyHighlightingTest extends LightCodeInsightFixtureTestCase {
public void testDelegatedMethodIsImplemented() {
doTest();
}
public void testEnumImplementsAllGroovyObjectMethods() {
doTest();
}
}
@@ -0,0 +1,11 @@
enum E {
a, b, c
}
interface I {
def foo()
}
enum <error descr="Method 'foo' is not implemented">EI</error> implements I {
}
@@ -1,5 +1,7 @@
package pack1;
import java.util.ArrayList;
import java.util.List;
public class A {
}
@@ -651,7 +651,7 @@ public class MavenIndex {
if (exceptions[0] != null) throw exceptions[0];
}
private void safeClose(PersistentEnumerator enumerator, MavenIndexException[] exceptions) {
private void safeClose(Closeable enumerator, MavenIndexException[] exceptions) {
try {
if (enumerator != null) enumerator.close();
}