From ead8833a889574ed798f78296fa2d89031eff13c Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 26 Sep 2013 20:14:38 +0400 Subject: [PATCH] Minor, fix warnings in codegen --- .../jet/codegen/ClassBodyCodegen.java | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/ClassBodyCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/ClassBodyCodegen.java index d7a19908f2c..07a6b4e9650 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/ClassBodyCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/ClassBodyCodegen.java @@ -104,8 +104,8 @@ public abstract class ClassBodyCodegen extends MemberCodegen { generatePrimaryConstructorProperties(propertyCodegen, myClass); } - private boolean shouldProcessFirst(JetDeclaration declaration) { - return false == (declaration instanceof JetProperty || declaration instanceof JetNamedFunction); + private static boolean shouldProcessFirst(JetDeclaration declaration) { + return !(declaration instanceof JetProperty || declaration instanceof JetNamedFunction); } @@ -163,7 +163,7 @@ public abstract class ClassBodyCodegen extends MemberCodegen { } } - @Nullable + @NotNull protected MethodVisitor createOrGetClInitMethod() { if (clInitMethod == null) { clInitMethod = v.newMethod(null, ACC_STATIC, "", "()V", null, null); @@ -171,22 +171,20 @@ public abstract class ClassBodyCodegen extends MemberCodegen { return clInitMethod; } - @Nullable + @NotNull protected ExpressionCodegen createOrGetClInitCodegen() { assert state.getClassBuilderMode() == ClassBuilderMode.FULL; - if (state.getClassBuilderMode() == ClassBuilderMode.FULL) { - if (clInitCodegen == null) { - MethodVisitor method = createOrGetClInitMethod(); - method.visitCode(); - SimpleFunctionDescriptorImpl clInit = - new SimpleFunctionDescriptorImpl(descriptor, Collections.emptyList(), - Name.special(""), - CallableMemberDescriptor.Kind.SYNTHESIZED); - clInit.initialize(null, null, Collections.emptyList(), - Collections.emptyList(), null, null, Visibilities.PRIVATE, false); + if (clInitCodegen == null) { + MethodVisitor method = createOrGetClInitMethod(); + method.visitCode(); + SimpleFunctionDescriptorImpl clInit = + new SimpleFunctionDescriptorImpl(descriptor, Collections.emptyList(), + Name.special(""), + CallableMemberDescriptor.Kind.SYNTHESIZED); + clInit.initialize(null, null, Collections.emptyList(), + Collections.emptyList(), null, null, Visibilities.PRIVATE, false); - clInitCodegen = new ExpressionCodegen(method, new FrameMap(), Type.VOID_TYPE, context.intoFunction(clInit), state); - } + clInitCodegen = new ExpressionCodegen(method, new FrameMap(), Type.VOID_TYPE, context.intoFunction(clInit), state); } return clInitCodegen; }