visitLinesInstructions(frameProxy.location(), true, lines, visitor);
// check if anything real left, fallback to the previous state
- if (!targets.isEmpty() && !immediateMethodCalls(targets).findAny().isPresent()) {
+ if (!targets.isEmpty() && immediateMethodCalls(targets).findAny().isEmpty()) {
targets.clear();
targets.addAll(copy);
}
}
Method lambdaMethod = MethodBytecodeUtil.getLambdaMethod(classType, classesByName);
if (lambdaMethod != null &&
- !breakpoint
+ breakpoint
.matchingMethods(StreamEx.of(((ClassType)classType).interfaces()).flatCollection(ReferenceType::allMethods), debugProcess)
- .findFirst().isPresent()) {
+ .findFirst().isEmpty()) {
return;
}
StreamEx<Method> methods = lambdaMethod != null
Optional<PsiElement> referenceExpression = StreamEx.ofTree(((PsiElement)runnableExpression), el -> StreamEx.of(el.getChildren()))
.findAny(el -> el instanceof PsiReferenceExpression &&
((PsiReferenceExpression)el).isReferenceTo(variable));
- if (!referenceExpression.isPresent()) return;
+ if (referenceExpression.isEmpty()) return;
String variableName = variable.getName();
if (variableName == null) return;
highlightingElement = referenceExpression.get();
.mapAll(expression)
.filter(f -> f.myInspection.isAppropriateLanguageLevel(myLevel))
.findAny();
- if (!fix.isPresent()) return;
+ if (fix.isEmpty()) return;
handleSimplification(expression, fix.get());
}
if (providers.size() > 1) {
final Optional<JsonSchemaFileProvider> userSchema =
providers.stream().filter(provider -> SchemaType.userSchema.equals(provider.getSchemaType())).findFirst();
- if (!userSchema.isPresent()) return ContainerUtil.emptyList();
+ if (userSchema.isEmpty()) return ContainerUtil.emptyList();
selected = userSchema.get();
} else selected = providers.get(0);
VirtualFile schemaFile = getSchemaForProvider(myProject, selected);
private boolean secondAnalysisFilter(ChangeListManager changeListManager, String text, VirtualFile file, int line) {
List<Range> ranges = getOrComputeUnchangedRanges(file, changeListManager);
Optional<Range> first = StreamEx.of(ranges).findFirst(it -> it.start1 <= line && line < it.end1);
- if (!first.isPresent()) {
+ if (first.isEmpty()) {
logNotFiltered(text, file, line, -1);
return true;
}
Presentation presentation = e.getPresentation();
Optional<JBPopup> seDialog = getPopup(e);
- if (!seDialog.isPresent()) {
+ if (seDialog.isEmpty()) {
presentation.setEnabled(false);
return;
}
final Optional<ExtendableTextComponent.Extension> extension =
extendableTextField.getExtensions().stream().filter(extensionFilter).findFirst();
- if (!extension.isPresent()) {
+ if (extension.isEmpty()) {
throw new ComponentLookupException("Unable to find extension");
}
protected void executeInEDT() throws Throwable {
Stream<Content> contentStream = Arrays.stream(myToolWindow.getContentManager().getContents());
Optional<Content> contentOptional = contentStream.filter(content -> content.getTabName().equals(tabName)).findAny();
- if (!contentOptional.isPresent()) {
+ if (contentOptional.isEmpty()) {
throw new ComponentLookupException("Unable to find content with tab name: \"" + tabName +
"\" for ToolWindow with id: \"" + myToolWindowId + "\"");
}
private static boolean containsCollapsedUnversionedNode(@NotNull VcsTreeModelData treeModelData) {
Optional<ChangesBrowserNode<?>> node = treeModelData.nodesStream()
.filter(it -> it instanceof ChangesBrowserUnversionedFilesNode).findAny();
- if (!node.isPresent()) return false;
+ if (node.isEmpty()) return false;
ChangesBrowserUnversionedFilesNode unversionedFilesNode = (ChangesBrowserUnversionedFilesNode)node.get();
return unversionedFilesNode.isManyFiles();
if (condition == null) return false;
checker.negate = true;
OptionalInt argNum = condition.getArgumentComparedTo(ContractValue.booleanValue(true), true);
- if (!argNum.isPresent()) {
+ if (argNum.isEmpty()) {
checker.negate = false;
argNum = condition.getArgumentComparedTo(ContractValue.booleanValue(false), true);
}
- if (!argNum.isPresent()) return false;
+ if (argNum.isEmpty()) return false;
int index = argNum.getAsInt();
PsiExpression[] args = call.getArgumentList().getExpressions();
if (index >= args.length) return false;
if (field.hasAnnotation(JAVA_IO_SERIAL) || !isConstant(field)) return;
Optional<PsiClass> pClass = getSerializablePsiClass(field);
- if (!pClass.isPresent()) return;
+ if (pClass.isEmpty()) return;
boolean candidateToBeAnnotated =
SerializationUtils.isExternalizable(pClass.get()) ? isSerialFieldInExternalizable(field) : isSerialFieldInSerializable(field);
if (method.hasAnnotation(JAVA_IO_SERIAL)) return;
Optional<PsiClass> pClass = getSerializablePsiClass(method);
- if (!pClass.isPresent()) return;
+ if (pClass.isEmpty()) return;
boolean candidateToBeAnnotated =
SerializationUtils.isExternalizable(pClass.get()) ? isSerialMethodInExternalizable(method) : isSerialMethodInSerializable(method);
!JavaOverridingMethodUtil.containsAnnotationWithName(m, OVERRIDE_SHORT_NAME);
Stream<PsiMethod> overridingMethods = JavaOverridingMethodUtil.getOverridingMethodsIfCheapEnough(method, scope, preFilter);
if (overridingMethods == null) return;
- result.hierarchyAnnotated = ThreeState.fromBoolean(!overridingMethods.findAny().isPresent());
+ result.hierarchyAnnotated = ThreeState.fromBoolean(overridingMethods.findAny().isEmpty());
}
private void checkMissingOverride(@NotNull PsiMethod method,
.filter(child -> child instanceof EditorConfigDescribableElement)
.findFirst();
- if (!first.isPresent()) {
+ if (first.isEmpty()) {
throw new IllegalStateException();
}
.skip(1)
.findFirst();
- if (!second.isPresent()) {
+ if (second.isEmpty()) {
throw new IllegalStateException();
}
.filter(i -> UastUtils.isUastChildOf(expression, UastLiteralUtils.wrapULiteral(arguments.get(i)), false))
.findFirst();
- if (!idx.isPresent()) return Unspecified.UNKNOWN;
+ if (idx.isEmpty()) return Unspecified.UNKNOWN;
PsiMethod method = callExpression.resolve();
if (method == null) return Unspecified.UNKNOWN;
String jdkVersion = null;
Optional<Sdk> sdk = Optional.ofNullable(ModuleRootManager.getInstance(module).getSdk());
- if (!sdk.isPresent()) {
+ if (sdk.isEmpty()) {
Optional<JdkOrderEntry> jdkEntry =
Arrays.stream(ModuleRootManager.getInstance(module).getOrderEntries())
.filter(JdkOrderEntry.class::isInstance)