Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
16,600
void (final Node n) { if (!myNeighbours.contains(n)) { myNeighbours.add(n); n.addEdge(this); } }
addEdge
16,601
void (final PsiType t) { if (t instanceof PsiTypeVariable) { boundVars.add((PsiTypeVariable)t); } else if (t instanceof PsiArrayType) { visit(t.getDeepComponentType()); } else if (t instanceof PsiClassType) { final PsiSubstitutor subst = Util.resolveType(t).getSubstitutor(); for (final PsiType type : subst.getSubstitut...
visit
16,602
void (final Constraint constraint, final Set<PsiTypeVariable> vars) { if (myBoundVariables == null) { myBoundVariables = vars; } else { myBoundVariables.addAll(vars); } myConstraints.add(constraint); }
addConstraint
16,603
PsiTypeVariableFactory () { return myTypeVariableFactory; }
getVariableFactory
16,604
Set<PsiTypeVariable> () { return myBoundVariables; }
getBoundVariables
16,605
String (final Binding bestBinding) { final @NonNls String[] data = new String[myElements.size()]; class Substitutor { PsiType substitute(final PsiType t) { if (t instanceof PsiWildcardType wcType) { final PsiType bound = wcType.getBound(); if (bound == null) { return t; } final PsiManager manager = PsiManager.getInstan...
dumpResult
16,606
Settings () { return mySettings; }
getSettings
16,607
Set<PsiElement> (final PsiElement[] scopes) { return new VictimCollector(scopes, mySettings).getVictims(); }
collect
16,608
boolean (final PsiElement element, final Set<PsiElement> victims, final PsiSearchHelper helper) { PsiMethod method; PsiParameter parameter = null; int index = 0; if (element instanceof PsiMethod) { method = (PsiMethod)element; } else if (element instanceof PsiParameter) { parameter = (PsiParameter)element; method = (Ps...
verifyMethod
16,609
void (final PsiElement e, final PsiType t) { myTypes.put(e, t); }
setType
16,610
PsiType (final PsiElement e) { PsiType t = myTypes.get(e); if (t != null) { return t; } t = Util.getType(e); final PsiType parameterizedType = Util.createParameterizedType(t, myTypeVariableFactory, e); myTypes.put(e, parameterizedType); return parameterizedType; }
defineType
16,611
PsiType (final PsiElement e) { final PsiType t = myTypes.get(e); if (t != null) { return t; } return Util.banalize(Util.getType(e)); }
getType
16,612
boolean (final PsiElement element) { return myTypes.get(element) != null; }
isCooked
16,613
PsiType (final PsiTypeParameter typeParameter, final PsiParameter[] parameters, PsiExpression[] arguments, PsiSubstitutor partialSubstitutor, PsiElement parent, ReductionSystem system) { PsiType substitution = PsiTypes.nullType(); PsiResolveHelper helper = JavaPsiFacade.getInstance(typeParameter.getProject()).getResolv...
inferTypeForMethodTypeParameter
16,614
PsiType (final PsiTypeParameter typeParameter, PsiSubstitutor substitutor, PsiElement parent, ReductionSystem system) { PsiTypeParameterListOwner owner = typeParameter.getOwner(); PsiType substitution = PsiTypes.nullType(); if (owner instanceof PsiMethod && parent instanceof PsiMethodCallExpression methodCall) { substi...
inferMethodTypeParameterFromParent
16,615
PsiType (PsiElement parent, PsiMethodCallExpression methodCall, final PsiTypeParameter typeParameter, PsiSubstitutor substitutor, ReductionSystem system) { PsiType type = null; if (parent instanceof PsiVariable && methodCall.equals(((PsiVariable)parent).getInitializer())) { type = getType(parent); } else if (parent ins...
inferMethodTypeParameterFromParent
16,616
PsiType (final PsiType ext) { final PsiClassType.ClassResolveResult result = Util.resolveType(ext); final PsiClass aClass = result.getElement(); if (aClass != null) { if (aClass instanceof PsiTypeParameter) { final PsiType type = mapping.get(aClass); if (type != null) { return type; } return ext; } final PsiSubstitutor...
substitute
16,617
void (final ReductionSystem system, final PsiElement element) { if (element instanceof PsiVariable) { final PsiExpression initializer = ((PsiVariable)element).getInitializer(); if (initializer != null) { final PsiExpression core = PsiUtil.deparenthesizeExpression(initializer); if (core instanceof PsiArrayInitializerExp...
addUsage
16,618
void (@NotNull PsiClass aClass) {}
visitClass
16,619
void (@NotNull PsiLambdaExpression expression) {}
visitLambdaExpression
16,620
SearchScope (final PsiSearchHelper helper, final PsiElement element) { SearchScope scope = helper.getUseScope(element); if (scope instanceof GlobalSearchScope) { scope = GlobalSearchScope.getScopeRestrictedByFileTypes((GlobalSearchScope)scope, JavaFileType.INSTANCE, StdFileTypes.JSP, StdFileTypes.JSPX); } return scope;...
getScope
16,621
void (final PsiType defined, final PsiType type, final ReductionSystem system) { final PsiClassType.ClassResolveResult resultDefined = Util.resolveType(defined); final PsiClassType.ClassResolveResult resultType = Util.resolveType(type); final PsiClass definedClass = resultDefined.getElement(); if (definedClass == null ...
addBoundConstraintsImpl
16,622
void (final ReductionSystem system, final PsiType definedType, final PsiElement element) { final PsiType elementType = Util.getType(element); if (elementType != null) { addBoundConstraintsImpl(definedType, elementType, system); if (mySettings.cookObjects() && elementType.getCanonicalText().equals(CommonClassNames.JAVA_...
addBoundConstraints
16,623
ReductionSystem (final PsiElement... scopes) { return build(collect(scopes)); }
build
16,624
ReductionSystem (final Set<PsiElement> victims) { final PsiSearchHelper helper = PsiSearchHelper.getInstance(myManager.getProject()); ReductionSystem system = new ReductionSystem(myProject, victims, myTypes, myTypeVariableFactory, mySettings); for (final PsiElement element : victims) { if (element instanceof PsiParamet...
build
16,625
void (final ReductionSystem system, final PsiForeachStatement statement) { final PsiType paramType = getType(statement.getIterationParameter()); final PsiExpression value = statement.getIteratedValue(); if (value != null) { final PsiType type = evaluateType(value, system); if (type instanceof PsiClassType) { final PsiC...
addForEachConstraint
16,626
void (final Binding binding) { if (myBinding == null) { myBinding = binding; } else { myBinding.merge(binding, mySettings.leaveObjectParameterizedTypesRaw()); } }
incorporateSolution
16,627
PsiType (final PsiElement element) { final PsiType originalType = Util.getType(element); if (myBinding != null) { final PsiType type = myBinding.substitute(myTypes.get(element)); @NonNls final String objectFQName = CommonClassNames.JAVA_LANG_OBJECT; if (originalType.getCanonicalText().equals(objectFQName)) { if (type =...
getCookedType
16,628
Set<PsiElement> () { myCookedNumber = 0; final Set<PsiElement> set = new HashSet<>(); for (final PsiElement element : myVictims) { final PsiType originalType = Util.getType(element); final PsiType cookedType = getCookedType(element); if (cookedType != null && !originalType.equals(cookedType)) { set.add(element); myCook...
getCookedElements
16,629
boolean (final PsiType type) { final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(type); final PsiClass clazz = resolveResult.getElement(); if (clazz != null) { for (PsiTypeParameter typeParameter : PsiUtil.typeParametersIterable(clazz)) { final PsiType t = resolveResult.getSubstit...
isBottomArgument
16,630
void (final Set<PsiElement> victims) { for (final PsiElement element : victims) { if (element instanceof PsiTypeCastExpression cast && myCastToOperandType.containsKey(element)) { try { cast.replace(cast.getOperand()); myCastsRemoved++; } catch (IncorrectOperationException e1) { LOG.error(e1); } } else { Util.changeType...
apply
16,631
String (final int x, final int y) { final String ratio = JavaRareRefactoringsBundle.message("type.cook.ratio.generified", x, y); return ratio + (y != 0 ? " (" + (x * 100 / y) + "%)" : ""); }
getRatio
16,632
Constraint (final Binding b) { return new Subtype(b.apply(myLeft), b.apply(myRight)); }
apply
16,633
PsiType () { return myRight; }
getRight
16,634
PsiType () { return myLeft; }
getLeft
16,635
String () { return myLeft.getCanonicalText() + " " + relationString() + " " + myRight.getCanonicalText(); }
toString
16,636
boolean (Object o) { if (this == o) return true; return o instanceof Constraint constraint && Objects.equals(myLeft, constraint.myLeft) && Objects.equals(myRight, constraint.myRight); }
equals
16,637
int () { int result; result = (myLeft != null ? myLeft.hashCode() : 0); result = 29 * result + (myRight != null ? myRight.hashCode() : 0); return result + relationType(); }
hashCode
16,638
void (final Binding b1) { for (final Binding b2 : mySolutions) { switch (b1.compare(b2)) { case Binding.WORSE, Binding.SAME -> { return; } case Binding.BETTER -> { mySolutions.remove(b2); mySolutions.addFirst(b1); return; } case Binding.NONCOMPARABLE -> { } } } mySolutions.addFirst(b1); }
putSolution
16,639
Binding () { Binding best = null; int width = 0; for (final Binding binding : mySolutions) { final int w = binding.getWidth(); if (w > width && binding.isValid()) { width = w; best = binding; } } return best; }
getBestSolution
16,640
PsiClass[] (final PsiClass aClass, final PsiClass bClass) { if (InheritanceUtil.isInheritorOrSelf(aClass, bClass, true)) { return new PsiClass[]{aClass}; } if (InheritanceUtil.isInheritorOrSelf(bClass, aClass, true)) { return new PsiClass[]{bClass}; } final Set<PsiClass> descendants = new LinkedHashSet<>(); new Object(...
getGreatestLowerClasses
16,641
void (final PsiClass aClass, final PsiClass bClass, final Set<? super PsiClass> descendants) { if (bClass.hasModifierProperty(PsiModifier.FINAL)) return; if (aClass.isInheritor(bClass, true)) { descendants.add(aClass); } else { for (PsiClass bInheritor : ClassInheritorsSearch.search(bClass, false)) { getGreatestLowerCl...
getGreatestLowerClasses
16,642
PsiType (final PsiType type) { if (type instanceof PsiTypeVariable) { final PsiType t = myBindings.get(((PsiTypeVariable) type).getIndex()); return t == null ? type : t; } else if (type instanceof PsiArrayType) { return apply(((PsiArrayType)type).getComponentType()).createArrayType(); } else if (type instanceof PsiClas...
apply
16,643
boolean (final Object o) { if (this == o) return true; return o instanceof BindingImpl binding && myBindings.equals(binding.myBindings); }
equals
16,644
Binding (final Binding b) { LOG.assertTrue(b instanceof BindingImpl); final BindingImpl b1 = this; final BindingImpl b2 = (BindingImpl)b; final BindingImpl b3 = new BindingImpl(); for (PsiTypeVariable boundVariable : myBoundVariables) { final int i = boundVariable.getIndex(); final PsiType b1i = b1.myBindings.get(i); f...
compose
16,645
String () { final StringBuilder buffer = new StringBuilder(); for (PsiTypeVariable boundVariable : myBoundVariables) { final int i = boundVariable.getIndex(); final PsiType binding = myBindings.get(i); if (binding != null) { buffer.append("#").append(i).append(" -> ").append(binding.getPresentableText()).append("; "); ...
toString
16,646
PsiType (final PsiType t) { if (t == null || t instanceof PsiTypeVariable) { return Bottom.BOTTOM; } if (t instanceof PsiWildcardType) { return ((PsiWildcardType)t).getBound(); } return t; }
normalize
16,647
int (final Binding binding) { final BindingImpl b2 = (BindingImpl)binding; final BindingImpl b1 = this; int directoin = Binding.NONCOMPARABLE; boolean first = true; for (PsiTypeVariable boundVariable : myBoundVariables) { final int index = boundVariable.getIndex(); final PsiType x = normalize(b1.myBindings.get(index));...
compare
16,648
int (final PsiType type) { if (type == null) { return 0; } if (type instanceof PsiPrimitiveType) { return 1; } if (type instanceof PsiArrayType) { return 2; } if (type instanceof PsiClassType) { return 3; } return 4; // Bottom }
classify
16,649
boolean () { return myBindings.size() > 0; }
nonEmpty
16,650
boolean () { return myCyclic; }
isCyclic
16,651
Binding () { final BindingImpl binding = (BindingImpl)create(); for (final PsiTypeVariable var : myBoundVariables) { final int index = var.getIndex(); final PsiType type = myBindings.get(index); if (type != null) { class Verifier extends PsiExtendedTypeVisitor<Void> { boolean myFlag; @Override public Void visitTypeVari...
reduceRecursive
16,652
boolean (final PsiTypeVariable var) { return myBindings.get(var.getIndex()) != null; }
binds
16,653
void (final Binding b, final boolean removeObject) { for (final PsiTypeVariable var : b.getBoundVariables()) { final int index = var.getIndex(); if (myBindings.get(index) != null) { LOG.error("Oops... Binding conflict..."); } else { final PsiType type = b.apply(var); final PsiClassType javaLangObject = PsiType.getJavaL...
merge
16,654
Set<PsiTypeVariable> () { return myBoundVariables; }
getBoundVariables
16,655
int () { int width= 0; for (Int2ObjectMap.Entry<PsiType> entry : myBindings.int2ObjectEntrySet()) { PsiType type = entry.getValue(); if (substitute(type) != null) width++; } return width; }
getWidth
16,656
boolean () { for (final PsiTypeVariable var : myBoundVariables) { final PsiType type = substitute(var); if (!var.isValidInContext(type)) { return false; } } return true; }
isValid
16,657
void (final PsiTypeVariable var) { myBoundVariables.add(var); }
addTypeVariable
16,658
PsiType (final PsiType t) { if (t instanceof PsiWildcardType wcType) { final PsiType bound = wcType.getBound(); if (bound == null) { return t; } final PsiManager manager = PsiManager.getInstance(myProject); final PsiType subst = substitute(bound); if (subst == null) return null; return subst instanceof PsiWildcardType ...
substitute
16,659
Binding (final PsiType x, final PsiType y, final Balancer balancer, final Set<? super Constraint> constraints) { final int indicator = (x instanceof PsiTypeVariable ? 1 : 0) + (y instanceof PsiTypeVariable ? 2 : 0); switch (indicator) { case 0 -> { if (x instanceof PsiWildcardType || y instanceof PsiWildcardType) { fin...
balance
16,660
Binding (final PsiType x, final PsiType y) { return balance(x, y, balancer, constraints); }
unify
16,661
Binding (final PsiType x, final PsiType y, final Unifier unifier) { final int indicator = (x instanceof PsiTypeVariable ? 1 : 0) + (y instanceof PsiTypeVariable ? 2 : 0); if (indicator == 0) { if (x instanceof PsiWildcardType || y instanceof PsiWildcardType) { return unifier.unify(x, y); } else if (x instanceof PsiArra...
unify
16,662
Binding (final PsiType x, final PsiType y, final Set<? super Constraint> constraints) { final Binding binding = balance(x, y, new Balancer() { @Override public Binding varType(final PsiTypeVariable x, final PsiType y) { if (y instanceof Bottom) { return create(); } if (y == null || y instanceof PsiWildcardType) { retur...
riseWithWildcard
16,663
Binding (final PsiTypeVariable x, final PsiType y) { if (y instanceof Bottom) { return create(); } if (y == null || y instanceof PsiWildcardType) { return null; } final PsiTypeVariable var = myFactory.create(); final Binding binding = create(x, PsiWildcardType.createSuper(PsiManager.getInstance(myProject), var)); bindi...
varType
16,664
Binding (final PsiTypeVariable x, final PsiTypeVariable y) { final int xi = x.getIndex(); final int yi = y.getIndex(); if (xi == yi) return create (); return create (y, PsiWildcardType.createExtends(PsiManager.getInstance(myProject), x)); /* if (xi < yi) { return create(x, y); } else if (yi < xi) { return create(y, x);...
varVar
16,665
Binding (final PsiType x, final PsiTypeVariable y) { if (x == null) { return create(y, Bottom.BOTTOM); } if (x instanceof PsiWildcardType) { return null; } final PsiTypeVariable var = myFactory.create(); final Binding binding = create(y, PsiWildcardType.createExtends(PsiManager.getInstance(myProject), var)); binding.ad...
typeVar
16,666
Binding (final PsiType x, final PsiType y, final Set<? super Constraint> constraints) { final Binding binding = balance(x, y, new Balancer() { @Override public Binding varType(final PsiTypeVariable x, final PsiType y) { if (y instanceof Bottom || y instanceof PsiWildcardType) { return create(); } return create(x, y); }...
rise
16,667
Binding (final PsiTypeVariable x, final PsiType y) { if (y instanceof Bottom || y instanceof PsiWildcardType) { return create(); } return create(x, y); }
varType
16,668
Binding (final PsiTypeVariable x, final PsiTypeVariable y) { final int xi = x.getIndex(); final int yi = y.getIndex(); if (xi < yi) { return create(x, y); } else if (yi < xi) { return create(y, x); } else { return create(); } }
varVar
16,669
Binding (final PsiType x, final PsiTypeVariable y) { if (x == null) return create(y, Bottom.BOTTOM); if (x instanceof PsiWildcardType) return create(); return create(y, x); }
typeVar
16,670
Binding (final PsiType x, final PsiType y, final Set<? super Constraint> constraints) { return balance(x, y, new Balancer() { @Override public Binding varType(final PsiTypeVariable x, final PsiType y) { return create(x, y); } @Override public Binding varVar(final PsiTypeVariable x, final PsiTypeVariable y) { return cre...
sink
16,671
Binding (final PsiTypeVariable x, final PsiType y) { return create(x, y); }
varType
16,672
Binding (final PsiTypeVariable x, final PsiTypeVariable y) { return create(y, Bottom.BOTTOM); }
varVar
16,673
Binding (final PsiType x, final PsiTypeVariable y) { return create(y, Bottom.BOTTOM); }
typeVar
16,674
Binding (final PsiTypeVariable var, final PsiType type) { return new BindingImpl(var, type); }
create
16,675
Binding () { return new BindingImpl(); }
create
16,676
Set<PsiTypeVariable> () { return myBoundVariables; }
getBoundVariables
16,677
Object (@NotNull final PsiTypeVariable var) { mySet.add(var); return null; }
visitTypeVariable
16,678
Set<PsiTypeVariable> (final PsiType type) { type.accept(this); return mySet; }
getSet
16,679
boolean (final PsiTypeVariable var) { return myBindingDegree.getInt(var) != 1; }
isBoundElseWhere
16,680
boolean (final Binding b) { if (mySettings.exhaustive()) return false; for (final PsiTypeVariable var : b.getBoundVariables()) { final PsiType type = b.apply(var); if (!(type instanceof PsiTypeVariable) && isBoundElseWhere(var)) { return false; } } return true; }
canBePruned
16,681
Object2IntMap<PsiTypeVariable> () { Object2IntMap<PsiTypeVariable> result=new Object2IntOpenHashMap<>(); for (Constraint constr : myConstraints) { PsiTypeVarCollector collector = new PsiTypeVarCollector(); setDegree(collector.getSet(constr.getRight()), result); } return result; }
calculateDegree
16,682
void (final Set<PsiTypeVariable> set, Object2IntMap<PsiTypeVariable> result) { for (PsiTypeVariable var : set) { result.mergeInt(var, 1, Math::addExact); } }
setDegree
16,683
Set<Constraint> (final Binding b) { final Set<Constraint> result = new HashSet<>(); for (final Constraint constr : myConstraints) { result.add(constr.apply(b)); } return result; }
apply
16,684
Set<Constraint> (final Binding b, final Set<Constraint> additional) { final Set<Constraint> result = new HashSet<>(); for (final Constraint constr : myConstraints) { result.add(constr.apply(b)); } for (final Constraint constr : additional) { result.add(constr.apply(b)); } return result; }
apply
16,685
ResolverTree (final Binding b) { final Binding newBinding = b != null ? myCurrentBinding.compose(b) : null; return newBinding == null ? null : new ResolverTree(this, apply(b), newBinding); }
applyRule
16,686
ResolverTree (final Binding b, final Set<Constraint> additional) { final Binding newBinding = b != null ? myCurrentBinding.compose(b) : null; return newBinding == null ? null : new ResolverTree(this, apply(b, additional), newBinding); }
applyRule
16,687
void () { final Set<PsiTypeVariable> nodes = new HashSet<>(); final Set<Constraint> candidates = new HashSet<>(); final Map<PsiTypeVariable, Set<PsiTypeVariable>> ins = new HashMap<>(); final Map<PsiTypeVariable, Set<PsiTypeVariable>> outs = new HashMap<>(); for (final Constraint constraint : myConstraints) { final Psi...
reduceCyclicVariables
16,688
Collection<PsiTypeVariable> () { return nodes; }
getNodes
16,689
Iterator<PsiTypeVariable> (final PsiTypeVariable n) { final Set<PsiTypeVariable> in = ins.get(n); if (in == null) { return Collections.emptyIterator(); } return in.iterator(); }
getIn
16,690
Iterator<PsiTypeVariable> (final PsiTypeVariable n) { final Set<PsiTypeVariable> out = outs.get(n); if (out == null) { return Collections.emptyIterator(); } return out.iterator(); }
getOut
16,691
void (final Constraint constr) { final PsiType left = constr.getLeft(); final PsiType right = constr.getRight(); final Set<Constraint> addendumRise = new HashSet<>(); final Set<Constraint> addendumSink = new HashSet<>(); final Set<Constraint> addendumWcrd = new HashSet<>(); int numSons = 0; Binding riseBinding = myBind...
reduceTypeType
16,692
void (final PsiType lowerBound, final PsiType upperBound, final Set<PsiType> holder) { if (lowerBound instanceof PsiClassType && upperBound instanceof PsiClassType) { final PsiClassType.ClassResolveResult resultLower = ((PsiClassType)lowerBound).resolveGenerics(); final PsiClassType.ClassResolveResult resultUpper = ((P...
fillTypeRange
16,693
PsiType[] (final PsiType lowerBound, final PsiType upperBound) { Set<PsiType> range = new HashSet<>(); range.add(lowerBound); range.add(upperBound); fillTypeRange(lowerBound, upperBound, range); return range.toArray(PsiType.createArray(range.size())); }
getTypeRange
16,694
void (final Constraint left, final Constraint right) { final PsiType leftType = left.getLeft(); final PsiType rightType = right.getRight(); final PsiTypeVariable var = (PsiTypeVariable)left.getRight(); if (leftType.equals(rightType)) { final Binding binding = myBindingFactory.create(var, leftType); myConstraints.remove...
reduceInterval
16,695
void () { if (myConstraints.isEmpty()) { return; } if (myCurrentBinding.isCyclic()) { reduceCyclicVariables(); } final Map<PsiTypeVariable, Constraint> myTypeVarConstraints = new HashMap<>(); final Map<PsiTypeVariable, Constraint> myVarTypeConstraints = new HashMap<>(); for (final Constraint constr : myConstraints) { f...
reduce
16,696
void () { LOG.debug("Reduced system:"); for (final Constraint constr : myConstraints) { LOG.debug(constr.toString()); } LOG.debug("End of Reduced system."); LOG.debug("Reduced binding:"); LOG.debug(myCurrentBinding.toString()); LOG.debug("End of Reduced binding."); }
logSolution
16,697
void (final Constraint x, final Constraint y) { reduceSideVar(x, y, new Reducer() { @Override public LinkedList<Pair<PsiType, Binding>> unify(final PsiType x, final PsiType y) { return myBindingFactory.intersect(x, y); } @Override public Constraint create(final PsiTypeVariable var, final PsiType type) { return new Subt...
reduceTypeVar
16,698
Constraint (final PsiTypeVariable var, final PsiType type) { return new Subtype(type, var); }
create
16,699
PsiType (final Constraint c) { return c.getLeft(); }
getType