diff --git a/java/java-impl/src/com/intellij/psi/impl/PsiElementFactoryImpl.java b/java/java-impl/src/com/intellij/psi/impl/PsiElementFactoryImpl.java index cbdaa33b5f3f..4a4c8a7620ba 100644 --- a/java/java-impl/src/com/intellij/psi/impl/PsiElementFactoryImpl.java +++ b/java/java-impl/src/com/intellij/psi/impl/PsiElementFactoryImpl.java @@ -242,8 +242,11 @@ public class PsiElementFactoryImpl extends PsiJavaParserFacadeImpl implements Ps throw new IncorrectOperationException("Cannot create field with type \"\"."); } final FileElement treeHolder = DummyHolderFactory.createHolder(myManager, null).getTreeElement(); - final CompositeElement treeElement = - getJavaParsingContext(treeHolder).getDeclarationParsing().parseParameterText(type.getCanonicalText() + " " + name); + final String text = type.getCanonicalText() + " " + name; + final CompositeElement treeElement = getJavaParsingContext(treeHolder).getDeclarationParsing().parseParameterText(text); + if (treeElement == null) { + throw new AssertionError("Null element for text = " + text); + } treeHolder.rawAddChildren(treeElement); CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(myManager.getProject()); diff --git a/platform/lang-api/src/com/intellij/psi/search/PsiSearchRequest.java b/platform/lang-api/src/com/intellij/psi/search/PsiSearchRequest.java index 16ccdef9514f..4a0d56fe312b 100644 --- a/platform/lang-api/src/com/intellij/psi/search/PsiSearchRequest.java +++ b/platform/lang-api/src/com/intellij/psi/search/PsiSearchRequest.java @@ -18,6 +18,9 @@ public class PsiSearchRequest { boolean caseSensitive, @NotNull RequestResultProcessor processor) { + if (word.length() == 0) { + throw new IllegalArgumentException("Cannot search for elements with empty text"); + } this.searchScope = searchScope; this.word = word; this.searchContext = searchContext; diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/GroovyDslExecutor.groovy b/plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/GroovyDslExecutor.groovy index 4dfb2112225a..44d7dad25b24 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/GroovyDslExecutor.groovy +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/dsl/GroovyDslExecutor.groovy @@ -8,9 +8,8 @@ import org.jetbrains.plugins.groovy.dsl.psi.PsiEnhancerCategory import org.jetbrains.plugins.groovy.dsl.toplevel.CompositeContextFilter import org.jetbrains.plugins.groovy.dsl.toplevel.ContextFilter import org.jetbrains.plugins.groovy.dsl.toplevel.GdslMetaClassProperties -import com.intellij.openapi.project.Project -/** + /** * @author ilyas */ @@ -20,6 +19,7 @@ public class GroovyDslExecutor { private final String myFileName; static final String ideaVersion + private boolean locked = false static { def major = ApplicationInfo.instance.majorVersion @@ -52,9 +52,12 @@ public class GroovyDslExecutor { mc.initialize() script.metaClass = mc script.run() + + locked = true } def addClassEnhancer(List cts, Closure toDo) { + assert !locked : 'Contributing to GDSL is only allowed at the top-level of the *.gdsl script' enhancers << Pair.create(CompositeContextFilter.compose(cts, false), toDo) } diff --git a/xml/dom-impl/src/com/intellij/xml/impl/dom/AbstractDomChildrenDescriptor.java b/xml/dom-impl/src/com/intellij/xml/impl/dom/AbstractDomChildrenDescriptor.java index 95a2c47d9cbf..b8baa40361a2 100644 --- a/xml/dom-impl/src/com/intellij/xml/impl/dom/AbstractDomChildrenDescriptor.java +++ b/xml/dom-impl/src/com/intellij/xml/impl/dom/AbstractDomChildrenDescriptor.java @@ -115,6 +115,9 @@ public abstract class AbstractDomChildrenDescriptor implements XmlElementDescrip @Nullable public PsiElement getDeclaration() { final PomTarget target = ((CustomDomChildrenDescription)description).getTagNameDescriptor().findDeclaration(finalDomElement); + if (target == description) { + return childTag; + } return target == null ? null : PomService.convertToPsi(childTag.getProject(), target); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/converters/values/BooleanValueConverter.java b/xml/dom-openapi/src/com/intellij/util/xml/converters/values/BooleanValueConverter.java index cc5293155163..a7fa99b038e6 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/converters/values/BooleanValueConverter.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/converters/values/BooleanValueConverter.java @@ -38,6 +38,10 @@ public class BooleanValueConverter extends ResolvingConverter { return new BooleanValueConverter(allowEmpty); } + public BooleanValueConverter() { + this(false); + } + public BooleanValueConverter(final boolean allowEmpty) { myAllowEmpty = allowEmpty; }