/** * Returns the array of definitions for brace pairs that need to be matched when * editing code in the language. * * @return the array of brace pair definitions. */ @Contract(pure = true) @Override public BracePair[] getPairs() { return BRACE_PAIRS; }
@Contract("null -> false") private static boolean isFieldDefinition(@Nullable PsiElement element) { return element instanceof GoFieldDefinition || element instanceof GoAnonymousFieldDefinition; }
@Contract("null -> fail") private void check(Long value) { if (value == null) throw new RuntimeException("null check failed"); } }
/** * @return Transaction counters. * @param createIfAbsent {@code True} if non-null instance is needed. */ @Nullable @Contract("true -> !null;") public TxCounters txCounters(boolean createIfAbsent); }
@Contract("_,null->!null") private static String realValue(@NotNull String value, @Nullable String defaultValue) { return GoBuildTargetSettings.DEFAULT.equals(value) ? defaultValue : value; } }
/** * @return Always {@code null} because a no argument call by definition has no arguments, not even an empty list * of arguments. */ @Contract(pure = true, value = "-> null") @Override @Nullable PsiElement[] primaryArguments();
/** * @return Always {@code null} because a no argument call doesn't ever have {@link #primaryArguments}, so it can't * have secondary arguments. */ @Contract(pure = true, value = "-> null") @Override @Nullable PsiElement[] secondaryArguments(); }
@Contract(pure = true) @NotNull public static TokenSet operatorTokenSet(@SuppressWarnings("unused") final ElixirDotInfixOperator dotInfixOperator) { return DOT_OPERATOR_TOKEN_SET; }
@Contract(pure = true) @NotNull public static TokenSet operatorTokenSet(@SuppressWarnings("unused") final ElixirMultiplicationInfixOperator multiplicationInfixOperator) { return MULTIPLICATIVE_OPERATOR_TOKEN_SET; }
@Contract(pure = true) @NotNull public static TokenSet operatorTokenSet(@SuppressWarnings("unused") final ElixirUnaryPrefixOperator unaryPrefixOperator) { return UNARY_OPERATOR_TOKEN_SET; }
@Contract(pure = true) @NotNull XSourcePosition getSourcePosition() { return mySourcePosition; }
/** * Unlike with a base {@link Call}, {@link Parentheses#primaryArguments} are {@code @NotNull} because the first set * of parentheses has to be there or it wouldn't be a {@link Parentheses} */ @Contract(pure = true) @Override @NotNull PsiElement[] primaryArguments(); }
@Contract(pure = true) @NotNull private static <T> T notNullize(@Nullable T nullable, @NotNull T defaultValue) { T notNull; if (nullable == null) { notNull = defaultValue; } else { notNull = nullable; } return notNull; }
/** * Use this method in order to check whether the method is appropriate for providing Go-specific code insight */ @Contract("null -> false") public boolean isGoModule(@Nullable Module module) { return module != null && !module.isDisposed(); }
@Contract(pure = true) public static boolean processDeclarationsDefault(@NotNull BallerinaCompositeElement o, @NotNull PsiScopeProcessor processor, @NotNull ResolveState state, @Nullable PsiElement lastParent, @NotNull PsiElement place) { return false; }
@Contract(pure = true) @Nullable private static <T> T forLanguage(@Nullable IElementType tokenType, @NotNull T forEEx, @Nullable T forElixir) { T forLanguage; if (tokenType == ELIXIR) { forLanguage = forElixir; } else { forLanguage = forEEx; } return forLanguage; }
@Contract("null -> false") public static boolean isPackageContext(@Nullable PsiElement contextElement) { return PsiTreeUtil.getNonStrictParentOfType(contextElement, GoPackageClause.class) != null; }
@Contract("null -> false") private static boolean isBallerinaTestFile(@Nullable PsiFile psiFile) { if (psiFile == null) { return false; } return psiFile.getName().endsWith(BallerinaConstants.BALLERINA_TEST_FILE_SUFFIX); }
/** * Use this method in order to check whether the method is appropriate for providing Ballerina-specific code * insight. */ @Contract("null -> false") public boolean isBallerinaModule(@Nullable Module module) { return module != null && !module.isDisposed(); }
@Contract("null -> false") public static boolean isBuiltinPackage(@Nullable PsiFileSystemItem directory) { return directory instanceof PsiDirectory && GoConstants.BUILTIN_PACKAGE_NAME.equals(directory.getName()) && GoConstants.BUILTIN_PACKAGE_NAME.equals(GoSdkUtil.getImportPath((PsiDirectory)directory, false)); }