Remove SuppressWarning('NullableProblems') and change @NotNull annotation to @Nullable in DescriptorPredicate.apply method

This commit is contained in:
Michael Nedzelsky
2014-09-07 15:21:07 +04:00
parent cc4f84ffae
commit 36ada06bdb
3 changed files with 10 additions and 5 deletions
@@ -53,7 +53,8 @@ public enum PrimitiveUnaryOperationFIF implements FunctionIntrinsicFactory {
@NotNull
private static final DescriptorPredicate NO_PARAMETERS = new DescriptorPredicate() {
@Override
public boolean apply(@NotNull FunctionDescriptor descriptor) {
public boolean apply(@Nullable FunctionDescriptor descriptor) {
assert descriptor != null : "argument for DescriptorPredicate.apply should not be null";
return !JsDescriptorUtils.hasParameters(descriptor);
}
};
@@ -17,10 +17,10 @@
package org.jetbrains.k2js.translate.intrinsic.functions.patterns;
import com.google.common.base.Predicate;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
public interface DescriptorPredicate extends Predicate<FunctionDescriptor> {
@Override
boolean apply(@SuppressWarnings("NullableProblems") @NotNull FunctionDescriptor descriptor);
boolean apply(@Nullable FunctionDescriptor descriptor);
}
@@ -18,6 +18,7 @@ package org.jetbrains.k2js.translate.intrinsic.functions.patterns;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.OverrideResolver;
@@ -84,7 +85,8 @@ public final class PatternBuilder {
return new DescriptorPredicate() {
@Override
public boolean apply(@NotNull FunctionDescriptor descriptor) {
public boolean apply(@Nullable FunctionDescriptor descriptor) {
assert descriptor != null : "argument for DescriptorPredicate.apply should not be null, checkers=" + checkersWithPrefixChecker;
//TODO: no need to wrap if we check beforehand
try {
return doApply(descriptor);
@@ -167,7 +169,9 @@ public final class PatternBuilder {
}
@Override
public boolean apply(@NotNull FunctionDescriptor functionDescriptor) {
public boolean apply(@Nullable FunctionDescriptor functionDescriptor) {
assert functionDescriptor != null :
"argument for DescriptorPredicate.apply should not be null, receiverFqName=" + receiverFqName + " names=" + Arrays.asList(names);
ReceiverParameterDescriptor actualReceiver = functionDescriptor.getReceiverParameter();
if (actualReceiver != null) {
if (receiverFqName == null) return false;