Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
23,500
GenericType (@NotNull PsiMethodCallExpression call) { return JavaTypes.INSTANCE.fromPsiType(extractType(call)); }
resolveTerminationCallType
23,501
List<TraceElement> (@NotNull Collection<? extends TraceElement> values) { return values.stream().sorted(Comparator.comparing(TraceElement::getTime)).collect(Collectors.toList()); }
sortedByTime
23,502
Object (@NotNull TraceElement element) { final Value value = element.getValue(); if (!(value instanceof PrimitiveValue)) return value; if (value instanceof IntegerValue) return ((IntegerValue)value).value(); if (value instanceof DoubleValue) return ((DoubleValue)value).value(); if (value instanceof LongValue) return ((LongValue)value).value(); if (value instanceof BooleanValue) return ((BooleanValue)value).value(); if (value instanceof ByteValue) return ((ByteValue)value).value(); if (value instanceof CharValue) return ((CharValue)value).value(); if (value instanceof FloatValue) return ((FloatValue)value).value(); throw new RuntimeException("unknown primitive value: " + value.type().name()); }
extractKey
23,503
String (@NotNull MethodCall call) { return call.getName() + StreamEx.of(call.getArguments()) .map(x -> StringUtil.shortenTextWithEllipsis(x.getText().replaceAll("\\s", ""), 30, 5, THREE_DOTS)) .joining(", ", "(", ")"); }
formatWithArguments
23,504
String (@NotNull String expression, int maxLength) { expression = expression.replaceAll("\\s", "").replaceAll(",", ", "); if (expression.length() < maxLength) return expression; if (expression.isEmpty()) return "qualifier"; return StringUtil.shortenTextWithEllipsis(expression, maxLength - 8, 5, THREE_DOTS); }
formatQualifierExpression
23,505
TextRange () { return myTextRange; }
getTextRange
23,506
List<CallArgument> () { return myArgs; }
getArguments
23,507
StreamCallType () { return myType; }
getType
23,508
GenericType () { return myTypeBefore; }
getTypeBefore
23,509
GenericType () { return myTypeAfter; }
getTypeAfter
23,510
QualifierExpression () { return myQualifierExpression; }
getQualifierExpression
23,511
List<IntermediateStreamCall> () { return Collections.unmodifiableList(myIntermediateCalls); }
getIntermediateCalls
23,512
StreamCall (int index) { if (0 <= index && index < length()) { return doGetCall(index); } throw new IndexOutOfBoundsException("Call index out of bound: " + index); }
getCall
23,513
TerminatorStreamCall () { return myTerminator; }
getTerminationCall
23,514
int () { return 1 + myIntermediateCalls.size(); }
length
23,515
PsiElement () { return myContext; }
getContext
23,516
StreamCall (int index) { if (index < myIntermediateCalls.size()) { return myIntermediateCalls.get(index); } return myTerminator; }
doGetCall
23,517
String (@NotNull List<CallArgument> args) { return StreamEx.of(args).map(CallArgument::getText).joining(", ", "(", ")"); }
args2Text
23,518
GenericType () { return myTypeBefore; }
getTypeBefore
23,519
GenericType () { return myReturnType; }
getResultType
23,520
Icon (@NotNull String path, int cacheKey, int flags) { return IconManager.getInstance().loadRasterizedIcon(path, JavaDebuggerStreamsIcons.class.getClassLoader(), cacheKey, flags); }
load
23,521
void (String s) { new CapturedParam().capturedParamHelper(s, "-", 0, "-"); }
capturedParam
23,522
void (String s1, String s2, int i3, String s4) { class Local { final String f; Local(@Pattern("\\d+") String s) { f = s + s2 + i3 + s4; } } new Local(s1); }
capturedParamHelper
23,523
void (String s1, String s2) { new Inner(s1, s2); }
createInner
23,524
void () { A a = new B(); a.get("-"); }
bridgeMethod
23,525
String () { return "-"; }
metaAnnotation
23,526
Object () { return new Object() { public void foo(@Pattern("\\d+") String s) { } }; }
enclosingStatic
23,527
Object () { return new Object() { public boolean foo(@Pattern("\\d+") String s) { return s.contains(EnclosingClass.this.toString()); } }; }
enclosingInstance
23,528
String (int i) { if (i == 1) return "+"; switch (i) { case 2: return "-"; } return "="; }
multiReturn
23,529
String () { return "-"; }
simpleReturn
23,530
String () { return "-"; }
simpleReturn
23,531
void (String s1, String s2) { new Nested(s1, s2); }
createNested
23,532
void (int maxStack, int maxLocals) { try { super.visitMaxs(maxStack, maxLocals); } catch (Throwable e) { myInstrumenter.registerError(myMethodName, "visitMaxs", e); } }
visitMaxs
23,533
String () { return JpsBuildBundle.message("intellilang.pattern.validator.presentable.name"); }
getPresentableName
23,534
boolean (CompileContext context, ModuleChunk chunk) { JpsGlobal project = context.getProjectDescriptor().getModel().getGlobal(); JpsIntelliLangConfiguration config = JpsIntelliLangExtensionService.getInstance().getConfiguration(project); return config.getInstrumentationType() != InstrumentationType.NONE; }
isEnabled
23,535
boolean (CompiledClass compiledClass, int classFileVersion) { return !"module-info".equals(compiledClass.getClassName()); }
canInstrument
23,536
BinaryContent (CompileContext context, CompiledClass compiled, ClassReader reader, ClassWriter writer, InstrumentationClassFinder finder) { JpsGlobal project = context.getProjectDescriptor().getModel().getGlobal(); JpsIntelliLangConfiguration config = JpsIntelliLangExtensionService.getInstance().getConfiguration(project); try { boolean instrumented = processClassFile(reader, writer, finder, config.getPatternAnnotationClass(), config.getInstrumentationType()); if (instrumented) { return new BinaryContent(writer.toByteArray()); } } catch (InstrumentationException e) { context.processMessage(new CompilerMessage(getPresentableName(), BuildMessage.Kind.ERROR, e.getMessage())); } return null; }
instrument
23,537
String () { return JpsBuildBundle.message("intellilang.pattern.validator.progress.message"); }
getProgressMessage
23,538
boolean (ClassReader reader, ClassWriter writer, InstrumentationClassFinder finder, String annotationClassName, InstrumentationType type) { PatternInstrumenter instrumenter = new PatternInstrumenter(annotationClassName, writer, type, finder); reader.accept(instrumenter, 0); return instrumenter.instrumented(); }
processClassFile
23,539
void (int version, int access, String name, String signature, String superName, String[] interfaces) { super.visit(version, access, name, signature, superName, interfaces); myClassName = name; myEnum = (access & ACC_ENUM) != 0; }
visit
23,540
void (String name, String outerName, String innerName, int access) { super.visitInnerClass(name, outerName, innerName, access); if (myClassName.equals(name)) { myInner = (access & ACC_STATIC) == 0; } }
visitInnerClass
23,541
FieldVisitor (int access, String name, String desc, String signature, Object value) { if (name.equals(ASSERTIONS_DISABLED_NAME)) { myHasAssertions = true; } return super.visitField(access, name, desc, signature, value); }
visitField
23,542
void () { if (myInstrumented) { for (String pattern : myPatterns) { // checks patterns so we can rely on them being valid at runtime try { Pattern.compile(pattern); } catch (Exception e) { throw new InstrumentationException("Illegal Pattern: " + pattern, e); } } addField(PATTERN_CACHE_NAME, ACC_PRIVATE | ACC_FINAL | ACC_STATIC | ACC_SYNTHETIC, JAVA_UTIL_REGEX_PATTERN); if (myDoAssert && !myHasAssertions) { addField(ASSERTIONS_DISABLED_NAME, ACC_FINAL | ACC_STATIC | ACC_SYNTHETIC, "Z"); } if (!myHasStaticInitializer) { MethodVisitor mv = cv.visitMethod(ACC_STATIC, "<clinit>", "()V", null, null); mv.visitCode(); patchStaticInitializer(mv); mv.visitInsn(RETURN); mv.visitMaxs(0, 0); mv.visitEnd(); } } super.visitEnd(); }
visitEnd
23,543
void (String name, int access, String desc) { cv.visitField(access, name, desc, null, null).visitEnd(); }
addField
23,544
void (MethodVisitor mv) { if (myDoAssert && !myHasAssertions) { mv.visitLdcInsn(Type.getType("L" + myClassName + ";")); mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Class", "desiredAssertionStatus", "()Z", false); Label l0 = new Label(); mv.visitJumpInsn(IFNE, l0); mv.visitInsn(ICONST_1); Label l1 = new Label(); mv.visitJumpInsn(GOTO, l1); mv.visitLabel(l0); mv.visitInsn(ICONST_0); mv.visitLabel(l1); mv.visitFieldInsn(PUTSTATIC, myClassName, ASSERTIONS_DISABLED_NAME, "Z"); } mv.visitIntInsn(BIPUSH, myPatterns.size()); mv.visitTypeInsn(ANEWARRAY, "java/util/regex/Pattern"); mv.visitFieldInsn(PUTSTATIC, myClassName, PATTERN_CACHE_NAME, JAVA_UTIL_REGEX_PATTERN); int i = 0; for (String pattern : myPatterns) { mv.visitFieldInsn(GETSTATIC, myClassName, PATTERN_CACHE_NAME, JAVA_UTIL_REGEX_PATTERN); mv.visitIntInsn(BIPUSH, i++); mv.visitLdcInsn(pattern); mv.visitMethodInsn(INVOKESTATIC, "java/util/regex/Pattern", "compile", "(Ljava/lang/String;)Ljava/util/regex/Pattern;", false); mv.visitInsn(AASTORE); } }
patchStaticInitializer
23,545
MethodVisitor (int access, String name, String desc, String signature, String[] exceptions) { MethodVisitor methodvisitor = cv.visitMethod(access, name, desc, signature, exceptions); boolean isStatic = (access & ACC_STATIC) != 0; if (isStatic && name.equals("<clinit>")) { myHasStaticInitializer = true; return new ErrorPostponingMethodVisitor(this, name, methodvisitor) { @Override public void visitCode() { super.visitCode(); patchStaticInitializer(mv); } }; } if ((access & Opcodes.ACC_BRIDGE) == 0) { Type[] argTypes = Type.getArgumentTypes(desc); Type returnType = Type.getReturnType(desc); if (isCandidate(argTypes, returnType)) { int offset = !"<init>".equals(name) ? 0 : myEnum ? 2 : myInner ? 1 : 0; return new InstrumentationAdapter(this, methodvisitor, argTypes, returnType, myClassName, name, myDoAssert, isStatic, offset); } } return new ErrorPostponingMethodVisitor(this, name, methodvisitor); }
visitMethod
23,546
void () { super.visitCode(); patchStaticInitializer(mv); }
visitCode
23,547
boolean (Type[] argTypes, Type returnType) { if (isStringType(returnType)) { return true; } for (Type argType : argTypes) { if (isStringType(argType)) { return true; } } return false; }
isCandidate
23,548
boolean (Type type) { return type.getSort() == Type.OBJECT && type.getDescriptor().equals(JAVA_LANG_STRING); }
isStringType
23,549
AnnotationVisitor (String desc, boolean visible) { boolean matches = myPatternAnnotationClassName.equals(Type.getType(desc).getClassName()); return !matches ? null : new AnnotationVisitor(Opcodes.API_VERSION) { @Override public void visit(String name, Object value) { if ("value".equals(name) && value instanceof String) { myAnnotationPatterns.put(annotationClassName, (String)value); } } }; }
visitAnnotation
23,550
void (String name, Object value) { if ("value".equals(name) && value instanceof String) { myAnnotationPatterns.put(annotationClassName, (String)value); } }
visit
23,551
void (int parameterCount, boolean visible) { if (myParamAnnotationOffset != 0 && parameterCount == myArgTypes.length) { myParamAnnotationOffset = 0; } super.visitAnnotableParameterCount(parameterCount, visible); }
visitAnnotableParameterCount
23,552
AnnotationVisitor (int parameter, String desc, boolean visible) { AnnotationVisitor av = mv.visitParameterAnnotation(parameter, desc, visible); if (isStringType(myArgTypes[parameter + myParamAnnotationOffset])) { String annotationClassName = Type.getType(desc).getClassName(); String pattern = myInstrumenter.getAnnotationPattern(annotationClassName); if (pattern != null) { String shortName = annotationClassName.substring(annotationClassName.lastIndexOf('.') + 1); PatternValue patternValue = new PatternValue(parameter + myParamAnnotationOffset, shortName, pattern); myParameterPatterns.add(patternValue); if (Strings.areSameInstance(pattern, PatternInstrumenter.NULL_PATTERN)) { return new MyAnnotationVisitor(av, patternValue); } } } return av; }
visitParameterAnnotation
23,553
AnnotationVisitor (String desc, boolean visible) { AnnotationVisitor av = mv.visitAnnotation(desc, visible); if (isStringType(myReturnType)) { String annotationClassName = Type.getType(desc).getClassName(); String pattern = myInstrumenter.getAnnotationPattern(annotationClassName); if (pattern != null) { String shortName = annotationClassName.substring(annotationClassName.lastIndexOf('.') + 1); myMethodPattern = new PatternValue(-1, shortName, pattern); if (Strings.areSameInstance(pattern, PatternInstrumenter.NULL_PATTERN)) { return new MyAnnotationVisitor(av, myMethodPattern); } } } return av; }
visitAnnotation
23,554
void () { for (PatternValue parameter : myParameterPatterns) { int var = myIsStatic ? 0 : 1; for (int l = 0; l < parameter.parameterIndex; l++) var += myArgTypes[l].getSize(); Label checked = new Label(); addPatternTest(parameter.patternIndex, checked, var); String message = MessageFormat.format("Argument {0} for @{1} parameter of {2}.{3} does not match pattern {4}", parameter.parameterIndex, parameter.annotation, myClassName, myMethodName, parameter.pattern); addPatternAssertion(message, false); mv.visitLabel(checked); } if (myMethodPattern != null) { myCheckReturnLabel = new Label(); } }
visitCode
23,555
void (int opcode) { if (opcode == Opcodes.ARETURN && myCheckReturnLabel != null) { mv.visitJumpInsn(Opcodes.GOTO, myCheckReturnLabel); } else { mv.visitInsn(opcode); } }
visitInsn
23,556
void (int maxStack, int maxLocals) { try { if (myCheckReturnLabel != null) { int var = maxLocals + 1; // next index for synthetic variable that holds return value mv.visitLabel(myCheckReturnLabel); mv.visitVarInsn(Opcodes.ASTORE, var); Label checked = new Label(); addPatternTest(myMethodPattern.patternIndex, checked, var); String message = MessageFormat.format("Return value of method {0}.{1} annotated as @{2} does not match pattern {3}", myClassName, myMethodName, myMethodPattern.annotation, myMethodPattern.pattern); addPatternAssertion(message, true); mv.visitLabel(checked); mv.visitLocalVariable(RETURN_VALUE_NAME, PatternInstrumenter.JAVA_LANG_STRING, null, myCheckReturnLabel, checked, var); mv.visitVarInsn(Opcodes.ALOAD, var); mv.visitInsn(Opcodes.ARETURN); } super.visitMaxs(maxStack, maxLocals); } catch (Throwable e) { myInstrumenter.registerError(myMethodName, "visitMaxs", e); } }
visitMaxs
23,557
void (int patternIndex, Label label, int varIndex) { if (myDoAssert) { mv.visitFieldInsn(Opcodes.GETSTATIC, myClassName, PatternInstrumenter.ASSERTIONS_DISABLED_NAME, "Z"); mv.visitJumpInsn(Opcodes.IFNE, label); } mv.visitVarInsn(Opcodes.ALOAD, varIndex); mv.visitJumpInsn(Opcodes.IFNULL, label); mv.visitFieldInsn(GETSTATIC, myClassName, PatternInstrumenter.PATTERN_CACHE_NAME, "[Ljava/util/regex/Pattern;"); mv.visitIntInsn(BIPUSH, patternIndex); mv.visitInsn(AALOAD); mv.visitVarInsn(ALOAD, varIndex); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/regex/Pattern", "matcher", "(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;", false); mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/regex/Matcher", "matches", "()Z", false); mv.visitJumpInsn(Opcodes.IFNE, label); }
addPatternTest
23,558
void (String message, boolean isMethod) { if (myDoAssert) { addThrow("java/lang/AssertionError", "(Ljava/lang/Object;)V", message); } else if (isMethod) { addThrow("java/lang/IllegalStateException", "(Ljava/lang/String;)V", message); } else { addThrow("java/lang/IllegalArgumentException", "(Ljava/lang/String;)V", message); } myInstrumenter.markInstrumented(); }
addPatternAssertion
23,559
void (String throwableClass, String ctorSignature, String message) { mv.visitTypeInsn(Opcodes.NEW, throwableClass); mv.visitInsn(Opcodes.DUP); mv.visitLdcInsn(message); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, throwableClass, "<init>", ctorSignature, false); mv.visitInsn(Opcodes.ATHROW); }
addThrow
23,560
void (String name, Object value) { av.visit(name, value); if ("value".equals(name) && value instanceof String) { myPatternValue.set((String)value); } }
visit
23,561
JpsIntelliLangExtensionService () { return JpsServiceManager.getInstance().getService(JpsIntelliLangExtensionService.class); }
getInstance
23,562
JpsIntelliLangConfiguration (@NotNull JpsGlobal global) { JpsIntelliLangConfiguration configuration = global.getContainer().getChild(JpsIntelliLangConfigurationImpl.ROLE); return configuration != null ? configuration : new JpsIntelliLangConfigurationImpl(); }
getConfiguration
23,563
void (@NotNull JpsGlobal global, @NotNull JpsIntelliLangConfiguration config) { global.getContainer().setChild(JpsIntelliLangConfigurationImpl.ROLE, config); }
setConfiguration
23,564
void (@NotNull JpsGlobal global, @NotNull Element componentTag) { JpsIntelliLangConfigurationImpl configuration = new JpsIntelliLangConfigurationImpl(); String annotationName = JDOMExternalizerUtil.readField(componentTag, PATTERN_ANNOTATION_NAME); if (annotationName != null) { configuration.setPatternAnnotationClassName(annotationName); } String instrumentationType = JDOMExternalizerUtil.readField(componentTag, INSTRUMENTATION_TYPE_NAME); if (instrumentationType != null) { try { configuration.setInstrumentationType(InstrumentationType.valueOf(instrumentationType)); } catch (IllegalArgumentException e) { LOG.info(e); } } JpsIntelliLangExtensionService.getInstance().setConfiguration(global, configuration); }
loadExtension
23,565
void (@NotNull JpsGlobal global) { JpsIntelliLangExtensionService.getInstance().setConfiguration(global, new JpsIntelliLangConfigurationImpl()); }
loadExtensionWithDefaultSettings
23,566
JpsIntelliLangConfigurationImpl () { return new JpsIntelliLangConfigurationImpl(); }
createCopy
23,567
void (@NotNull JpsIntelliLangConfigurationImpl modified) { myPatternAnnotationClassName = modified.myPatternAnnotationClassName; myInstrumentationType = modified.myInstrumentationType; }
applyChanges
23,568
String () { return myPatternAnnotationClassName; }
getPatternAnnotationClass
23,569
InstrumentationType () { return myInstrumentationType; }
getInstrumentationType
23,570
void (@NotNull String patternAnnotationClassName) { myPatternAnnotationClassName = patternAnnotationClassName; }
setPatternAnnotationClassName
23,571
void (@NotNull InstrumentationType instrumentationType) { myInstrumentationType = instrumentationType; }
setInstrumentationType
23,572
void () { Element state = getState(); myInjections.clear(); PatternCompilerFactory.getFactory().dropCache(); loadState(state); configurationModified(); }
reloadInjections
23,573
void (Runnable runnable) { runnable.run(); }
invokeAfterReload
23,574
void (@NotNull IdeaPluginDescriptor pluginDescriptor, boolean isUpdate) { // myDefaultInjections could change while we perform the unloading, but we need to have original state until plugin is fully unloaded myUnloadingDefaultInjections = getDefaultInjections(); }
beforePluginUnload
23,575
void (@NotNull IdeaPluginDescriptor pluginDescriptor, boolean isUpdate) { reloadInjections(); myUnloadingDefaultInjections = null; while (!myActionsPostponedUntilUnloadingEnds.isEmpty()) { myActionsPostponedUntilUnloadingEnds.removeLast().run(); } configurationModified(); }
pluginUnloaded
23,576
void () { }
dispose
23,577
void (Runnable runnable) { if (myUnloadingDefaultInjections == null) { runnable.run(); } else { myActionsPostponedUntilUnloadingEnds.add(runnable); } }
invokeAfterReload
23,578
void () { super.reloadInjections(); myDefaultInjections = loadDefaultInjections(); }
reloadInjections
23,579
List<BaseInjection> () { if (myUnloadingDefaultInjections != null) { return myUnloadingDefaultInjections; } else { return myDefaultInjections; } }
getDefaultInjections
23,580
AdvancedConfiguration () { return myAdvancedConfiguration; }
getAdvancedConfiguration
23,581
void (@NotNull final Element element) { myAdvancedConfiguration.loadState(element); super.loadState(element); }
loadState
23,582
Element () { final Element element = new Element(COMPONENT_NAME); myAdvancedConfiguration.writeState(element); return getState(element); }
getState
23,583
AdvancedConfiguration () { return myParentConfiguration.getAdvancedConfiguration(); }
getAdvancedConfiguration
23,584
List<BaseInjection> () { return myParentConfiguration.getDefaultInjections(); }
getDefaultInjections
23,585
Collection<BaseInjection> () { Collection<BaseInjection> injections = super.getAllInjections(); injections.addAll(myParentConfiguration.getAllInjections()); return injections; }
getAllInjections
23,586
List<BaseInjection> (final String injectorId) { return ContainerUtil.concat(myParentConfiguration.getInjections(injectorId), getOwnInjections(injectorId)); }
getInjections
23,587
Configuration () { return myParentConfiguration; }
getParentConfiguration
23,588
void (Runnable runnable) { Configuration parentConfiguration = getParentConfiguration(); if(parentConfiguration != null){ parentConfiguration.invokeAfterReload(runnable); return; } super.invokeAfterReload(runnable); }
invokeAfterReload
23,589
List<BaseInjection> (final String injectorId) { return super.getInjections(injectorId); }
getOwnInjections
23,590
long () { return super.getModificationCount() + myParentConfiguration.getModificationCount(); }
getModificationCount
23,591
boolean (List<? extends BaseInjection> newInjections, List<? extends BaseInjection> originalInjections, boolean forceLevel) { if (!forceLevel && !originalInjections.isEmpty()) { if (myParentConfiguration.replaceInjections(Collections.emptyList(), originalInjections, false)) { myParentConfiguration.replaceInjections(newInjections, Collections.emptyList(), false); return true; } } return super.replaceInjections(newInjections, originalInjections, forceLevel); }
replaceInjections
23,592
Collection<BaseInjection> () { List<BaseInjection> injections = new ArrayList<>(); for (List<BaseInjection> list : myInjections.values()) { injections.addAll(list); } return injections; }
getAllInjections
23,593
AdvancedConfiguration () { throw new UnsupportedOperationException("getAdvancedConfiguration should not be called"); }
getAdvancedConfiguration
23,594
void (@NotNull final Element element) { myInjections.clear(); List<Element> injectionElements = element.getChildren("injection"); if (!injectionElements.isEmpty()) { final Map<String, LanguageInjectionSupport> supports = new HashMap<>(); for (LanguageInjectionSupport support : InjectorUtils.getActiveInjectionSupports()) { supports.put(support.getId(), support); } for (Element child : injectionElements) { final String key = child.getAttributeValue("injector-id"); final LanguageInjectionSupport support = supports.get(key); final BaseInjection injection = support == null ? new BaseInjection(key) : support.createInjection(child); injection.loadState(child); InjectionPlace[] places = dropKnownInvalidPlaces(injection.getInjectionPlaces()); if (places != null) { // not all places were removed injection.setInjectionPlaces(places); myInjections.get(key).add(injection); } } } invokeAfterReload(() -> importPlaces(getDefaultInjections())); }
loadState
23,595
boolean (Element element, String key, boolean defValue) { final String value = JDOMExternalizerUtil.readField(element, key); if (value == null) return defValue; return Boolean.parseBoolean(value); }
readBoolean
23,596
List<BaseInjection> () { final List<Configuration> cfgList = new ArrayList<>(); final Set<Object> visited = new HashSet<>(); LanguageInjectionSupport.CONFIG_EP_NAME.processWithPluginDescriptor((configBean, pluginDescriptor) -> { final ClassLoader loader = pluginDescriptor.getClassLoader(); try { final Enumeration<URL> enumeration = loader.getResources(configBean.getConfigUrl()); if (enumeration == null || !enumeration.hasMoreElements()) { LOG.warn(pluginDescriptor.getPluginId() +": " + configBean.getConfigUrl() + " was not found"); } else { while (enumeration.hasMoreElements()) { URL url = enumeration.nextElement(); if (!visited.add(url.getFile())) continue; // for DEBUG mode try (InputStream stream = url.openStream()) { cfgList.add(load(stream)); } catch (ProcessCanceledException e) { throw e; } catch (Exception e) { LOG.warn(e); } } } } catch (ProcessCanceledException e) { throw e; } catch (Exception e) { LOG.warn(e); } return Unit.INSTANCE; }); final List<BaseInjection> defaultInjections = new ArrayList<>(); for (String supportId : InjectorUtils.getActiveInjectionSupportIds()) { for (Configuration cfg : cfgList) { final List<BaseInjection> imported = cfg.getInjections(supportId); defaultInjections.addAll(imported); } } return Collections.unmodifiableList(defaultInjections); }
loadDefaultInjections
23,597
Element () { return getState(new Element(COMPONENT_NAME)); }
getState
23,598
Element (Element element) { Comparator<BaseInjection> comparator = (o1, o2) -> { int rc = Comparing.compare(o1.getDisplayName(), o2.getDisplayName()); if (rc != 0) return rc; return ContainerUtil.compareLexicographically( Arrays.asList(o1.getInjectionPlaces()), Arrays.asList(o2.getInjectionPlaces()), (o11, o22) -> { if (o11.isEnabled() && !o22.isEnabled()) return -1; if (!o11.isEnabled() && o22.isEnabled()) return 1; return Comparing.compare(o11.getElementPattern().toString(), o22.getElementPattern().toString()); }); }; for (String key : new TreeSet<>(myInjections.keySet())) { Set<BaseInjection> injections = new HashSet<>(myInjections.get(key)); injections.removeAll(getDefaultInjections()); for (BaseInjection injection : ContainerUtil.sorted(injections, comparator)) { element.addContent(injection.getState()); } } return element; }
getState
23,599
Configuration () { return ApplicationManager.getApplication().getService(Configuration.class); }
getInstance