TypeVariableImpl<GenericDeclaration> parseTypeVariableSignature() { // TypeVariableSignature ::= "T" Ident ";". expect('T'); scanIdentifier(); expect(';'); // Reference to type variable: // Note: we don't know the declaring GenericDeclaration yet. return new TypeVariableImpl<GenericDeclaration>(genericDecl, identifier); }
void resolve() { if (formalVar != null) { return; } GenericDeclaration curLayer = declOfVarUser; TypeVariable var; while ((var = findFormalVar(curLayer, name)) == null) { curLayer = nextLayer(curLayer); if (curLayer == null) { throw new AssertionError("illegal type variable reference"); } } formalVar = (TypeVariableImpl<D>) var; this.genericDeclaration = formalVar.genericDeclaration; this.bounds = formalVar.bounds; }
@Override public int hashCode() { return 31 * getName().hashCode() + getGenericDeclaration().hashCode(); }
public D getGenericDeclaration() { resolve(); return genericDeclaration; }
public Type[] getBounds() { resolve(); return bounds.getResolvedTypes().clone(); }
@Override public boolean equals(Object o) { if(!(o instanceof TypeVariable)) { return false; } TypeVariable<?> that = (TypeVariable<?>) o; return getName().equals(that.getName()) && getGenericDeclaration().equals(that.getGenericDeclaration()); }
void resolve() { if (formalVar != null) { return; } GenericDeclaration curLayer = declOfVarUser; TypeVariable var; while ((var = findFormalVar(curLayer, name)) == null) { curLayer = nextLayer(curLayer); if (curLayer == null) { throw new AssertionError("illegal type variable reference"); } } formalVar = (TypeVariableImpl<D>) var; this.genericDeclaration = formalVar.genericDeclaration; this.bounds = formalVar.bounds; }
TypeVariableImpl<GenericDeclaration> parseFormalTypeParameter() { // FormalTypeParameter ::= Ident ClassBound {InterfaceBound}. scanIdentifier(); String name = identifier.intern(); // FIXME: is this o.k.? ListOfTypes bounds = new ListOfTypes(8); // ClassBound ::= ":" [FieldTypeSignature]. expect(':'); if (symbol == 'L' || symbol == '[' || symbol == 'T') { bounds.add(parseFieldTypeSignature()); } while (symbol == ':') { // InterfaceBound ::= ":" FieldTypeSignature. scanSymbol(); bounds.add(parseFieldTypeSignature()); } return new TypeVariableImpl<GenericDeclaration>(genericDecl, name, bounds); }
public D getGenericDeclaration() { resolve(); return genericDeclaration; }
@Override public int hashCode() { return 31 * getName().hashCode() + getGenericDeclaration().hashCode(); }
void resolve() { if (formalVar != null) { return; } GenericDeclaration curLayer = declOfVarUser; TypeVariable var; while ((var = findFormalVar(curLayer, name)) == null) { curLayer = nextLayer(curLayer); if (curLayer == null) { throw new AssertionError("illegal type variable reference"); } } formalVar = (TypeVariableImpl<D>) var; this.genericDeclaration = formalVar.genericDeclaration; this.bounds = formalVar.bounds; }
TypeVariableImpl<GenericDeclaration> parseTypeVariableSignature() { // TypeVariableSignature ::= "T" Ident ";". expect('T'); scanIdentifier(); expect(';'); // Reference to type variable: // Note: we don't know the declaring GenericDeclaration yet. return new TypeVariableImpl<GenericDeclaration>(genericDecl, identifier); }
public D getGenericDeclaration() { resolve(); return genericDeclaration; }
@Override public int hashCode() { return 31 * getName().hashCode() + getGenericDeclaration().hashCode(); }
void resolve() { if (formalVar != null) { return; } GenericDeclaration curLayer = declOfVarUser; TypeVariable var; while ((var = findFormalVar(curLayer, name)) == null) { curLayer = nextLayer(curLayer); if (curLayer == null) { throw new AssertionError("illegal type variable reference"); } } formalVar = (TypeVariableImpl<D>) var; this.genericDeclaration = formalVar.genericDeclaration; this.bounds = formalVar.bounds; }
TypeVariableImpl<GenericDeclaration> parseTypeVariableSignature() { // TypeVariableSignature ::= "T" Ident ";". expect('T'); scanIdentifier(); expect(';'); // Reference to type variable: // Note: we don't know the declaring GenericDeclaration yet. return new TypeVariableImpl<GenericDeclaration>(genericDecl, identifier); }
public D getGenericDeclaration() { resolve(); return genericDeclaration; }
@Override public int hashCode() { return 31 * getName().hashCode() + getGenericDeclaration().hashCode(); }
void resolve() { if (formalVar != null) { return; } GenericDeclaration curLayer = declOfVarUser; TypeVariable var; while ((var = findFormalVar(curLayer, name)) == null) { curLayer = nextLayer(curLayer); if (curLayer == null) { throw new AssertionError("illegal type variable reference"); } } formalVar = (TypeVariableImpl<D>) var; this.genericDeclaration = formalVar.genericDeclaration; this.bounds = formalVar.bounds; }
TypeVariableImpl<GenericDeclaration> parseTypeVariableSignature() { // TypeVariableSignature ::= "T" Ident ";". expect('T'); scanIdentifier(); expect(';'); // Reference to type variable: // Note: we don't know the declaring GenericDeclaration yet. return new TypeVariableImpl<GenericDeclaration>(genericDecl, identifier); }