From 905542379b299a72eaad8327bacc289fee339e37 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Fri, 9 Sep 2011 18:03:23 +0200 Subject: [PATCH] Javadoc; cleanup --- .../impl/source/tree/java/PsiCodeBlockImpl.java | 14 +++++++++----- .../openapi/src/com/intellij/psi/PsiCodeBlock.java | 5 +++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/java/java-impl/src/com/intellij/psi/impl/source/tree/java/PsiCodeBlockImpl.java b/java/java-impl/src/com/intellij/psi/impl/source/tree/java/PsiCodeBlockImpl.java index 0191c035a9a9..c4f1f0330e18 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/tree/java/PsiCodeBlockImpl.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/tree/java/PsiCodeBlockImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2011 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ import com.intellij.psi.tree.ChildRoleBase; import com.intellij.psi.tree.IElementType; import gnu.trove.THashSet; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.Set; @@ -57,7 +58,9 @@ public class PsiCodeBlockImpl extends LazyParseablePsiElement implements PsiCode } public PsiElement getFirstBodyElement() { - final PsiElement nextSibling = getLBrace().getNextSibling(); + final PsiJavaToken lBrace = getLBrace(); + if (lBrace == null) return null; + final PsiElement nextSibling = lBrace.getNextSibling(); return nextSibling == getRBrace() ? null : nextSibling; } @@ -82,7 +85,8 @@ public class PsiCodeBlockImpl extends LazyParseablePsiElement implements PsiCode private volatile Set myClassesSet = null; private volatile boolean myConflict = false; - // return Pair(classesset, localsSet) or null if there was conflict + // return Pair(classes, locals) or null if there was conflict + @Nullable private Pair, Set> buildMaps() { Set set1 = myClassesSet; Set set2 = myVariablesSet; @@ -223,7 +227,7 @@ public class PsiCodeBlockImpl extends LazyParseablePsiElement implements PsiCode } public boolean shouldChangeModificationCount(PsiElement place) { - PsiElement pparent = getParent(); - return !(pparent instanceof PsiMethod || pparent instanceof PsiClassInitializer); + PsiElement parent = getParent(); + return !(parent instanceof PsiMethod || parent instanceof PsiClassInitializer); } } diff --git a/java/openapi/src/com/intellij/psi/PsiCodeBlock.java b/java/openapi/src/com/intellij/psi/PsiCodeBlock.java index 338da097af86..7a400f81b610 100644 --- a/java/openapi/src/com/intellij/psi/PsiCodeBlock.java +++ b/java/openapi/src/com/intellij/psi/PsiCodeBlock.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2011 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,8 @@ public interface PsiCodeBlock extends PsiElement, PsiModifiableCodeBlock { PsiCodeBlock[] EMPTY_ARRAY = new PsiCodeBlock[0]; /** - * Returns the array of statements contained in the block. + * Returns the array of statements contained in the block.
+ * Please note that this method doesn't return comments which are not part of statements. * * @return the array of statements. */