Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
62,200
void (DomElementAnnotationHolder holder, OverrideText overrideText) { if (!DomUtil.hasXml(overrideText.getText())) return; DomElement parent = overrideText.getParent(); PropertiesFile propertiesFile = DescriptorI18nUtil.findBundlePropertiesFile(parent); holder.createProblem(overrideText, ProblemHighlightType.GENERIC_ER...
highlightOverrideText
62,201
void (@NotNull DomElementAnnotationHolder holder, @NotNull ActionOrGroup actionOrGroup) { String id = actionOrGroup.getId().getStringValue(); if (id == null) return; String text = actionOrGroup.getText().getStringValue(); String desc = actionOrGroup.getDescription().getStringValue(); if (text == null && desc == null) r...
highlightActionOrGroup
62,202
boolean (@NotNull DomElement action, String internalAttributeName) { final GenericAttributeValue<?> internalAttribute = DevKitDomUtil.getAttribute(action, internalAttributeName); if (internalAttribute != null && "true".equals(internalAttribute.getStringValue())) return true; return false; }
isInternal
62,203
void (Project project, List<XmlTag> tags, Consumer<String> doFixConsumer) { ResourceBundleManager resourceBundleManager; try { resourceBundleManager = ResourceBundleManager.getManager(ContainerUtil.map(tags, x -> x.getContainingFile()), project); } catch (ResourceBundleManager.ResourceBundleNotFoundException e) { resou...
choosePropertiesFileAndExtract
62,204
String (@NotNull Project project, PropertiesFile propertiesFile) { String baseName = propertiesFile.getResourceBundle().getBaseName(); VirtualFile virtualFile = propertiesFile.getVirtualFile(); VirtualFile sourceRootForFile = ProjectRootManager.getInstance(project).getFileIndex().getSourceRootForFile(virtualFile); if (...
getBundleQName
62,205
List<XmlTag> (List<CommonProblemDescriptor> descriptors) { List<XmlTag> tags = new ArrayList<>(); for (CommonProblemDescriptor d : descriptors) { if (d instanceof ProblemDescriptor) { PsiElement e = ((ProblemDescriptor)d).getPsiElement(); if (e instanceof XmlTag) { tags.add((XmlTag)e); } else if (e instanceof XmlAttrib...
getTags
62,206
boolean () { return false; }
startInWriteAction
62,207
IntentionPreviewInfo (@NotNull Project project, @NotNull ProblemDescriptor previewDescriptor) { return IntentionPreviewInfo.EMPTY; }
generatePreview
62,208
String () { return DevKitI18nBundle.message("inspections.plugin.xml.i18n.inspection.tag.family.name", "key"); }
getFamilyName
62,209
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement psiElement = descriptor.getPsiElement(); if (!(psiElement instanceof XmlTag xmlTag)) return; choosePropertiesFileAndExtract(project, Collections.singletonList(xmlTag), selection -> { PropertiesFile propertiesFile = findPropertiesFile(pr...
applyFix
62,210
String () { return DevKitI18nBundle.message("inspections.plugin.xml.i18n.inspection.tag.family.name", "displayName"); }
getFamilyName
62,211
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement element = descriptor.getPsiElement(); XmlTag xml = null; if (element instanceof XmlTag) { xml = (XmlTag)element; } else if (element instanceof XmlAttributeValue) { PsiElement parent = element.getParent(); xml = parent instanceof XmlAttr...
applyFix
62,212
void (@NotNull Project project, CommonProblemDescriptor @NotNull [] descriptors, @NotNull List<PsiElement> psiElementsToIgnore, @Nullable Runnable refreshViews) { doFix(project, getTags(Arrays.asList(descriptors))); }
applyFix
62,213
boolean () { return false; }
startInWriteAction
62,214
void (@NotNull Project project, List<XmlTag> tags) { choosePropertiesFileAndExtract(project, tags, selection -> { PropertiesFile propertiesFile = findPropertiesFile(project, selection); if (propertiesFile != null) { List<PsiFile> psiFiles = new ArrayList<>(); psiFiles.add(propertiesFile.getContainingFile()); for (XmlTa...
doFix
62,215
void (@NotNull Project project, XmlTag xml, PropertiesFile propertiesFile) { String displayName = xml.getAttributeValue("displayName"); if (displayName == null) return; xml.setAttribute("displayName", null); String shortName = xml.getAttributeValue("shortName"); if (shortName == null) { String implementationClass = xml...
registerPropertyKey
62,216
IntentionPreviewInfo (@NotNull Project project, @NotNull ProblemDescriptor previewDescriptor) { return IntentionPreviewInfo.EMPTY; }
generatePreview
62,217
String () { return DevKitI18nBundle.message("inspections.plugin.xml.i18n.name"); }
getFamilyName
62,218
void (@NotNull Project project, CommonProblemDescriptor @NotNull [] descriptors, @NotNull List<PsiElement> psiElementsToIgnore, @Nullable Runnable refreshViews) { VirtualFile nullValue = new LightVirtualFile(); Map<VirtualFile, List<CommonProblemDescriptor>> byPropertyFiles = Arrays.stream(descriptors) .filter(d -> d i...
applyFix
62,219
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement element = descriptor.getPsiElement(); if (!(element instanceof XmlTag tag)) return; doFix(project, myPropertiesFile, Collections.singletonList(tag)); }
applyFix
62,220
boolean () { return false; }
startInWriteAction
62,221
void (@NotNull Project project, VirtualFile file, List<XmlTag> tags) { if (file == null) { choosePropertiesFileAndExtract(project, tags, selection -> { PropertiesFile propertiesFile = findPropertiesFile(project, selection); doFix(project, tags, propertiesFile, true); }); } else { PropertiesFile propertiesFile = Propert...
doFix
62,222
void (@NotNull Project project, List<XmlTag> tags, PropertiesFile propertiesFile, boolean attachResourceBundle) { if (propertiesFile != null) { List<PsiFile> psiFiles = new ArrayList<>(); psiFiles.add(propertiesFile.getContainingFile()); for (XmlTag t : tags) { psiFiles.add(t.getContainingFile()); } WriteCommandAction ...
doFix
62,223
void (@NotNull Project project, List<XmlTag> tags, PropertiesFile propertiesFile) { for (XmlTag tag : tags) { XmlTag rootTag = ((XmlFile)tag.getContainingFile()).getRootTag(); LOG.assertTrue(rootTag != null); if (rootTag.findFirstSubTag("resource-bundle") == null) { XmlElementFactory elementFactory = XmlElementFactory....
createResourceBundleTag
62,224
void (@NotNull Project project, Collection<XmlTag> tags, PropertiesFile propertiesFile, boolean isAction) { for (XmlTag tag : tags) { String text = tag.getAttributeValue("text"); tag.setAttribute("text", null); String description = tag.getAttributeValue("description"); tag.setAttribute("description", null); String id; ...
extractTextAndDescription
62,225
IntentionPreviewInfo (@NotNull Project project, @NotNull ProblemDescriptor previewDescriptor) { return IntentionPreviewInfo.EMPTY; }
generatePreview
62,226
String () { return DevKitI18nBundle.message("inspections.plugin.xml.i18n.key"); }
getFamilyName
62,227
boolean () { return false; }
startInWriteAction
62,228
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { XmlTag xml = (XmlTag)descriptor.getPsiElement(); if (xml == null) return; doFix(project, Collections.singletonList(xml)); }
applyFix
62,229
void (@NotNull Project project, CommonProblemDescriptor @NotNull [] descriptors, @NotNull List<PsiElement> psiElementsToIgnore, @Nullable Runnable refreshViews) { doFix(project, getTags(Arrays.asList(descriptors))); }
applyFix
62,230
void (@NotNull Project project, List<XmlTag> tags) { choosePropertiesFileAndExtract(project, tags, selection -> { PropertiesFile propertiesFile = findPropertiesFile(project, selection); if (propertiesFile != null) { List<PsiFile> psiFiles = new ArrayList<>(); psiFiles.add(propertiesFile.getContainingFile()); for (XmlTa...
doFix
62,231
void (@NotNull Project project, XmlTag xml, PropertiesFile propertiesFile) { final DomElement domElement = DomUtil.getDomElement(xml); assert domElement instanceof Separator; Separator separator = (Separator)domElement; String text = StringUtil.defaultIfEmpty(separator.getText().getStringValue(), "noText"); @NonNls Str...
registerPropertyKey
62,232
IntentionPreviewInfo (@NotNull Project project, @NotNull ProblemDescriptor previewDescriptor) { return IntentionPreviewInfo.EMPTY; }
generatePreview
62,233
String () { return "DevKitPropertiesMessageValidation"; }
getMergedToolName
62,234
void (@NotNull DomElement element, @NotNull DomElementAnnotationHolder holder, @NotNull DomHighlightingHelper helper) { if (!isAllowed(holder)) return; if (element instanceof ActionOrGroup) { checkActionOrGroup((ActionOrGroup)element, holder); } else if (element instanceof OverrideText) { checkOverrideText((OverrideTex...
checkDomElement
62,235
void (Separator separator, DomElementAnnotationHolder holder) { if (checkCapitalization(holder, separator.getText(), Nls.Capitalization.Title)) return; checkCapitalizationWithKey(holder, separator.getKey(), Nls.Capitalization.Title); }
checkSeparator
62,236
void (Synonym synonym, DomElementAnnotationHolder holder) { if (checkCapitalization(holder, synonym.getText(), Nls.Capitalization.Title)) return; checkCapitalizationWithKey(holder, synonym.getKey(), Nls.Capitalization.Title); }
checkSynonym
62,237
void (OverrideText overrideText, DomElementAnnotationHolder holder) { if (checkCapitalization(holder, overrideText.getText(), Nls.Capitalization.Title)) return; if (DomUtil.hasXml(overrideText.getUseTextOfPlace())) return; ActionOrGroup actionOrGroup = overrideText.getParentOfType(ActionOrGroup.class, true); assert act...
checkOverrideText
62,238
void (ActionOrGroup actionOrGroup, DomElementAnnotationHolder holder) { checkActionOrGroupCapitalization(holder, actionOrGroup, ActionOrGroup.TextType.TEXT); checkActionOrGroupCapitalization(holder, actionOrGroup, ActionOrGroup.TextType.DESCRIPTION); }
checkActionOrGroup
62,239
void (DomElementAnnotationHolder holder, ActionOrGroup actionOrGroup, ActionOrGroup.TextType textType) { final GenericDomValue<String> genericDomValue = textType.getDomValue(actionOrGroup); final Nls.Capitalization capitalization = textType.getCapitalization(); if (checkCapitalization(holder, genericDomValue, capitaliz...
checkActionOrGroupCapitalization
62,240
void (DomElementAnnotationHolder holder, DomElement domElement, Nls.Capitalization capitalization, @NonNls @Nullable String resourceKey, boolean required) { if (resourceKey == null) return; final PropertiesFile bundleFile = DescriptorI18nUtil.findBundlePropertiesFile(domElement); if (bundleFile == null) return; final P...
checkPropertyCapitalization
62,241
void (Extension extension, DomElementAnnotationHolder holder) { for (DomChildrenDescription child : extension.getGenericInfo().getFixedChildrenDescriptions()) { for (DomElement value : child.getValues(extension)) { if (!value.exists() || !(value instanceof GenericDomValue genericDomValue)) continue; checkDomValue(exten...
checkExtension
62,242
void (Extension extension, DomElementAnnotationHolder holder, DomChildrenDescription childrenDescription, GenericDomValue genericDomValue) { final Class attributeType = DomUtil.getGenericValueParameter(childrenDescription.getType()); if (attributeType != String.class) return; final PsiElement declaration = childrenDesc...
checkDomValue
62,243
void (DomElementAnnotationHolder holder, GenericDomValue genericDomValue, Nls.Capitalization capitalization) { if (!DomUtil.hasXml(genericDomValue)) return; final XmlElement xmlElement = DomUtil.getValueElement(genericDomValue); if (xmlElement == null) return; for (PsiReference reference : xmlElement.getReferences()) {...
checkCapitalizationWithKey
62,244
boolean (DomElementAnnotationHolder holder, GenericDomValue genericDomValue, Nls.Capitalization capitalization) { if (!DomUtil.hasXml(genericDomValue)) return false; final String stringValue = genericDomValue.getStringValue(); highlightCapitalization(holder, genericDomValue, stringValue, capitalization, null); return t...
checkCapitalization
62,245
void (DomElementAnnotationHolder holder, DomElement domElement, String value, Nls.Capitalization capitalization, @Nullable Property property) { if (StringUtil.isEmptyOrSpaces(value)) return; @NlsSafe final String escapedValue = XmlUtil.unescape(value).replace("_", ""); if (NlsCapitalizationUtil.isCapitalizationSatisfie...
highlightCapitalization
62,246
IntentionPreviewInfo (@NotNull Project project, @NotNull ProblemDescriptor previewDescriptor) { Property property = myPropertyPointer.getElement(); if (property == null) return IntentionPreviewInfo.EMPTY; PsiFile containingFile = myPropertyPointer.getContainingFile(); assert containingFile != null; String propertyKey =...
generatePreview
62,247
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { Property propertyToFix = myPropertyPointer.getElement(); if (propertyToFix == null) return; propertyToFix.setValue(NlsCapitalizationUtil.fixValue(myValue, myCapitalization)); }
applyFix
62,248
void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { DomElement domElement = DomUtil.getDomElement(descriptor.getPsiElement()); if (!(domElement instanceof GenericDomValue)) return; ((GenericDomValue<?>)domElement).setStringValue(NlsCapitalizationUtil.fixValue(myValue, myCapitalization)); }
applyFix
62,249
void () {}
runEdtAction
62,250
Object () { return null; }
foo
62,251
Object () { return null; }
test
62,252
Object () { return null; }
test
62,253
Object () { Object o = new Object(); return o; }
test
62,254
Object () { return null; }
test
62,255
Object () { return null; }
test
62,256
Object () { return null; }
test
62,257
Object () { return null; }
test
62,258
Object () { return null; }
test
62,259
Object () { return null; }
test
62,260
Object () { return null; }
someMethod
62,261
Object () { return null; }
test
62,262
void () {}
test
62,263
Object () { return null; }
test
62,264
void () {}
test
62,265
Object () { return null; }
test
62,266
Application () { return new Application() { @Override public void assertIsDispatchThread() { if ("TESTING_BACKGROUND_THREAD".equals(Thread.currentThread().getName())) { throw new RuntimeException("Access is allowed from Event Dispatch Thread (EDT) only"); } } @Override public void assertIsNonDispatchThread() { if (!"TE...
getApplication
62,267
void () { if ("TESTING_BACKGROUND_THREAD".equals(Thread.currentThread().getName())) { throw new RuntimeException("Access is allowed from Event Dispatch Thread (EDT) only"); } }
assertIsDispatchThread
62,268
void () { if (!"TESTING_BACKGROUND_THREAD".equals(Thread.currentThread().getName())) { throw new RuntimeException("Access from Event Dispatch Thread (EDT) is not allowed"); } }
assertIsNonDispatchThread
62,269
void () {}
assertReadAccessAllowed
62,270
void () {}
assertWriteAccessAllowed
62,271
void () {}
assertReadAccessNotAllowed
62,272
String () { return DevKitJpsBundle.message("tmh.instrumenting.builder.name"); }
getPresentableName
62,273
String () { return DevKitJpsBundle.message("tmh.instrumenting.builder.progress"); }
getProgressMessage
62,274
boolean (CompileContext context, ModuleChunk chunk) { return SystemProperties.getBooleanProperty(INSTRUMENT_ANNOTATIONS_PROPERTY, false) || Boolean.TRUE.toString().equals(context.getBuilderParameter(INSTRUMENT_ANNOTATIONS_PROPERTY)); }
isEnabled
62,275
boolean (CompiledClass compiledClass, int classFileVersion) { return !"module-info".equals(compiledClass.getClassName()); }
canInstrument
62,276
BinaryContent (CompileContext context, CompiledClass compiledClass, ClassReader reader, ClassWriter writer, InstrumentationClassFinder finder) { try { boolean generateLineNumbers = SystemProperties.getBooleanProperty(GENERATE_LINE_NUMBERS_PROPERTY, false); if (TMHInstrumenter.instrument(reader, writer, generateLineNumb...
instrument
62,277
AnnotationChecker (int api, Runnable onShouldGenerateAssertion) { return new AnnotationChecker(api, onShouldGenerateAssertion); }
getAnnotationChecker
62,278
void (String annotationParameterName, Object value) { if (GENERATE_ASSERTION_PARAMETER.equals(annotationParameterName) && Boolean.FALSE.equals(value)) { myShouldGenerateAssertion = false; } }
visit
62,279
void () { if (myShouldGenerateAssertion) { myOnShouldGenerateAssertion.run(); } }
visitEnd
62,280
boolean (ClassReader classReader, ClassVisitor classWriter, Set<? extends TMHAssertionGenerator> generators, boolean generateLineNumbers) { AnnotatedMethodsCollector collector = new AnnotatedMethodsCollector(generators); int options = ClassReader.SKIP_FRAMES; if (!generateLineNumbers) { options |= ClassReader.SKIP_CODE...
instrument
62,281
boolean (ClassReader classReader, ClassVisitor classWriter, boolean generateLineNumbers) { return instrument(classReader, classWriter, Set.of( new TMHAssertionGenerator.AssertEdt(), new TMHAssertionGenerator.AssertBackgroundThread(), new TMHAssertionGenerator.AssertReadAccess(), new TMHAssertionGenerator.AssertWriteAcc...
instrument
62,282
MethodVisitor (int access, final String name, final String methodDescriptor, String signature, String[] exceptions) { return new MethodVisitor(Opcodes.API_VERSION) { private final MethodKey methodKey = new MethodKey(name, methodDescriptor); private boolean annotated = false; private boolean firstLineNumberVisited = fal...
visitMethod
62,283
AnnotationVisitor (String annotationDescriptor, boolean visible) { for (TMHAssertionGenerator assertionGenerator : assertionGenerators) { if (assertionGenerator.isMyAnnotation(annotationDescriptor)) { return assertionGenerator.getAnnotationChecker(Opcodes.API_VERSION, () -> { annotatedMethods.put(methodKey, new Instrum...
visitAnnotation
62,284
void (int line, Label start) { super.visitLineNumber(line, start); if (annotated && !firstLineNumberVisited) { annotatedMethods.get(methodKey).methodStartLineNumber = line; firstLineNumberVisited = true; } }
visitLineNumber
62,285
MethodVisitor (int access, String name, String descriptor, String signature, String[] exceptions) { InstrumentationInfo instrumentationInfo = myAnnotatedMethods.get(new MethodKey(name, descriptor)); if (instrumentationInfo == null) { return super.visitMethod(access, name, descriptor, signature, exceptions); } return ne...
visitMethod
62,286
void () { instrumentationInfo.assertionGenerator.generateAssertion(mv, instrumentationInfo.methodStartLineNumber); super.visitCode(); }
visitCode
62,287
int () { int result = 1; result = 31 * result + name.hashCode(); result = 31 * result + descriptor.hashCode(); return result; }
hashCode
62,288
boolean (Object obj) { return obj == this || obj instanceof MethodKey && ((MethodKey)obj).name.equals(name) && ((MethodKey)obj).descriptor.equals(descriptor); }
equals
62,289
List<JpsArtifact> (@NotNull JpsModel model) { List<JpsArtifact> artifacts = new ArrayList<>(); for (JpsTypedModule<JpsSimpleElement<JpsPluginModuleProperties>> module : model.getProject().getModules(JpsPluginModuleType.INSTANCE)) { artifacts.add(createArtifact(module, module.getProperties().getData())); } return artifa...
createArtifacts
62,290
JpsArtifact (JpsModule module, JpsPluginModuleProperties properties) { JpsPackagingElementFactory factory = JpsPackagingElementFactory.getInstance(); JpsCompositePackagingElement root = factory.createArtifactRoot(); String pluginXmlUrl = properties.getPluginXmlUrl(); if (pluginXmlUrl != null) { String pluginXmlPath = J...
createArtifact
62,291
boolean (JpsLibrary library) { List<File> files = library.getFiles(JpsOrderRootType.COMPILED); for (File file : files) { if (!file.isDirectory()) { return false; } } return true; }
hasDirsOnly
62,292
String () { return mySandboxHome; }
getSandboxHome
62,293
String () { return myJdkName; }
getJdkName
62,294
String () { return myPluginXmlUrl; }
getPluginXmlUrl
62,295
String () { return myManifestFileUrl; }
getManifestFileUrl
62,296
String (@NotNull JpsElement properties) { return ((JpsIdeaSdkProperties)((JpsSimpleElement<?>)properties).getData()).getJdkName(); }
getJavaSdkName
62,297
String () { return "IntelliJ Platform Plugin SDK"; }
getPresentableName
62,298
JpsSimpleElement<JpsIdeaSdkProperties> (@Nullable Element propertiesElement) { String sandboxHome = null; String jdkName = null; if (propertiesElement != null) { sandboxHome = JDOMExternalizerUtil.readField(propertiesElement, SANDBOX_HOME_FIELD); jdkName = propertiesElement.getAttributeValue(JDK_NAME_ATTRIBUTE); } retu...
loadProperties
62,299
JpsSimpleElement<JpsPluginModuleProperties> (@Nullable Element componentElement) { String pluginXmlUrl = componentElement != null ? componentElement.getAttributeValue(URL_ATTRIBUTE) : null; String manifestFileUrl = componentElement != null ? componentElement.getAttributeValue(MANIFEST_ATTRIBUTE) : null; return JpsEleme...
loadProperties