final modifiers added as suggested by IDEA

This commit is contained in:
Alex Tkachman
2012-08-23 14:50:37 +03:00
parent 179597156f
commit a42842889e
7 changed files with 50 additions and 59 deletions
@@ -168,6 +168,7 @@ public abstract class AnnotationCodegen {
String value = null; String value = null;
if (annotations != null) { if (annotations != null) {
for (AnnotationDescriptor annotation : annotations) { for (AnnotationDescriptor annotation : annotations) {
//noinspection ConstantConditions
if ("Intrinsic".equals(annotation.getType().getConstructor().getDeclarationDescriptor().getName().getName())) { if ("Intrinsic".equals(annotation.getType().getConstructor().getDeclarationDescriptor().getName().getName())) {
value = (String) annotation.getValueArguments().get(0).getValue(); value = (String) annotation.getValueArguments().get(0).getValue();
break; break;
@@ -175,6 +176,7 @@ public abstract class AnnotationCodegen {
} }
} }
if (IntrinsicMethods.KOTLIN_JAVA_CLASS_FUNCTION.equals(value)) { if (IntrinsicMethods.KOTLIN_JAVA_CLASS_FUNCTION.equals(value)) {
//noinspection ConstantConditions
annotationVisitor.visit(keyName, typeMapper annotationVisitor.visit(keyName, typeMapper
.mapType(call.getResultingDescriptor().getReturnType().getArguments().get(0).getType(), MapTypeMode.VALUE)); .mapType(call.getResultingDescriptor().getReturnType().getArguments().get(0).getType(), MapTypeMode.VALUE));
return; return;
@@ -86,7 +86,7 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
static class LoopBlockStackElement extends BlockStackElement { static class LoopBlockStackElement extends BlockStackElement {
final Label continueLabel; final Label continueLabel;
final Label breakLabel; final Label breakLabel;
public JetSimpleNameExpression targetLabel; public final JetSimpleNameExpression targetLabel;
LoopBlockStackElement(Label breakLabel, Label continueLabel, JetSimpleNameExpression targetLabel) { LoopBlockStackElement(Label breakLabel, Label continueLabel, JetSimpleNameExpression targetLabel) {
this.breakLabel = breakLabel; this.breakLabel = breakLabel;
@@ -40,7 +40,7 @@ public class ObjectOrClosureCodegen {
protected final CodegenContext context; protected final CodegenContext context;
protected ClassBuilder cv = null; protected ClassBuilder cv = null;
public JvmClassName name = null; public JvmClassName name = null;
protected Map<DeclarationDescriptor, EnclosedValueDescriptor> closure = protected final Map<DeclarationDescriptor, EnclosedValueDescriptor> closure =
new LinkedHashMap<DeclarationDescriptor, EnclosedValueDescriptor>(); new LinkedHashMap<DeclarationDescriptor, EnclosedValueDescriptor>();
public JetDelegatorToSuperCall superCall; public JetDelegatorToSuperCall superCall;
@@ -354,7 +354,7 @@ public abstract class StackValue {
} }
private static class None extends StackValue { private static class None extends StackValue {
public static None INSTANCE = new None(); public static final None INSTANCE = new None();
private None() { private None() {
super(Type.VOID_TYPE); super(Type.VOID_TYPE);
@@ -554,7 +554,7 @@ public abstract class StackValue {
} }
private static class Invert extends StackValue { private static class Invert extends StackValue {
private StackValue myOperand; private final StackValue myOperand;
private Invert(StackValue operand) { private Invert(StackValue operand) {
super(Type.BOOLEAN_TYPE); super(Type.BOOLEAN_TYPE);
@@ -586,7 +586,7 @@ public abstract class StackValue {
} }
private static class ArrayElement extends StackValue { private static class ArrayElement extends StackValue {
private Type boxed; private final Type boxed;
public ArrayElement(Type type, boolean unbox) { public ArrayElement(Type type, boolean unbox) {
super(type); super(type);
@@ -1147,8 +1147,8 @@ public abstract class StackValue {
} }
private static class ThisOuter extends StackValue { private static class ThisOuter extends StackValue {
private ExpressionCodegen codegen; private final ExpressionCodegen codegen;
private ClassDescriptor descriptor; private final ClassDescriptor descriptor;
public ThisOuter(ExpressionCodegen codegen, ClassDescriptor descriptor) { public ThisOuter(ExpressionCodegen codegen, ClassDescriptor descriptor) {
super(TYPE_OBJECT); super(TYPE_OBJECT);
@@ -1164,8 +1164,8 @@ public abstract class StackValue {
} }
private static class PostIncrement extends StackValue { private static class PostIncrement extends StackValue {
private int index; private final int index;
private int increment; private final int increment;
public PostIncrement(int index, int increment) { public PostIncrement(int index, int increment) {
super(Type.INT_TYPE); super(Type.INT_TYPE);
@@ -1184,8 +1184,8 @@ public abstract class StackValue {
} }
private static class PreIncrement extends StackValue { private static class PreIncrement extends StackValue {
private int index; private final int index;
private int increment; private final int increment;
public PreIncrement(int index, int increment) { public PreIncrement(int index, int increment) {
super(Type.INT_TYPE); super(Type.INT_TYPE);
@@ -1204,10 +1204,10 @@ public abstract class StackValue {
} }
public static class CallReceiver extends StackValue { public static class CallReceiver extends StackValue {
private ResolvedCall<? extends CallableDescriptor> resolvedCall; private final ResolvedCall<? extends CallableDescriptor> resolvedCall;
StackValue receiver; final StackValue receiver;
private ExpressionCodegen codegen; private final ExpressionCodegen codegen;
private CallableMethod callableMethod; private final CallableMethod callableMethod;
public CallReceiver( public CallReceiver(
ResolvedCall<? extends CallableDescriptor> resolvedCall, ResolvedCall<? extends CallableDescriptor> resolvedCall,
@@ -75,7 +75,7 @@ public class BothSignatureWriter {
private String kotlinClassParameters; private String kotlinClassParameters;
private String kotlinClassSignature; private String kotlinClassSignature;
private List<JvmMethodParameterSignature> kotlinParameterTypes = new ArrayList<JvmMethodParameterSignature>(); private final List<JvmMethodParameterSignature> kotlinParameterTypes = new ArrayList<JvmMethodParameterSignature>();
private String kotlinReturnType; private String kotlinReturnType;
private int jvmCurrentTypeArrayLevel; private int jvmCurrentTypeArrayLevel;
@@ -104,7 +104,7 @@ public class BothSignatureWriter {
} }
// TODO: ignore when debugging is disabled // TODO: ignore when debugging is disabled
private Stack<SignatureVisitor> visitors = new Stack<SignatureVisitor>(); private final Stack<SignatureVisitor> visitors = new Stack<SignatureVisitor>();
private void push(SignatureVisitor visitor) { private void push(SignatureVisitor visitor) {
visitors.push(visitor); visitors.push(visitor);
@@ -17,29 +17,30 @@
package org.jetbrains.jet.di; package org.jetbrains.jet.di;
import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.annotations.NotNull;
import java.util.List;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.codegen.JetTypeMapper;
import org.jetbrains.jet.codegen.BuiltinToJavaTypesMapping; import org.jetbrains.jet.codegen.BuiltinToJavaTypesMapping;
import org.jetbrains.jet.codegen.ClassBuilderMode; import org.jetbrains.jet.codegen.ClassBuilderMode;
import org.jetbrains.jet.codegen.ClosureAnnotator; import org.jetbrains.jet.codegen.ClosureAnnotator;
import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.codegen.JetTypeMapper;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.resolve.BindingContext;
import javax.annotation.PreDestroy; import javax.annotation.PreDestroy;
import java.util.List;
/* This file is generated by org.jetbrains.jet.di.AllInjectorsGenerator. DO NOT EDIT! */ /* This file is generated by org.jetbrains.jet.di.AllInjectorsGenerator. DO NOT EDIT! */
public class InjectorForJetTypeMapper { public class InjectorForJetTypeMapper {
private final BindingContext bindingContext; private final BindingContext bindingContext;
private final List<JetFile> listOfJetFile; private final List<JetFile> listOfJetFile;
private JetTypeMapper jetTypeMapper; private final JetTypeMapper jetTypeMapper;
private BuiltinToJavaTypesMapping builtinToJavaTypesMapping; private final BuiltinToJavaTypesMapping builtinToJavaTypesMapping;
private ClassBuilderMode classBuilderMode; private final ClassBuilderMode classBuilderMode;
private ClosureAnnotator closureAnnotator; private final ClosureAnnotator closureAnnotator;
public InjectorForJetTypeMapper( public InjectorForJetTypeMapper(
@NotNull BindingContext bindingContext, @NotNull BindingContext bindingContext,
@NotNull List<JetFile> listOfJetFile @NotNull List<JetFile> listOfJetFile
) { ) {
this.bindingContext = bindingContext; this.bindingContext = bindingContext;
this.listOfJetFile = listOfJetFile; this.listOfJetFile = listOfJetFile;
@@ -57,7 +58,6 @@ public class InjectorForJetTypeMapper {
closureAnnotator.setFiles(listOfJetFile); closureAnnotator.setFiles(listOfJetFile);
jetTypeMapper.init(); jetTypeMapper.init();
} }
@PreDestroy @PreDestroy
@@ -67,5 +67,4 @@ public class InjectorForJetTypeMapper {
public JetTypeMapper getJetTypeMapper() { public JetTypeMapper getJetTypeMapper() {
return this.jetTypeMapper; return this.jetTypeMapper;
} }
} }
@@ -17,22 +17,14 @@
package org.jetbrains.jet.di; package org.jetbrains.jet.di;
import org.jetbrains.jet.lang.resolve.BindingContext;
import java.util.List;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.codegen.BuiltinToJavaTypesMapping;
import org.jetbrains.jet.codegen.ClassBuilderMode;
import org.jetbrains.jet.codegen.GenerationState;
import org.jetbrains.jet.codegen.ClassBuilderFactory;
import org.jetbrains.jet.codegen.JetTypeMapper;
import org.jetbrains.jet.codegen.ClassCodegen;
import org.jetbrains.jet.codegen.ScriptCodegen;
import org.jetbrains.jet.codegen.intrinsics.IntrinsicMethods;
import org.jetbrains.jet.codegen.ClassFileFactory;
import org.jetbrains.jet.codegen.MemberCodegen;
import org.jetbrains.jet.codegen.ClosureAnnotator;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.codegen.*;
import org.jetbrains.jet.codegen.intrinsics.IntrinsicMethods;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.resolve.BindingContext;
import javax.annotation.PreDestroy; import javax.annotation.PreDestroy;
import java.util.List;
/* This file is generated by org.jetbrains.jet.di.AllInjectorsGenerator. DO NOT EDIT! */ /* This file is generated by org.jetbrains.jet.di.AllInjectorsGenerator. DO NOT EDIT! */
public class InjectorForJvmCodegen { public class InjectorForJvmCodegen {
@@ -43,21 +35,21 @@ public class InjectorForJvmCodegen {
private final ClassBuilderMode classBuilderMode; private final ClassBuilderMode classBuilderMode;
private final GenerationState generationState; private final GenerationState generationState;
private final ClassBuilderFactory classBuilderFactory; private final ClassBuilderFactory classBuilderFactory;
private JetTypeMapper jetTypeMapper; private final JetTypeMapper jetTypeMapper;
private ClassCodegen classCodegen; private final ClassCodegen classCodegen;
private ScriptCodegen scriptCodegen; private final ScriptCodegen scriptCodegen;
private IntrinsicMethods intrinsics; private final IntrinsicMethods intrinsics;
private ClassFileFactory classFileFactory; private final ClassFileFactory classFileFactory;
private MemberCodegen memberCodegen; private final MemberCodegen memberCodegen;
private ClosureAnnotator closureAnnotator; private final ClosureAnnotator closureAnnotator;
public InjectorForJvmCodegen( public InjectorForJvmCodegen(
@NotNull BindingContext bindingContext, @NotNull BindingContext bindingContext,
@NotNull List<JetFile> listOfJetFile, @NotNull List<JetFile> listOfJetFile,
@NotNull BuiltinToJavaTypesMapping builtinToJavaTypesMapping, @NotNull BuiltinToJavaTypesMapping builtinToJavaTypesMapping,
@NotNull ClassBuilderMode classBuilderMode, @NotNull ClassBuilderMode classBuilderMode,
@NotNull GenerationState generationState, @NotNull GenerationState generationState,
@NotNull ClassBuilderFactory classBuilderFactory @NotNull ClassBuilderFactory classBuilderFactory
) { ) {
this.bindingContext = bindingContext; this.bindingContext = bindingContext;
this.listOfJetFile = listOfJetFile; this.listOfJetFile = listOfJetFile;
@@ -99,7 +91,6 @@ public class InjectorForJvmCodegen {
jetTypeMapper.init(); jetTypeMapper.init();
intrinsics.init(); intrinsics.init();
} }
@PreDestroy @PreDestroy
@@ -137,5 +128,4 @@ public class InjectorForJvmCodegen {
public ClosureAnnotator getClosureAnnotator() { public ClosureAnnotator getClosureAnnotator() {
return this.closureAnnotator; return this.closureAnnotator;
} }
} }