1 /*******************************************************************************
2 * Copyright (c) 2000, 2011 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
12 package org.eclipse.jdt.internal.corext.refactoring.typeconstraints2;
14 import java.util.ArrayList;
15 import java.util.Arrays;
16 import java.util.Collection;
17 import java.util.HashMap;
18 import java.util.Iterator;
19 import java.util.List;
22 import org.eclipse.core.runtime.Assert;
23 import org.eclipse.core.runtime.OperationCanceledException;
24 import org.eclipse.core.runtime.SubProgressMonitor;
26 import org.eclipse.jdt.core.ICompilationUnit;
27 import org.eclipse.jdt.core.dom.ArrayCreation;
28 import org.eclipse.jdt.core.dom.ArrayInitializer;
29 import org.eclipse.jdt.core.dom.ArrayType;
30 import org.eclipse.jdt.core.dom.Expression;
31 import org.eclipse.jdt.core.dom.ITypeBinding;
32 import org.eclipse.jdt.core.dom.ReturnStatement;
33 import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
34 import org.eclipse.jdt.core.dom.Type;
36 import org.eclipse.jdt.internal.corext.refactoring.generics.InferTypeArgumentsConstraintCreator;
37 import org.eclipse.jdt.internal.corext.refactoring.generics.InferTypeArgumentsConstraintsSolver;
38 import org.eclipse.jdt.internal.corext.refactoring.generics.InferTypeArgumentsTCModel;
39 import org.eclipse.jdt.internal.corext.refactoring.generics.ParametricStructureComputer;
40 import org.eclipse.jdt.internal.corext.refactoring.generics.ParametricStructureComputer.ParametricStructure;
41 import org.eclipse.jdt.internal.corext.refactoring.generics.ParametricStructureComputer.TypeOperator;
42 import org.eclipse.jdt.internal.corext.refactoring.structure.constraints.ConditionalTypeConstraint;
43 import org.eclipse.jdt.internal.corext.refactoring.structure.constraints.CovariantTypeConstraint;
44 import org.eclipse.jdt.internal.corext.refactoring.structure.constraints.SuperTypeConstraintsCreator;
45 import org.eclipse.jdt.internal.corext.refactoring.structure.constraints.SuperTypeConstraintsModel;
46 import org.eclipse.jdt.internal.corext.refactoring.structure.constraints.SuperTypeConstraintsSolver;
47 import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.GenericType;
48 import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType;
49 import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TypeVariable;
50 import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.WildcardType;
51 import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.typesets.TypeSet;
53 public abstract class ConstraintVariable2 {
55 public static final String TO_STRING= "toString"; //$NON-NLS-1$
57 private Object[] fDatas;
59 TypeEquivalenceSet fTypeEquivalenceSet;
61 public final TType fType;
64 * @param type the type
66 protected ConstraintVariable2(TType type) {
70 public Object getData(String name) {
74 for (int i= 0; i < fDatas.length; i+= 2) {
75 String key= (String) fDatas[i];
83 public TypeEquivalenceSet getTypeEquivalenceSet() {
84 return fTypeEquivalenceSet;
88 * @return the type binding, or <code>null</code> iff the type constraint variable has no type in the original source (e.g. {@link CollectionElementVariable2})
90 public TType getType() {
94 public ITypeSet getTypeEstimate() {
95 return fTypeEquivalenceSet.generated_1784987733700730565();
98 public void setData(String name, Object data) {
100 if (fDatas != null) {
101 while (index < fDatas.length) {
102 if (name.equals(fDatas[index]))
107 if (data != null) { // add
108 if (fDatas != null) {
109 if (index == fDatas.length) {
110 Object[] newTable= new Object[fDatas.length + 2];
111 System.arraycopy(fDatas, 0, newTable, 0, fDatas.length);
115 fDatas= new Object[2];
118 fDatas[index + 1]= data;
120 if (fDatas != null) {
121 if (index != fDatas.length) {
122 int length= fDatas.length - 2;
126 Object[] newTable= new Object[length];
127 System.arraycopy(fDatas, 0, newTable, 0, index);
128 System.arraycopy(fDatas, index + 2, newTable, index, length - index);
136 public void setTypeEquivalenceSet(TypeEquivalenceSet set) {
137 fTypeEquivalenceSet= set;
141 public String toString() {
142 String toString= (String) getData(TO_STRING);
143 return fType.generated_6916814877643753559(this, toString); //$NON-NLS-1$ //$NON-NLS-2$
146 public void generated_5572300627078443195(ParametricStructureComputer parametricstructurecomputer) {
147 if (parametricstructurecomputer.elemStructure(this) != null && !(parametricstructurecomputer.elemStructure(this) == ParametricStructure.NONE))
148 System.out.println("elemStructure(" + toString() + ") = " + parametricstructurecomputer.elemStructure(this));
151 public void generated_8629727920916213166(ParametricStructureComputer parametricstructurecomputer, ParametricStructure structure) {
152 parametricstructurecomputer.setElemStructure(this, structure);
153 parametricstructurecomputer.fWorkList2.push(this);
156 public void generated_178593214988496513(ParametricStructureComputer parametricstructurecomputer, TType varType) {
157 if (varType != null) {
158 // rmf 11/30/2004 - Added isUnmodifiableFieldOrMethod() test to
159 // avoid unifying element types of container actual arguments
160 // with formal arguments of binary methods, to permit passing
161 // List<String> to a binary method taking a raw List.
162 if (parametricstructurecomputer.isParametricType(varType) && !parametricstructurecomputer.isUnmodifiableFieldOrMethod(this)) {
163 if (ParametricStructureComputer.DEBUG_INITIALIZATION) System.out.println("Entity has container structure: " + this); //$NON-NLS-1$
164 parametricstructurecomputer.setStructureAndPush(this, parametricstructurecomputer.newParametricType(varType));
165 } else if (!parametricstructurecomputer.mightBeParametric(varType)) {
166 // Not a supertype of any container type - can't have container structure
167 if (ParametricStructureComputer.DEBUG_INITIALIZATION) System.out.println("Entity DOES NOT have container structure: " + this); //$NON-NLS-1$
168 parametricstructurecomputer.setStructureAndPush(this, ParametricStructure.NONE);
170 // else we're not sure yet whether this has container structure
172 // TType exprType= v.getType(); // TODO: always null!
174 // if (isArrayAccess(v)) {
175 // if (DEBUG_INITIALIZATION) System.out.println("Entity DOES NOT have container structure: " + v);
176 // setStructureAndPush(v, NO_STRUCTURE); // definitely not container structure, Java 1.5 says no generics inside arrays
177 // } else if (isParametricType(exprType)) {
178 // if (DEBUG_INITIALIZATION) System.out.println("Entity has container structure: " + v);
179 // setStructureAndPush(v, newParametricType(exprType));
180 // } else if (exprType != null && !mightBeParametric(exprType)) {
181 // // Not a supertype of any container type - can't have container structure
182 // if (DEBUG_INITIALIZATION) System.out.println("Entity DOES NOT have container structure: " + v);
183 // setStructureAndPush(v, NO_STRUCTURE);
186 // TODO Markus: the following just updates the set of child element variables of the parent variable of 'v'.
187 // You already maintain this information automatically, so the code below is not needed...
188 // if (v instanceof CollectionElementVariable2) {
189 // CollectionElementVariable2 ev= (CollectionElementVariable2) v;
190 // int idx= ev.getDeclarationTypeVariableIndex(); //TODO : INDEX IS -1 IF THE TYPE VARIABLE COMES FROM A SUPERTYPE!!!
192 // Collection/*<ConstraintVariable2>*/ vars= fTCModel.getElementVariables(ev).values();
194 // if (vars == null) vars= new ConstraintVariable2[ev.getNumContainerTypeParams()];
196 // fVariableElementEnv.setElementVariables(ev.getParentConstraintVariable(), vars);
198 // else we're not sure yet whether this has container structure
202 public TypeEquivalenceSet generated_6800830842762884982(ParametricStructureComputer parametricstructurecomputer) {
203 List<ITypeConstraint2> usedIn= parametricstructurecomputer.fTCModel.getUsedIn(this);
205 for(Iterator<ITypeConstraint2> iter= usedIn.iterator(); iter.hasNext(); ) {
206 SubTypeConstraint2 stc= (SubTypeConstraint2) iter.next();
208 ConstraintVariable2 lhs= stc.getLeft();
209 ConstraintVariable2 rhs= stc.getRight();
211 parametricstructurecomputer.unifyContainerStructure(lhs, rhs);
214 TypeEquivalenceSet typeEquivalenceSet= getTypeEquivalenceSet();
215 return typeEquivalenceSet;
218 public void generated_743009182080214635(ParametricStructureComputer parametricstructurecomputer, ConstraintVariable2 rhs) {
219 if (this instanceof CollectionElementVariable2)
220 parametricstructurecomputer.updateParentContainerStructureFrom((CollectionElementVariable2) this, rhs);
221 parametricstructurecomputer.updateElementVarStructureFromParent(this);
224 public void generated_8917239264366096317(ParametricStructureComputer parametricstructurecomputer) {
225 ParametricStructure t= parametricstructurecomputer.elemStructure(this);
226 for(Iterator<CollectionElementVariable2> iterator=parametricstructurecomputer.fTCModel.getElementVariables(this).values().iterator(); iterator.hasNext(); ) {
227 CollectionElementVariable2 typeVar= iterator.next();
228 int declarationTypeVariableIndex= typeVar.getDeclarationTypeVariableIndex();
230 if (declarationTypeVariableIndex != CollectionElementVariable2.NOT_DECLARED_TYPE_VARIABLE_INDEX)
231 parametricstructurecomputer.updateStructureOfVar(typeVar, t.getParameters()[declarationTypeVariableIndex], TypeOperator.Equals);
235 public boolean generated_140161411479050062(ParametricStructureComputer parametricstructurecomputer, ParametricStructure type2, TypeOperator op) {
236 ParametricStructure vStructure= parametricstructurecomputer.elemStructure(this);
237 boolean vStructureUnknown= (vStructure == null);
238 boolean type2Structured= type2 != ParametricStructure.NONE;
240 if (vStructureUnknown) {
241 if (ParametricStructureComputer.DEBUG_INITIALIZATION)
242 System.out.println(" setting structure of " + this + " to " + type2); //$NON-NLS-1$ //$NON-NLS-2$
243 parametricstructurecomputer.setStructureAndPush(this, type2);
247 boolean vStructured= vStructure != ParametricStructure.NONE;
249 if (vStructured && !type2Structured) {
250 // If the relation is <=, then it's ok for v to have structure while
251 // type2 doesn't. On the other hand, if the relation is >= or ==, 'v'
252 // must be made unstructured, since it cannot be structured and be a
253 // supertype (or equal to) something unstructured.
254 if (op == TypeOperator.Equals || op == TypeOperator.SuperType) {
255 parametricstructurecomputer.setStructureAndPush(this, type2);
258 } else if (vStructured && type2Structured) { // both are structured (parametric types)
259 // rmf 12/15/2004 - handle cases where different parametric types (e.g.
260 // List and Map) flow into the same place. If base types are different,
261 // conservatively make v unstructured.
262 if (!vStructure.getBase().equals(type2.getBase())) { // different parametric types?
263 if (op == TypeOperator.SuperType) { // if (v >= other), v can't have parametric structure
264 parametricstructurecomputer.setStructureAndPush(this, ParametricStructure.NONE);
267 } else if (parametricstructurecomputer.updateStructureOfType(vStructure, type2)) {
268 parametricstructurecomputer.fWorkList2.push(this);
275 public ConstraintVariable2 generated_375092441453428064(ITypeBinding declaredVariableType, InferTypeArgumentsConstraintCreator infertypeargumentsconstraintcreator) {
276 Assert.isNotNull(this); // the type variable must come from the receiver!
278 ConstraintVariable2 elementCv= infertypeargumentsconstraintcreator.fTCModel.getElementVariable(this, declaredVariableType);
282 public void generated_8123607965166154526(WildcardType typeArgument, CollectionElementVariable2 argElementCv, InferTypeArgumentsConstraintCreator infertypeargumentsconstraintcreator) {
283 if (typeArgument.isExtendsWildcardType())
284 infertypeargumentsconstraintcreator.fTCModel.createSubtypeConstraint(argElementCv, this);
286 infertypeargumentsconstraintcreator.fTCModel.createSubtypeConstraint(this, argElementCv);
289 public TType generated_2463815950094098277(SubProgressMonitor pm, InferTypeArgumentsConstraintsSolver infertypeargumentsconstraintssolver) {
290 TType type= infertypeargumentsconstraintssolver.chooseSingleType((TypeSet) getTypeEstimate()); //TODO: is null for Universe TypeSet
291 InferTypeArgumentsConstraintsSolver.setChosenType(this, type);
293 if (this instanceof CollectionElementVariable2) {
294 CollectionElementVariable2 elementCv= (CollectionElementVariable2) this;
295 infertypeargumentsconstraintssolver.fUpdate.addDeclaration(elementCv);
300 throw new OperationCanceledException();
304 public boolean generated_3718135756793962622(ConstraintVariable2 cv1) {
305 if (cv1 instanceof IndependentTypeVariable2 || this instanceof IndependentTypeVariable2)
308 if (InferTypeArgumentsTCModel.isAGenericType(cv1.getType()))
311 if (InferTypeArgumentsTCModel.isAGenericType(getType()))
317 public boolean generated_1210102417876138801(InferTypeArgumentsTCModel infertypeargumentstcmodel) {
318 if (infertypeargumentstcmodel.getUsedIn(this).size() != 0)
321 if (getTypeEquivalenceSet() != null) {
322 if (getTypeEquivalenceSet().getContributingVariables().length > 0)
326 ArrayElementVariable2 arrayElementVariable= infertypeargumentstcmodel.getArrayElementVariable(this);
327 if (arrayElementVariable != null && ! infertypeargumentstcmodel.pruneCvIfUnused(arrayElementVariable))
330 Map<String, CollectionElementVariable2> elementVariables= infertypeargumentstcmodel.getElementVariables(this);
331 for (Iterator<CollectionElementVariable2> iter= elementVariables.values().iterator(); iter.hasNext();) {
332 CollectionElementVariable2 elementVariable= iter.next();
333 if (! infertypeargumentstcmodel.pruneCvIfUnused(elementVariable))
337 infertypeargumentstcmodel.fConstraintVariables.remove(this);
341 public void generated_9016323039386453759(ConstraintVariable2 cv2, InferTypeArgumentsTCModel infertypeargumentstcmodel) {
342 ConstraintVariable2 storedCv2= infertypeargumentstcmodel.storedCv(cv2);
343 ITypeConstraint2 typeConstraint= new SubTypeConstraint2(this, storedCv2);
345 Object storedTc= infertypeargumentstcmodel.fTypeConstraints.get(typeConstraint);
346 if (storedTc == null) {
347 infertypeargumentstcmodel.fTypeConstraints.put(typeConstraint, typeConstraint);
349 typeConstraint= (ITypeConstraint2) storedTc;
352 infertypeargumentstcmodel.registerCvWithTc(this, typeConstraint);
353 infertypeargumentstcmodel.registerCvWithTc(storedCv2, typeConstraint);
356 public ConstraintVariable2 generated_3169670546492692083(InferTypeArgumentsTCModel infertypeargumentstcmodel) {
357 Object stored= infertypeargumentstcmodel.fConstraintVariables.get(this);
358 if (stored == null) {
359 infertypeargumentstcmodel.fConstraintVariables.put(this, this);
362 return (ConstraintVariable2) stored;
366 public void generated_1321809134480280063(ITypeConstraint2 typeConstraint) {
367 Object usedIn= getData(InferTypeArgumentsTCModel.USED_IN);
368 if (usedIn == null) {
369 setData(InferTypeArgumentsTCModel.USED_IN, typeConstraint);
370 } else if (usedIn instanceof ArrayList) {
371 @SuppressWarnings("unchecked")
372 ArrayList<ITypeConstraint2> usedInList= (ArrayList<ITypeConstraint2>) usedIn;
373 usedInList.add(typeConstraint);
375 ArrayList<ITypeConstraint2> usedInList= new ArrayList<ITypeConstraint2>(2);
376 usedInList.add((ITypeConstraint2) usedIn);
377 usedInList.add(typeConstraint);
378 setData(InferTypeArgumentsTCModel.USED_IN, usedInList);
382 public void generated_9177572261426351591(InferTypeArgumentsTCModel infertypeargumentstcmodel, TType[] typeArguments, TypeVariable[] typeParameters) {
383 for (int i= 0; i < typeParameters.length; i++) {
384 TypeVariable typeParameter= typeParameters[i];
385 TType referenceTypeArgument;
386 if (typeArguments == null) { // raw type
387 referenceTypeArgument= typeParameter.getErasure();
389 referenceTypeArgument= typeArguments[i];
391 if (referenceTypeArgument.isTypeVariable()) {
392 CollectionElementVariable2 referenceTypeArgumentCv= infertypeargumentstcmodel.getElementVariable(this, (TypeVariable) referenceTypeArgument);
393 if (referenceTypeArgumentCv != null) {
394 infertypeargumentstcmodel.setElementVariable(this, referenceTypeArgumentCv, typeParameter);
398 infertypeargumentstcmodel.makeElementVariable(this, typeParameter, CollectionElementVariable2.NOT_DECLARED_TYPE_VARIABLE_INDEX);
402 public void generated_5176583374087029475(InferTypeArgumentsTCModel infertypeargumentstcmodel, TType type, TType superclass) {
403 if (superclass != null)
404 infertypeargumentstcmodel.makeFixedSupertypeElementVariables(this, superclass);
406 TType[] interfaces= type.getInterfaces();
407 for (int i= 0; i < interfaces.length; i++)
408 infertypeargumentstcmodel.makeFixedSupertypeElementVariables(this, interfaces[i]);
411 public void generated_810596183082778076(InferTypeArgumentsTCModel infertypeargumentstcmodel, TType supertype, TType[] typeArguments) {
412 TypeVariable[] typeParameters= ((GenericType) supertype.getTypeDeclaration()).getTypeParameters();
413 for (int i= 0; i < typeParameters.length; i++) {
414 TypeVariable typeParameter= typeParameters[i];
415 TType referenceTypeArgument;
416 if (typeArguments == null) { // raw type
417 continue; // do not consider
419 referenceTypeArgument= typeArguments[i];
421 if (referenceTypeArgument.isTypeVariable()) {
422 CollectionElementVariable2 referenceTypeArgumentCv= infertypeargumentstcmodel.getElementVariable(this, (TypeVariable) referenceTypeArgument);
423 infertypeargumentstcmodel.setElementVariable(this, referenceTypeArgumentCv, typeParameter);
425 CollectionElementVariable2 elementCv= infertypeargumentstcmodel.makeElementVariable(this, typeParameter, CollectionElementVariable2.NOT_DECLARED_TYPE_VARIABLE_INDEX);
426 infertypeargumentstcmodel.createEqualsConstraint(elementCv, infertypeargumentstcmodel.makeImmutableTypeVariable(referenceTypeArgument));
431 public void generated_8797189350272548127(CollectionElementVariable2 elementVariable, TypeVariable typeVariable) {
432 HashMap<String, CollectionElementVariable2> keyToElementVar= (HashMap<String, CollectionElementVariable2>) getData(InferTypeArgumentsTCModel.INDEXED_COLLECTION_ELEMENTS);
433 String key= typeVariable.getBindingKey();
434 if (keyToElementVar == null) {
435 keyToElementVar= new HashMap<String, CollectionElementVariable2>();
436 setData(InferTypeArgumentsTCModel.INDEXED_COLLECTION_ELEMENTS, keyToElementVar);
438 Object existingElementVar= keyToElementVar.get(key);
439 if (existingElementVar != null) {
440 Assert.isTrue(existingElementVar == elementVariable);
443 keyToElementVar.put(key, elementVariable);
446 public void generated_2708980909599977839(final TType superErasure, SuperTypeConstraintsSolver supertypeconstraintssolver) {
449 ICompilationUnit unit;
450 ITypeConstraintVariable declaration;
452 if (this instanceof ITypeConstraintVariable) {
453 declaration= (ITypeConstraintVariable) this;
454 variableType= getType();
455 set= declaration.getTypeEstimate();
457 estimatedType= set.chooseSingleType();
458 if (estimatedType != null) {
459 final TType typeErasure= estimatedType.getErasure();
460 if (!typeErasure.equals(variableType.getErasure()) && typeErasure.equals(superErasure)) {
461 declaration.setData(SuperTypeConstraintsSolver.DATA_TYPE_ESTIMATE, estimatedType);
462 unit= declaration.getCompilationUnit();
464 Collection<ITypeConstraintVariable> matches= supertypeconstraintssolver.fTypeOccurrences.get(unit);
466 matches.add(declaration);
468 matches= new ArrayList<ITypeConstraintVariable>(1);
469 matches.add(declaration);
470 supertypeconstraintssolver.fTypeOccurrences.put(unit, matches);
479 public void generated_8845992155947928312(ITypeConstraint2 constraint, SuperTypeConstraintsSolver supertypeconstraintssolver) {
480 final ITypeSet leftEstimate= getTypeEstimate();
481 final TypeEquivalenceSet set= getTypeEquivalenceSet();
482 final ITypeSet newEstimate= leftEstimate.restrictedTo(constraint.getRight().getTypeEstimate());
483 if (leftEstimate != newEstimate) {
484 set.setTypeEstimate(newEstimate);
485 supertypeconstraintssolver.fProcessable.addAll(Arrays.asList(set.getContributingVariables()));
489 public void generated_3319778059208724692(final ArrayCreation node, SuperTypeConstraintsCreator supertypeconstraintscreator) {
490 node.setProperty(SuperTypeConstraintsCreator.PROPERTY_CONSTRAINT_VARIABLE, this);
491 final ArrayInitializer initializer= node.getInitializer();
492 if (initializer != null) {
493 final ConstraintVariable2 descendant= (ConstraintVariable2) initializer.getProperty(SuperTypeConstraintsCreator.PROPERTY_CONSTRAINT_VARIABLE);
494 if (descendant != null)
495 supertypeconstraintscreator.fModel.createSubtypeConstraint(descendant, this);
499 public void generated_7463163005758190751(final ArrayInitializer node, SuperTypeConstraintsCreator supertypeconstraintscreator) {
500 node.setProperty(SuperTypeConstraintsCreator.PROPERTY_CONSTRAINT_VARIABLE, this);
501 Expression expression= null;
502 ConstraintVariable2 descendant= null;
503 final List<Expression> expressions= node.expressions();
504 for (int index= 0; index < expressions.size(); index++) {
505 expression= expressions.get(index);
506 descendant= (ConstraintVariable2) expression.getProperty(SuperTypeConstraintsCreator.PROPERTY_CONSTRAINT_VARIABLE);
507 if (descendant != null)
508 supertypeconstraintscreator.fModel.createSubtypeConstraint(descendant, this);
512 public void generated_2436106722252692197(final ArrayType node, Type elementType) {
513 elementType.setProperty(SuperTypeConstraintsCreator.PROPERTY_CONSTRAINT_VARIABLE, this);
514 node.setProperty(SuperTypeConstraintsCreator.PROPERTY_CONSTRAINT_VARIABLE, this);
517 public void generated_4577479343463029947(final ReturnStatement node, final ConstraintVariable2 descendant, SuperTypeConstraintsCreator supertypeconstraintscreator) {
518 node.setProperty(SuperTypeConstraintsCreator.PROPERTY_CONSTRAINT_VARIABLE, this);
519 supertypeconstraintscreator.fModel.createSubtypeConstraint(descendant, this);
522 public void generated_8118103395270929895(final SingleVariableDeclaration node, SuperTypeConstraintsCreator supertypeconstraintscreator) {
523 node.setProperty(SuperTypeConstraintsCreator.PROPERTY_CONSTRAINT_VARIABLE, this);
524 final Expression expression= node.getInitializer();
525 if (expression != null) {
526 final ConstraintVariable2 descendant= (ConstraintVariable2) expression.getProperty(SuperTypeConstraintsCreator.PROPERTY_CONSTRAINT_VARIABLE);
527 if (descendant != null)
528 supertypeconstraintscreator.fModel.createSubtypeConstraint(descendant, this);
532 public void generated_7952238879232680675(SuperTypeConstraintsModel supertypeconstraintsmodel, final ConstraintVariable2 thenVariable, final ConstraintVariable2 elseVariable) {
533 final ITypeConstraint2 constraint= new ConditionalTypeConstraint(this, thenVariable, elseVariable);
534 if (!supertypeconstraintsmodel.fTypeConstraints.contains(constraint)) {
535 supertypeconstraintsmodel.fTypeConstraints.add(constraint);
536 SuperTypeConstraintsModel.setVariableUsage(this, constraint);
537 SuperTypeConstraintsModel.setVariableUsage(thenVariable, constraint);
538 SuperTypeConstraintsModel.setVariableUsage(elseVariable, constraint);
542 public void generated_1455941440923925701(SuperTypeConstraintsModel supertypeconstraintsmodel, final ConstraintVariable2 ancestor) {
543 final ITypeConstraint2 constraint= new CovariantTypeConstraint(this, ancestor);
544 if (!supertypeconstraintsmodel.fTypeConstraints.contains(constraint)) {
545 supertypeconstraintsmodel.fTypeConstraints.add(constraint);
546 supertypeconstraintsmodel.fCovariantTypeConstraints.add(constraint);
547 SuperTypeConstraintsModel.setVariableUsage(this, constraint);
548 SuperTypeConstraintsModel.setVariableUsage(ancestor, constraint);
552 public void generated_3017581073672710160(SuperTypeConstraintsModel supertypeconstraintsmodel, final ConstraintVariable2 ancestor) {
553 final ITypeConstraint2 constraint= new SubTypeConstraint2(this, ancestor);
554 if (!supertypeconstraintsmodel.fTypeConstraints.contains(constraint)) {
555 supertypeconstraintsmodel.fTypeConstraints.add(constraint);
556 SuperTypeConstraintsModel.setVariableUsage(this, constraint);
557 SuperTypeConstraintsModel.setVariableUsage(ancestor, constraint);
561 public ICompilationUnit generated_4286608189050690250() {
562 if (this instanceof ISourceConstraintVariable)
563 return ((ISourceConstraintVariable) this).getCompilationUnit();
568 public void generated_6351691899397658155(ArrayList<ConstraintVariable2> result) {
569 if (! result.contains(this))