org.checkerframework.checker.nullness.qual.EnsuresNonNullIf Java Examples
The following examples show how to use
org.checkerframework.checker.nullness.qual.EnsuresNonNullIf.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HlsPlaylistParser.java From MediaSDK with Apache License 2.0 | 6 votes |
@EnsuresNonNullIf(expression = "next", result = true) public boolean hasNext() throws IOException { if (next != null) { return true; } if (!extraLines.isEmpty()) { next = Assertions.checkNotNull(extraLines.poll()); return true; } while ((next = reader.readLine()) != null) { next = next.trim(); if (!next.isEmpty()) { return true; } } return false; }
Example #2
Source File: ProtoFieldInfo.java From curiostack with MIT License | 5 votes |
/** Returns whether this is a map field. */ @EnsuresNonNullIf( expression = {"mapKeyField", "mapValueField"}, result = true) boolean isMapField() { return field.isMapField(); }
Example #3
Source File: StringUtils.java From talkback with Apache License 2.0 | 5 votes |
/** * Checks the input {@link String} to see if it contains any non-whitespace characters. * * @param str The {@link String} to be checked * @return {@code true} if the input is null or consists of zero or more whitespace characters; * {@code false} otherwise */ @EnsuresNonNullIf(expression = "#1", result = false) public static boolean isEmpty(@Nullable CharSequence cs) { if ((cs == null) || (cs.length() == 0)) { return true; } for (int i = 0; i < cs.length(); i++) { if (!Character.isWhitespace(cs.charAt(i))) { return false; } } return true; }
Example #4
Source File: DefaultDrmSession.java From MediaSDK with Apache License 2.0 | 4 votes |
@EnsuresNonNullIf(result = true, expression = "sessionId") @SuppressWarnings("contracts.conditional.postcondition.not.satisfied") private boolean isOpen() { return state == STATE_OPENED || state == STATE_OPENED_WITH_KEYS; }
Example #5
Source File: State.java From zetasketch with Apache License 2.0 | 4 votes |
/** Returns whether the state has at least one byte of readable {@link #data}. */ @EnsuresNonNullIf(expression = "this.data", result = true) public boolean hasData() { return data != null && data.hasRemaining(); }
Example #6
Source File: State.java From zetasketch with Apache License 2.0 | 4 votes |
/** Returns whether the state has at least one byte of readable {@link #sparseData}. */ @EnsuresNonNullIf(expression = "this.sparseData", result = true) public boolean hasSparseData() { return sparseData != null && sparseData.hasRemaining(); }
Example #7
Source File: StringValidator.java From aws-xray-sdk-java with Apache License 2.0 | 4 votes |
@EnsuresNonNullIf(expression = "#1", result = true) public static boolean isNotNullOrBlank(@Nullable String string) { return string != null && !string.trim().isEmpty(); }
Example #8
Source File: StringValidator.java From aws-xray-sdk-java with Apache License 2.0 | 4 votes |
@EnsuresNonNullIf(expression = "#1", result = false) public static boolean isNullOrBlank(@Nullable String string) { return string == null || string.trim().isEmpty(); }
Example #9
Source File: TextUtils.java From Accessibility-Test-Framework-for-Android with Apache License 2.0 | 4 votes |
/** * @see android.text.TextUtils#isEmpty(CharSequence) */ @EnsuresNonNullIf(expression = "#1", result = false) public static boolean isEmpty(@Nullable CharSequence str) { return (str == null) || (str.length() == 0); }
Example #10
Source File: ThreadContextImpl.java From glowroot with Apache License 2.0 | 4 votes |
@EnsuresNonNullIf(expression = "asyncTimer", result = true) private boolean isAsync() { return asyncTimer != null; }
Example #11
Source File: TraceEntryImpl.java From glowroot with Apache License 2.0 | 4 votes |
@EnsuresNonNullIf(expression = "asyncTimer", result = true) private boolean isAsync() { return asyncTimer != null; }
Example #12
Source File: DefaultDrmSession.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
@EnsuresNonNullIf(result = true, expression = "sessionId") @SuppressWarnings("contracts.conditional.postcondition.not.satisfied") private boolean isOpen() { return state == STATE_OPENED || state == STATE_OPENED_WITH_KEYS; }
Example #13
Source File: DefaultDrmSession.java From Telegram with GNU General Public License v2.0 | 4 votes |
@EnsuresNonNullIf(result = true, expression = "sessionId") @SuppressWarnings("contracts.conditional.postcondition.not.satisfied") private boolean isOpen() { return state == STATE_OPENED || state == STATE_OPENED_WITH_KEYS; }