Removed unnecessary final on local variables.

This commit is contained in:
Evgeny Gerashchenko
2013-03-13 14:11:44 +04:00
parent c24f1605f3
commit ec5331057a
284 changed files with 1135 additions and 1132 deletions
@@ -81,7 +81,7 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
@NotNull
@Override
public ResolveSession getLazyResolveSession(@NotNull final Project fileProject, @NotNull Collection<JetFile> files) {
public ResolveSession getLazyResolveSession(@NotNull Project fileProject, @NotNull Collection<JetFile> files) {
ModuleDescriptor javaModule = new ModuleDescriptor(Name.special("<java module>"));
BindingTraceContext javaResolverTrace = new BindingTraceContext();
@@ -91,7 +91,7 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
// TODO: Replace with stub declaration provider
LockBasedStorageManager storageManager = new LockBasedStorageManager();
final FileBasedDeclarationProviderFactory declarationProviderFactory = new FileBasedDeclarationProviderFactory(storageManager, files, new Predicate<FqName>() {
FileBasedDeclarationProviderFactory declarationProviderFactory = new FileBasedDeclarationProviderFactory(storageManager, files, new Predicate<FqName>() {
@Override
public boolean apply(FqName fqName) {
return psiClassFinder.findPsiPackage(fqName) != null || new FqName("jet").equals(fqName);
@@ -199,7 +199,7 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
Predicate<PsiFile> filesToAnalyzeCompletely,
boolean storeContextForBodiesResolve
) {
final ModuleDescriptor owner = new ModuleDescriptor(Name.special("<module>"));
ModuleDescriptor owner = new ModuleDescriptor(Name.special("<module>"));
TopDownAnalysisParameters topDownAnalysisParameters = new TopDownAnalysisParameters(
filesToAnalyzeCompletely, false, false, scriptParameters);
@@ -82,7 +82,7 @@ public class JavaPsiFacadeKotlinHacks {
return psiPackage;
}
public PsiClass findClass(@NotNull final String qualifiedName, @NotNull GlobalSearchScope scope) {
public PsiClass findClass(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
ProgressIndicatorProvider.checkCanceled(); // We hope this method is being called often enough to cancel daemon processes smoothly
PsiClass aClass = javaFileManager.findClass(qualifiedName, scope);
@@ -55,7 +55,7 @@ public class JavaTypeTransformer {
}
@NotNull
private TypeProjection transformToTypeProjection(@NotNull final PsiType javaType,
private TypeProjection transformToTypeProjection(@NotNull PsiType javaType,
@NotNull final TypeParameterDescriptor typeParameterDescriptor,
@NotNull final TypeVariableResolver typeVariableByPsiResolver,
@NotNull final TypeUsage howThisTypeIsUsed
@@ -102,7 +102,7 @@ public class JavaTypeTransformer {
@NotNull
public JetType transformToType(@NotNull PsiType javaType,
@NotNull final TypeVariableResolver typeVariableResolver) {
@NotNull TypeVariableResolver typeVariableResolver) {
return transformToType(javaType, TypeUsage.MEMBER_SIGNATURE_INVARIANT, typeVariableResolver);
}
@@ -159,7 +159,7 @@ public class SignaturesPropagationData {
List<ValueParameterDescriptor> resultParameters = Lists.newArrayList();
for (final ValueParameterDescriptor originalParam : parameters.getDescriptors()) {
for (ValueParameterDescriptor originalParam : parameters.getDescriptors()) {
final int index = originalParam.getIndex();
List<TypeAndVariance> typesFromSuperMethods = ContainerUtil.map(superFunctions,
new Function<FunctionDescriptor, TypeAndVariance>() {
@@ -53,7 +53,7 @@ public class JetClassAnnotation extends PsiAnnotationWithAbiVersion {
@NotNull
public static JetClassAnnotation get(PsiClass psiClass) {
final PsiAnnotation annotation = JavaAnnotationResolver.findOwnAnnotation(psiClass,
PsiAnnotation annotation = JavaAnnotationResolver.findOwnAnnotation(psiClass,
JvmStdlibNames.JET_CLASS.getFqName().getFqName());
return annotation != null ? new JetClassAnnotation(annotation) : NULL_ANNOTATION;
}
@@ -47,7 +47,7 @@ public class JetConstructorAnnotation extends PsiAnnotationWithFlags {
}
public static JetConstructorAnnotation get(PsiMethod constructor) {
final PsiAnnotation annotation =
PsiAnnotation annotation =
JavaAnnotationResolver.findOwnAnnotation(constructor, JvmStdlibNames.JET_CONSTRUCTOR.getFqName().getFqName());
return annotation != null ? new JetConstructorAnnotation(annotation) : NULL_ANNOTATION;
}
@@ -68,7 +68,7 @@ public class JetMethodAnnotation extends PsiAnnotationWithFlags {
}
public static JetMethodAnnotation get(PsiMethod psiMethod) {
final PsiAnnotation annotation =
PsiAnnotation annotation =
JavaAnnotationResolver.findOwnAnnotation(psiMethod, JvmStdlibNames.JET_METHOD.getFqName().getFqName());
return annotation != null ? new JetMethodAnnotation(annotation) : NULL_ANNOTATION;
}
@@ -35,7 +35,7 @@ public class JetPackageClassAnnotation extends PsiAnnotationWithAbiVersion {
@NotNull
public static JetPackageClassAnnotation get(PsiClass psiClass) {
final PsiAnnotation annotation = JavaAnnotationResolver.findOwnAnnotation(psiClass,
PsiAnnotation annotation = JavaAnnotationResolver.findOwnAnnotation(psiClass,
JvmStdlibNames.JET_PACKAGE_CLASS.getFqName().getFqName());
return annotation != null ? new JetPackageClassAnnotation(annotation) : NULL_ANNOTATION;
}
@@ -39,7 +39,7 @@ public class JetTypeParameterAnnotation extends PsiAnnotationWrapper {
@NotNull
public static JetTypeParameterAnnotation get(@NotNull PsiParameter psiParameter) {
final PsiAnnotation annotation =
PsiAnnotation annotation =
JavaAnnotationResolver.findOwnAnnotation(psiParameter, JvmStdlibNames.JET_TYPE_PARAMETER.getFqName().getFqName());
return annotation != null ? new JetTypeParameterAnnotation(annotation) : NULL_ANNOTATION;
}
@@ -76,7 +76,7 @@ public class JetValueParameterAnnotation extends PsiAnnotationWrapper {
}
public static JetValueParameterAnnotation get(PsiParameter psiParameter) {
final PsiAnnotation annotation =
PsiAnnotation annotation =
JavaAnnotationResolver.findOwnAnnotation(psiParameter, JvmStdlibNames.JET_VALUE_PARAMETER.getFqName().getFqName());
return annotation != null ? new JetValueParameterAnnotation(annotation) : NULL_ANNOTATION;
}
@@ -49,7 +49,7 @@ public class KotlinSignatureAnnotation extends PsiAnnotationWrapper {
@NotNull
public static KotlinSignatureAnnotation get(PsiModifierListOwner psiModifierListOwner) {
final PsiAnnotation annotation =
PsiAnnotation annotation =
JavaAnnotationResolver.findAnnotationWithExternal(psiModifierListOwner, JvmStdlibNames.KOTLIN_SIGNATURE.getFqName().getFqName());
return annotation != null ? new KotlinSignatureAnnotation(annotation) : NULL_ANNOTATION;
}
@@ -263,7 +263,7 @@ public final class MembersCache {
}
// TODO: what if returnType == null?
final PsiType returnType = method.getReturnType();
PsiType returnType = method.getReturnType();
assert returnType != null;
TypeSource propertyType = new TypeSource(method.getJetMethodAnnotation().propertyType(), returnType, method.getPsiMethod());
@@ -190,7 +190,7 @@ public final class JavaClassResolver {
@NotNull
private ClassDescriptor createJavaClassDescriptor(
@NotNull FqName fqName, @NotNull final PsiClass psiClass,
@NotNull FqName fqName, @NotNull PsiClass psiClass,
@NotNull PostponedTasks taskList
) {
@@ -292,7 +292,7 @@ public final class JavaClassResolver {
}
void checkFqNamesAreConsistent(@NotNull PsiClass psiClass, @NotNull FqName desiredFqName) {
final String qualifiedName = psiClass.getQualifiedName();
String qualifiedName = psiClass.getQualifiedName();
assert qualifiedName != null;
FqName fqName = new FqName(qualifiedName);
@@ -315,7 +315,7 @@ public final class JavaClassResolver {
@NotNull
private static FqName getFqName(@NotNull PsiClass psiClass) {
final String qualifiedName = psiClass.getQualifiedName();
String qualifiedName = psiClass.getQualifiedName();
assert qualifiedName != null;
return new FqName(qualifiedName);
}
@@ -91,7 +91,7 @@ public final class JavaFunctionResolver {
@Nullable
private SimpleFunctionDescriptor resolveMethodToFunctionDescriptor(
@NotNull final PsiClass psiClass, final PsiMethodWrapper method,
@NotNull PsiClass psiClass, PsiMethodWrapper method,
@NotNull PsiDeclarationProvider scopeData, @NotNull ClassOrNamespaceDescriptor ownerDescriptor
) {
PsiType returnPsiType = method.getReturnType();
@@ -104,8 +104,8 @@ public final class JavaFunctionResolver {
return null;
}
final PsiMethod psiMethod = method.getPsiMethod();
final PsiClass containingClass = psiMethod.getContainingClass();
PsiMethod psiMethod = method.getPsiMethod();
PsiClass containingClass = psiMethod.getContainingClass();
if (scopeData.getDeclarationOrigin() == KOTLIN) {
// TODO: unless maybe class explicitly extends Object
assert containingClass != null;
@@ -119,7 +119,7 @@ public final class JavaFunctionResolver {
return trace.get(BindingContext.FUNCTION, psiMethod);
}
final SimpleFunctionDescriptorImpl functionDescriptorImpl = new SimpleFunctionDescriptorImpl(
SimpleFunctionDescriptorImpl functionDescriptorImpl = new SimpleFunctionDescriptorImpl(
ownerDescriptor,
annotationResolver.resolveAnnotations(psiMethod),
Name.identifier(method.getName()),
@@ -141,7 +141,7 @@ public final class JavaFunctionResolver {
.resolveParameterDescriptors(functionDescriptorImpl, method.getParameters(), methodTypeVariableResolver);
JetType returnType = makeReturnType(returnPsiType, method, methodTypeVariableResolver);
final List<String> signatureErrors = Lists.newArrayList();
List<String> signatureErrors = Lists.newArrayList();
List<FunctionDescriptor> superFunctions;
if (ownerDescriptor instanceof ClassDescriptor) {
@@ -58,7 +58,7 @@ class JavaMethodSignatureUtil {
) {
if (superReturnType == null) return false;
PsiType substitutedSuperReturnType;
final boolean isJdk15 = PsiUtil.isLanguageLevel5OrHigher(method);
boolean isJdk15 = PsiUtil.isLanguageLevel5OrHigher(method);
if (isJdk15 && !superMethodSignature.isRaw() && superMethodSignature.equals(methodSignature)) { //see 8.4.5
PsiSubstitutor unifyingSubstitutor = MethodSignatureUtil.getSuperMethodSignatureSubstitutor(methodSignature,
superMethodSignature);
@@ -198,7 +198,7 @@ public final class JavaSignatureResolver {
List<TypeParameterDescriptorInitialization> r = new ArrayList<TypeParameterDescriptorInitialization>();
@Override
public JetSignatureVisitor visitFormalTypeParameter(final String name, final TypeInfoVariance variance, boolean reified) {
public JetSignatureVisitor visitFormalTypeParameter(final String name, TypeInfoVariance variance, boolean reified) {
TypeParameterDescriptorImpl typeParameter = TypeParameterDescriptorImpl.createForFurtherModification(
containingDeclaration,
Collections.<AnnotationDescriptor>emptyList(), // TODO: wrong
@@ -274,7 +274,7 @@ public final class JavaSignatureResolver {
private void initializeTypeParameter(TypeParameterDescriptorInitialization typeParameter, TypeVariableResolver typeVariableByPsiResolver) {
TypeParameterDescriptorImpl typeParameterDescriptor = typeParameter.descriptor;
if (typeParameter.origin == TypeParameterDescriptorOrigin.KOTLIN) {
final List<JetType> upperBoundsForKotlin = typeParameter.upperBoundsForKotlin;
List<JetType> upperBoundsForKotlin = typeParameter.upperBoundsForKotlin;
assert upperBoundsForKotlin != null;
if (upperBoundsForKotlin.size() == 0){
typeParameterDescriptor.addUpperBound(KotlinBuiltIns.getInstance().getNullableAnyType());
@@ -344,7 +344,7 @@ public final class JavaSignatureResolver {
) {
List<TypeParameterDescriptorInitialization> typeParametersIntialization;
final PsiMethod psiMethod = method.getPsiMethod();
PsiMethod psiMethod = method.getPsiMethod();
if (method.getJetMethodAnnotation().typeParameters().length() > 0) {
typeParametersIntialization = resolveMethodTypeParametersFromJetSignature(
method.getJetMethodAnnotation().typeParameters(), psiMethod, functionDescriptor);
@@ -353,7 +353,7 @@ public final class JavaSignatureResolver {
typeParametersIntialization = makeUninitializedTypeParameters(functionDescriptor, psiMethod.getTypeParameters());
}
final PsiClass psiMethodContainingClass = psiMethod.getContainingClass();
PsiClass psiMethodContainingClass = psiMethod.getContainingClass();
assert psiMethodContainingClass != null;
String context = "method " + method.getName() + " in class " + psiMethodContainingClass.getQualifiedName();
initializeTypeParameters(typeParametersIntialization, functionDescriptor, context);
@@ -371,9 +371,9 @@ public final class JavaSignatureResolver {
* @see #resolveClassTypeParametersFromJetSignature(String, PsiClass, ClassDescriptor)
*/
private List<TypeParameterDescriptorInitialization> resolveMethodTypeParametersFromJetSignature(String jetSignature,
final PsiMethod method, final DeclarationDescriptor functionDescriptor)
PsiMethod method, DeclarationDescriptor functionDescriptor)
{
final PsiClass methodContainingClass = method.getContainingClass();
PsiClass methodContainingClass = method.getContainingClass();
assert methodContainingClass != null;
String context = "method " + method.getName() + " in class " + methodContainingClass.getQualifiedName();
JetSignatureTypeParametersVisitor jetSignatureTypeParametersVisitor = new JetSignatureTypeParametersVisitor(functionDescriptor, method, context);
@@ -79,7 +79,7 @@ public final class JavaSupertypeResolver {
@NotNull List<TypeParameterDescriptor> typeParameters
) {
final List<JetType> result = new ArrayList<JetType>();
List<JetType> result = new ArrayList<JetType>();
String context = "class " + psiClass.getQualifiedName();
@@ -179,7 +179,7 @@ public final class JavaSupertypeResolver {
for (PsiClassType type : extendsListTypes) {
PsiClass resolved = type.resolve();
if (resolved != null) {
final String qualifiedName = resolved.getQualifiedName();
String qualifiedName = resolved.getQualifiedName();
assert qualifiedName != null;
if (JvmStdlibNames.JET_OBJECT.getFqName().equalsTo(qualifiedName)) {
continue;
@@ -40,7 +40,7 @@ public final class ScopeUtils {
JavaSemanticServices javaSemanticServices
) {
Collection<DeclarationDescriptor> result = Sets.newHashSet();
final JavaDescriptorResolver descriptorResolver = javaSemanticServices.getDescriptorResolver();
JavaDescriptorResolver descriptorResolver = javaSemanticServices.getDescriptorResolver();
for (PsiPackage psiSubPackage : psiPackage.getSubPackages()) {
NamespaceDescriptor childNs = descriptorResolver.resolveNamespace(