file_path
stringlengths 57
191
| method_name
stringlengths 2
80
| method_block
stringlengths 8
32.6k
| method_name_pointers
sequencelengths 2
2
| method_signature
stringlengths 7
4.42k
| length
int64 8
32.6k
| __index_level_0__
int64 0
516k
|
---|---|---|---|---|---|---|
../intellij-community/java/java-psi-api/src/com/intellij/psi/PsiDeconstructionPattern.java | getPatternVariable | @Nullable
PsiPatternVariable getPatternVariable(); | [
31,
49
] | @Nullable
PsiPatternVariable getPatternVariable() | 52 | 488,483 |
../intellij-community/java/java-impl-refactorings/src/com/intellij/refactoring/encapsulateFields/JavaEncapsulateFieldHelper.java | checkMethodResolvable | @Nullable
private static PsiMethodCallExpression checkMethodResolvable(@NotNull PsiMethodCallExpression methodCall,
@NotNull PsiMethod targetMethod,
PsiReferenceExpression context,
PsiClass aClass) throws IncorrectOperationException {
PsiElementFactory factory = JavaPsiFacade.getElementFactory(targetMethod.getProject());
final PsiElement resolved = methodCall.getMethodExpression().resolve();
if (!targetMethod.equals(resolved)) {
PsiClass containingClass;
if (resolved instanceof PsiMethod) {
containingClass = ((PsiMethod)resolved).getContainingClass();
}
else if (resolved instanceof PsiClass) {
containingClass = (PsiClass)resolved;
}
else {
return null;
}
if (containingClass != null && containingClass.isInheritor(aClass, false)) {
final PsiExpression newMethodExpression =
factory.createExpressionFromText("super." + targetMethod.getName(), context);
methodCall.getMethodExpression().replace(newMethodExpression);
}
else {
methodCall = null;
}
}
return methodCall;
} | [
51,
72
] | @Nullable
private static PsiMethodCallExpression checkMethodResolvable(@NotNull PsiMethodCallExpression methodCall,
@NotNull PsiMethod targetMethod,
PsiReferenceExpression context,
PsiClass aClass) | 1,312 | 481,632 |
../intellij-community/python/python-psi-impl/src/com/jetbrains/python/inspections/PyPropertyDefinitionInspection.java | visitPyFunction | @Override
public void visitPyFunction(@NotNull PyFunction node) {
super.visitPyFunction(node);
// check @foo.setter and @foo.deleter
PyClass cls = node.getContainingClass();
if (cls != null) {
final PyDecoratorList decos = node.getDecoratorList();
if (decos != null) {
String name = node.getName();
for (PyDecorator deco : decos.getDecorators()) {
final QualifiedName qName = deco.getQualifiedName();
if (qName != null) {
List<String> nameParts = qName.getComponents();
if (nameParts.size() == 2) {
final int suffixIndex = SUFFIXES.indexOf(nameParts.get(1));
if (suffixIndex >= 0) {
if (Objects.equals(name, nameParts.get(0))) {
// names are ok, what about signatures?
PsiElement markable = getFunctionMarkingElement(node);
if (suffixIndex == 0) {
checkSetter(node, markable);
}
else {
checkDeleter(node, markable);
}
}
else {
registerProblem(deco, PyPsiBundle.message("INSP.func.property.name.mismatch"));
}
}
}
}
}
}
}
} | [
26,
41
] | @Override
public void visitPyFunction(@NotNull PyFunction node) | 1,396 | 8,636 |
../intellij-community/platform/indexing-impl/src/com/intellij/psi/stubs/LazyStubList.java | instantiateStub | private @NotNull StubBase<?> instantiateStub(int index) {
LazyStubData data = myData;
if (data == null) {
StubBase<?> stub = getCachedStub(index);
if (stub != null) return stub;
throw new IllegalStateException("Not all (" + mySize + ") stubs are instantiated (" + myInstantiated + "), but data for them is missing");
}
try {
StubBase<?> parent = get(data.getParentIndex(index));
StubBase<?> stub = data.deserializeStub(index, parent, getStubType(index));
stub.id = index;
return stub;
}
catch (ProcessCanceledException e) {
throw e;
}
catch (Exception | Error e) {
throw new RuntimeException(StubSerializationUtil.brokenStubFormat(myRootSerializer), e);
}
} | [
29,
44
] | private @NotNull StubBase<?> instantiateStub(int index) | 751 | 302,093 |
../intellij-community/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/ChangeDiffRequestProducer.java | createContent | public static @NotNull DiffContent createContent(@Nullable Project project,
@Nullable ContentRevision revision,
@NotNull UserDataHolder context,
@NotNull ProgressIndicator indicator) throws DiffRequestProducerException {
try {
indicator.checkCanceled();
if (revision == null) return DiffContentFactory.getInstance().createEmpty();
FilePath filePath = revision.getFile();
DiffContentFactoryEx contentFactory = DiffContentFactoryEx.getInstanceEx();
if (revision instanceof CurrentContentRevision) {
VirtualFile vFile = ((CurrentContentRevision)revision).getVirtualFile();
if (vFile == null || !vFile.isValid()) {
throw new DiffRequestProducerException(DiffBundle.message("error.cant.show.diff.cant.load.revision.content"));
}
return contentFactory.create(project, vFile);
}
DiffContent content;
if (revision instanceof ByteBackedContentRevision) {
byte[] revisionContent = ((ByteBackedContentRevision)revision).getContentAsBytes();
if (revisionContent == null) {
throw new DiffRequestProducerException(DiffBundle.message("error.cant.show.diff.cant.load.revision.content"));
}
content = contentFactory.createFromBytes(project, revisionContent, filePath);
}
else {
String revisionContent = revision.getContent();
if (revisionContent == null) {
throw new DiffRequestProducerException(DiffBundle.message("error.cant.show.diff.cant.load.revision.content"));
}
content = contentFactory.create(project, revisionContent, filePath);
}
content.putUserData(DiffVcsDataKeys.REVISION_INFO, Pair.create(revision.getFile(), revision.getRevisionNumber()));
return content;
}
catch (IOException | VcsException e) {
LOG.info(e);
throw new DiffRequestProducerException(e);
}
} | [
35,
48
] | public static @NotNull DiffContent createContent(@Nullable Project project,
@Nullable ContentRevision revision,
@NotNull UserDataHolder context,
@NotNull ProgressIndicator indicator) | 2,047 | 222,897 |
../intellij-community/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java | createTitle | @NotNull
public static JComponent createTitle(@Nullable @NlsContexts.Label String title,
@Nullable LineSeparator separator,
@Nullable Charset charset,
@Nullable Boolean bom,
boolean readOnly,
@Nullable DiffEditorTitleCustomizer titleCustomizer) {
JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(JBUI.Borders.empty(0, 4));
BorderLayoutPanel labelWithIcon = new BorderLayoutPanel();
JComponent titleLabel = titleCustomizer != null ? titleCustomizer.getLabel()
: new JBLabel(StringUtil.notNullize(title)).setCopyable(true);
labelWithIcon.addToCenter(titleLabel);
if (readOnly) {
labelWithIcon.addToLeft(new JBLabel(AllIcons.Ide.Readonly));
}
panel.add(labelWithIcon, BorderLayout.CENTER);
if (charset != null || separator != null) {
JPanel panel2 = new JPanel();
panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));
if (charset != null) {
panel2.add(Box.createRigidArea(JBUI.size(4, 0)));
panel2.add(createCharsetPanel(charset, bom));
}
if (separator != null) {
panel2.add(Box.createRigidArea(JBUI.size(4, 0)));
panel2.add(createSeparatorPanel(separator));
}
panel.add(panel2, BorderLayout.EAST);
}
return panel;
} | [
36,
47
] | @NotNull
public static JComponent createTitle(@Nullable @NlsContexts.Label String title,
@Nullable LineSeparator separator,
@Nullable Charset charset,
@Nullable Boolean bom,
boolean readOnly,
@Nullable DiffEditorTitleCustomizer titleCustomizer) | 1,507 | 274,251 |
../intellij-community/jps/jps-builders-6/src/org/jetbrains/jps/javac/Iterators.java | hasNext | @Override
public boolean hasNext() {
return li.hasPrevious();
} | [
35,
42
] | @Override
public boolean hasNext() | 95 | 334,617 |
../intellij-community/plugins/maven/maven3-server-common/src/org/jetbrains/idea/maven/server/embedder/CustomMaven3ArtifactFactory.java | createDependencyArtifact | @Override
public Artifact createDependencyArtifact(String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope) {
return wrap(super.createDependencyArtifact(checkValue(groupId), checkValue(artifactId), checkVersionRange(versionRange), type, classifier, scope));
} | [
28,
52
] | @Override
public Artifact createDependencyArtifact(String groupId, String artifactId, VersionRange versionRange, String type, String classifier, String scope) | 320 | 55,985 |
../intellij-community/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenProjectsManager.java | findProject | @Nullable
public MavenProject findProject(@NotNull VirtualFile f) {
return getProjectsTree().findProject(f);
} | [
32,
43
] | @Nullable
public MavenProject findProject(@NotNull VirtualFile f) | 118 | 57,857 |
../intellij-community/platform/platform-api/src/com/intellij/openapi/keymap/KeyMapBundle.java | message | public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
return INSTANCE.getMessage(key, params);
} | [
35,
42
] | public static @NotNull @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) | 180 | 257,459 |
../intellij-community/platform/util/nanoxml/src/net/n3/nanoxml/IXMLElement.java | getName | String getName(); | [
7,
14
] | String getName() | 17 | 231,081 |
../intellij-community/platform/xdebugger-api/src/com/intellij/xdebugger/breakpoints/XLineBreakpointType.java | filePositionDisplayText | @Nls
private String filePositionDisplayText(String path, XLineBreakpoint<P> breakpoint) {
var line = breakpoint.getLine();
var column = getColumn(breakpoint);
if (column <= 0) {
return XDebuggerBundle.message("xbreakpoint.default.display.text", line + 1, path);
} else {
return XDebuggerBundle.message("xbreakpoint.default.display.text.with.column", line + 1, column + 1, path);
}
} | [
22,
45
] | @Nls
private String filePositionDisplayText(String path, XLineBreakpoint<P> breakpoint) | 418 | 259,325 |
../intellij-community/platform/util-rt/src/com/intellij/util/ExceptionUtilRt.java | unwrapException | public static @NotNull Throwable unwrapException(@NotNull Throwable throwable, @NotNull Class<? extends Throwable> classToUnwrap) {
while (classToUnwrap.isInstance(throwable) && throwable.getCause() != null && throwable.getCause() != throwable) {
throwable = throwable.getCause();
}
return throwable;
} | [
33,
48
] | public static @NotNull Throwable unwrapException(@NotNull Throwable throwable, @NotNull Class<? extends Throwable> classToUnwrap) | 322 | 264,017 |
../intellij-community/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedBinaryFilePatch.java | patchCopy | public static ShelvedBinaryFilePatch patchCopy(@NotNull final ShelvedBinaryFilePatch patch) {
return new ShelvedBinaryFilePatch(patch.getShelvedBinaryFile());
} | [
37,
46
] | public static ShelvedBinaryFilePatch patchCopy(@NotNull final ShelvedBinaryFilePatch patch) | 166 | 223,294 |
../intellij-community/java/java-analysis-impl/src/com/siyeh/ig/style/RedundantFieldInitializationInspection.java | buildVisitor | @Override
public BaseInspectionVisitor buildVisitor() {
return new RedundantFieldInitializationVisitor();
} | [
41,
53
] | @Override
public BaseInspectionVisitor buildVisitor() | 115 | 347,096 |
../intellij-community/java/java-analysis-impl/src/com/siyeh/ig/psiutils/InstanceOfUtils.java | hasConflictingDeclaredNames | public static boolean hasConflictingDeclaredNames(@NotNull PsiLocalVariable variable, @NotNull PsiInstanceOfExpression instanceOf) {
PsiIdentifier identifier = variable.getNameIdentifier();
if (identifier == null) {
return false;
}
PsiElement scope = JavaSharedImplUtil.getPatternVariableDeclarationScope(instanceOf);
if (scope == null) {
return false;
}
boolean hasConflict = isConflictingNameDeclaredInside(variable, scope, false);
if (hasConflict) {
if (instanceOf.getPattern() != null) return true;
final PsiElementFactory factory = JavaPsiFacade.getElementFactory(variable.getProject());
PsiElement newExpression = factory.createExpressionFromText(instanceOf.getText() + " " + identifier.getText(), instanceOf);
PsiFile file = variable.getContainingFile();
if (file != instanceOf.getContainingFile()) {
return true;
}
PsiFile copyFile = (PsiFile)file.copy();
PsiInstanceOfExpression copyInstanceOf = PsiTreeUtil.findSameElementInCopy(instanceOf, copyFile);
PsiLocalVariable copyVariable = PsiTreeUtil.findSameElementInCopy(variable, copyFile);
copyVariable.delete();
newExpression = copyInstanceOf.replace(newExpression);
if (!(newExpression instanceof PsiInstanceOfExpression newInstanceOfExpression)) {
return true;
}
if (!(newInstanceOfExpression.getPattern() instanceof PsiTypeTestPattern typeTestPattern)) {
return true;
}
PsiPatternVariable patternVariable = typeTestPattern.getPatternVariable();
if (patternVariable == null) {
return true;
}
scope = JavaSharedImplUtil.getPatternVariableDeclarationScope(newInstanceOfExpression);
if (scope == null) {
return false;
}
return isConflictingNameDeclaredInside(patternVariable, scope, true);
}
return false;
} | [
22,
49
] | public static boolean hasConflictingDeclaredNames(@NotNull PsiLocalVariable variable, @NotNull PsiInstanceOfExpression instanceOf) | 1,894 | 344,629 |
../intellij-community/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/field/GrIntroduceFieldDialog.java | checkErrors | private void checkErrors() {
List<String> errors = new ArrayList<>();
if (myCurrentMethodRadioButton.isSelected() && myDeclareFinalCheckBox.isSelected() && !isInvokedInAlwaysInvokedConstructor) {
errors.add(GroovyRefactoringBundle.message("final.field.cant.be.initialized.in.cur.method"));
}
if (myDeclareFinalCheckBox.isSelected() && myReplaceAllOccurrencesCheckBox.isSelected() && myInvokedOnLocalVar != null && hasLHSUsages) {
errors.add(GroovyRefactoringBundle.message("Field.cannot.be.final.because.replaced.variable.has.lhs.usages"));
}
if (!myCanBeInitializedOutsideBlock) {
if (myFieldDeclarationRadioButton.isSelected()) {
errors.add(GroovyRefactoringBundle.message("field.cannot.be.initialized.in.field.declaration"));
}
else if (myClassConstructorSRadioButton.isSelected()) {
errors.add(GroovyRefactoringBundle.message("field.cannot.be.initialized.in.constructor(s)"));
}
}
if (errors.isEmpty()) {
setErrorText(null);
}
else {
setErrorText(errorString(errors));
}
} | [
13,
24
] | private void checkErrors() | 1,086 | 171,916 |
../intellij-community/python/src/com/jetbrains/python/console/PythonConsoleToolWindow.java | init | public void init(final @NotNull ToolWindow toolWindow, final @NotNull RunContentDescriptor contentDescriptor) {
setContent(toolWindow, contentDescriptor);
if (!myInitialized) {
doInit(toolWindow);
}
if (toolWindow instanceof ToolWindowEx toolWindowEx) {
toolWindowEx.setTabActions(new NewConsoleAction());
}
} | [
12,
16
] | public void init(final @NotNull ToolWindow toolWindow, final @NotNull RunContentDescriptor contentDescriptor) | 345 | 27,350 |
../intellij-community/java/java-impl/src/com/siyeh/ipp/concatenation/ReplaceFormatStringWithConcatenationIntention.java | buildReplacementExpression | private static String buildReplacementExpression(PsiExpression[] arguments,
int indexOfFormatString,
CommentTracker commentTracker) {
final StringBuilder builder = new StringBuilder();
String value = (String)ExpressionUtils.computeConstantExpression(arguments[indexOfFormatString]);
assert value != null;
value = value.replace("%%", "%");
int start = 0;
int end = value.indexOf("%s");
int count = 0;
while (end >= 0) {
if (end > start) {
if (builder.length() > 0) {
builder.append('+');
}
builder.append('"').append(StringUtil.escapeStringCharacters(value.substring(start, end))).append('"');
}
if (builder.length() > 0) {
builder.append('+');
}
count++;
final PsiExpression argument = arguments[indexOfFormatString + count];
if (builder.length() == 0 && !ExpressionUtils.hasStringType(argument)) {
builder.append("String.valueOf(").append(commentTracker.text(argument)).append(')');
}
else {
builder.append(commentTracker.text(argument, ParenthesesUtils.ADDITIVE_PRECEDENCE));
}
start = end + 2;
end = value.indexOf("%s", start);
}
if (start < value.length()) {
if (builder.length() > 0) {
builder.append('+');
}
builder.append('"').append(StringUtil.escapeStringCharacters(value.substring(start))).append('"');
}
return builder.toString();
} | [
22,
48
] | private static String buildReplacementExpression(PsiExpression[] arguments,
int indexOfFormatString,
CommentTracker commentTracker) | 1,551 | 367,306 |
../intellij-community/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/NonCodeMembersContributor.java | runContributors | public static boolean runContributors(@NotNull PsiType qualifierType,
@NotNull PsiScopeProcessor processor,
@NotNull PsiElement place,
@NotNull ResolveState state) {
ensureInit();
final PsiClass aClass = PsiTypesUtil.getPsiClass(qualifierType);
final Iterable<? extends PsiScopeProcessor> unwrappedOriginals = MultiProcessor.allProcessors(processor);
for (PsiScopeProcessor each : unwrappedOriginals) {
if (!processClassMixins(qualifierType, each, place, state)) {
return false;
}
if (!processCategoriesInScope(qualifierType, each, place, state)) {
return false;
}
if (!processDgmMethods(qualifierType, each, place, state)) {
return false;
}
}
final List<MyDelegatingScopeProcessor> wrapped = Collections.singletonList(new MyDelegatingScopeProcessor(processor));
final List<MyDelegatingScopeProcessor> unwrapped = map(MultiProcessor.allProcessors(processor), MyDelegatingScopeProcessor::new);
final Iterable<NonCodeMembersContributor> contributors = getApplicableContributors(aClass);
for (NonCodeMembersContributor contributor : contributors) {
ProgressManager.checkCanceled();
processor.handleEvent(CHANGE_LEVEL, null);
final List<MyDelegatingScopeProcessor> delegates = contributor.unwrapMultiprocessor() ? unwrapped : wrapped;
for (MyDelegatingScopeProcessor delegatingProcessor : delegates) {
ProgressManager.checkCanceled();
contributor.processDynamicElements(qualifierType, aClass, delegatingProcessor, place, state);
if (!delegatingProcessor.wantMore) {
return false;
}
}
}
return true;
} | [
22,
37
] | public static boolean runContributors(@NotNull PsiType qualifierType,
@NotNull PsiScopeProcessor processor,
@NotNull PsiElement place,
@NotNull ResolveState state) | 1,799 | 164,091 |
../intellij-community/platform/platform-api/src/com/intellij/ide/browsers/BrowserFamily.java | createBrowserSpecificSettings | public @Nullable BrowserSpecificSettings createBrowserSpecificSettings() {
return null;
} | [
41,
70
] | public @Nullable BrowserSpecificSettings createBrowserSpecificSettings() | 95 | 249,600 |
../intellij-community/jps/jps-builders/gen/org/jetbrains/jps/api/CmdlineRemoteProto.java | addTargetId | public Builder addTargetId(
java.lang.String value) {
copyOnWrite();
instance.addTargetId(value);
return this;
} | [
15,
26
] | public Builder addTargetId(
java.lang.String value) | 182 | 337,159 |
../intellij-community/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/typeEnhancers/GrStringConverter.java | isConvertible | @Nullable
@Override
public ConversionResult isConvertible(@NotNull PsiType lType,
@NotNull PsiType rType,
@NotNull Position position,
@NotNull GroovyPsiElement context) {
if (!isClassType(lType, JAVA_LANG_STRING)) return null;
if (position == Position.EXPLICIT_CAST || position == Position.METHOD_PARAMETER) {
return isClassType(rType, GROOVY_LANG_GSTRING)
? ConversionResult.OK
: null;
}
return ConversionResult.OK;
} | [
48,
61
] | @Nullable
@Override
public ConversionResult isConvertible(@NotNull PsiType lType,
@NotNull PsiType rType,
@NotNull Position position,
@NotNull GroovyPsiElement context) | 592 | 168,087 |
../intellij-community/platform/analysis-impl/src/com/intellij/openapi/paths/PsiDynaReference.java | getUnresolvedMessagePattern | @Override
@SuppressWarnings("UnresolvedPropertyKey")
public @NotNull String getUnresolvedMessagePattern() {
final PsiReference reference = chooseReference();
return reference instanceof EmptyResolveMessageProvider ?
((EmptyResolveMessageProvider)reference).getUnresolvedMessagePattern() :
AnalysisBundle.message("cannot.resolve.symbol");
} | [
80,
107
] | @Override
@SuppressWarnings("UnresolvedPropertyKey")
public @NotNull String getUnresolvedMessagePattern() | 376 | 244,839 |
../intellij-community/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/decompose/GenericDominatorEngine.java | isDominator | public boolean isDominator(IGraphNode node, IGraphNode dom) {
while (!node.equals(dom)) {
IGraphNode idom = colOrderedIDoms.getWithKey(node);
if (idom == node) {
return false; // root node or merging point
}
else if (idom == null) {
throw new RuntimeException("Inconsistent idom sequence discovered!");
}
else {
node = idom;
}
}
return true;
} | [
15,
26
] | public boolean isDominator(IGraphNode node, IGraphNode dom) | 427 | 33,018 |
../intellij-community/platform/platform-api/src/com/intellij/util/config/ExternalizablePropertyContainer.java | createListExternalizer | private static <T> Externalizer<List<T>> createListExternalizer(Externalizer<T> itemExternalizer, String itemTagName) {
return new ListExternalizer<>(itemExternalizer, itemTagName);
} | [
41,
63
] | private static <T> Externalizer<List<T>> createListExternalizer(Externalizer<T> itemExternalizer, String itemTagName) | 189 | 254,921 |
../intellij-community/platform/platform-api/src/com/intellij/ui/SearchTextField.java | getSelectedItem | public String getSelectedItem() {
return mySelectedItem;
} | [
14,
29
] | public String getSelectedItem() | 68 | 249,926 |
../intellij-community/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsReferenceExpressionImpl.java | getType | @Override
public PsiType getType() {
return myPatternExpression.getType();
} | [
27,
34
] | @Override
public PsiType getType() | 84 | 497,580 |
../intellij-community/python/python-psi-impl/src/com/jetbrains/python/inspections/PyShadowingNamesInspection.java | processElement | private void processElement(@NotNull PsiNameIdentifierOwner element) {
final ScopeOwner owner = ScopeUtil.getScopeOwner(element);
if (owner instanceof PyClass) {
return;
}
final String name = element.getName();
if (name != null) {
final PsiElement identifier = element.getNameIdentifier();
final PsiElement problemElement = identifier != null ? identifier : element;
if (PyNames.UNDERSCORE.equals(name) || name.startsWith(PyNames.UNDERSCORE) && element instanceof PyParameter) {
return;
}
if (owner != null) {
final ScopeOwner nextOwner = ScopeUtil.getScopeOwner(owner);
if (nextOwner != null) {
final PyResolveProcessor processor = new PyResolveProcessor(name);
PyResolveUtil.scopeCrawlUp(processor, nextOwner, null, name, null);
for (PsiElement resolved : processor.getElements()) {
if (resolved != null) {
final PyComprehensionElement comprehension = PsiTreeUtil.getParentOfType(resolved, PyComprehensionElement.class);
if (comprehension != null && PyUtil.isOwnScopeComprehension(comprehension)) {
return;
}
final Scope scope = ControlFlowCache.getScope(owner);
if (scope.isGlobal(name) || scope.isNonlocal(name)) {
return;
}
if (Arrays.stream(PyInspectionExtension.EP_NAME.getExtensions())
.anyMatch(o -> o.ignoreShadowed(resolved))) {
return;
}
registerProblem(problemElement, PyPsiBundle.message("INSP.shadows.name.from.outer.scope", name),
ProblemHighlightType.WEAK_WARNING, null,
LocalQuickFix.notNullElements(PythonUiService.getInstance().createPyRenameElementQuickFix(problemElement)));
return;
}
}
}
}
}
} | [
13,
27
] | private void processElement(@NotNull PsiNameIdentifierOwner element) | 2,032 | 8,988 |
../intellij-community/python/python-psi-impl/src/com/jetbrains/python/PyStringFormatParser.java | setConversion | public void setConversion(@Nullable String conversion) {
myConversion = conversion;
} | [
12,
25
] | public void setConversion(@Nullable String conversion) | 95 | 8,202 |
../intellij-community/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/assignment/GroovyAssignmentCanBeOperatorAssignmentInspection.java | buildVisitor | @NotNull
@Override
public BaseInspectionVisitor buildVisitor() {
return new ReplaceAssignmentWithOperatorAssignmentVisitor();
} | [
52,
64
] | @NotNull
@Override
public BaseInspectionVisitor buildVisitor() | 137 | 162,636 |
../intellij-community/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/processors/PropertyResolverProcessor.java | getHint | @Override
public <T> T getHint(@NotNull Key<T> hintKey) {
if (hintKey == DynamicMembersHint.KEY) {
//noinspection unchecked
return (T)this;
}
return super.getHint(hintKey);
} | [
25,
32
] | @Override
public <T> T getHint(@NotNull Key<T> hintKey) | 202 | 164,206 |
../intellij-community/plugins/sh/core/gen/com/intellij/sh/psi/impl/ShLiteralExpressionImpl.java | getReferences | @Override
public PsiReference @NotNull [] getReferences() {
return ShPsiImplUtil.getReferences(this);
} | [
44,
57
] | @Override
public PsiReference @NotNull [] getReferences() | 111 | 145,008 |
../intellij-community/plugins/junit/src/com/intellij/execution/junit/JUnitConfiguration.java | getMethodPresentation | public static @NlsSafe String getMethodPresentation(PsiMethod method) {
String methodName = method.getName();
if ((!method.getParameterList().isEmpty() || methodName.contains("(") || methodName.contains(")")) && MetaAnnotationUtil.isMetaAnnotated(method, JUnitUtil.CUSTOM_TESTABLE_ANNOTATION_LIST)) {
return methodName + "(" + ClassUtil.getVMParametersMethodSignature(method) + ")";
}
else {
return methodName;
}
} | [
30,
51
] | public static @NlsSafe String getMethodPresentation(PsiMethod method) | 464 | 53,771 |
../intellij-community/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/BraceEnforcer.java | processText | public TextRange processText(final PsiFile source, final TextRange rangeToReformat) {
myPostProcessor.setResultTextRange(rangeToReformat);
source.accept(this);
return myPostProcessor.getResultTextRange();
} | [
17,
28
] | public TextRange processText(final PsiFile source, final TextRange rangeToReformat) | 220 | 371,404 |
../intellij-community/jps/jps-builders/src/org/jetbrains/jps/builders/java/JavaBuilderUtil.java | getRemovedPaths | private static Set<String> getRemovedPaths(ModuleChunk chunk, DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder) {
if (!dirtyFilesHolder.hasRemovedFiles()) {
return Collections.emptySet();
}
final Set<String> removed = CollectionFactory.createFilePathSet();
for (ModuleBuildTarget target : chunk.getTargets()) {
removed.addAll(dirtyFilesHolder.getRemovedFiles(target));
}
return removed;
} | [
27,
42
] | private static Set<String> getRemovedPaths(ModuleChunk chunk, DirtyFilesHolder<JavaSourceRootDescriptor, ModuleBuildTarget> dirtyFilesHolder) | 456 | 340,394 |
../intellij-community/java/execution/impl/src/com/intellij/execution/application/ApplicationConfigurable.java | resetEditorFrom | @Override
public void resetEditorFrom(@NotNull ApplicationConfiguration configuration) {
myCommonProgramParameters.reset(configuration);
myModuleSelector.reset(configuration);
getMainClassField().setText(getInitialMainClassName(configuration));
myJrePathEditor.setPathOrName(configuration.getAlternativeJrePath(), configuration.isAlternativeJrePathEnabled());
myShortenClasspathModeCombo.getComponent().setSelectedItem(configuration.getShortenCommandLine());
myIncludeProvidedDeps.getComponent().setSelected(configuration.isProvidedScopeIncluded());
hideUnsupportedFieldsIfNeeded();
} | [
24,
39
] | @Override
public void resetEditorFrom(@NotNull ApplicationConfiguration configuration) | 618 | 382,075 |
../intellij-community/plugins/yaml/src/org/jetbrains/yaml/schema/YamlJsonPsiWalker.java | getDefaultArrayValue | @Override
public String getDefaultArrayValue() {
return "- ";
} | [
26,
46
] | @Override
public String getDefaultArrayValue() | 71 | 150,225 |
../intellij-community/platform/util/ui/src/com/intellij/util/ui/JBUI.java | defaultExperimentalToolbarFont | public static @NotNull JBFont defaultExperimentalToolbarFont() {
return JBFont.label();
} | [
30,
60
] | public static @NotNull JBFont defaultExperimentalToolbarFont() | 103 | 227,681 |
../intellij-community/platform/lang-impl/src/com/intellij/execution/runners/AbstractConsoleRunnerWithHistory.java | registerActionShortcuts | public static void registerActionShortcuts(final List<? extends AnAction> actions, final JComponent component) {
for (AnAction action : actions) {
action.registerCustomShortcutSet(action.getShortcutSet(), component);
}
} | [
19,
42
] | public static void registerActionShortcuts(final List<? extends AnAction> actions, final JComponent component) | 236 | 202,573 |
../intellij-community/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/execution/ExternalSystemBeforeRunTaskProvider.java | getName | @Override
public String getName() {
return ExternalSystemBundle.message("tasks.before.run.empty", mySystemId.getReadableName());
} | [
26,
33
] | @Override
public String getName() | 138 | 333,210 |
../intellij-community/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/apply/PlainSimplePatchApplier.java | execute | @Nullable
private String execute() {
if (myHunks.isEmpty()) return myText.toString();
try {
for (PatchHunk hunk : myHunks) {
appendUnchangedLines(hunk.getStartLineBefore());
checkContextLines(hunk);
applyChangedLines(hunk);
}
if (!handleLastLine()) {
appendUnchangedLines(myLineOffsets.getLineCount());
}
return sb.toString();
}
catch (PatchApplyException e) {
LOG.debug(e);
return null;
}
} | [
27,
34
] | @Nullable
private String execute() | 494 | 218,789 |
../intellij-community/java/java-indexing-impl/src/com/intellij/psi/impl/java/JavaFunctionalExpressionIndex.java | getVersion | @Override
public int getVersion() {
return 6;
} | [
23,
33
] | @Override
public int getVersion() | 55 | 382,667 |
../intellij-community/plugins/maven/src/main/java/org/jetbrains/idea/maven/project/MavenModificationTracker.java | projectsIgnoredStateChanged | @Override
public void projectsIgnoredStateChanged(List<? extends MavenProject> ignored, List<? extends MavenProject> unignored, boolean fromImport) {
incModificationCount();
} | [
28,
55
] | @Override
public void projectsIgnoredStateChanged(List<? extends MavenProject> ignored, List<? extends MavenProject> unignored, boolean fromImport) | 195 | 57,919 |
../intellij-community/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java | actionPerformed | @Override
public void actionPerformed(ActionEvent e) {
XExpression text = getInputEditor().getExpression();
EvaluationMode newMode = (myMode == EvaluationMode.EXPRESSION) ? EvaluationMode.CODE_FRAGMENT : EvaluationMode.EXPRESSION;
// remember only on user selection
XDebuggerSettingManagerImpl.getInstanceImpl().getGeneralSettings().setEvaluationDialogMode(newMode);
DebuggerEvaluationStatisticsCollector.MODE_SWITCH.log(myProject, newMode);
switchToMode(newMode, text);
} | [
26,
41
] | @Override
public void actionPerformed(ActionEvent e) | 516 | 261,054 |
../intellij-community/python/python-psi-api/src/com/jetbrains/python/psi/types/PyClassLikeType.java | visitMembers | void visitMembers(@NotNull Processor<? super PsiElement> processor, boolean inherited, @NotNull TypeEvalContext context); | [
5,
17
] | void visitMembers(@NotNull Processor<? super PsiElement> processor, boolean inherited, @NotNull TypeEvalContext context) | 121 | 2,818 |
../intellij-community/plugins/stream-debugger/src/com/intellij/debugger/streams/psi/StreamApiUtil.java | isStreamCall | public static boolean isStreamCall(@NotNull PsiMethodCallExpression expression) {
return isIntermediateStreamCall(expression) || isProducerStreamCall(expression) || isTerminationStreamCall(expression);
} | [
22,
34
] | public static boolean isStreamCall(@NotNull PsiMethodCallExpression expression) | 209 | 34,948 |
../intellij-community/java/idea-ui/src/com/intellij/facet/impl/ui/libraries/LibraryCompositionSettings.java | setSelectedExistingLibrary | public void setSelectedExistingLibrary(@Nullable Library library) {
mySelectedLibrary = library;
} | [
12,
38
] | public void setSelectedExistingLibrary(@Nullable Library library) | 104 | 364,709 |
../intellij-community/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/MarkupModel.java | removeAllHighlighters | void removeAllHighlighters(); | [
5,
26
] | void removeAllHighlighters() | 29 | 300,932 |
../intellij-community/java/java-impl/src/com/siyeh/ig/performance/ListRemoveInLoopInspection.java | getStartEnd | public Couple<String> getStartEnd(PsiLoopStatement loopStatement, CommentTracker ct) {
if (loopStatement instanceof PsiForStatement) {
CountingLoop loop = CountingLoop.from((PsiForStatement)loopStatement);
if (loop == null) return null;
String start, end;
if (loop.isDescending()) {
start = loop.isIncluding() ? ct.text(loop.getBound()) : JavaPsiMathUtil.add(loop.getBound(), 1, ct);
end = JavaPsiMathUtil.add(loop.getInitializer(), 1, ct);
}
else {
start = ct.text(loop.getInitializer());
end = loop.isIncluding() ? JavaPsiMathUtil.add(loop.getBound(), 1, ct) : ct.text(loop.getBound());
}
return Couple.of(start, end);
}
if (loopStatement instanceof PsiWhileStatement) {
PsiBinaryExpression condition =
tryCast(PsiUtil.skipParenthesizedExprDown(((PsiWhileStatement)loopStatement).getCondition()), PsiBinaryExpression.class);
if (condition == null) return null;
RelationType relationType = DfaPsiUtil.getRelationByToken(condition.getOperationTokenType());
if (relationType == null) return null;
PsiExpression left = condition.getLOperand();
PsiExpression right = condition.getROperand();
if (right == null) return null;
String start, end;
switch (relationType) {
case GE -> {
start = JavaPsiMathUtil.add(right, -1, ct);
end = ct.text(left);
}
case GT -> {
start = ct.text(right);
end = ct.text(left);
}
case LE -> {
start = JavaPsiMathUtil.add(left, -1, ct);
end = ct.text(right);
}
case LT -> {
start = ct.text(left);
end = ct.text(right);
}
default -> {
return null;
}
}
return Couple.of(start, end);
}
return null;
} | [
22,
33
] | public Couple<String> getStartEnd(PsiLoopStatement loopStatement, CommentTracker ct) | 1,965 | 366,876 |
../intellij-community/jps/jps-builders/src/org/jetbrains/jps/api/RequestFuture.java | performCancel | @Override
protected void performCancel() throws Exception {
if (myCancelAction != null) {
myCancelAction.cancel(this);
}
} | [
27,
40
] | @Override
protected void performCancel() | 140 | 342,395 |
../intellij-community/platform/lang-impl/src/com/intellij/ide/todo/FileTree.java | add | void add(@NotNull VirtualFile file) {
assertThreadIfNeeded();
if (myFiles.contains(file)) {
return;
}
VirtualFile dir = file.getParent();
if (dir == null) {
LOG.error("Parent is null for " + file);
return;
}
myFiles.add(file);
List<VirtualFile> children = myStrictDirectory2Children.get(dir);
if (children != null) {
LOG.assertTrue(!children.contains(file));
children.add(file);
}
else {
children = ContainerUtil.createConcurrentList();
children.add(file);
myStrictDirectory2Children.put(dir, children);
}
children = myDirectory2Children.get(dir);
if (children != null) {
LOG.assertTrue(!children.contains(file));
children.add(file);
return;
}
else {
children = ContainerUtil.createConcurrentList();
children.add(file);
myDirectory2Children.put(dir, children);
}
VirtualFile parent = dir.getParent();
while (parent != null) {
children = myDirectory2Children.get(parent);
if (children != null) {
if ((!children.contains(dir))) {
children.add(dir);
}
return;
}
else {
children = ContainerUtil.createConcurrentList();
children.add(dir);
myDirectory2Children.put(parent, children);
}
dir = parent;
parent = parent.getParent();
}
} | [
5,
8
] | void add(@NotNull VirtualFile file) | 1,398 | 193,136 |
../intellij-community/plugins/tasks/tasks-core/src/com/intellij/tasks/generic/GenericRepository.java | getIssues | @Override
public Task[] getIssues(final @Nullable String query, final int max, final long since) throws Exception {
if (StringUtil.isEmpty(myTasksListUrl)) {
throw new Exception(TaskBundle.message("task.list.url.configuration.parameter.is.mandatory"));
}
if (!isLoginAnonymously() && !isUseHttpAuthentication()) {
executeMethod(getLoginMethod());
}
List<TemplateVariable> variables = concat(getAllTemplateVariables(),
new TemplateVariable("max", String.valueOf(max)),
new TemplateVariable("since", String.valueOf(since)));
String requestUrl = substituteTemplateVariables(getTasksListUrl(), variables);
String responseBody = executeMethod(getHttpMethod(requestUrl, myTasksListMethodType));
Task[] tasks = getActiveResponseHandler().parseIssues(responseBody, max);
if (myResponseType == ResponseType.TEXT) {
return tasks;
}
if (StringUtil.isNotEmpty(mySingleTaskUrl) && myDownloadTasksInSeparateRequests) {
for (int i = 0; i < tasks.length; i++) {
tasks[i] = findTask(tasks[i].getId());
}
}
return tasks;
} | [
26,
35
] | @Override
public Task[] getIssues(final @Nullable String query, final int max, final long since) | 1,190 | 40,191 |
../intellij-community/platform/dvcs-impl/src/com/intellij/dvcs/repo/AbstractRepositoryManager.java | getRepositoryForFile | @Override
@RequiresBackgroundThread
public @Nullable T getRepositoryForFile(@Nullable VirtualFile file) {
return validateAndGetRepository(myGlobalRepositoryManager.getRepositoryForFile(file));
} | [
59,
79
] | @Override
@RequiresBackgroundThread
public @Nullable T getRepositoryForFile(@Nullable VirtualFile file) | 204 | 242,825 |
../intellij-community/plugins/ui-designer/src/com/intellij/uiDesigner/AbstractToolWindowManager.java | getOppositeManager | @Override
protected LightToolWindowManager getOppositeManager() {
AbstractToolWindowManager designerManager = DesignerToolWindowManager.getInstance(myProject);
AbstractToolWindowManager paletteManager = PaletteToolWindowManager.getInstance(myProject);
return myManager == designerManager ? paletteManager : designerManager;
} | [
49,
67
] | @Override
protected LightToolWindowManager getOppositeManager() | 361 | 174,730 |
../intellij-community/platform/projectModel-impl/src/com/intellij/project/model/impl/module/content/JpsContentEntry.java | getSourceFolders | @NotNull
@Override
public List<SourceFolder> getSourceFolders(@NotNull Set<? extends JpsModuleSourceRootType<?>> rootTypes) {
List<SourceFolder> folders = new SmartList<>();
for (JpsSourceFolder folder : mySourceFolders) {
if (rootTypes.contains(folder.getRootType())) {
folders.add(folder);
}
}
return folders;
} | [
49,
65
] | @NotNull
@Override
public List<SourceFolder> getSourceFolders(@NotNull Set<? extends JpsModuleSourceRootType<?>> rootTypes) | 355 | 225,679 |
../intellij-community/plugins/kotlin/jvm-debugger/core/src/org/jetbrains/kotlin/idea/debugger/core/breakpoints/KotlinBreakpointFiltersPanel.java | concatWithEx | @NlsSafe
private static StringBuilder concatWithEx(StringBuilder builder, List<String> s, String glue, int N, String nthGlue) {
int i = 1;
for (Iterator<String> iterator = s.iterator(); iterator.hasNext(); i++) {
String str = iterator.next();
builder.append(str);
if (iterator.hasNext()) {
if (i % N == 0) {
builder.append(nthGlue);
} else {
builder.append(glue);
}
}
}
return builder;
} | [
42,
54
] | @NlsSafe
private static StringBuilder concatWithEx(StringBuilder builder, List<String> s, String glue, int N, String nthGlue) | 563 | 91,788 |
../intellij-community/jps/jps-builders-6/gen/org/jetbrains/jps/javac/rpc/JavacRemoteProto.java | getContent | com.google.protobuf.ByteString getContent(); | [
31,
41
] | com.google.protobuf.ByteString getContent() | 44 | 334,074 |
../intellij-community/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeViewDiffRequestProcessor.java | createProducer | @Nullable
@Override
public DiffRequestProducer createProducer(@Nullable Project project) {
return UnversionedDiffRequestProducer.create(project, path);
} | [
55,
69
] | @Nullable
@Override
public DiffRequestProducer createProducer(@Nullable Project project) | 171 | 220,685 |
../intellij-community/platform/lang-impl/src/com/intellij/ide/actions/searcheverywhere/SearchListModel.java | expireResults | public void expireResults() {
resultsExpired = true;
} | [
12,
25
] | public void expireResults() | 60 | 194,643 |
../intellij-community/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/synthetic/ClosureSyntheticParameter.java | findSameElementInCopy | @Override
public @NotNull PsiElement findSameElementInCopy(@NotNull PsiFile copy) {
GrClosableBlock block = myClosure.getElement();
if (block == null) {
throw new IllegalStateException("No parent closure");
}
return new ClosureSyntheticParameter(PsiTreeUtil.findSameElementInCopy(block, copy), isOptional());
} | [
39,
60
] | @Override
public @NotNull PsiElement findSameElementInCopy(@NotNull PsiFile copy) | 336 | 166,541 |
../intellij-community/java/java-impl/src/com/intellij/slicer/JavaValueFilter.java | getDfType | DfType getDfType() {
return myDfaFilter == null ? DfType.TOP : myDfaFilter.getDfType();
} | [
7,
16
] | DfType getDfType() | 95 | 369,933 |
../intellij-community/python/src/com/jetbrains/python/findUsages/PyFindUsagesHandlerFactory.java | canFindUsages | @Override
public boolean canFindUsages(@NotNull PsiElement element) {
return PyPsiFindUsagesHandlerFactory.super.canFindUsages(element);
} | [
27,
40
] | @Override
public boolean canFindUsages(@NotNull PsiElement element) | 146 | 24,674 |
../intellij-community/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/handlers/DeclarationStatementHandler.java | match | @Override
public boolean match(PsiElement patternNode, PsiElement matchedNode, @NotNull MatchContext context) {
if (patternNode instanceof PsiComment) {
return myCommentHandler.match(patternNode, matchedNode, context);
}
if (!super.match(patternNode, matchedNode, context)) {
return false;
}
final PsiDeclarationStatement dcl = (PsiDeclarationStatement)patternNode;
if (matchedNode instanceof PsiDeclarationStatement) {
return context.getMatcher().matchSequentially(SsrFilteringNodeIterator.create(patternNode.getFirstChild()),
SsrFilteringNodeIterator.create(matchedNode.getFirstChild()));
}
final PsiElement[] declared = dcl.getDeclaredElements();
// declaration statement could wrap class or dcl
if (declared.length > 0 && !(matchedNode.getParent() instanceof PsiDeclarationStatement) /* skip twice matching for child*/) {
if (!(matchedNode instanceof PsiField)) {
return context.getMatcher().matchSequentially(
new ArrayBackedNodeIterator(declared),
new CountingNodeIterator(declared.length, SsrFilteringNodeIterator.create(matchedNode))
);
}
// special handling for multiple fields in single declaration
final PsiElement sibling = PsiTreeUtil.skipWhitespacesAndCommentsBackward(matchedNode);
if (PsiUtil.isJavaToken(sibling, JavaTokenType.COMMA)) {
return false;
}
final List<PsiElement> matchNodes = new ArrayList<>();
matchNodes.add(matchedNode);
PsiElement node = matchedNode;
node = PsiTreeUtil.skipWhitespacesAndCommentsForward(node);
while (PsiUtil.isJavaToken(node, JavaTokenType.COMMA)) {
node = PsiTreeUtil.skipWhitespacesAndCommentsForward(node);
if (node instanceof PsiField) {
matchNodes.add(node);
}
node = PsiTreeUtil.skipWhitespacesAndCommentsForward(node);
}
boolean result = context.getMatcher().matchSequentially(
new ArrayBackedNodeIterator(declared),
new ArrayBackedNodeIterator(matchNodes.toArray(PsiElement.EMPTY_ARRAY))
);
if (result) {
for (PsiElement matchNode : matchNodes) {
context.addMatchedNode(matchNode);
}
}
if (result && declared[0] instanceof PsiVariable) {
// we may have comments behind to match!
final PsiElement lastChild = dcl.getLastChild();
if (lastChild instanceof PsiComment) {
final PsiElement[] fieldChildren = matchedNode.getChildren();
result = context.getPattern().getHandler(lastChild).match(lastChild, fieldChildren[fieldChildren.length - 1], context);
}
}
return result;
}
return false;
} | [
27,
32
] | @Override
public boolean match(PsiElement patternNode, PsiElement matchedNode, @NotNull MatchContext context) | 2,767 | 360,360 |
../intellij-community/platform/remote-servers/api/src/com/intellij/remoteServer/runtime/Deployment.java | getRuntime | @Nullable
DeploymentRuntime getRuntime(); | [
30,
40
] | @Nullable
DeploymentRuntime getRuntime() | 43 | 265,694 |
../intellij-community/platform/platform-api/src/com/intellij/ide/util/treeView/TreeState.java | writeExternal | @Override
public void writeExternal(Element element) {
writeExternal(element, myExpandedPaths, EXPAND_TAG);
writeExternal(element, mySelectedPaths, SELECT_TAG);
writeExternal(element, myPresentationData);
} | [
24,
37
] | @Override
public void writeExternal(Element element) | 222 | 249,408 |
../intellij-community/java/manifest/src/org/jetbrains/lang/manifest/parser/ManifestParser.java | consumeHeaderValue | private static void consumeHeaderValue(PsiBuilder builder) {
while (!builder.eof() && !HEADER_END_TOKENS.contains(builder.getTokenType())) {
builder.advanceLexer();
}
} | [
20,
38
] | private static void consumeHeaderValue(PsiBuilder builder) | 184 | 356,913 |
../intellij-community/java/java-psi-api/src/com/intellij/psi/util/MethodSignatureHandMade.java | getName | @NotNull
@Override
public String getName() {
return myName;
} | [
37,
44
] | @NotNull
@Override
public String getName() | 71 | 489,123 |
../intellij-community/plugins/ant/src/com/intellij/lang/ant/config/impl/configuration/AnActionListEditor.java | setItems | public void setItems(Collection<? extends T> items) {
DefaultListModel<T> model = myForm.getListModel();
model.removeAllElements();
for (T item : items) {
model.addElement(item);
}
ScrollingUtil.ensureSelectionExists(getList());
} | [
12,
20
] | public void setItems(Collection<? extends T> items) | 258 | 29,423 |
../intellij-community/java/compiler/impl/src/com/intellij/compiler/progress/CompilerMessagesService.java | isFinished | @Override
public boolean isFinished(@NotNull TaskInfo task) {
return false;
} | [
29,
39
] | @Override
public boolean isFinished(@NotNull TaskInfo task) | 91 | 491,534 |
../intellij-community/python/python-sdk/src/com/jetbrains/python/sdk/PySdkUtil.java | getProcessOutput | @NotNull
public static ProcessOutput getProcessOutput(String homePath, @NonNls String[] command) {
return getProcessOutput(homePath, command, -1);
} | [
39,
55
] | @NotNull
public static ProcessOutput getProcessOutput(String homePath, @NonNls String[] command) | 156 | 1,355 |
../intellij-community/python/python-psi-impl/src/com/jetbrains/python/psi/stubs/PropertyStubStorage.java | deserialize | public static PropertyStubStorage deserialize(StubInputStream stream) throws IOException {
PropertyStubStorage me = new PropertyStubStorage();
me.myGetter = readOne(stream);
me.mySetter = readOne(stream);
me.myDeleter = readOne(stream);
//
me.myDoc = stream.readNameString();
return me;
} | [
34,
45
] | public static PropertyStubStorage deserialize(StubInputStream stream) | 320 | 11,165 |
../intellij-community/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/common/PsiTreeElementBase.java | getChildrenWithoutCustomRegions | public final @NotNull List<StructureViewTreeElement> getChildrenWithoutCustomRegions() {
return doGetChildren(false);
} | [
53,
84
] | public final @NotNull List<StructureViewTreeElement> getChildrenWithoutCustomRegions() | 125 | 283,258 |
../intellij-community/platform/lang-api/src/com/intellij/application/options/codeStyle/properties/WrapOnTypingAccessor.java | parseString | @Override
protected @Nullable Boolean parseString(@NotNull String string) {
return "true".equalsIgnoreCase(string);
} | [
40,
51
] | @Override
protected @Nullable Boolean parseString(@NotNull String string) | 125 | 216,896 |
../intellij-community/plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/tooling/serialization/internal/adapter/InternalIdeaJavaLanguageSettings.java | setJdk | public void setJdk(InternalInstalledJdk jdk) {
this.jdk = jdk;
} | [
12,
18
] | public void setJdk(InternalInstalledJdk jdk) | 70 | 141,600 |
../intellij-community/java/java-impl-inspections/src/com/intellij/codeInspection/varScopeCanBeNarrowed/FieldCanBeLocalInspection.java | isImmutableState | private static boolean isImmutableState(PsiType type) {
return type instanceof PsiPrimitiveType ||
PsiPrimitiveType.getUnboxedType(type) != null ||
Comparing.strEqual(CommonClassNames.JAVA_LANG_STRING, type.getCanonicalText());
} | [
23,
39
] | private static boolean isImmutableState(PsiType type) | 257 | 379,975 |
../intellij-community/java/debugger/impl/src/com/intellij/debugger/engine/requests/RequestManagerImpl.java | registerRequest | public void registerRequest(Requestor requestor, EventRequest request) {
myRequestorToBelongedRequests.computeIfAbsent(requestor, r -> new HashSet<>()).add(request);
} | [
12,
27
] | public void registerRequest(Requestor requestor, EventRequest request) | 173 | 387,697 |
../intellij-community/python/python-psi-impl/src/com/jetbrains/python/inspections/PyPep8NamingInspection.java | visitPyClass | @Override
public void visitPyClass(@NotNull PyClass node) {
final String name = node.getName();
if (name == null) return;
final String errorCode = "N801";
if (!ignoredErrors.contains(errorCode)) {
final boolean isLowercaseContextManagerClass = isContextManager(node) && LOWERCASE_REGEX.matcher(name).matches();
if (!isLowercaseContextManagerClass && !MIXEDCASE_REGEX.matcher(name).matches()) {
final ASTNode nameNode = node.getNameNode();
if (nameNode != null) {
registerAndAddRenameAndIgnoreErrorQuickFixes(nameNode.getPsi(), errorCode);
}
}
}
} | [
26,
38
] | @Override
public void visitPyClass(@NotNull PyClass node) | 650 | 8,901 |
../intellij-community/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsAnnotationParameterListImpl.java | appendMirrorText | @Override
public void appendMirrorText(int indentLevel, @NotNull StringBuilder buffer) {
if (myAttributes.length != 0) {
buffer.append("(");
for (int i = 0; i < myAttributes.length; i++) {
if (i > 0) buffer.append(", ");
myAttributes[i].appendMirrorText(indentLevel, buffer);
}
buffer.append(")");
}
} | [
24,
40
] | @Override
public void appendMirrorText(int indentLevel, @NotNull StringBuilder buffer) | 353 | 498,314 |
../intellij-community/java/java-impl/src/com/intellij/codeInsight/generation/ui/GenerateEqualsWizard.java | getFieldsToNonNull | @Override
protected HashMap<PsiMember, MemberInfo> getFieldsToNonNull() {
return myFieldsToNonNull;
} | [
55,
73
] | @Override
protected HashMap<PsiMember, MemberInfo> getFieldsToNonNull() | 115 | 378,246 |
../intellij-community/java/execution/openapi/src/com/intellij/execution/JavaExecutionUtil.java | getShortClassName | public static String getShortClassName(@Nullable String fqName) {
return fqName == null ? "" : StringUtil.getShortName(fqName);
} | [
21,
38
] | public static String getShortClassName(@Nullable String fqName) | 135 | 382,329 |
../intellij-community/jps/jps-builders/src/org/jetbrains/jps/builders/java/dependencyView/Difference.java | isPrivate | public static boolean isPrivate(int access) {
return (access & Opcodes.ACC_PRIVATE) != 0;
} | [
22,
31
] | public static boolean isPrivate(int access) | 97 | 340,613 |
../intellij-community/platform/analysis-impl/src/com/intellij/lang/LanguagePerFileMappings.java | getProject | @Override
protected @NotNull Project getProject() {
return Objects.requireNonNull(super.getProject());
} | [
39,
49
] | @Override
protected @NotNull Project getProject() | 112 | 244,897 |
../intellij-community/plugins/git4idea/src/git4idea/commands/Git.java | untrackedFiles | @Deprecated
@NotNull
Set<VirtualFile> untrackedFiles(@NotNull Project project, @NotNull VirtualFile root,
@Nullable Collection<? extends VirtualFile> files) throws VcsException; | [
42,
56
] | @Deprecated
@NotNull
Set<VirtualFile> untrackedFiles(@NotNull Project project, @NotNull VirtualFile root,
@Nullable Collection<? extends VirtualFile> files) | 215 | 37,506 |
../intellij-community/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/FileTemplateManagerImpl.java | getState | @Override
public @NotNull State getState() {
state.SCHEME = scheme.getName();
return state;
} | [
34,
42
] | @Override
public @NotNull State getState() | 105 | 195,520 |
../intellij-community/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/ui/ExternalSystemJdkComboBox.java | getSelectedValue | @Nullable
public String getSelectedValue() {
final DefaultComboBoxModel model = (DefaultComboBoxModel)getModel();
final Object item = model.getSelectedItem();
return item != null ? ((JdkComboBoxItem)item).jdkName : null;
} | [
26,
42
] | @Nullable
public String getSelectedValue() | 238 | 332,447 |
../intellij-community/platform/core-impl/src/com/intellij/psi/impl/BlockSupportImpl.java | reparseRange | @Override
public @NotNull DiffLog reparseRange(@NotNull PsiFile file,
@NotNull FileASTNode oldFileNode,
@NotNull TextRange changedPsiRange,
@NotNull CharSequence newFileText,
@NotNull ProgressIndicator indicator,
@NotNull CharSequence lastCommittedText) {
return reparse(file, oldFileNode, changedPsiRange, newFileText, indicator, lastCommittedText).log;
} | [
36,
48
] | @Override
public @NotNull DiffLog reparseRange(@NotNull PsiFile file,
@NotNull FileASTNode oldFileNode,
@NotNull TextRange changedPsiRange,
@NotNull CharSequence newFileText,
@NotNull ProgressIndicator indicator,
@NotNull CharSequence lastCommittedText) | 559 | 184,759 |
../intellij-community/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/conflicts/ChangelistConflictTracker.java | ignoreConflict | public void ignoreConflict(@NotNull VirtualFile file, boolean ignore) {
String path = file.getPath();
Conflict conflict = myConflicts.get(path);
if (conflict == null) {
conflict = new Conflict();
myConflicts.put(path, conflict);
}
conflict.ignored = ignore;
FileStatusManager.getInstance(myProject).fileStatusChanged(file);
EditorNotifications.getInstance(myProject).updateNotifications(file);
} | [
12,
26
] | public void ignoreConflict(@NotNull VirtualFile file, boolean ignore) | 438 | 222,190 |
../intellij-community/platform/editor-ui-api/src/com/intellij/ide/util/treeView/smartTree/TreeModel.java | getGroupers | Grouper @NotNull [] getGroupers(); | [
20,
31
] | Grouper @NotNull [] getGroupers() | 34 | 299,748 |
../intellij-community/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/CompiledPattern.java | isRealTypedVar | public boolean isRealTypedVar(PsiElement element) {
if (element == null || element.getTextLength() <= 0) {
return false;
}
final String str = getTypedVarString(element);
return !str.isEmpty() && isTypedVar(str);
} | [
15,
29
] | public boolean isRealTypedVar(PsiElement element) | 237 | 270,211 |
../intellij-community/platform/platform-api/src/com/intellij/ui/jcef/JBCefAppArmorUtils.java | getApparmorProfilePath | static String getApparmorProfilePath() {
final Path configDirPath = Path.of("/etc/apparmor.d");
if (!Files.exists(configDirPath) || !Files.isDirectory(configDirPath)) {
LOG.warn("Can't generate the apparmor profile for CEF: /etc/apparmor.d doesn't exists");
return null;
}
String appName = getApplicationName();
for (int i = 0; i <= 1000; ++i) {
String fileName = appName + (i == 0 ? "" : "-" + i);
Path configPath = configDirPath.resolve(fileName);
if (!Files.exists(configPath)) {
return configPath.toString();
}
}
LOG.warn("Can't generate the apparmor profile for CEF: failed to find the filename");
return null;
} | [
14,
36
] | static String getApparmorProfilePath() | 697 | 252,158 |
../intellij-community/java/idea-ui/src/com/intellij/jarRepository/RepositoryAddLibraryAction.java | applyFix | @Override
public void applyFix(@NotNull Project project, PsiFile file, @Nullable Editor editor) {
addLibraryToModule(libraryDescription, module);
} | [
24,
32
] | @Override
public void applyFix(@NotNull Project project, PsiFile file, @Nullable Editor editor) | 155 | 361,730 |
../intellij-community/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyFileBaseImpl.java | getGroovyControlFlow | public GroovyControlFlow getGroovyControlFlow() {
assert isValid();
GroovyControlFlow result = dereference(myControlFlow);
if (result == null) {
result = ControlFlowBuilder.buildControlFlow(this);
myControlFlow = new SoftReference<>(result);
}
return result;
} | [
25,
45
] | public GroovyControlFlow getGroovyControlFlow() | 294 | 165,053 |
../intellij-community/plugins/gradle/tooling-extension-api/src/org/jetbrains/plugins/gradle/model/AnnotationProcessingModel.java | bySourceSetName | @Nullable
AnnotationProcessingConfig bySourceSetName(@NotNull String sourceSetName); | [
39,
54
] | @Nullable
AnnotationProcessingConfig bySourceSetName(@NotNull String sourceSetName) | 86 | 141,883 |
../intellij-community/java/java-impl/src/com/siyeh/ig/migration/ForCanBeForeachInspection.java | isIteratorNextDeclaration | static boolean isIteratorNextDeclaration(
PsiStatement statement, PsiVariable iterator,
PsiType contentType) {
if (!(statement instanceof PsiDeclarationStatement declarationStatement)) {
return false;
}
final PsiElement[] declaredElements =
declarationStatement.getDeclaredElements();
if (declaredElements.length != 1) {
return false;
}
final PsiElement declaredElement = declaredElements[0];
if (!(declaredElement instanceof PsiVariable variable)) {
return false;
}
final PsiExpression initializer = variable.getInitializer();
return isIteratorNext(initializer, iterator, contentType);
} | [
15,
40
] | static boolean isIteratorNextDeclaration(
PsiStatement statement, PsiVariable iterator,
PsiType contentType) | 662 | 367,050 |
../intellij-community/plugins/java-i18n/src/com/intellij/codeInspection/i18n/folding/PropertyFoldingEditHandler.java | valueToPlaceholderOffset | public int valueToPlaceholderOffset(int offset) {
offset++;
if (myCallExpression == null) return offset;
Pair<String, List<Couple<Integer>>> info = PropertyFoldingBuilder.format(myCallExpression);
List<Couple<Integer>> replacements = info.second;
if (replacements == null) return offset;
Iterator<Couple<Integer>> it = replacements.iterator();
int diff = 0;
while (it.hasNext()) {
Couple<Integer> start = it.next();
Couple<Integer> end = it.next();
if (offset <= start.first) return offset - start.first + start.second;
if (offset < end.first) return end.second - 1;
diff = end.second - end.first;
}
return offset + diff;
} | [
11,
35
] | public int valueToPlaceholderOffset(int offset) | 695 | 55,370 |
../intellij-community/platform/platform-api/src/com/intellij/ide/util/BrowseFilesListener.java | getFileToSelect | protected @Nullable VirtualFile getFileToSelect() {
final String path = myTextField.getText().trim().replace(File.separatorChar, '/');
if (path.length() > 0) {
File file = new File(path);
while (file != null && !file.exists()) {
file = file.getParentFile();
}
if (file != null) {
return LocalFileSystem.getInstance().findFileByIoFile(file);
}
}
return null;
} | [
32,
47
] | protected @Nullable VirtualFile getFileToSelect() | 423 | 249,325 |
../intellij-community/platform/diff-impl/src/com/intellij/diff/tools/util/side/OnesideTextDiffViewer.java | getEditor | @NotNull
public EditorEx getEditor() {
return getEditorHolder().getEditor();
} | [
27,
36
] | @NotNull
public EditorEx getEditor() | 86 | 273,193 |
../intellij-community/jps/jps-builders/src/org/jetbrains/jps/dependency/DifferentiateResult.java | getAffectedSources | Iterable<NodeSource> getAffectedSources(); | [
21,
39
] | Iterable<NodeSource> getAffectedSources() | 42 | 341,291 |
../intellij-community/platform/core-nio-fs/src/com/intellij/platform/core/nio/fs/DelegatingFileSystemProvider.java | newFileChannel | @Override
public FileChannel newFileChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException {
return getDelegate(path, null).newFileChannel(fromDelegatePath(path), options, attrs);
} | [
31,
45
] | @Override
public FileChannel newFileChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) | 234 | 263,939 |