private void checkAbstractMethodInConcreteClass( NodeTraversal t, Node n, FunctionType ctorType, JSDocInfo info) { if (info == null || !info.isAbstract()) { return; } if (ctorType.isConstructor() && !ctorType.isAbstract()) { report(t, n, ABSTRACT_METHOD_IN_CONCRETE_CLASS); } }
if (currSuperCtor == null || !currSuperCtor.isAbstract()) { return; while (currSuperCtor != null && currSuperCtor.isAbstract()) { ObjectType superType = currSuperCtor.getInstanceType(); for (String prop : FunctionType maybeAbstractMethod = superType.findPropertyType(prop).toMaybeFunctionType(); if (maybeAbstractMethod != null && maybeAbstractMethod.isAbstract() && !abstractMethodSuperTypeMap.containsKey(prop)) { abstractMethodSuperTypeMap.put(prop, superType); ObjectType superType = entry.getValue(); FunctionType abstractMethod = instance.findPropertyType(method).toMaybeFunctionType(); if (abstractMethod == null || abstractMethod.isAbstract()) { String sourceName = n.getSourceFileName(); sourceName = nullToEmpty(sourceName);
/** Copies all the information from another function type. */ public FunctionBuilder copyFromOtherFunction(FunctionType otherType) { int isNative = otherType.isNativeObjectType() ? IS_NATIVE : 0; int isAbstract = otherType.isAbstract() ? IS_ABSTRACT : 0; int inferredReturnType = otherType.isReturnTypeInferred() ? INFERRED_RETURN_TYPE : 0; this.name = otherType.getReferenceName(); this.sourceNode = otherType.getSource(); this.parametersNode = otherType.getParametersNode(); this.returnType = otherType.getReturnType(); this.typeOfThis = otherType.getTypeOfThis(); this.templateTypeMap = otherType.getTemplateTypeMap(); this.kind = otherType.getKind(); this.properties = isNative | isAbstract | inferredReturnType; return this; }
if (methodType == null || !methodType.isAbstract() || methodType.isConstructor()) {
/** * Visits a NEW node. */ private void visitNew(NodeTraversal t, Node n) { Node constructor = n.getFirstChild(); JSType type = getJSType(constructor).restrictByNotNullOrUndefined(); if (!couldBeAConstructor(type) || type.isEquivalentTo(typeRegistry.getNativeType(SYMBOL_OBJECT_FUNCTION_TYPE))) { report(t, n, NOT_A_CONSTRUCTOR); ensureTyped(n); return; } FunctionType fnType = type.toMaybeFunctionType(); if (fnType != null && fnType.hasInstanceType()) { FunctionType ctorType = fnType.getInstanceType().getConstructor(); if (ctorType != null && ctorType.isAbstract()) { report(t, n, INSTANTIATE_ABSTRACT_CLASS); } visitArgumentList(t, n, fnType); ensureTyped(n, fnType.getInstanceType()); } else { ensureTyped(n); } }
if (!functionType.isAbstract()) { validator.expectAbstractMethodsImplemented(n, functionType);