Cleanup (formatting; warnings)

This commit is contained in:
Roman Shevchenko
2016-04-22 17:11:57 +02:00
parent 1a1e96a67b
commit 7960569325
11 changed files with 53 additions and 59 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -48,7 +48,7 @@ public class PsiCapturedWildcardType extends PsiType.Stub {
private PsiCapturedWildcardType(@NotNull PsiWildcardType existential,
@NotNull PsiElement context,
@Nullable PsiTypeParameter parameter) {
super(PsiAnnotation.EMPTY_ARRAY);
super(TypeAnnotationProvider.EMPTY);
myExistential = existential;
myContext = context;
myParameter = parameter;
@@ -208,4 +208,4 @@ public class PsiCapturedWildcardType extends PsiType.Stub {
public PsiTypeParameter getTypeParameter() {
return myParameter;
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -30,9 +30,6 @@ import org.jetbrains.annotations.Nullable;
* @author max
*/
public abstract class PsiClassType extends PsiType {
/**
* The empty array of PSI class types which can be reused to avoid unnecessary allocations.
*/
public static final PsiClassType[] EMPTY_ARRAY = new PsiClassType[0];
public static final ArrayFactory<PsiClassType> ARRAY_FACTORY = new ArrayFactory<PsiClassType>() {
@NotNull
@@ -53,8 +50,8 @@ public abstract class PsiClassType extends PsiType {
myLanguageLevel = languageLevel;
}
public PsiClassType(LanguageLevel languageLevel, @NotNull TypeAnnotationProvider annotations) {
super(annotations);
public PsiClassType(LanguageLevel languageLevel, @NotNull TypeAnnotationProvider provider) {
super(provider);
myLanguageLevel = languageLevel;
}
@@ -221,7 +218,7 @@ public abstract class PsiClassType extends PsiType {
public abstract PsiClassType rawType();
/**
* Overrides {@link com.intellij.psi.PsiType#getResolveScope()} to narrow specify @NotNull.
* Overrides {@link PsiType#getResolveScope()} to narrow specify @NotNull.
*/
@Override
@NotNull
@@ -314,4 +311,4 @@ public abstract class PsiClassType extends PsiType {
@Override
public abstract String getCanonicalText(boolean annotated);
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -26,8 +26,8 @@ import java.util.List;
public abstract class PsiDiamondType extends PsiType {
public static final RecursionGuard ourDiamondGuard = RecursionManager.createGuard("diamondInference");
public PsiDiamondType(PsiAnnotation[] annotations) {
super(annotations);
public PsiDiamondType() {
super(TypeAnnotationProvider.EMPTY);
}
public abstract DiamondInferenceResult resolveInferredTypes();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -39,7 +39,7 @@ public class PsiDisjunctionType extends PsiType.Stub {
private final CachedValue<PsiType> myLubCache;
public PsiDisjunctionType(@NotNull List<PsiType> types, @NotNull PsiManager psiManager) {
super(PsiAnnotation.EMPTY_ARRAY);
super(TypeAnnotationProvider.EMPTY);
myManager = psiManager;
myTypes = Collections.unmodifiableList(types);
@@ -168,4 +168,4 @@ public class PsiDisjunctionType extends PsiType.Stub {
return true;
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -35,7 +35,7 @@ public class PsiIntersectionType extends PsiType.Stub {
private final PsiType[] myConjuncts;
private PsiIntersectionType(@NotNull PsiType[] conjuncts) {
super(PsiAnnotation.EMPTY_ARRAY);
super(TypeAnnotationProvider.EMPTY);
myConjuncts = conjuncts;
}
@@ -176,6 +176,7 @@ public class PsiIntersectionType extends PsiType.Stub {
return myConjuncts[0];
}
@Override
public boolean equals(final Object obj) {
if (this == obj) return true;
if (!(obj instanceof PsiIntersectionType)) return false;
@@ -190,6 +191,7 @@ public class PsiIntersectionType extends PsiType.Stub {
return true;
}
@Override
public int hashCode() {
return myConjuncts[0].hashCode();
}
@@ -221,4 +223,4 @@ public class PsiIntersectionType extends PsiType.Stub {
}
return null;
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -26,7 +26,7 @@ public class PsiLambdaExpressionType extends PsiType {
private final PsiLambdaExpression myExpression;
public PsiLambdaExpressionType(PsiLambdaExpression expression) {
super(PsiAnnotation.EMPTY_ARRAY);
super(TypeAnnotationProvider.EMPTY);
myExpression = expression;
}
@@ -77,4 +77,4 @@ public class PsiLambdaExpressionType extends PsiType {
public PsiLambdaExpression getExpression() {
return myExpression;
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -26,7 +26,7 @@ public class PsiLambdaParameterType extends PsiType {
private final PsiParameter myParameter;
public PsiLambdaParameterType(PsiParameter parameter) {
super(PsiAnnotation.EMPTY_ARRAY);
super(TypeAnnotationProvider.EMPTY);
myParameter = parameter;
}
@@ -77,4 +77,4 @@ public class PsiLambdaParameterType extends PsiType {
public PsiParameter getParameter() {
return myParameter;
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -25,7 +25,7 @@ public class Bottom extends PsiType {
public static final Bottom BOTTOM = new Bottom();
private Bottom() {
super(PsiAnnotation.EMPTY_ARRAY);
super(TypeAnnotationProvider.EMPTY);
}
@NotNull
@@ -56,12 +56,9 @@ public class Bottom extends PsiType {
return text.equals("_");
}
@Override
public boolean equals(Object o) {
if (o instanceof Bottom) {
return true;
}
return false;
return o instanceof Bottom;
}
@Override
@@ -84,4 +81,4 @@ public class Bottom extends PsiType {
public GlobalSearchScope getResolveScope() {
return null;
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -47,13 +47,12 @@ import java.util.*;
* @since Jul 30, 2010
*/
public class PsiDiamondTypeImpl extends PsiDiamondType {
private static final Logger LOG = Logger.getInstance("#" + PsiDiamondTypeImpl.class.getName());
private static final Logger LOG = Logger.getInstance(PsiDiamondTypeImpl.class);
private final PsiManager myManager;
private final PsiTypeElement myTypeElement;
public PsiDiamondTypeImpl(PsiManager manager, PsiTypeElement psiTypeElement) {
super(PsiAnnotation.EMPTY_ARRAY);
myManager = manager;
myTypeElement = psiTypeElement;
}
@@ -134,9 +133,9 @@ public class PsiDiamondTypeImpl extends PsiDiamondType {
final DiamondInferenceResult inferenceResult = resolveInferredTypesNoCheck(newExpression, context);
if (anonymousClass != null && PsiUtil.isLanguageLevel9OrHigher(newExpression)) {
final InferredAnonymTypeVisitor anonymTypeVisitor = new InferredAnonymTypeVisitor(context);
final InferredAnonymousTypeVisitor anonymousTypeVisitor = new InferredAnonymousTypeVisitor(context);
for (PsiType type : inferenceResult.getInferredTypes()) {
final Boolean accepted = type.accept(anonymTypeVisitor);
final Boolean accepted = type.accept(anonymousTypeVisitor);
if (accepted != null && !accepted.booleanValue()) {
return PsiDiamondTypeImpl.DiamondInferenceResult.ANONYMOUS_INNER_RESULT;
}
@@ -150,17 +149,16 @@ public class PsiDiamondTypeImpl extends PsiDiamondType {
final PsiSubstitutor inferredSubstitutor = ourDiamondGuard.doPreventingRecursion(context, false, new Computable<PsiSubstitutor>() {
@Override
public PsiSubstitutor compute() {
final JavaResolveResult staticFactoryCandidateInfo = context == newExpression ?
CachedValuesManager.getCachedValue(newExpression,
new CachedValueProvider<JavaResolveResult>() {
@Nullable
@Override
public Result<JavaResolveResult> compute() {
return new Result<JavaResolveResult>(getStaticFactoryCandidateInfo(newExpression, newExpression),
PsiModificationTracker.MODIFICATION_COUNT);
}
})
: getStaticFactoryCandidateInfo(newExpression, context);
final JavaResolveResult staticFactoryCandidateInfo =
context == newExpression
? CachedValuesManager.getCachedValue(newExpression, new CachedValueProvider<JavaResolveResult>() {
@Nullable
@Override
public Result<JavaResolveResult> compute() {
return new Result<JavaResolveResult>(getStaticFactoryCandidateInfo(newExpression, newExpression), PsiModificationTracker.MODIFICATION_COUNT);
}
})
: getStaticFactoryCandidateInfo(newExpression, context);
staticFactoryRef.set(staticFactoryCandidateInfo);
if (staticFactoryCandidateInfo != null) {
PsiSubstitutor substitutor = staticFactoryCandidateInfo.getSubstitutor();
@@ -515,10 +513,10 @@ public class PsiDiamondTypeImpl extends PsiDiamondType {
* The term "subexpression" includes type arguments of parameterized types (4.5), bounds of wildcards (4.5.1), and element types of array types (10.1).
* It excludes bounds of type variables.
*/
private static class InferredAnonymTypeVisitor extends PsiTypeVisitor<Boolean> {
private static class InferredAnonymousTypeVisitor extends PsiTypeVisitor<Boolean> {
private final PsiElement myExpression;
public InferredAnonymTypeVisitor(PsiElement expression) {
public InferredAnonymousTypeVisitor(PsiElement expression) {
myExpression = expression;
}
@@ -564,4 +562,4 @@ public class PsiDiamondTypeImpl extends PsiDiamondType {
return true;
}
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -22,7 +22,7 @@ import org.jetbrains.annotations.NotNull;
*/
public abstract class PsiTypeVariable extends PsiType {
protected PsiTypeVariable() {
super(PsiAnnotation.EMPTY_ARRAY);
super(TypeAnnotationProvider.EMPTY);
}
public abstract int getIndex();
@@ -37,4 +37,4 @@ public abstract class PsiTypeVariable extends PsiType {
return visitor.visitType(this);
}
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2016 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.
@@ -326,7 +326,7 @@ public class CanonicalTypes {
PsiType substitute = substitutor.substitute(typeParameter);
substitutionMap.put(typeParameter.getName(), substitute != null ? substitute.accept(this) : null);
}
String qualifiedName = ObjectUtils.notNull(aClass.getQualifiedName(), aClass.getName());
String qualifiedName = ObjectUtils.notNull(aClass.getQualifiedName(), ObjectUtils.assertNotNull(aClass.getName()));
return new ClassType(type, qualifiedName, substitutionMap);
}
}
@@ -358,4 +358,4 @@ public class CanonicalTypes {
public static Type createTypeWrapper(@NotNull PsiType type) {
return type.accept(Creator.INSTANCE);
}
}
}