anchor.diff:    for (Annotation annotationNode in annotatedNode.metadata) {
       // TODO(sigurdm): Emit a warning/error if the element is not in the global
       // public scope of the library.
  -    importCollector._addLibrary(annotationNode.element.library);
  -    String prefix = importCollector._getPrefix(annotationNode.element.library);
  +    if (annotationNode.element == null) {
  +      // Some internal constants (mainly in dart:html) cannot be resolved by
  +      // the analyzer. Ignore them.
  +      // TODO(sigurdm) clarify: Investigate this, and see if these constants can
  +      // somehow be included.
  +      logger.fine("Ignoring unresolved metadata $annotationNode",
  +          asset: resolver.getSourceAssetId(element),
  +          span: resolver.getSourceSpan(element));
  +      continue;
  +    }
  +
  +    LibraryElement library = annotationNode.element.library;
  +    Uri importUri = resolver.getImportUri(library, from: dataId);
  +    if (annotationNode.element.isPrivate ||
  +        (importUri.scheme == "dart" &&
  +            !sdkLibraryNames.contains(importUri.path))) {
  +      // Private constants, and constants made of classes in internal libraries
  +      // cannot be represented.
  +      // Skip them.
  +      // TODO(sigurdm) clarify: Investigate this, and see if these constants can
  +      // somehow be included.
  +      logger.fine("Ignoring unrepresentable metadata $annotationNode",
  +          asset: resolver.getSourceAssetId(element),
  +          span: resolver.getSourceSpan(element));
  +      continue;
  +    }
  +    importCollector._addLibrary(library);
  +    String prefix = importCollector._getPrefix(library);
       if (annotationNode.arguments != null) {
         // A const constructor.
         String constructor = (annotationNode.constructorName == null)
  
positive.code:     });
    }
  
    String generateCode(Resolver resolver) {
      return _formatAsMap(reflectors.map((_ReflectorDomain reflector) {
        return "${reflector._constConstructionCode(importCollector)}: "
            "${reflector._generateCode(resolver, importCollector)}";
      }));
    }
  }
  
negative.code:       int ownerIndex = classes.indexOf(element.enclosingElement);
        String metadataCode;
        if (_capabilities._supportsMetadata) {
          metadataCode = _extractMetadataCode(
              element, resolver, importCollector, logger, dataId);
        } else {
          metadataCode = null;
        }
  