public ParameterizedTypeReference(ITypeReferenceOwner owner, JvmType type) { super(owner); if (type == null) { throw new NullPointerException("type may not be null"); } if (type instanceof JvmArrayType) { throw new IllegalArgumentException("type may not be an array type"); } if (type.eClass() == TypesPackage.Literals.JVM_GENERIC_TYPE) { EObject container = type.eContainer(); if (container instanceof JvmDeclaredType) { checkStaticFlag((JvmDeclaredType)type); } } this.type = type; this.resolved = !(type instanceof JvmTypeParameter); }
protected boolean isInner(JvmType type) { if (type != null && type.eClass() == TypesPackage.Literals.JVM_GENERIC_TYPE) { if (type.eContainer() instanceof JvmDeclaredType) { return !((JvmGenericType) type).isStatic(); } } return false; }
protected boolean isInner(JvmType type) { if (type.eClass() == TypesPackage.Literals.JVM_GENERIC_TYPE) { if (type.eContainer() instanceof JvmDeclaredType) { return !((JvmGenericType) type).isStatic(); } } return false; }
@Override protected JvmType findNestedType(JvmType result, int index, QualifiedName name) { if (result.eContainer() instanceof JvmDeclaredType && name.getSegmentCount() == 1) { QualifiedName importName = importNames.get(index); if (importName != null && importName.getLastSegment().equals(name.getFirstSegment())) { return result; } } return super.findNestedType(result, index, name); }
@Override public ParameterizedTypeReference newParameterizedTypeReference(JvmType type) { ParameterizedTypeReference result; if (factory.isInner(type)) { ParameterizedTypeReference outer = newParameterizedTypeReference((JvmDeclaredType)type.eContainer()); result = new InnerTypeReference(this, outer, type); } else { result = new ParameterizedTypeReference(this, type); } return result; }
@Override public FunctionTypeReference newFunctionTypeReference(JvmType type) { FunctionTypeReference result; if (factory.isInner(type)) { ParameterizedTypeReference outer = newParameterizedTypeReference((JvmDeclaredType)type.eContainer()); result = new InnerFunctionTypeReference(this, outer, type); } else { result = new FunctionTypeReference(this, type); } return result; }
@Override protected void doGetDescriptions(JvmType type, JvmType knownType, int index, List<IEObjectDescription> result) { if (type == knownType) { result.add(EObjectDescription.create(QualifiedName.create(type.getSimpleName()), type)); } else if (type.eContainer() == knownType) { result.add(EObjectDescription.create(QualifiedName.create(knownType.getSimpleName(), type.getSimpleName()), type)); result.add(EObjectDescription.create(QualifiedName.create(knownType.getSimpleName() + '$' + type.getSimpleName()), type)); } else { String knownTypeName = knownType.getQualifiedName(); String withDollar = type.getQualifiedName('$'); String withDot = type.getQualifiedName('.'); result.add(EObjectDescription.create(QualifiedName.create(Strings.split(withDot.substring(knownTypeName.length()), '.')), type)); result.add(EObjectDescription.create(QualifiedName.create(withDollar.substring(knownTypeName.length())), type)); } }
LightweightTypeReference rightOuter = right.getOuter(); if (leftOuter != null) { JvmType rawLeftOuter = (JvmType) left.getType().eContainer(); if (rightOuter != null) { JvmType rawRightOuter = (JvmType) right.getType().eContainer(); if (rawLeftOuter != rawRightOuter) { throw new IllegalStateException("References must point to same raw types: " + left + " / " + right);
if (shouldUseQualifiedNestedName(qualifiedName)) { JvmType outerContainer = type; while (outerContainer.eContainer() instanceof JvmType) { outerContainer = (JvmType) outerContainer.eContainer();
public void appendType(final JvmType type, StringBuilder builder) { if (type instanceof JvmPrimitiveType || type instanceof JvmVoid || type instanceof JvmTypeParameter) { builder.append(type.getQualifiedName(getInnerTypeSeparator())); } else if (type instanceof JvmArrayType) { appendType(((JvmArrayType) type).getComponentType(), builder); builder.append("[]"); } else { final String qualifiedName = type.getQualifiedName(getInnerTypeSeparator()); String nameToImport = qualifiedName; String shortName = type.getSimpleName(); String outerShortName = shortName; if (shouldUseQualifiedNestedName(qualifiedName)) { JvmType outerContainer = type; while (outerContainer.eContainer() instanceof JvmType) { outerContainer = (JvmType) outerContainer.eContainer(); } if (type != outerContainer) { outerShortName = outerContainer.getSimpleName(); if(!getThisTypeQualifiedNames().contains(outerContainer.getQualifiedName(getInnerTypeSeparator())) && getThisTypeSimpleNames().contains(outerShortName)) { outerShortName = qualifiedName; shortName = qualifiedName; } else { nameToImport = outerContainer.getQualifiedName(getInnerTypeSeparator()); shortName = outerShortName + qualifiedName.substring(nameToImport.length()); } } } appendType(qualifiedName, shortName, outerShortName, nameToImport, builder); } }
error("The import '" + importedType.getIdentifier() + "' collides with the import '" + collidingImport.getIdentifier() + "'.", imp, null, IssueCodes.IMPORT_COLLISION); while (currentType.eContainer() instanceof JvmType) { currentType = (JvmType) currentType.eContainer(); currentSuffix = currentType.getSimpleName()+"$"+currentSuffix; JvmType collidingImport2 = importedNames.put(currentSuffix, importedType);
protected int doIsConformantOuter(LightweightTypeReference left, LightweightTypeReference right, int nestedResult, int flags) { if ((nestedResult & SUCCESS) != 0) { JvmType leftType = left.getType(); EObject leftDeclarator = leftType.eContainer(); if (leftDeclarator instanceof JvmDeclaredType) { JvmDeclaredType castedLeftDeclarator = (JvmDeclaredType) leftDeclarator; LightweightTypeReference leftOuter = left.getOuter().getSuperType(castedLeftDeclarator); if (leftOuter != null) { LightweightTypeReference rightOuter = right.getOuter().getSuperType(castedLeftDeclarator); if (rightOuter != null) { int outerResult = doIsConformant(leftOuter, rightOuter, flags); if ((outerResult & SUCCESS) == 0) { return outerResult; } } } } } return nestedResult; }
if (withDot == null) { withDot = QualifiedName.create(Strings.split(type.getQualifiedName('.'), '.')); withDollar = type.eContainer() instanceof JvmType ? type.getQualifiedName('$').substring(packageName.length() + 1) : null;
JvmType worker = type; while(worker != importedType) { worker = (JvmType) worker.eContainer(); name = worker.getSimpleName() + "$" + name;
return true; EObject container = contextType.eContainer(); while (container instanceof JvmType) { if (receiverType.isSubtypeOf((JvmType)container)) {