Merge remote-tracking branch 'origin/master'

This commit is contained in:
Vassiliy Kudryashov
2012-11-30 20:32:22 +04:00
10 changed files with 61 additions and 16 deletions
@@ -427,7 +427,12 @@ public class GenerateMembersUtil {
private static PsiType substituteType(final PsiSubstitutor substitutor, final PsiType type) {
final PsiType psiType = substitutor.substitute(type);
if (psiType != null) return psiType;
if (psiType != null) {
final PsiType deepComponentType = psiType.getDeepComponentType();
if (!(deepComponentType instanceof PsiCapturedWildcardType || deepComponentType instanceof PsiWildcardType)){
return psiType;
}
}
return TypeConversionUtil.erasure(type);
}
@@ -116,7 +116,7 @@ public class TypeMigrationLabeler {
usages.add(new UsageInfo(expr) {
@Nullable
public String getTooltipText() {
final PsiType type = expr.getType();
final PsiType type = expr.isValid() ? expr.getType() : null;
if (type == null) return null;
return "Cannot convert type of the expression from " +
type.getCanonicalText() + " to " + p.getSecond().getCanonicalText();
@@ -115,8 +115,8 @@ public class TypeConversionUtil {
final PsiClass psiClass = classType.resolve();
if (psiClass == null || psiClass instanceof PsiTypeParameter) return false;
final PsiClassType boxedType = ((PsiPrimitiveType)toType).getBoxedType(psiClass.getManager(), psiClass.getResolveScope());
if (boxedType != null) {
return isAssignable(fromType, boxedType);
if (boxedType != null && isAssignable(fromType, boxedType)) {
return true;
}
}
return fromTypeRank == toTypeRank ||
@@ -90,4 +90,8 @@ class C {
}
void m(int i) { }
void asLongs(Integer i) {
long l = (long) i;
}
}
@@ -0,0 +1,9 @@
interface Generic<T> {
T foo();
}
class II implements Generic<?> {
public Object foo() {
<selection>return null; //To change body of implemented methods use File | Settings | File Templates.</selection>
}
}
@@ -0,0 +1,7 @@
interface Generic<T> {
T foo();
}
class II implements Generic<?> {
<caret>
}
@@ -61,6 +61,7 @@ public class OverrideImplementTest extends LightCodeInsightTestCase {
public void testClone() { doTest(false); }
public void testOnTheLineWithExistingExpression() { doTest(false); }
public void testSimplifyObjectWildcard() { doTest(false); }
public void testErasureWildcard() { doTest(false); }
public void testImplementExtensionMethods() { doTest8(false, true); }
public void testDoNotImplementExtensionMethods() { doTest8(false, true); }
@@ -126,17 +126,18 @@ public abstract class HTMLComposerImpl extends HTMLComposer {
final HTMLComposerExtension extension = getLanguageExtension(refElement);
if (extension != null) {
extension.appendShortName(refElement, buf);
}
refElement.accept(new RefVisitor() {
@Override public void visitFile(RefFile file) {
final PsiFile psiFile = file.getElement();
if (psiFile != null) {
buf.append(B_OPENING);
buf.append(psiFile.getName());
buf.append(B_CLOSING);
} else {
refElement.accept(new RefVisitor() {
@Override public void visitFile(RefFile file) {
final PsiFile psiFile = file.getElement();
if (psiFile != null) {
buf.append(B_OPENING);
buf.append(psiFile.getName());
buf.append(B_CLOSING);
}
}
}
});
});
}
}
protected void appendQualifiedName(StringBuffer buf, RefEntity refEntity) {
@@ -630,8 +630,9 @@ public class FinalUtils {
}
private void satisfyVacuously() {
definitelyAssigned = true;
definitelyUnassigned = true;
if (definitelyAssigned) {
definitelyUnassigned = true;
}
}
private static boolean isPrePostFixExpression(
@@ -398,4 +398,21 @@ class Q implements Iterator<String> {
public void remove() {
throw new UnsupportedOperationException();
}
}
class R {
private static final String someStaticStuff;
static {
try {
someStaticStuff = "";
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
private String someInjectedStuff;
public String getSomeInjectedStuff() {
return someInjectedStuff;
}
}