Merge remote-tracking branch 'origin/master'

This commit is contained in:
Konstantin Bulenkov
2012-09-15 23:31:04 +04:00
6 changed files with 32 additions and 26 deletions
@@ -833,6 +833,7 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui {
void paintComponent(BalloonImpl balloon, final Rectangle bounds, final Graphics2D g, Point pointTarget, JComponent component) {
final GraphicsConfig cfg = new GraphicsConfig(g);
cfg.setAntialiasing(true);
Shape shape;
if (balloon.myShowPointer) {
@@ -18,6 +18,7 @@ package com.intellij.util.containers;
import com.intellij.util.SmartList;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.Serializable;
import java.util.*;
@@ -77,7 +78,7 @@ public class MultiMap<K, V> implements Serializable {
list.addAll(values);
}
public void putValue(K key, V value) {
public void putValue(@Nullable K key, V value) {
Collection<V> list = myMap.get(key);
if (list == null) {
list = createCollection();
@@ -17,7 +17,6 @@ package com.siyeh.ig.junit;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.InheritanceUtil;
import com.intellij.psi.util.TypeConversionUtil;
import com.siyeh.InspectionGadgetsBundle;
@@ -85,8 +84,7 @@ public class AssertEqualsBetweenInconvertibleTypesInspection extends BaseInspect
final PsiExpressionList argumentList = expression.getArgumentList();
final PsiExpression[] arguments = argumentList.getExpressions();
final int argumentIndex;
if (firstParameterType.equalsToText(
CommonClassNames.JAVA_LANG_STRING)) {
if (firstParameterType.equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
if (arguments.length < 3) {
return;
}
@@ -110,18 +108,10 @@ public class AssertEqualsBetweenInconvertibleTypesInspection extends BaseInspect
}
final PsiType parameterType1 = parameters[argumentIndex].getType();
final PsiType parameterType2 = parameters[argumentIndex + 1].getType();
if (!parameterType1.equals(parameterType2)) {
final PsiClassType objectType = TypeUtils.getObjectType(expression);
if (!objectType.equals(parameterType1) || !objectType.equals(parameterType2)) {
return;
}
if (type2 instanceof PsiPrimitiveType && parameterType2.equals(TypeUtils.getObjectType(expression))) {
final PsiPrimitiveType primitiveType = (PsiPrimitiveType)type2;
final PsiManager manager = expression.getManager();
final GlobalSearchScope scope = expression.getResolveScope();
final PsiClassType boxedType = primitiveType.getBoxedType(manager, scope);
if (boxedType != null && TypeConversionUtil.areTypesConvertible(type1, boxedType)) {
return;
}
}
if (TypeConversionUtil.areTypesConvertible(type1, type2)) {
return;
}
@@ -435,6 +435,7 @@ public class PsiUtil {
PsiElement stopAt = PsiTreeUtil.findCommonParent(place, resolveContext);
while (place != null && place != stopAt && !(place instanceof GrMember)) {
if (place instanceof PsiFile) break;
if (place instanceof GrClosableBlock) return true;
place = place.getParent();
}
if (place == null || place instanceof PsiFile || place == stopAt) return true;
@@ -448,6 +449,7 @@ public class PsiUtil {
while (place != null) {
place = place.getParent();
if (place instanceof PsiClass && InheritanceUtil.isInheritorOrSelf((PsiClass)place, containingClass, true)) return true;
if (place instanceof GrClosableBlock) return true;
if (place instanceof PsiMember && ((PsiMember)place).hasModifierProperty(PsiModifier.STATIC)) {
return false;
}
@@ -1474,4 +1474,22 @@ foo<warning descr="'foo' in '_' cannot be applied to '(groovy.lang.Closure<java.
''', GroovyAssignabilityCheckInspection)
}
void testInstanceMethodUsedInStaticClosure() {
testHighlighting('''\
class A {
static staticClosure = {
foo()
}
def staticMethod() {
foo()
}
def foo() { }
}
''')
}
}
@@ -105,17 +105,11 @@ public class AssertEqualsBetweenInconvertibleTypesTestNGInspection extends BaseJ
if (type2 == null) {
return;
}
if (!parameterType1.equals(parameterType2)) {
return;
}
final PsiManager manager = expression.getManager();
final GlobalSearchScope scope = expression.getResolveScope();
if (type2 instanceof PsiPrimitiveType && parameterType2.equals(PsiType.getJavaLangObject(manager, scope))) {
final PsiPrimitiveType primitiveType = (PsiPrimitiveType)type2;
final PsiClassType boxedType = primitiveType.getBoxedType(manager, scope);
if (boxedType != null && TypeConversionUtil.areTypesConvertible(type1, boxedType)) {
return;
}
final PsiClassType objectType = PsiType.getJavaLangObject(manager, scope);
if (!objectType.equals(parameterType1) || !objectType.equals(parameterType2)) {
return;
}
if (TypeConversionUtil.areTypesConvertible(type1, type2)) {
return;
@@ -125,9 +119,9 @@ public class AssertEqualsBetweenInconvertibleTypesTestNGInspection extends BaseJ
return;
}
myProblemsHolder.registerProblem(referenceNameElement,
"<code>#ref()</code> between objects of inconvertible types ''" +
StringUtil.escapeXml(type1.getPresentableText()) + "'' and ''" +
StringUtil.escapeXml(type2.getPresentableText()) + "'' #loc");
"<code>#ref()</code> between objects of inconvertible types '" +
StringUtil.escapeXml(type1.getPresentableText()) + "' and '" +
StringUtil.escapeXml(type2.getPresentableText()) + "' #loc");
}
}
}