org.gradle.api.Nullable Java Examples

The following examples show how to use org.gradle.api.Nullable. 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: DaemonClientInputForwarder.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public DaemonClientInputForwarder(InputStream inputStream, final Dispatch<? super IoCommand> dispatch, ExecutorFactory executorFactory, final IdGenerator<?> idGenerator, int bufferSize) {
    TextStream handler = new TextStream() {
        public void text(String input) {
            if (LOGGER.isDebugEnabled()) {
                LOGGER.debug("Forwarding input to daemon: '{}'", input.replace("\n", "\\n"));
            }
            dispatch.dispatch(new ForwardInput(idGenerator.generateId(), input.getBytes()));
        }

        public void endOfStream(@Nullable Throwable failure) {
            CloseInput message = new CloseInput(idGenerator.generateId());
            LOGGER.debug("Dispatching close input message: {}", message);
            dispatch.dispatch(message);
        }
    };

    forwarder = new InputForwarder(inputStream, handler, executorFactory, bufferSize);
}
 
Example #2
Source File: AvailableJavaHomes.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/**
 * Locates a JDK installation that is different to the current JVM, ie for which java.home is different.
 *
 * @return null if not found.
 */
@Nullable
public static JavaInfo getDifferentJdk() {
    Jvm jvm = Jvm.current();
    for (JvmInstallation candidate : getJvms()) {
        if (candidate.getJavaHome().equals(jvm.getJavaHome())) {
            continue;
        }

        // Currently tests implicitly assume a JDK
        if (!candidate.isJdk()) {
            continue;
        }
        return Jvm.forHome(candidate.getJavaHome());
    }

    return null;
}
 
Example #3
Source File: VersionNumber.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private VersionNumber(int major, int minor, int micro, int patch, @Nullable String qualifier, AbstractScheme scheme) {
    this.major = major;
    this.minor = minor;
    this.micro = micro;
    this.patch = patch;
    this.qualifier = qualifier;
    this.scheme = scheme;
}
 
Example #4
Source File: AstUtils.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Nullable
public static ScriptBlock detectScriptBlock(Statement statement, final Collection<String> names) {
    return detectScriptBlock(statement, new Predicate<ScriptBlock>() {
        public boolean apply(ScriptBlock input) {
            return names.contains(input.getName());
        }
    });
}
 
Example #5
Source File: AbstractEncoder.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void writeNullableString(@Nullable CharSequence value) throws IOException {
    if (value == null) {
        writeBoolean(false);
    } else {
        writeBoolean(true);
        writeString(value.toString());
    }
}
 
Example #6
Source File: ClassDirectoryBinaryNamingScheme.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public String getTaskName(@Nullable String verb, @Nullable String target) {
    String name = baseName;
    if (target != null) {
        name = collapsedName;
    }
    return GUtil.toLowerCamelCase(String.format("%s %s %s", nullToEmpty(verb), name, nullToEmpty(target)));
}
 
Example #7
Source File: MavenLocalResolver.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
@Nullable
protected MutableModuleComponentResolveMetaData parseMetaDataFromArtifact(ModuleComponentIdentifier moduleComponentIdentifier, ExternalResourceArtifactResolver artifactResolver, ResourceAwareResolveResult result) {
    MutableModuleComponentResolveMetaData metaData = super.parseMetaDataFromArtifact(moduleComponentIdentifier, artifactResolver, result);
    if (metaData == null) {
        return null;
    }

    if (isOrphanedPom(mavenMetaData(metaData), artifactResolver)) {
        return null;
    }
    return metaData;
}
 
Example #8
Source File: ModelMapping.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Nullable
public Class<?> getProtocolType(Class<?> modelType) {
    if (MODEL_TO_PROTOCOL_MAP.containsValue(modelType)) {
        return modelType;
    }
    return MODEL_TO_PROTOCOL_MAP.get(modelType);
}
 
Example #9
Source File: DefaultMavenFileLocations.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Nullable
public File getGlobalSettingsFile() {
    File dir = getGlobalMavenDir();
    if (dir == null) {
        return null;
    }
    return new File(dir, "conf/settings.xml");
}
 
Example #10
Source File: PlaceholderException.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public PlaceholderException(String exceptionClassName, @Nullable String message, @Nullable Throwable getMessageException, @Nullable String toString,
                            @Nullable Throwable toStringException, @Nullable Throwable cause) {
    super(message, cause);
    this.exceptionClassName = exceptionClassName;
    this.getMessageException = getMessageException;
    this.toString = toString;
    this.toStringRuntimeEx = toStringException;
}
 
Example #11
Source File: DefaultExternalResourceMetaData.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public DefaultExternalResourceMetaData(URI location, @Nullable Date lastModified, long contentLength, @Nullable String etag, @Nullable HashValue sha1) {
    this.location = location;
    this.lastModified = lastModified;
    this.contentLength = contentLength;
    this.etag = etag;
    this.sha1 = sha1 == null ? null : sha1.asHexString();
}
 
Example #12
Source File: IdeaDependenciesProvider.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private static Function<String, Dependency> scopeToDependency(final IdeDependencyKey<?, Dependency> dependencyKey) {
    return new Function<String, Dependency>() {
        @Nullable
        public Dependency apply(String s) {
            return dependencyKey.buildDependency(s);
        }
    };
}
 
Example #13
Source File: ClassDirectoryBinaryNamingScheme.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public String getTaskName(@Nullable String verb, @Nullable String target) {
    String name = baseName;
    if (target != null) {
        name = collapsedName;
    }
    return GUtil.toLowerCamelCase(String.format("%s %s %s", nullToEmpty(verb), name, nullToEmpty(target)));
}
 
Example #14
Source File: FullExceptionFormatter.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private int countCommonElements(List<StackTraceElement> stackTrace, @Nullable List<StackTraceElement> parentTrace) {
    if (parentTrace == null) {
        return 0;
    }

    int commonElements = 0;
    for (int i = stackTrace.size() - 1, j = parentTrace.size() - 1;
        // i >= 1 makes sure that commonElements < stackTrace.size()
         i >= 1 && j >= 0 && stackTrace.get(i).equals(parentTrace.get(j)); i--, j--) {
        commonElements++;
    }
    return commonElements;
}
 
Example #15
Source File: IdeaDependenciesProvider.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private static Function<String, Dependency> scopeToDependency(final IdeDependencyKey<?, Dependency> dependencyKey) {
    return new Function<String, Dependency>() {
        @Nullable
        public Dependency apply(String s) {
            return dependencyKey.buildDependency(s);
        }
    };
}
 
Example #16
Source File: ModelMapping.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Nullable
public Class<?> getProtocolTypeFromModelName(String name) {
    Class<?> modelType = MODEL_NAME_MAP.inverse().get(name);
    if (modelType == null) {
        return null;
    }
    return getProtocolType(modelType);
}
 
Example #17
Source File: AbstractTestLogger.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
protected void logEvent(TestDescriptor descriptor, TestLogEvent event, @Nullable String details) {
    StyledTextOutput output = textOutputFactory.create("TestEventLogger", logLevel);
    if (!descriptor.equals(lastSeenTestDescriptor) || event != lastSeenTestEvent) {
        output.println().append(getEventPath(descriptor));
        output.withStyle(getStyle(event)).println(event.toString());
    }
    lastSeenTestDescriptor = descriptor;
    lastSeenTestEvent = event;
    if (details != null) {
        output.append(TextUtil.toPlatformLineSeparators(details));
    }
}
 
Example #18
Source File: HttpPluginResolutionServiceClient.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Nullable
public Response<PluginUseMetaData>  queryPluginMetadata(String portalUrl, boolean shouldValidate, final PluginRequest pluginRequest) {
    String escapedId = PATH_SEGMENT_ESCAPER.escape(pluginRequest.getId().toString());
    String escapedPluginVersion = PATH_SEGMENT_ESCAPER.escape(pluginRequest.getVersion());
    final String requestUrl = toRequestUrl(portalUrl, String.format(PLUGIN_USE_REQUEST_URL, escapedId, escapedPluginVersion));
    return request(requestUrl, PluginUseMetaData.class, new Action<PluginUseMetaData>() {
        public void execute(PluginUseMetaData pluginUseMetaData) {
            validate(requestUrl, pluginUseMetaData);
        }
    });
}
 
Example #19
Source File: AstUtils.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Nullable
public static String extractConstantMethodName(MethodCallExpression methodCall) {
    if (!(methodCall.getMethod() instanceof ConstantExpression)) {
        return null;
    }

    return methodCall.getMethod().getText();
}
 
Example #20
Source File: TaskDependencyGraph.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Nullable
public TaskInfo getNode(Task task) {
    return nodes.get(task);
}
 
Example #21
Source File: ModuleInternal.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Nullable
String getProjectPath();
 
Example #22
Source File: ReflectiveRule.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public BindableParameter(@Nullable ModelPath path, Class<T> type) {
    this.path = path;
    this.type = type;
}
 
Example #23
Source File: ModelMapping.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Nullable
public String getModelName(Class<?> modelType) {
    return MODEL_NAME_MAP.get(modelType);
}
 
Example #24
Source File: InternalDependencyResult.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Nullable
ModuleVersionIdentifier getSelected();
 
Example #25
Source File: DefaultConflictHandler.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/**
 * Registers new newModule and returns an instance of a conflict if conflict exists.
 */
@Nullable
public PotentialConflict registerModule(CandidateModule newModule) {
    ModuleIdentifier replacedBy = moduleReplacements.getReplacementFor(newModule.getId());
    return potentialConflict(conflicts.newElement(newModule.getId(), newModule.getVersions(), replacedBy));
}
 
Example #26
Source File: ExternalResourceMetaDataCompare.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static boolean isDefinitelyUnchanged(@Nullable ExternalResourceMetaData local, Factory<ExternalResourceMetaData> remoteFactory) {
    if (local == null) {
        return false;
    }

    String localEtag = local.getEtag();

    Date localLastModified = local.getLastModified();
    if (localEtag == null && localLastModified == null) {
        return false;
    }

    long localContentLength = local.getContentLength();
    if (localEtag == null && localContentLength < 1) {
        return false;
    }

    // We have enough local data to make a comparison, get the remote metadata
    ExternalResourceMetaData remote = remoteFactory.create();
    if (remote == null) {
        return false;
    }

    String remoteEtag = remote.getEtag();
    if (localEtag != null && remoteEtag != null) {
        return localEtag.equals(remoteEtag);
    }

    Date remoteLastModified = remote.getLastModified();
    if (remoteLastModified == null) {
        return false;
    }

    long remoteContentLength = remote.getContentLength();
    //noinspection SimplifiableIfStatement
    if (remoteContentLength < 1) {
        return false;
    }

    return localContentLength == remoteContentLength && remoteLastModified.equals(localLastModified);
}
 
Example #27
Source File: DefaultExternalResourceMetaData.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Nullable
public String getEtag() {
    return etag;
}
 
Example #28
Source File: LockFileAccess.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Nullable
public FileLock tryLockState(boolean shared) throws IOException {
    return lockStateAccess.tryLock(lockFileAccess, shared);
}
 
Example #29
Source File: FileTransport.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ExternalResource getResource(String source, @Nullable LocallyAvailableResourceCandidates localCandidates) throws IOException {
    return connector.getResource(source);
}
 
Example #30
Source File: InternalDependencyResult.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Nullable
ModuleVersionResolveException getFailure();