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/plugins/git4idea/src/git4idea/branch/GitBranchIncomingOutgoingManager.java | calcBranchesWithIncoming | private @NotNull Set<GitLocalBranch> calcBranchesWithIncoming(@NotNull GitRepository repository) {
Set<GitLocalBranch> result = new HashSet<>();
GitBranchesCollection branchesCollection = repository.getBranches();
Map<GitLocalBranch, Hash> cachedBranchesToFetch = myLocalBranchesToFetch.get(repository);
branchesCollection.getLocalBranches().forEach(localBranch -> {
GitBranchTrackInfo info = GitBranchUtil.getTrackInfoForBranch(repository, localBranch);
if (info == null) return;
Hash localHashForRemoteBranch = branchesCollection.getHash(info.getRemoteBranch());
Hash localHash = branchesCollection.getHash(localBranch);
if (localHashForRemoteBranch == null) return;
if (hasCommitsForBranch(repository, info.getLocalBranch(), localHash, localHashForRemoteBranch, true)) {
result.add(info.getLocalBranch());
}
else if (cachedBranchesToFetch != null && localHashForRemoteBranch.equals(cachedBranchesToFetch.get(localBranch))) {
result.add(info.getLocalBranch());
}
});
return result;
} | [
37,
61
] | private @NotNull Set<GitLocalBranch> calcBranchesWithIncoming(@NotNull GitRepository repository) | 1,084 | 35,910 |
../intellij-community/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/psi/impl/XPathVariableReferenceImpl.java | getElement | @Override
@NotNull
public PsiElement getElement() {
return this;
} | [
45,
55
] | @Override
@NotNull
public PsiElement getElement() | 86 | 50,816 |
../intellij-community/platform/platform-api/src/com/intellij/ui/components/JBList.java | itemToText | protected @Nullable String itemToText(int index, E value) {
ListCellRenderer<? super E> renderer = getCellRenderer();
Component c = renderer == null ? null : renderer.getListCellRendererComponent(this, value, index, true, true);
if (c != null) {
c = ExpandedItemRendererComponentWrapper.unwrap(c);
}
if (c instanceof KotlinUIDslRendererComponent uiDslRendererComponent) {
return uiDslRendererComponent.getCopyText();
}
SimpleColoredComponent coloredComponent = null;
if (c instanceof JComponent) {
coloredComponent = UIUtil.findComponentOfType((JComponent)c, SimpleColoredComponent.class);
}
return coloredComponent != null ? coloredComponent.getCharSequence(true).toString() :
c instanceof JTextComponent ? ((JTextComponent)c).getText() :
c instanceof JLabel ? ((JLabel)c).getText() :
value != null ? value.toString() : null;
} | [
27,
37
] | protected @Nullable String itemToText(int index, E value) | 923 | 253,184 |
../intellij-community/xml/xml-psi-impl/src/com/intellij/xml/util/IncludedXmlText.java | getPrevSiblingInTag | @Override
public XmlTagChild getPrevSiblingInTag() {
return null;
} | [
31,
50
] | @Override
public XmlTagChild getPrevSiblingInTag() | 75 | 506,608 |
../intellij-community/java/java-analysis-impl/src/com/siyeh/ig/visibility/ClassEscapesItsScopeInspection.java | visitReferenceElement | @Override
public void visitReferenceElement(@NotNull PsiJavaCodeReferenceElement reference) {
super.visitReferenceElement(reference);
PsiMember member = getExportingMember(reference);
if (member == null || isPrivate(member)) {
return;
}
PsiElement resolved = reference.resolve();
if (!(resolved instanceof PsiClass psiClass) || resolved instanceof PsiTypeParameter) {
return;
}
for (VisibilityChecker checker : myCheckers) {
if (checker.checkVisibilityIssue(member, psiClass, reference)) {
return;
}
}
} | [
26,
47
] | @Override
public void visitReferenceElement(@NotNull PsiJavaCodeReferenceElement reference) | 607 | 345,760 |
../intellij-community/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/groovydoc/psi/impl/GrDocFieldReferenceImpl.java | multiResolveImpl | @Override
protected ResolveResult[] multiResolveImpl() {
String name = getReferenceName();
GrDocReferenceElement holder = getReferenceHolder();
PsiElement resolved;
if (holder != null) {
GrCodeReferenceElement referenceElement = holder.getReferenceElement();
resolved = referenceElement != null ? referenceElement.resolve() : null;
} else {
resolved = PsiUtil.getContextClass(GrDocCommentUtil.findDocOwner(this));
}
if (resolved instanceof PsiClass) {
PropertyResolverProcessor processor = new PropertyResolverProcessor(name, this);
resolved.processDeclarations(processor, ResolveState.initial(), resolved, this);
GroovyResolveResult[] candidates = processor.getCandidates();
if (candidates.length == 0) {
PsiType thisType = JavaPsiFacade.getInstance(getProject()).getElementFactory().createType((PsiClass) resolved, PsiSubstitutor.EMPTY);
MethodResolverProcessor methodProcessor = new MethodResolverProcessor(name, this, false, thisType, null, PsiType.EMPTY_ARRAY);
MethodResolverProcessor constructorProcessor = new MethodResolverProcessor(name, this, true, thisType, null, PsiType.EMPTY_ARRAY);
resolved.processDeclarations(methodProcessor, ResolveState.initial(), resolved, this);
resolved.processDeclarations(constructorProcessor, ResolveState.initial(), resolved, this);
candidates = ArrayUtil.mergeArrays(methodProcessor.getCandidates(), constructorProcessor.getCandidates());
if (candidates.length > 0) {
candidates = new GroovyResolveResult[]{candidates[0]};
}
}
return candidates;
}
return ResolveResult.EMPTY_ARRAY;
} | [
38,
54
] | @Override
protected ResolveResult[] multiResolveImpl() | 1,696 | 163,964 |
../intellij-community/platform/indexing-impl/src/com/intellij/psi/stubs/StubTreeSerializerBase.java | serializeSelf | private void serializeSelf(Stub stub,
@NotNull StubOutputStream stream,
@NotNull SerializationState state) throws IOException {
if (((ObjectStubBase<?>)stub).isDangling()) {
stream.writeByte(0);
}
writeSerializerId(stub, stream, state).serialize(stub, stream);
} | [
13,
26
] | private void serializeSelf(Stub stub,
@NotNull StubOutputStream stream,
@NotNull SerializationState state) | 340 | 301,985 |
../intellij-community/platform/projectModel-api/src/com/intellij/openapi/roots/ImmutableSyntheticLibrary.java | getBinaryRoots | @Override
public @NotNull Collection<VirtualFile> getBinaryRoots() {
return myBinaryRoots;
} | [
52,
66
] | @Override
public @NotNull Collection<VirtualFile> getBinaryRoots() | 100 | 305,138 |
../intellij-community/platform/core-impl/src/com/intellij/psi/impl/source/tree/LeafPsiElement.java | getContext | @Override
public PsiElement getContext() {
return getParent();
} | [
30,
40
] | @Override
public PsiElement getContext() | 72 | 185,899 |
../intellij-community/platform/util/src/com/intellij/util/containers/FilteredTraverserBase.java | reset | public Meta<T> reset() {
return new Meta<>(roots, TreeTraversal.PRE_ORDER_DFS, tree, Cond.TRUE, Cond.TRUE, Cond.TRUE,
forceExpand, forceIgnore, forceDisregard, interceptor, original);
} | [
15,
20
] | public Meta<T> reset() | 219 | 238,154 |
../intellij-community/plugins/svn4idea/src/org/jetbrains/idea/svn/history/Fragment.java | isConsistentWithOlder | public boolean isConsistentWithOlder() {
return myConsistentWithOlder;
} | [
15,
36
] | public boolean isConsistentWithOlder() | 78 | 153,529 |
../intellij-community/platform/util/src/com/intellij/util/io/PersistentMap.java | containsMapping | boolean containsMapping(K key) throws IOException; | [
8,
23
] | boolean containsMapping(K key) | 50 | 235,436 |
../intellij-community/platform/platform-impl/src/com/intellij/openapi/command/impl/CommandMerger.java | reset | private void reset() {
reset(
new UndoRedoList<>(),
new HashSet<>(),
new HashSet<>(),
null,
false,
false,
null,
true,
null,
null,
UndoConfirmationPolicy.DEFAULT
);
} | [
13,
18
] | private void reset() | 241 | 324,022 |
../intellij-community/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagDelegate.java | getLocalNamespaceDeclarations | @NotNull
Map<String, String> getLocalNamespaceDeclarations() {
Map<String, String> namespaces = new HashMap<>();
for (final XmlAttribute attribute : myTag.getAttributes()) {
if (!attribute.isNamespaceDeclaration() || attribute.getValue() == null) continue;
// xmlns -> "", xmlns:a -> a
final String localName = attribute.getLocalName();
namespaces.put(localName.equals(attribute.getName()) ? "" : localName, attribute.getValue());
}
return namespaces;
} | [
31,
60
] | @NotNull
Map<String, String> getLocalNamespaceDeclarations() | 497 | 507,533 |
../intellij-community/platform/platform-api/src/com/intellij/util/ui/ComponentWithEmptyText.java | getEmptyText | @NotNull StatusText getEmptyText(); | [
20,
32
] | @NotNull StatusText getEmptyText() | 35 | 254,246 |
../intellij-community/java/openapi/src/com/intellij/util/xml/converters/values/GenericDomValueConvertersRegistry.java | getCustomConverter | @Nullable
protected Converter<?> getCustomConverter(Pair<PsiType, GenericDomValue> pair) {
return null;
} | [
35,
53
] | @Nullable
protected Converter<?> getCustomConverter(Pair<PsiType, GenericDomValue> pair) | 113 | 359,596 |
../intellij-community/platform/code-style-impl/src/com/intellij/psi/impl/source/PostprocessReformattingAspectImpl.java | visitNode | @Override
protected boolean visitNode(TreeElement element) {
if (nodesToProcess.contains(element)) return false;
final boolean currentNodeGenerated = CodeEditUtil.isNodeGenerated(element);
CodeEditUtil.setNodeGenerated(element, false);
if (currentNodeGenerated && !inGeneratedContext) {
rangesToProcess.add(new ReformatTask(document.createRangeMarker(element.getTextRange())));
inGeneratedContext = true;
}
if (!currentNodeGenerated && inGeneratedContext) {
if (element.getElementType() == TokenType.WHITE_SPACE) return false;
int oldIndent = CodeEditUtil.getOldIndentation(element);
if (oldIndent < 0) {
LOG.warn("For not generated items old indentation must be defined: element " + element);
oldIndent = 0;
}
CodeEditUtil.setOldIndentation(element, -1);
for (TextRange indentRange : getEnabledRanges(element.getPsi())) {
rangesToProcess.add(new ReindentTask(document.createRangeMarker(indentRange), oldIndent));
}
inGeneratedContext = false;
}
return true;
} | [
36,
45
] | @Override
protected boolean visitNode(TreeElement element) | 1,219 | 269,134 |
../intellij-community/platform/lang-impl/src/com/intellij/codeInsight/template/macro/EnumMacro.java | calculateResult | @Override
public Result calculateResult(Expression @NotNull [] params, ExpressionContext context) {
if (params.length == 0) return null;
return params[0].calculateResult(context);
} | [
26,
41
] | @Override
public Result calculateResult(Expression @NotNull [] params, ExpressionContext context) | 193 | 212,047 |
../intellij-community/python/python-psi-impl/src/com/jetbrains/python/codeInsight/intentions/convertToFString/NewStyleConvertToFStringProcessor.java | processSubstitutionChunk | @Override
protected boolean processSubstitutionChunk(@NotNull Field field, @NotNull StringBuilder fStringText) {
final String stringText = myPyString.getText();
// Actual format field
fStringText.append("{");
final PySubstitutionChunkReference reference = createReference(field);
final PyExpression resolveResult = adjustResolveResult(reference.resolve());
if (resolveResult == null) return false;
final PsiElement adjusted = prepareExpressionToInject(resolveResult, field);
if (adjusted == null) return false;
fStringText.append(adjusted.getText());
final String quotedAttrsAndItems = quoteItemsInFragments(field);
if (quotedAttrsAndItems == null) return false;
fStringText.append(quotedAttrsAndItems);
// Conversion is copied as is if it's present
final String conversion = field.getConversion();
if (conversion != null) {
fStringText.append(conversion);
}
// Format spec is copied if present handling nested fields
final TextRange specRange = field.getFormatSpecRange();
if (specRange != null) {
int specOffset = specRange.getStartOffset();
// Do not proceed too nested fields
if (field.getDepth() == 1) {
for (Field nestedField : field.getNestedFields()) {
// Copy text of the format spec between nested fragments
fStringText.append(stringText, specOffset, nestedField.getLeftBraceOffset());
specOffset = nestedField.getFieldEnd();
// recursively format nested field
if (!processSubstitutionChunk(nestedField, fStringText)) {
return false;
}
}
}
if (specOffset < specRange.getEndOffset()) {
fStringText.append(stringText, specOffset, specRange.getEndOffset());
}
}
fStringText.append("}");
return true;
} | [
30,
54
] | @Override
protected boolean processSubstitutionChunk(@NotNull Field field, @NotNull StringBuilder fStringText) | 1,847 | 12,957 |
../intellij-community/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/codeInspection/exception/GroovyContinueOrBreakFromFinallyBlockInspection.java | buildVisitor | @NotNull
@Override
public BaseInspectionVisitor buildVisitor() {
return new Visitor();
} | [
52,
64
] | @NotNull
@Override
public BaseInspectionVisitor buildVisitor() | 98 | 163,207 |
../intellij-community/java/java-psi-impl/src/com/intellij/codeInsight/ExceptionUtil.java | collectUnhandledExceptions | public static @NotNull Collection<PsiClassType> collectUnhandledExceptions(@NotNull PsiElement element, @Nullable PsiElement topElement, @NotNull PsiCallExpression skippedCall) {
return UnhandledExceptions.collect(element, topElement, c -> c == skippedCall).exceptions();
} | [
48,
74
] | public static @NotNull Collection<PsiClassType> collectUnhandledExceptions(@NotNull PsiElement element, @Nullable PsiElement topElement, @NotNull PsiCallExpression skippedCall) | 279 | 499,798 |
../intellij-community/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/DiffShelvedChangesActionProvider.java | createDiffProducer | private static @Nullable ChangeDiffRequestChain.Producer createDiffProducer(@NotNull Project project,
@NotNull String base,
@NotNull ApplyPatchContext patchContext,
@NotNull ShelvedWrapper shelvedWrapper,
boolean withLocal) {
ShelvedChange textChange = shelvedWrapper.getShelvedChange();
if (textChange != null) {
return processTextChange(project, base, patchContext, textChange, withLocal);
}
ShelvedBinaryFile binaryChange = shelvedWrapper.getBinaryFile();
if (binaryChange != null) {
return processBinaryChange(project, base, binaryChange);
}
return null;
} | [
57,
75
] | private static @Nullable ChangeDiffRequestChain.Producer createDiffProducer(@NotNull Project project,
@NotNull String base,
@NotNull ApplyPatchContext patchContext,
@NotNull ShelvedWrapper shelvedWrapper,
boolean withLocal) | 914 | 223,109 |
../intellij-community/plugins/gradle/src/org/jetbrains/plugins/gradle/service/settings/IdeaGradleProjectSettingsControlBuilder.java | getSdkLookupProvider | private @NotNull SdkLookupProvider getSdkLookupProvider(@NotNull Project project) {
return getGradleJvmLookupProvider(project, myInitialSettings);
} | [
35,
55
] | private @NotNull SdkLookupProvider getSdkLookupProvider(@NotNull Project project) | 154 | 142,663 |
../intellij-community/platform/vcs-impl/src/com/intellij/openapi/vcs/history/VcsHistoryUtil.java | loadRevisionContentGuessEncoding | public static String loadRevisionContentGuessEncoding(@NotNull final VcsFileRevision revision, @Nullable final VirtualFile file,
@Nullable final Project project) throws VcsException, IOException {
final byte[] bytes = loadRevisionContent(revision);
if (file != null) {
return new String(bytes, file.getCharset());
}
EncodingManager e = project != null ? EncodingProjectManager.getInstance(project) : null;
if (e == null) {
e = EncodingManager.getInstance();
}
return CharsetToolkit.bytesToString(bytes, e.getDefaultCharset());
} | [
21,
53
] | public static String loadRevisionContentGuessEncoding(@NotNull final VcsFileRevision revision, @Nullable final VirtualFile file,
@Nullable final Project project) | 627 | 223,599 |
../intellij-community/java/java-impl/src/com/siyeh/ig/maturity/CommentedOutCodeInspection.java | getFamilyName | @Override
public @NotNull String getFamilyName() {
return InspectionGadgetsBundle.message("commented.out.code.delete.quickfix");
} | [
37,
50
] | @Override
public @NotNull String getFamilyName() | 144 | 366,346 |
../intellij-community/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/types/GrTypeParameterImpl.java | isEnum | @Override
public boolean isEnum() {
return false;
} | [
27,
33
] | @Override
public boolean isEnum() | 59 | 165,284 |
../intellij-community/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/libraryEditor/JavadocOrderRootTypeUIFactory.java | getActionUpdateThread | @Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
} | [
53,
74
] | @Override
public @NotNull ActionUpdateThread getActionUpdateThread() | 129 | 364,411 |
../intellij-community/platform/ide-core-impl/src/com/intellij/openapi/fileEditor/impl/NonProjectFileWritingAccessProvider.java | fileCreated | @Override
public void fileCreated(@NotNull VirtualFileEvent event) {
unlock(event);
} | [
26,
37
] | @Override
public void fileCreated(@NotNull VirtualFileEvent event) | 99 | 217,763 |
../intellij-community/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/EditorWindowImpl.java | addPropertyChangeListener | @Override
public void addPropertyChangeListener(@NotNull PropertyChangeListener listener, @NotNull Disposable parentDisposable) {
myDelegate.addPropertyChangeListener(listener, parentDisposable);
} | [
24,
49
] | @Override
public void addPropertyChangeListener(@NotNull PropertyChangeListener listener, @NotNull Disposable parentDisposable) | 205 | 203,674 |
../intellij-community/plugins/maven/src/main/java/org/jetbrains/idea/maven/dom/MavenDomProjectProcessorUtils.java | process | @Override
public final boolean process(T t) {
R res = find(t);
if (res != null) {
myResult = res;
return true;
}
return false;
} | [
35,
42
] | @Override
public final boolean process(T t) | 177 | 59,161 |
../intellij-community/platform/util/src/com/intellij/util/containers/LockFreeCopyOnWriteArrayList.java | createArrayAdd | private static <E> Object @NotNull [] createArrayAdd(Object @NotNull [] elements, E e) {
int len = elements.length;
Object[] newElements = Arrays.copyOf(elements, len + 1);
newElements[len] = e;
return newElements;
} | [
38,
52
] | private static <E> Object @NotNull [] createArrayAdd(Object @NotNull [] elements, E e) | 234 | 237,712 |
../intellij-community/platform/platform-impl/src/com/intellij/openapi/ui/playback/commands/KeyStrokeMap.java | get | public KeyStroke get(String strokeText) {
String s = strokeText.trim();
assert !s.isEmpty();
final String lowerCaseS = StringUtil.toLowerCase(s);
boolean hasModifiers = lowerCaseS.contains("shift") || lowerCaseS.contains("control") || lowerCaseS.contains("alt") || lowerCaseS.contains("meta");
String symbol = null;
int beforeSymbol = -1;
boolean haveSymbol;
KeyStroke symbolStroke = null;
if (hasModifiers) {
s = lowerCaseS;// Avoid adding extra SHIFT modifier for uppercase letters in shortcuts
beforeSymbol = s.lastIndexOf(" ");
haveSymbol = beforeSymbol > 0;
} else {
symbol = s;
haveSymbol = true;
}
int modifiers = 0;
if (haveSymbol) {
if (symbol == null) {
symbol = s.substring(beforeSymbol + 1);
}
if (symbol.length() > 1) {
final Integer code = ReflectionUtil.getStaticFieldValue(KeyEvent.class, int.class, "VK_" + StringUtil.toUpperCase(symbol));
if (code == null) {
return throwUnrecognized(symbol);
}
symbolStroke = KeyStroke.getKeyStroke(code.intValue(), 0);
}
String modifierPlusA = s.substring(0, s.length() - (s.length() - beforeSymbol - 1)) + "A";
final KeyStroke modifierPlusAStroke = KeyStroke.getKeyStroke(modifierPlusA);
if (symbolStroke == null) {
symbol = String.valueOf(symbol.charAt(0));
symbolStroke = get(symbol.charAt(0));
}
modifiers = modifierPlusAStroke.getModifiers();
if ((symbolStroke.getModifiers() & KeyEvent.SHIFT_MASK) > 0) {
modifiers |= KeyEvent.SHIFT_MASK;
}
}
if (symbolStroke == null || symbolStroke.getKeyCode() == KeyEvent.VK_UNDEFINED) {
return throwUnrecognized(symbol);
}
return KeyStroke.getKeyStroke(symbolStroke.getKeyCode(), modifiers, false);
} | [
17,
20
] | public KeyStroke get(String strokeText) | 1,856 | 317,684 |
../intellij-community/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.java | getIntValue | private static int getIntValue(JTextField keepBlankLines) {
try {
return Integer.parseInt(keepBlankLines.getText());
}
catch (NumberFormatException e) {
return 0;
}
} | [
19,
30
] | private static int getIntValue(JTextField keepBlankLines) | 196 | 501,380 |
../intellij-community/platform/platform-impl/src/com/intellij/ide/ClipboardSynchronizer.java | getRetries | @Override
protected int getRetries() {
// Clipboard#setContents throws IllegalStateException if the clipboard is currently unavailable.
// On Windows, it uses Win32 OpenClipboard which may fail according to its documentation:
// "OpenClipboard fails if another window has the clipboard open."
// Other applications implement retry logic when calling OpenClipboard. Let's do the same.
//
// According to my simple local stress testing, Clipboard#setContents hasn't failed more than 2 times in a row.
// Probably, it needs to be adjusted in future.
return 5;
} | [
28,
38
] | @Override
protected int getRetries() | 616 | 305,801 |
../intellij-community/java/java-impl-inspections/src/com/intellij/codeInspection/OptionalIsPresentInspection.java | generateOptionalLambda | @NotNull
static String generateOptionalLambda(@NotNull PsiElementFactory factory,
@NotNull CommentTracker ct,
PsiReferenceExpression optionalRef,
PsiElement trueValue) {
PsiType type = optionalRef.getType();
String paramName = new VariableNameGenerator(trueValue, VariableKind.PARAMETER)
.byType(OptionalUtil.getOptionalElementType(type)).byName("value").generate(true);
if(trueValue instanceof PsiExpressionStatement) {
trueValue = ((PsiExpressionStatement)trueValue).getExpression();
}
ct.markUnchanged(trueValue);
PsiElement copy = trueValue.copy();
for (PsiElement getCall : PsiTreeUtil.collectElements(copy, e -> isOptionalGetCall(e, optionalRef))) {
PsiElement result = getCall.replace(factory.createIdentifier(paramName));
if (copy == getCall) copy = result;
}
if(copy instanceof PsiStatement && !(copy instanceof PsiBlockStatement)) {
return paramName + "->{" + copy.getText()+"}";
}
return paramName + "->" + copy.getText();
} | [
25,
47
] | @NotNull
static String generateOptionalLambda(@NotNull PsiElementFactory factory,
@NotNull CommentTracker ct,
PsiReferenceExpression optionalRef,
PsiElement trueValue) | 1,130 | 378,536 |
../intellij-community/jps/jps-builders-6/src/org/jetbrains/jps/javac/CompilationCanceledException.java | fillInStackTrace | @Override
public synchronized Throwable fillInStackTrace() {
return this;
} | [
42,
58
] | @Override
public synchronized Throwable fillInStackTrace() | 83 | 334,580 |
../intellij-community/platform/util/src/com/intellij/util/diff/ShallowNodeComparator.java | deepEqual | @NotNull
ThreeState deepEqual(@NotNull OT oldNode, @NotNull NT newNode); | [
22,
31
] | @NotNull
ThreeState deepEqual(@NotNull OT oldNode, @NotNull NT newNode) | 74 | 237,134 |
../intellij-community/platform/platform-impl/src/com/intellij/designer/propertyTable/editors/ComboEditor.java | actionPerformed | @Override
public void actionPerformed(ActionEvent event) {
listener.onCancelled();
} | [
28,
43
] | @Override
public void actionPerformed(ActionEvent event) | 104 | 329,384 |
../intellij-community/plugins/groovy/groovy-psi/gen/org/jetbrains/plugins/groovy/lang/parser/GroovyGeneratedParser.java | class_level | static boolean class_level(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "class_level")) return false;
boolean r;
Marker m = enter_section_(b);
r = class_initializer(b, l + 1);
if (!r) r = type_definition(b, l + 1);
if (!r) r = class_level_2(b, l + 1);
if (!r) r = parse_class_declaration(b, l + 1);
exit_section_(b, m, null, r);
return r;
} | [
15,
26
] | static boolean class_level(PsiBuilder b, int l) | 384 | 161,413 |
../intellij-community/platform/lang-impl/src/com/intellij/openapi/projectRoots/ui/Util.java | canClose | @Override
public boolean canClose(String inputString) {
try {
//noinspection ResultOfObjectAllocationIgnored
new URL(inputString);
return true;
}
catch (MalformedURLException e1) {
Messages.showErrorDialog(e1.getMessage(), ProjectBundle.message("sdk.configure.javadoc.url.title"));
}
return false;
} | [
31,
39
] | @Override
public boolean canClose(String inputString) | 391 | 201,254 |
../intellij-community/platform/platform-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java | getHelpTopic | @Override
public String getHelpTopic() {
return null;
} | [
28,
40
] | @Override
public String getHelpTopic() | 69 | 330,083 |
../intellij-community/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/SchemaPrefix.java | getTypeName | @Override
public String getTypeName() {
return XmlPsiBundle.message("xml.namespace.prefix");
} | [
26,
37
] | @Override
public String getTypeName() | 102 | 507,194 |
../intellij-community/plugins/xslt-debugger/engine/src/org/intellij/plugins/xsltDebugger/rt/engine/remote/RemoteFrameImpl.java | getInstruction | @Override
public String getInstruction() {
return ((Debugger.StyleFrame)myFrame).getInstruction();
} | [
26,
40
] | @Override
public String getInstruction() | 108 | 173,985 |
../intellij-community/java/java-impl/src/com/siyeh/ipp/junit/ReplaceAssertLiteralWithAssertEqualsIntention.java | getFamilyName | @Override
public @NotNull String getFamilyName() {
return IntentionPowerPackBundle.message("replace.assert.literal.with.assert.equals.intention.family.name");
} | [
35,
48
] | @Override
public @NotNull String getFamilyName() | 168 | 367,420 |
../intellij-community/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/inline/GrVariableInliner.java | getConflicts | @Override
@Nullable
public MultiMap<PsiElement, String> getConflicts(@NotNull PsiReference reference, @NotNull PsiElement referenced) {
MultiMap<PsiElement, String> conflicts = new MultiMap<>();
GrExpression expr = (GrExpression)reference.getElement();
if (expr.getParent() instanceof GrAssignmentExpression parent) {
if (expr.equals(parent.getLValue())) {
conflicts.putValue(expr, GroovyRefactoringBundle.message("local.variable.is.lvalue"));
}
}
if ((referenced instanceof GrAccessorMethod || referenced instanceof GrField) && expr instanceof GrReferenceExpression) {
final GroovyResolveResult resolveResult = ((GrReferenceExpression)expr).advancedResolve();
if (resolveResult.getElement() instanceof GrAccessorMethod && !resolveResult.isInvokedOnProperty()) {
final PsiElement parent = expr.getParent();
if (!(parent instanceof GrCall && parent instanceof GrExpression)) {
conflicts.putValue(expr, GroovyRefactoringBundle.message("reference.to.accessor.0.is.used", CommonRefactoringUtil.htmlEmphasize(PsiFormatUtil.formatMethod(
(GrAccessorMethod)resolveResult.getElement(), PsiSubstitutor.EMPTY, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_PARAMETERS, PsiFormatUtilBase.SHOW_TYPE))));
}
}
}
return conflicts;
} | [
60,
72
] | @Override
@Nullable
public MultiMap<PsiElement, String> getConflicts(@NotNull PsiReference reference, @NotNull PsiElement referenced) | 1,343 | 172,290 |
../intellij-community/java/java-impl/src/com/intellij/codeInsight/hint/JavaImplementationTextSelectioner.java | getTextEndOffset | @Override
public int getTextEndOffset(@NotNull PsiElement element) {
return element.getTextRange().getEndOffset();
} | [
25,
41
] | @Override
public int getTextEndOffset(@NotNull PsiElement element) | 130 | 373,642 |
../intellij-community/platform/lang-impl/src/com/intellij/psi/codeStyle/CodeStyleSettingsCodeFragmentFilter.java | getSettings | @Override
public List<String> getSettings(LanguageCodeStyleSettingsProvider.SettingsType type) {
return typeToTask.get(type).getAffectedFields();
} | [
36,
47
] | @Override
public List<String> getSettings(LanguageCodeStyleSettingsProvider.SettingsType type) | 167 | 204,488 |
../intellij-community/platform/platform-impl/src/com/intellij/openapi/editor/ex/EditorEx.java | setFile | void setFile(@NotNull VirtualFile vFile); | [
5,
12
] | void setFile(@NotNull VirtualFile vFile) | 41 | 327,681 |
../intellij-community/platform/platform-api/src/com/intellij/ui/tabs/impl/TabLayout.java | getMaxPinnedTabWidth | public static int getMaxPinnedTabWidth() {
return JBUI.scale(Registry.intValue("ide.editor.max.pinned.tab.width", 2000));
} | [
18,
38
] | public static int getMaxPinnedTabWidth() | 129 | 251,447 |
../intellij-community/plugins/svn4idea/src/org/jetbrains/idea/svn/integrate/QuickMerge.java | areInSameHierarchy | private static boolean areInSameHierarchy(@NotNull Url url1, @NotNull Url url2) {
return isAncestor(url1, url2) || isAncestor(url2, url1);
} | [
23,
41
] | private static boolean areInSameHierarchy(@NotNull Url url1, @NotNull Url url2) | 146 | 152,240 |
../intellij-community/platform/util/src/com/intellij/util/CompressionUtil.java | compressStringRawBytes | public static @NotNull Object compressStringRawBytes(@NotNull CharSequence string) {
int length = string.length();
if (length < STRING_COMPRESSION_THRESHOLD) {
if (string instanceof CharBuffer && ((CharBuffer)string).capacity() > STRING_COMPRESSION_THRESHOLD) {
string = string.toString(); // shrink to size
}
return string;
}
try {
BufferExposingByteArrayOutputStream bytes = new BufferExposingByteArrayOutputStream(length);
@NotNull DataOutput out = new DataOutputStream(bytes);
for (int i=0; i< length;i++) {
char c = string.charAt(i);
DataInputOutputUtilRt.writeINT(out, c);
}
LZ4Compressor compressor = compressor();
int bytesWritten = bytes.size();
ByteBuffer dest = ByteBuffer.wrap(spareBufferLocal.getBuffer(compressor.maxCompressedLength(bytesWritten) + 10));
DataInputOutputUtilRt.writeINT(dest, length);
DataInputOutputUtilRt.writeINT(dest, bytesWritten - length);
compressor.compress(ByteBuffer.wrap(bytes.getInternalBuffer(), 0, bytesWritten), dest);
return dest.position() < length * 2 ? Arrays.copyOf(dest.array(), dest.position()) : string;
}
catch (IOException e) {
e.printStackTrace();
return string;
}
} | [
30,
52
] | public static @NotNull Object compressStringRawBytes(@NotNull CharSequence string) | 1,277 | 234,510 |
../intellij-community/platform/lang-impl/src/com/intellij/util/ui/tree/AbstractFileTreeTable.java | reset | public void reset(@NotNull Map<VirtualFile, T> mappings) {
myCurrentMapping.clear();
myCurrentMapping.putAll(mappings);
((ProjectRootNode)getRoot()).clearCachedChildren();
} | [
12,
17
] | public void reset(@NotNull Map<VirtualFile, T> mappings) | 195 | 197,106 |
../intellij-community/plugins/ant/src/com/intellij/lang/ant/config/execution/TreeView.java | printMessage | @NotNull
static @NlsSafe String printMessage(@NotNull AntMessage message, @NlsSafe String url) {
final StringBuilder builder = new StringBuilder();
final VirtualFile file = message.getFile();
if (message.getLine() > 0) {
if (file != null) {
ApplicationManager.getApplication().runReadAction(() -> {
String presentableUrl = file.getPresentableUrl();
builder.append(presentableUrl);
builder.append(' ');
});
}
else if (url != null) {
builder.append(url);
builder.append(' ');
}
builder.append('(');
builder.append(message.getLine());
builder.append(':');
builder.append(message.getColumn());
builder.append(") ");
}
return builder.toString();
} | [
34,
46
] | @NotNull
static @NlsSafe String printMessage(@NotNull AntMessage message, @NlsSafe String url) | 782 | 29,873 |
../intellij-community/platform/lang-impl/src/com/intellij/ide/actions/searcheverywhere/SearchEverywhereHeader.java | autoSetEverywhere | public void autoSetEverywhere(boolean everywhere) {
if (everywhere == isEverywhere()) return;
myEverywhereAutoSet = true;
if (mySelectedTab.everywhereAction == null) return;
if (!mySelectedTab.everywhereAction.canToggleEverywhere()) return;
mySelectedTab.everywhereAction.setScopeIsDefaultAndAutoSet(!everywhere);
mySelectedTab.everywhereAction.setEverywhere(everywhere);
myToolbar.updateActionsImmediately();
} | [
12,
29
] | public void autoSetEverywhere(boolean everywhere) | 441 | 194,346 |
../intellij-community/plugins/yaml/editing/gen/org/jetbrains/yaml/_YAMLLexer.java | isAfterEol | private boolean isAfterEol() {
final char prev = getCharAtOffset(-1);
return prev == (char)-1 || prev == '\n';
} | [
16,
26
] | private boolean isAfterEol() | 122 | 148,682 |
../intellij-community/plugins/java-i18n/src/com/intellij/codeInspection/i18n/JavaI18nUtil.java | isValidPropertyReference | static boolean isValidPropertyReference(@NotNull Project project,
@NotNull PsiExpression expression,
@NotNull String key,
@NotNull Ref<? super String> outResourceBundle) {
Ref<PsiAnnotationMemberValue> resourceBundleRef = Ref.create();
if (mustBePropertyKey(expression, resourceBundleRef)) {
final Object resourceBundleName = resourceBundleRef.get();
if (!(resourceBundleName instanceof PsiExpression expr)) {
return false;
}
final PsiConstantEvaluationHelper constantEvaluationHelper = JavaPsiFacade.getInstance(project).getConstantEvaluationHelper();
Object value = constantEvaluationHelper.computeConstantExpression(expr);
if (value == null) {
if (expr instanceof PsiReferenceExpression) {
final PsiElement resolve = ((PsiReferenceExpression)expr).resolve();
if (resolve instanceof PsiField && ((PsiField)resolve).hasModifierProperty(PsiModifier.FINAL)) {
value = constantEvaluationHelper.computeConstantExpression(((PsiField)resolve).getInitializer());
if (value == null) {
return false;
}
}
}
if (value == null) {
final ResourceBundle resourceBundle = resolveResourceBundleByKey(key, project);
if (resourceBundle == null) {
return false;
}
final PropertiesFile defaultPropertiesFile = resourceBundle.getDefaultPropertiesFile();
final String bundleName = BundleNameEvaluator.DEFAULT.evaluateBundleName(defaultPropertiesFile.getContainingFile());
if (bundleName == null) {
return false;
}
value = bundleName;
}
}
String bundleName = value.toString();
outResourceBundle.set(bundleName);
return isPropertyRef(expression, key, bundleName);
}
return true;
} | [
15,
39
] | static boolean isValidPropertyReference(@NotNull Project project,
@NotNull PsiExpression expression,
@NotNull String key,
@NotNull Ref<? super String> outResourceBundle) | 1,984 | 55,239 |
../intellij-community/platform/lang-impl/src/com/intellij/refactoring/rename/RenamePsiElementProcessor.java | createDialog | @Override
public RenameRefactoringDialog createDialog(@NotNull Project project,
@NotNull PsiElement element,
@Nullable PsiElement nameSuggestionContext,
@Nullable Editor editor) {
return this.createRenameDialog(project, element, nameSuggestionContext, editor);
} | [
43,
55
] | @Override
public RenameRefactoringDialog createDialog(@NotNull Project project,
@NotNull PsiElement element,
@Nullable PsiElement nameSuggestionContext,
@Nullable Editor editor) | 453 | 209,087 |
../intellij-community/platform/vcs-impl/src/com/intellij/openapi/diff/impl/patch/formove/PathsVerifier.java | execute | @NotNull List<FilePatch> execute() {
List<String> failedMessages = new ArrayList<>();
List<FilePatch> failedPatches = new ArrayList<>();
for (FilePatch patch : myPatches) {
CheckPath checker = getChecker(patch);
if (!checker.check()) {
ContainerUtil.addIfNotNull(failedMessages, checker.getErrorMessage());
failedPatches.add(checker.getPatch());
}
}
if (!failedMessages.isEmpty()) {
PatchApplier.showError(myProject, StringUtil.join(failedMessages, "\n"));
}
myPatches.removeAll(failedPatches);
return failedPatches;
} | [
25,
32
] | @NotNull List<FilePatch> execute() | 592 | 218,874 |
../intellij-community/plugins/javaFX/src/org/jetbrains/plugins/javaFX/fxml/codeInsight/intentions/JavaFxCollapseSubTagToAttributeIntention.java | isAvailable | @Override
public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) {
if (element instanceof XmlToken && ((XmlToken)element).getTokenType() == XmlTokenType.XML_NAME &&
element.getParent() instanceof XmlTag tag) {
for (XmlTag xmlTag : tag.getSubTags()) {
if (xmlTag.getAttribute(FxmlConstants.FX_VALUE) == null) return false;
}
final XmlTag parentTag = tag.getParentTag();
if (parentTag != null &&
tag.getDescriptor() instanceof JavaFxPropertyTagDescriptor &&
parentTag.getDescriptor() instanceof JavaFxClassTagDescriptorBase) {
setText(JavaFXBundle.message("javafx.collapse.subtag.to.attribute.intention",tag.getName()));
return true;
}
}
return false;
} | [
27,
38
] | @Override
public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) | 792 | 49,762 |
../intellij-community/platform/platform-impl/src/com/intellij/openapi/fileChooser/impl/FileChooserPanelImpl.java | loadRoots | private void loadRoots(int id, @Nullable Path pathToSelect, boolean updatePathBar, boolean updateHistory) {
var cancelled = new AtomicBoolean(false);
update(id, cancelled, () -> {
myCurrentDirectory = null;
updatePathBarAndHistory(null, updatePathBar, updateHistory);
});
var roots = new ArrayList<Path>();
for (var root : FileSystems.getDefault().getRootDirectories()) roots.add(root);
if (WSLUtil.isSystemCompatible() && Experiments.getInstance().isFeatureEnabled("wsl.p9.show.roots.in.file.chooser")) {
try {
List<WSLDistribution> distributions = WslDistributionManager.getInstance().getInstalledDistributionsFuture().get(200, TimeUnit.MILLISECONDS);
for (var distribution : distributions) roots.add(distribution.getUNCRootPath());
}
catch (Exception e) {
LOG.warn(e);
}
}
var selection = new AtomicReference<FsItem>();
var error = new AtomicReference<String>();
for (var root : roots) {
if (cancelled.get()) break;
try {
var attrs = Files.readAttributes(root, BasicFileAttributes.class);
var virtualFile = new LazyDirectoryOrFile(null, root, attrs);
var name = NioFiles.getFileName(root);
if (name.length() > 1 && name.endsWith(File.separator)) {
name = name.substring(0, name.length() - 1);
}
if (SystemInfo.isWindows) {
try {
var store = Files.getFileStore(root).name();
if (!store.isBlank()) {
name += " [" + store + ']';
}
}
catch (IOException e) {
LOG.debug(e);
}
}
var item = new FsItem(root, name, null, true, myDescriptor.isFileSelectable(virtualFile), AllIcons.Nodes.Folder);
update(id, cancelled, () -> myModel.addRow(item));
if (pathToSelect != null && root.equals(pathToSelect)) {
selection.set(item);
}
}
catch (Exception e) {
LOG.warn(root.toString(), e);
error.set(e.getMessage());
}
}
if (!cancelled.get()) {
update(id, cancelled, () -> {
myList.setPaintBusy(false);
updateSelection(selection);
reportError("file.chooser.cannot.load.roots", error);
});
}
} | [
13,
22
] | private void loadRoots(int id, @Nullable Path pathToSelect, boolean updatePathBar, boolean updateHistory) | 2,286 | 321,056 |
../intellij-community/platform/platform-impl/src/com/intellij/openapi/vfs/encoding/EncodingProjectManagerImpl.java | getAllPointersMappings | public @NotNull Map<? extends VirtualFilePointer, ? extends Charset> getAllPointersMappings() {
return Collections.unmodifiableMap(myMapping);
} | [
69,
91
] | public @NotNull Map<? extends VirtualFilePointer, ? extends Charset> getAllPointersMappings() | 150 | 319,216 |
../intellij-community/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/AbstractInplaceIntroducer.java | startInplaceIntroduceTemplate | public boolean startInplaceIntroduceTemplate() {
final boolean replaceAllOccurrences = isReplaceAllOccurrences();
final Ref<Boolean> result = new Ref<>(false);
CommandProcessor.getInstance().executeCommand(myProject, () -> {
final String[] names = suggestNames(replaceAllOccurrences, getLocalVariable());
boolean started = false;
try (AccessToken ignore = SlowOperations.allowSlowOperations(SlowOperations.ACTION_PERFORM)) {
if (replaceAllOccurrences) {
int segmentsLimit = Registry.intValue("inplace.rename.segments.limit", -1);
// Too many occurrences: rename template won't start, see InplaceRefactoring.buildTemplateAndStart
// 2 = variable type + variable name
if (segmentsLimit != -1 && getOccurrences().length + 2 > segmentsLimit) return;
}
final V variable = createFieldToStartTemplateOn(replaceAllOccurrences, names);
if (variable != null) {
int caretOffset = getCaretOffset();
myEditor.getCaretModel().moveToOffset(caretOffset);
myEditor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
final LinkedHashSet<String> nameSuggestions = new LinkedHashSet<>();
nameSuggestions.add(variable.getName());
nameSuggestions.addAll(Arrays.asList(names));
initOccurrencesMarkers();
setElementToRename(variable);
updateTitle(getVariable());
started = super.performInplaceRefactoring(nameSuggestions);
TemplateState state = TemplateManagerImpl.getTemplateState(myEditor);
if (started && state != null && !state.isFinished()) {
myDocumentAdapter = new DocumentListener() {
@Override
public void documentChanged(@NotNull DocumentEvent e) {
if (myPreview == null) return;
final TemplateState templateState = TemplateManagerImpl.getTemplateState(myEditor);
if (templateState != null) {
final TextResult value = templateState.getVariableValue(InplaceRefactoring.PRIMARY_VARIABLE_NAME);
if (value != null) {
updateTitle(getVariable(), value.getText());
}
}
}
};
myEditor.getDocument().addDocumentListener(myDocumentAdapter);
updateTitle(getVariable());
if (TemplateManagerImpl.getTemplateState(myEditor) != null) {
myEditor.putUserData(ACTIVE_INTRODUCE, this);
}
}
}
result.set(started);
}
finally {
if (!started) {
finish(true);
}
}
}, getCommandName(), getCommandName());
return result.get();
} | [
15,
44
] | public boolean startInplaceIntroduceTemplate() | 2,767 | 208,430 |
../intellij-community/platform/analysis-api/src/com/intellij/codeInspection/LocalQuickFixOnPsiElementAsIntentionAdapter.java | startInWriteAction | @Override
public boolean startInWriteAction() {
return myFix.startInWriteAction();
} | [
27,
45
] | @Override
public boolean startInWriteAction() | 92 | 302,581 |
../intellij-community/platform/lang-impl/src/com/intellij/lang/impl/modcommand/ModCommandExecutorImpl.java | executeStartTemplate | private static boolean executeStartTemplate(@NotNull ActionContext context, @NotNull ModStartTemplate template, @Nullable Editor editor) {
VirtualFile file = actualize(template.file());
if (file == null) return false;
Editor finalEditor = getEditor(context.project(), editor, file);
if (finalEditor == null) return false;
PsiFile psiFile = PsiManagerEx.getInstanceEx(context.project()).findFile(file);
if (psiFile == null) return false;
String name = requireNonNullElse(CommandProcessor.getInstance().getCurrentCommandName(),
LangBundle.message("command.title.finishing.template"));
WriteAction.run(() -> {
TemplateBuilderImpl builder = new TemplateBuilderImpl(psiFile);
for (ModStartTemplate.TemplateField field : template.fields()) {
if (field instanceof ModStartTemplate.ExpressionField expr) {
if (expr.varName() != null) {
builder.replaceElement(psiFile, expr.range(), expr.varName(), expr.expression(), true);
} else {
builder.replaceElement(psiFile, expr.range(), expr.expression());
}
}
else if (field instanceof ModStartTemplate.DependantVariableField variableField) {
builder.replaceElement(psiFile, variableField.range(), variableField.varName(),
variableField.dependantVariableName(), variableField.alwaysStopAt());
}
else if (field instanceof ModStartTemplate.EndField endField) {
PsiElement leaf = psiFile.findElementAt(endField.range().getStartOffset());
if (leaf != null) {
builder.setEndVariableBefore(leaf);
}
}
}
final Template tmpl = builder.buildInlineTemplate();
finalEditor.getCaretModel().moveToOffset(0);
TemplateManager.getInstance(context.project()).startTemplate(finalEditor, tmpl, new TemplateEditingAdapter() {
@Override
public void templateFinished(@NotNull Template tmpl, boolean brokenOff) {
ModCommandExecutor.executeInteractively(context, name, editor, () -> template.templateFinishFunction().apply(psiFile));
}
});
});
return true;
} | [
23,
43
] | private static boolean executeStartTemplate(@NotNull ActionContext context, @NotNull ModStartTemplate template, @Nullable Editor editor) | 2,212 | 201,656 |
../intellij-community/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/projectlevelman/PersistentVcsSetting.java | isApplicableTo | boolean isApplicableTo(@NotNull Collection<? extends AbstractVcs> vcs); | [
8,
22
] | boolean isApplicableTo(@NotNull Collection<? extends AbstractVcs> vcs) | 71 | 219,463 |
../intellij-community/platform/lang-impl/src/com/intellij/refactoring/actions/ExtractSuperActionBase.java | isAvailableInEditorOnly | @Override
public boolean isAvailableInEditorOnly() {
return false;
} | [
27,
50
] | @Override
public boolean isAvailableInEditorOnly() | 76 | 208,764 |
../intellij-community/platform/lang-impl/src/com/intellij/largeFilesEditor/search/searchResultsPanel/RangeSearch.java | getComponent | public JComponent getComponent() {
return myComponent;
} | [
18,
30
] | public JComponent getComponent() | 62 | 209,558 |
../intellij-community/java/java-impl-refactorings/src/com/intellij/refactoring/rename/JavaVetoRenameCondition.java | value | @Override
public boolean value(PsiElement element) {
if (element instanceof LightMethod) {
PsiClass containingClass = ((LightMethod)element).getContainingClass();
if (containingClass.isEnum()) return true;
}
if (element instanceof PsiReceiverParameter) {
return true;
}
return element instanceof PsiJavaFile &&
!FileTypeUtils.isInServerPageFile(element) &&
!JavaProjectRootsUtil.isOutsideJavaSourceRoot((PsiFile)element) &&
((PsiJavaFile) element).getClasses().length > 0;
} | [
27,
32
] | @Override
public boolean value(PsiElement element) | 551 | 484,842 |
../intellij-community/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FSRecordsImpl.java | forEachRoot | void forEachRoot(@NotNull ObjIntConsumer<? super String> rootConsumer) {
checkNotClosed();
try {
treeAccessor.forEachRoot((rootId, rootUrlId) -> {
String rootUrl = getNameByNameId(rootUrlId);
rootConsumer.accept(rootUrl, rootId);
});
}
catch (IOException e) {
throw handleError(e);
}
} | [
5,
16
] | void forEachRoot(@NotNull ObjIntConsumer<? super String> rootConsumer) | 341 | 319,819 |
../intellij-community/plugins/sh/core/gen/com/intellij/sh/psi/impl/ShComparisonOperationImpl.java | getLt | @Override
@Nullable
public PsiElement getLt() {
return findChildByType(LT);
} | [
42,
47
] | @Override
@Nullable
public PsiElement getLt() | 87 | 144,974 |
../intellij-community/plugins/tasks/tasks-core/src/com/intellij/tasks/fogbugz/FogBugzRepository.java | getDate | @Override
public @NotNull Date getDate() {
return parseDate(element.getChildTextTrim("dt"));
} | [
45,
52
] | @Override
public @NotNull Date getDate() | 138 | 39,363 |
../intellij-community/platform/lang-impl/src/com/intellij/ide/projectView/actions/MoveModulesToGroupAction.java | whatToMove | protected static String whatToMove(Module @NotNull [] modules) {
return modules.length == 1 ? IdeBundle.message("message.module", modules[0].getName()) : IdeBundle.message("message.modules");
} | [
24,
34
] | protected static String whatToMove(Module @NotNull [] modules) | 199 | 192,802 |
../intellij-community/java/java-impl-refactorings/src/com/intellij/refactoring/convertToInstanceMethod/ConvertToInstanceMethodDialog.java | setVisibility | @TestOnly
public void setVisibility(String visibility) {
myVisibilityPanel.setVisibility(visibility);
} | [
24,
37
] | @TestOnly
public void setVisibility(String visibility) | 111 | 482,959 |
../intellij-community/platform/platform-impl/src/com/intellij/ide/lightEdit/LightEditorManagerImpl.java | fireAutosaveModeChanged | void fireAutosaveModeChanged(boolean autosaveMode) {
myEventDispatcher.getMulticaster().autosaveModeChanged(autosaveMode);
} | [
5,
28
] | void fireAutosaveModeChanged(boolean autosaveMode) | 130 | 308,955 |
../intellij-community/plugins/svn4idea/src/org/jetbrains/idea/svn/history/SvnHistoryProvider.java | getText | public String getText(final VcsFileRevision vcsFileRevision) {
return myRenderer.getText(vcsFileRevision);
} | [
14,
21
] | public String getText(final VcsFileRevision vcsFileRevision) | 118 | 153,627 |
../intellij-community/notebooks/visualization/src/org/jetbrains/plugins/notebooks/visualization/r/inlays/table/filters/gui/ParserModel.java | getFormat | @Override public final Format getFormat(Class cl) {
Format ret = formats.get(cl);
if (ret == null) {
if (cl.isEnum()) {
ret = new EnumTypeFormat(cl);
formats.put(cl, ret);
} else {
ret = getBasicFormat(cl);
}
}
return ret;
} | [
30,
39
] | @Override public final Format getFormat(Class cl) | 345 | 515,343 |
../intellij-community/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/extract/ExtractUtil.java | getModifierString | public static String getModifierString(ExtractMethodInfoHelper helper) {
String visibility = helper.getVisibility();
LOG.assertTrue(visibility != null && !visibility.isEmpty());
final StringBuilder builder = new StringBuilder();
builder.append(visibility);
builder.append(" ");
if (helper.isStatic()) {
builder.append("static ");
}
return builder.toString();
} | [
21,
38
] | public static String getModifierString(ExtractMethodInfoHelper helper) | 400 | 172,475 |
../intellij-community/platform/code-style-impl/src/com/intellij/formatting/FormattingProgressCallback.java | afterApplyingChange | void afterApplyingChange(@NotNull LeafBlockWrapper block); | [
5,
24
] | void afterApplyingChange(@NotNull LeafBlockWrapper block) | 58 | 268,710 |
../intellij-community/java/compiler/javac2/src/com/intellij/ant/Javac2.java | setInstrumentNotNull | @SuppressWarnings("unused")
public void setInstrumentNotNull(boolean instrumentNotNull) {
this.instrumentNotNull = instrumentNotNull;
} | [
42,
62
] | @SuppressWarnings("unused")
public void setInstrumentNotNull(boolean instrumentNotNull) | 143 | 493,592 |
../intellij-community/platform/lang-impl/src/com/intellij/openapi/editor/EditorMouseHoverPopupManager.java | scheduleProcessing | private void scheduleProcessing(@NotNull Editor editor,
@NotNull Context context,
boolean updateExistingPopup,
boolean forceShowing,
boolean requestFocus) {
ProgressIndicatorBase progress = new ProgressIndicatorBase();
progress.setModalityProgress(null);
if (!forceShowing) { // myCurrentProgress is cancelled on every mouse moved - do not use it for forceShowing mode
myCurrentProgress = progress;
}
myAlarm.addRequest(() -> {
ProgressManager.getInstance().executeProcessUnderProgress(() -> {
// errors are stored in the top level editor markup model, not the injected one
Editor topLevelEditor = InjectedLanguageUtil.getTopLevelEditor(editor);
EditorHoverInfo info = context.calcInfo(topLevelEditor);
ApplicationManager.getApplication().invokeLater(() -> {
if (!forceShowing && progress != myCurrentProgress) {
return;
}
myCurrentProgress = null;
if (info == null ||
!UIUtil.isShowing(topLevelEditor.getContentComponent()) ||
(!forceShowing && isPopupDisabled(topLevelEditor))) {
return;
}
VisualPosition position = context.getPopupPosition(topLevelEditor);
PopupBridge popupBridge = new PopupBridge(editor, position);
JComponent component = info.createComponent(topLevelEditor, popupBridge, requestFocus);
if (component == null) {
closeHint();
}
else {
if (updateExistingPopup && isHintShown()) {
updateHint(component, popupBridge);
}
else {
AbstractPopup hint = createHint(component, popupBridge, requestFocus);
showHintInEditor(hint, topLevelEditor, position);
CodeFloatingToolbar floatingToolbar = CodeFloatingToolbar.getToolbar(editor);
if (floatingToolbar != null) floatingToolbar.hideOnPopupConflict(hint);
myPopupReference = new WeakReference<>(hint);
myCurrentEditor = new WeakReference<>(topLevelEditor);
}
myContext = context;
}
});
}, progress);
}, context.getShowingDelay());
} | [
13,
31
] | private void scheduleProcessing(@NotNull Editor editor,
@NotNull Context context,
boolean updateExistingPopup,
boolean forceShowing,
boolean requestFocus) | 2,357 | 201,272 |
../intellij-community/platform/platform-impl/src/com/intellij/ui/TabbedPaneWrapper.java | addTab | public final synchronized void addTab(@TabTitle String title, @Nullable JComponent component) {
if (component == null) {
LOG.error("Unable to insert a tab without component: " + title);
}
else {
insertTab(title, null, component, null, tabbedPane.getTabCount());
}
} | [
31,
37
] | public final synchronized void addTab(@TabTitle String title, @Nullable JComponent component) | 295 | 310,421 |
../intellij-community/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/util/LayeredLexerEditorHighlighter.java | getTokenText | private @NotNull CharSequence getTokenText(int tokenIndex) {
return myText.subSequence(getSegments().getSegmentStart(tokenIndex), getSegments().getSegmentEnd(tokenIndex));
} | [
30,
42
] | private @NotNull CharSequence getTokenText(int tokenIndex) | 183 | 296,015 |
../intellij-community/platform/platform-api/src/com/intellij/openapi/ui/TextFieldWithBrowseButton.java | installPathCompletion | protected void installPathCompletion(FileChooserDescriptor fileChooserDescriptor, @Nullable Disposable parent) {
Application application = ApplicationManager.getApplication();
if (application == null || application.isUnitTestMode() || application.isHeadlessEnvironment()) return;
FileChooserFactory instance = FileChooserFactory.getInstance();
if (instance != null) {
instance.installFileCompletion(getChildComponent(), fileChooserDescriptor, true, parent);
}
} | [
15,
36
] | protected void installPathCompletion(FileChooserDescriptor fileChooserDescriptor, @Nullable Disposable parent) | 489 | 256,468 |
../intellij-community/plugins/yaml/editing/gen/org/jetbrains/yaml/_YAMLLexer.java | isCleanState | public boolean isCleanState() {
return yystate() == YYINITIAL
&& myBraceCount == 0
&& myPrevElementIndent == 0
&& !myPossiblePlainTextScalarContinue;
} | [
15,
27
] | public boolean isCleanState() | 190 | 148,678 |
../intellij-community/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/match/ArrangementMatchingRulesControl.java | onTableChange | private void onTableChange(@NotNull TableModelEvent e) {
final int signum;
switch (e.getType()) {
case TableModelEvent.INSERT -> signum = 1;
case TableModelEvent.DELETE -> {
signum = -1;
for (int i = e.getLastRow(); i >= e.getFirstRow(); i--) {
myComponents.remove(i);
}
}
default -> {
return;
}
}
int shift = Math.abs(e.getFirstRow() - e.getLastRow() + 1) * signum;
myComponents.shiftKeys(e.getFirstRow(), shift);
if (myRowUnderMouse >= e.getFirstRow()) {
myRowUnderMouse = -1;
}
if (getModel().getSize() > 0) {
repaintRows(0, getModel().getSize() - 1, false);
}
} | [
13,
26
] | private void onTableChange(@NotNull TableModelEvent e) | 687 | 206,729 |
../intellij-community/java/idea-ui/src/com/intellij/ide/projectWizard/ProjectTemplateList.java | getSelectedTemplate | @Nullable
public ProjectTemplate getSelectedTemplate() {
return myList.getSelectedValue();
} | [
35,
54
] | @Nullable
public ProjectTemplate getSelectedTemplate() | 100 | 361,567 |
../intellij-community/platform/core-api/src/com/intellij/psi/ElementManipulator.java | getRangeInElement | @NotNull
TextRange getRangeInElement(@NotNull T element); | [
21,
38
] | @NotNull
TextRange getRangeInElement(@NotNull T element) | 59 | 294,115 |
../intellij-community/platform/indexing-impl/src/com/intellij/util/indexing/diagnostic/IndexLookupTimingsReporting.java | reportDetailedDataToFUS | @Override
protected void reportDetailedDataToFUS(final long lookupFinishedAtMs) {
EVENT_INDEX_LOOKUP_ENTRIES_BY_KEYS.log(
FIELD_INDEX_ID.with(indexId.getName()),
FIELD_UP_TO_DATE_CHECK_DURATION_MS.with(
indexValidationFinishedAtMs > 0 ? indexValidationFinishedAtMs - lookupStartedAtMs : 0),
FIELD_LOOKUP_DURATION_MS.with(lookupFinishedAtMs - lookupStartedAtMs),
FIELD_LOOKUP_FAILED.with(lookupFailed),
FIELD_LOOKUP_KEYS_OP.with(lookupOperation),
FIELD_LOOKUP_KEYS_COUNT.with(lookupKeysCount),
FIELD_TOTAL_KEYS_INDEXED_COUNT.with(totalKeysIndexed),
FIELD_LOOKUP_RESULT_ENTRIES_COUNT.with(lookupResultSize)
);
} | [
31,
54
] | @Override
protected void reportDetailedDataToFUS(final long lookupFinishedAtMs) | 734 | 301,567 |
../intellij-community/java/java-psi-impl/src/com/intellij/psi/impl/light/LightMethod.java | isEquivalentTo | @Override
public boolean isEquivalentTo(final PsiElement another) {
return PsiClassImplUtil.isMethodEquivalentTo(this, another);
} | [
27,
41
] | @Override
public boolean isEquivalentTo(final PsiElement another) | 138 | 498,802 |
../intellij-community/jps/jps-builders-6/gen/org/jetbrains/jps/javac/rpc/JavacRemoteProto.java | writeTo | @java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (((bitField0_ & 0x00000001) != 0)) {
output.writeEnum(1, requestType_);
}
for (int i = 0; i < option_.size(); i++) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, option_.getRaw(i));
}
for (int i = 0; i < file_.size(); i++) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 3, file_.getRaw(i));
}
for (int i = 0; i < platformClasspath_.size(); i++) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 4, platformClasspath_.getRaw(i));
}
for (int i = 0; i < classpath_.size(); i++) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 5, classpath_.getRaw(i));
}
for (int i = 0; i < sourcepath_.size(); i++) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 6, sourcepath_.getRaw(i));
}
for (int i = 0; i < output_.size(); i++) {
output.writeMessage(7, output_.get(i));
}
for (int i = 0; i < modulePath_.size(); i++) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 8, modulePath_.getRaw(i));
}
for (int i = 0; i < upgradeModulePath_.size(); i++) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 9, upgradeModulePath_.getRaw(i));
}
com.google.protobuf.GeneratedMessageV3
.serializeStringMapTo(
output,
internalGetModuleNames(),
ModuleNamesDefaultEntryHolder.defaultEntry,
10);
getUnknownFields().writeTo(output);
} | [
38,
45
] | @java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output) | 1,756 | 333,743 |
../intellij-community/platform/analysis-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionActionWrapper.java | getShortcut | @Override
public @Nullable ShortcutSet getShortcut() {
IntentionAction delegate = getDelegate();
return delegate instanceof ShortcutProvider ? ((ShortcutProvider)delegate).getShortcut() : null;
} | [
41,
52
] | @Override
public @Nullable ShortcutSet getShortcut() | 207 | 245,996 |
../intellij-community/plugins/java-decompiler/engine/src/org/jetbrains/java/decompiler/modules/decompiler/IfHelper.java | collapseElse | private static boolean collapseElse(IfNode rtnode) {
if (rtnode.edgetypes.get(1) == 0) {
IfNode elsebranch = rtnode.succs.get(1);
if (elsebranch.succs.size() == 2) {
// else-if or else-else branch
int path = elsebranch.succs.get(1).value == rtnode.succs.get(0).value ? 2 :
(elsebranch.succs.get(0).value == rtnode.succs.get(0).value ? 1 : 0);
if (path > 0) {
IfStatement firstif = (IfStatement)rtnode.value;
IfStatement secondif = (IfStatement)elsebranch.value;
Statement parent = firstif.getParent();
if (secondif.getFirst().getExprents().isEmpty()) {
firstif.getFirst().removeSuccessor(firstif.getIfEdge());
// remove first if
firstif.removeAllSuccessors(secondif);
for (StatEdge edge : firstif.getAllPredecessorEdges()) {
if (!firstif.containsStatementStrict(edge.getSource())) {
firstif.removePredecessor(edge);
edge.getSource().changeEdgeNode(EdgeDirection.FORWARD, edge, secondif);
secondif.addPredecessor(edge);
}
}
parent.getStats().removeWithKey(firstif.id);
if (parent.getFirst() == firstif) {
parent.setFirst(secondif);
}
// merge if conditions
IfExprent statexpr = secondif.getHeadexprent();
List<Exprent> lstOperands = new ArrayList<>();
lstOperands.add(firstif.getHeadexprent().getCondition());
if (path == 2) {
lstOperands.set(0, new FunctionExprent(FunctionExprent.FUNCTION_BOOL_NOT, lstOperands.get(0), null));
}
lstOperands.add(statexpr.getCondition());
statexpr
.setCondition(new FunctionExprent(path == 1 ? FunctionExprent.FUNCTION_COR : FunctionExprent.FUNCTION_CADD, lstOperands, null));
if (secondif.getFirst().getExprents().isEmpty() &&
!firstif.getFirst().getExprents().isEmpty()) {
secondif.replaceStatement(secondif.getFirst(), firstif.getFirst());
}
return true;
}
}
}
else if (elsebranch.succs.size() == 1) {
if (elsebranch.succs.get(0).value == rtnode.succs.get(0).value) {
IfStatement firstif = (IfStatement)rtnode.value;
Statement second = elsebranch.value;
firstif.removeAllSuccessors(second);
for (StatEdge edge : second.getAllSuccessorEdges()) {
second.removeSuccessor(edge);
edge.setSource(firstif);
firstif.addSuccessor(edge);
}
StatEdge ifedge = firstif.getIfEdge();
firstif.getFirst().removeSuccessor(ifedge);
second.addSuccessor(new StatEdge(ifedge.getType(), second, ifedge.getDestination(), ifedge.closure));
StatEdge newifedge = new StatEdge(EdgeType.REGULAR, firstif.getFirst(), second);
firstif.getFirst().addSuccessor(newifedge);
firstif.setIfstat(second);
firstif.getStats().addWithKey(second, second.id);
second.setParent(firstif);
firstif.getParent().getStats().removeWithKey(second.id);
// negate the if condition
IfExprent statexpr = firstif.getHeadexprent();
statexpr
.setCondition(new FunctionExprent(FunctionExprent.FUNCTION_BOOL_NOT, statexpr.getCondition(), null));
return true;
}
}
}
return false;
} | [
23,
35
] | private static boolean collapseElse(IfNode rtnode) | 3,547 | 32,478 |
../intellij-community/jps/jps-builders-6/gen/org/jetbrains/jps/javac/rpc/JavacRemoteProto.java | buildPartial | @java.lang.Override
public org.jetbrains.jps.javac.rpc.JavacRemoteProto.Message.Request.OutputGroup buildPartial() {
org.jetbrains.jps.javac.rpc.JavacRemoteProto.Message.Request.OutputGroup result = new org.jetbrains.jps.javac.rpc.JavacRemoteProto.Message.Request.OutputGroup(this);
if (bitField0_ != 0) { buildPartial0(result); }
onBuilt();
return result;
} | [
110,
122
] | @java.lang.Override
public org.jetbrains.jps.javac.rpc.JavacRemoteProto.Message.Request.OutputGroup buildPartial() | 426 | 333,665 |
../intellij-community/platform/util-rt/src/com/intellij/util/text/VersionComparatorUtil.java | min | public static String min(final String v1, final String v2) {
return compare(v1, v2) < 0 ? v1 : v2;
} | [
21,
24
] | public static String min(final String v1, final String v2) | 106 | 264,081 |
../intellij-community/plugins/properties/src/com/intellij/lang/properties/LastSelectedPropertiesFileStore.java | loadState | @Override
public void loadState(@NotNull Element state) {
lastSelectedUrls.clear();
for (Element child : state.getChildren("entry")) {
String context = child.getAttributeValue("context");
String url = child.getAttributeValue("url");
VirtualFile propFile = VirtualFileManager.getInstance().findFileByUrl(url);
VirtualFile contextFile = VirtualFileManager.getInstance().findFileByUrl(context);
if (propFile != null && contextFile != null) {
lastSelectedUrls.put(context, url);
}
}
lastSelectedFileUrl = state.getAttributeValue("lastSelectedFileUrl");
} | [
24,
33
] | @Override
public void loadState(@NotNull Element state) | 614 | 147,634 |
../intellij-community/platform/core-impl/src/com/intellij/openapi/vfs/local/CoreLocalVirtualFile.java | fileKey | @Override
public Object fileKey() {
throw new UnsupportedOperationException();
} | [
28,
35
] | @Override
public Object fileKey() | 94 | 182,833 |
../intellij-community/platform/lang-impl/src/com/intellij/ide/actions/runAnything/RunAnythingPopupUI.java | adjustEmptyText | public static void adjustEmptyText(@NotNull JBTextField textEditor,
@NotNull Predicate<JBTextField> function,
@NotNull @NlsContexts.StatusText String leftText,
@NotNull @NlsContexts.StatusText String rightText) {
textEditor.putClientProperty(TextComponentEmptyText.STATUS_VISIBLE_FUNCTION, function);
StatusText statusText = textEditor.getEmptyText();
statusText.setShowAboveCenter(false);
statusText.setText(leftText, SimpleTextAttributes.GRAY_ATTRIBUTES);
statusText.appendText(false, 0, rightText, SimpleTextAttributes.GRAY_ATTRIBUTES, null);
statusText.setFont(UIUtil.getLabelFont(UIUtil.FontSize.SMALL));
} | [
19,
34
] | public static void adjustEmptyText(@NotNull JBTextField textEditor,
@NotNull Predicate<JBTextField> function,
@NotNull @NlsContexts.StatusText String leftText,
@NotNull @NlsContexts.StatusText String rightText) | 748 | 194,869 |
../intellij-community/plugins/hg4idea/src/org/zmlx/hg4idea/util/HgReferenceValidator.java | getErrorText | @Override
public @Nullable String getErrorText(@Nullable String inputString) {
return myErrorText;
} | [
36,
48
] | @Override
public @Nullable String getErrorText(@Nullable String inputString) | 108 | 138,302 |
../intellij-community/platform/platform-impl/src/com/intellij/openapi/editor/impl/ErrorStripeMarkersModel.java | hasNext | @Override
public boolean hasNext() {
return myNext != null;
} | [
29,
36
] | @Override
public boolean hasNext() | 75 | 326,169 |
../intellij-community/platform/analysis-impl/src/com/intellij/openapi/vfs/ex/dummy/DummyFileImpl.java | setModificationStamp | public void setModificationStamp(long modificationStamp, Object requestor) {
myModificationStamp = modificationStamp;
} | [
12,
32
] | public void setModificationStamp(long modificationStamp, Object requestor) | 125 | 244,687 |