當前位置: 首頁>>代碼示例>>Java>>正文


Java ErrorType類代碼示例

本文整理匯總了Java中javax.lang.model.type.ErrorType的典型用法代碼示例。如果您正苦於以下問題:Java ErrorType類的具體用法?Java ErrorType怎麽用?Java ErrorType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ErrorType類屬於javax.lang.model.type包,在下文中一共展示了ErrorType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: visitError

import javax.lang.model.type.ErrorType; //導入依賴的package包/類
@Override
public StringBuilder visitError(ErrorType t, Boolean p) {
    Element e = t.asElement();
    if (e instanceof TypeElement) {
        TypeElement te = (TypeElement)e;
        return DEFAULT_VALUE.append((p ? te.getQualifiedName() : te.getSimpleName()).toString());
    }
    return DEFAULT_VALUE;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:JavaSymbolProvider.java

示例2: resolveCapturedType

import javax.lang.model.type.ErrorType; //導入依賴的package包/類
private static TypeMirror resolveCapturedType(CompilationInfo info, TypeMirror tm) {
    if (tm == null) {
        return tm;
    }
    if (tm.getKind() == TypeKind.ERROR) {
        tm = info.getTrees().getOriginalType((ErrorType) tm);
    }
    TypeMirror type = resolveCapturedTypeInt(info, tm);
    if (type == null) {
        return tm;
    }
    if (type.getKind() == TypeKind.WILDCARD) {
        TypeMirror tmirr = ((WildcardType) type).getExtendsBound();
        if (tmirr != null)
            return tmirr;
        else { //no extends, just '?'
            TypeElement te = info.getElements().getTypeElement("java.lang.Object"); // NOI18N
            return te == null ? null : te.asType();
        }
            
    }
    
    return type;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:TypeUtilities.java

示例3: resolveCapturedType

import javax.lang.model.type.ErrorType; //導入依賴的package包/類
public static TypeMirror resolveCapturedType(CompilationInfo info, TypeMirror tm) {
    if (tm == null) {
        return tm;
    }
    if (tm.getKind() == TypeKind.ERROR) {
        tm = info.getTrees().getOriginalType((ErrorType) tm);
    }
    TypeMirror type = resolveCapturedTypeInt(info, tm);
    if (type == null) {
        return tm;
    }
    if (type.getKind() == TypeKind.WILDCARD) {
        TypeMirror tmirr = ((WildcardType) type).getExtendsBound();
        if (tmirr != null)
            return tmirr;
        else { //no extends, just '?'
            TypeElement te = info.getElements().getTypeElement("java.lang.Object"); // NOI18N
            return te == null ? null : te.asType();
        }
            
    }
    
    return type;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:25,代碼來源:Utilities.java

示例4: visitError

import javax.lang.model.type.ErrorType; //導入依賴的package包/類
@Override
public Void visitError(ErrorType type, Void p) {
    Element e = type.asElement();
    if (e instanceof TypeElement) {
        TypeElement te = (TypeElement)e;
        builder.append(te.getSimpleName());            
    }
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:AutoImport.java

示例5: testErrorTypes

import javax.lang.model.type.ErrorType; //導入依賴的package包/類
public void testErrorTypes() {
  TypeElement extendsUndefinedType =
      processingEnv.getElementUtils().getTypeElement("ExtendsUndefinedType");
  ErrorType errorType = (ErrorType) extendsUndefinedType.getSuperclass();
  TypeMirror javaLangObject = typeMirrorOf("java.lang.Object");
  TypeElement list = typeElementOf("java.util.List");
  TypeMirror listOfError = typeUtil.getDeclaredType(list, errorType);
  TypeMirror queryExtendsError = typeUtil.getWildcardType(errorType, null);
  TypeMirror listOfQueryExtendsError = typeUtil.getDeclaredType(list, queryExtendsError);
  TypeMirror querySuperError = typeUtil.getWildcardType(null, errorType);
  TypeMirror listOfQuerySuperError = typeUtil.getDeclaredType(list, querySuperError);
  TypeMirror arrayOfError = typeUtil.getArrayType(errorType);
  TypeMirror[] typesWithErrors = {
      errorType, listOfError, listOfQueryExtendsError, listOfQuerySuperError, arrayOfError
  };
  for (TypeMirror typeWithError : typesWithErrors) {
    try {
      new TypeSimplifier(typeUtil, "foo.bar", ImmutableSet.of(typeWithError), javaLangObject);
      fail("Expected exception for type: " + typeWithError);
    } catch (MissingTypeException expected) {
    }
  }
}
 
開發者ID:yongjhih,項目名稱:RetroFacebook,代碼行數:24,代碼來源:TypeSimplifierTest.java

示例6: visitError

import javax.lang.model.type.ErrorType; //導入依賴的package包/類
/**
 * Any reference to the as-yet-ungenerated builder should be an unresolved ERROR.
 * Similarly for many copy-and-paste errors
 */
@Override
public Boolean visitError(ErrorType t, Void p) {
  if (typeParameters.isEmpty()) {
    // For non-generic types, the ErrorType will have the correct name.
    String simpleName = t.toString();
    return equal(simpleName, superclass.getSimpleName());
  }
  // For generic types, we'll just have to hope for the best.
  // TODO: Revalidate in a subsequent round?
  return true;
}
 
開發者ID:google,項目名稱:FreeBuilder,代碼行數:16,代碼來源:Analyser.java

示例7: getTypeMirror

import javax.lang.model.type.ErrorType; //導入依賴的package包/類
public Value<TypeMirror> getTypeMirror(final String key) {
  final AnnotationValue annotationValue = values.get(key);

  if (annotationValue == null) {
    throw new IllegalArgumentException(key);
  }

  final TypeMirror typeMirror = toTypeMirror(annotationValue);

  if (typeMirror == null) {
    throw brokenValue("Could not resolve type", element, annotation, annotationValue);
  }

  if (typeMirror instanceof ErrorType) {
    throw brokenValue("Could not resolve type", element, annotation, annotationValue);
  }

  return new Value<>(annotationValue, typeMirror);
}
 
開發者ID:udoprog,項目名稱:tiny-serializer-java,代碼行數:20,代碼來源:AnnotationValues.java

示例8: getOriginalType

import javax.lang.model.type.ErrorType; //導入依賴的package包/類
@Override
public TypeMirror getOriginalType(ErrorType et) {
    return delegate.getOriginalType(et);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:5,代碼來源:CompletionFilter.java

示例9: purify

import javax.lang.model.type.ErrorType; //導入依賴的package包/類
private TypeMirror purify(CompilationInfo info, TypeMirror targetType) {
    if (targetType != null && targetType.getKind() == TypeKind.ERROR) {
        targetType = info.getTrees().getOriginalType((ErrorType) targetType);
    }

    if (targetType == null || targetType.getKind() == /*XXX:*/TypeKind.ERROR || targetType.getKind() == TypeKind.NONE || targetType.getKind() == TypeKind.NULL) return null;

    return Utilities.resolveTypeForDeclaration(info, targetType);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:ChangeMethodReturnType.java

示例10: purify

import javax.lang.model.type.ErrorType; //導入依賴的package包/類
private TypeMirror purify(CompilationInfo info, TypeMirror targetType) {
    if (targetType != null && targetType.getKind() == TypeKind.ERROR) {
        targetType = info.getTrees().getOriginalType((ErrorType) targetType);
    }

    if (targetType == null || targetType.getKind() == /*XXX:*/TypeKind.ERROR || targetType.getKind() == TypeKind.NONE || targetType.getKind() == TypeKind.NULL) return null;

    return Utilities.resolveCapturedType(info, targetType);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:ExpectedTypeResolver.java

示例11: asError

import javax.lang.model.type.ErrorType; //導入依賴的package包/類
/**
 * Returns a {@link ExecutableType} if the {@link TypeMirror} represents an executable type such
 * as may result from missing code, or bad compiles or throws an {@link IllegalArgumentException}.
 */
public static ErrorType asError(TypeMirror maybeErrorType) {
    return maybeErrorType.accept(new CastingTypeVisitor<ErrorType>() {
        @Override
        public ErrorType visitError(ErrorType type, String p) {
            return type;
        }
    }, "error type");
}
 
開發者ID:foodora,項目名稱:android-auto-mapper,代碼行數:13,代碼來源:MoreTypes.java

示例12: getErrorType

import javax.lang.model.type.ErrorType; //導入依賴的package包/類
@Test
public void getErrorType()
{
    ErrorType errorType =
            new DeclaredTypeAsErrorType(getTypes().getDeclaredType(getElement(Set.class)));
    assertThat(TypeName.get(errorType)).isEqualTo(ClassName.get(Set.class));
}
 
開發者ID:wrmsr,項目名稱:wava,代碼行數:8,代碼來源:TestAbstractTypes.java

示例13: visitError

import javax.lang.model.type.ErrorType; //導入依賴的package包/類
@Override
public Element visitError(ErrorType t, Void p) {
    return t.asElement();
}
 
開發者ID:aitorvs,項目名稱:auto-parcel,代碼行數:5,代碼來源:MoreTypes.java

示例14: visitError

import javax.lang.model.type.ErrorType; //導入依賴的package包/類
@Override
public Element visitError(ErrorType t, Void p) {
  return t.asElement();
}
 
開發者ID:SiimKinks,項目名稱:sqlitemagic,代碼行數:5,代碼來源:Environment.java

示例15: visitError

import javax.lang.model.type.ErrorType; //導入依賴的package包/類
@Override public Element visitError(ErrorType t, Void p) {
  return t.asElement();
}
 
開發者ID:yongjhih,項目名稱:RetroFacebook,代碼行數:4,代碼來源:BuilderSpec.java


注:本文中的javax.lang.model.type.ErrorType類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。