@Override public TypeMirror getEnclosingType() { ReferenceBinding binding = (ReferenceBinding)_binding; ReferenceBinding enclosingType = binding.enclosingType(); if (enclosingType != null) { return _env.getFactory().newTypeMirror(enclosingType); } return _env.getFactory().getNoType(TypeKind.NONE); }
@Override public Element asElement() { // The JDT compiler does not distinguish between type elements and declared types return _env.getFactory().newElement((ReferenceBinding)_binding, _elementKindHint); }
public BaseProcessingEnvImpl() { _addedUnits = new ArrayList<>(); _addedClassFiles = new ArrayList<>(); _deletedUnits = new ArrayList<>(); _elementUtils = new ElementsImpl(this); _typeUtils = new TypesImpl(this); _factory = new Factory(this); _errorRaised = false; }
public DeclaredType getAnnotationType() { if (this._binding == null) { return _env.getFactory().getErrorType(); } ReferenceBinding annoType = _binding.getAnnotationType(); return _env.getFactory().newAnnotationType(annoType); }
@Override public TypeMirror getEnclosingType() { ReferenceBinding binding = (ReferenceBinding)_binding; ReferenceBinding enclosingType = binding.enclosingType(); if (enclosingType != null) return _env.getFactory().newDeclaredType(enclosingType); return _env.getFactory().getNoType(TypeKind.NONE); }
case Binding.VARIABLE: return newTypeMirror(((VariableBinding)binding).type); return getNoType(TypeKind.PACKAGE); ReferenceBinding referenceBinding = (ReferenceBinding) binding; if ((referenceBinding.tagBits & TagBits.HasMissingType) != 0) { return getErrorType(referenceBinding); switch (btb.id) { case TypeIds.T_void: return getNoType(TypeKind.VOID); case TypeIds.T_null: return getNullType(); default: return getPrimitiveType(btb); return new TypeVariableImpl(_env, (TypeVariableBinding) binding); case Binding.MODULE: return getNoType(TypeKind.MODULE);
return Factory.getMatchingDummyValue(expectedType); for (int i = 0; i < bindings.length; ++i) { if (bindings[i] instanceof TypeBinding) { mirrors.add(_env.getFactory().newTypeMirror((TypeBinding)bindings[i])); TypeMirror mirror = _env.getFactory().newTypeMirror((TypeBinding)actualValue); throw new MirroredTypeException(mirror);
return Factory.getMatchingDummyValue(expectedType); return null == returnVal ? Factory.getMatchingDummyValue(expectedType) : returnVal; (AnnotationMirrorImpl)_env.getFactory().newAnnotationMirror((AnnotationBinding)jdtValue); return Proxy.newProxyInstance(expectedType.getClassLoader(), new Class[]{ expectedType }, annoMirror ); return Factory.getMatchingDummyValue(expectedType);
@Override public TypeMirror getExtendsBound() { WildcardBinding wildcardBinding = (WildcardBinding) this._binding; if (wildcardBinding.boundKind != Wildcard.EXTENDS) return null; TypeBinding bound = wildcardBinding.bound; if (bound == null) return null; return _env.getFactory().newTypeMirror(bound); }
@Override public Set<Modifier> getModifiers() { MethodBinding binding = (MethodBinding)_binding; return Factory.getModifiers(binding.modifiers, getKind()); }
@Override public Element getEnclosingElement() { ReferenceBinding binding = (ReferenceBinding)_binding; ReferenceBinding enclosingType = binding.enclosingType(); if (null == enclosingType) { // this is a top level type; get its package return _env.getFactory().newPackageElement(binding.fPackage); } else { return _env.getFactory().newElement(binding.enclosingType()); } }
public List<? extends AnnotationMirror> getAnnotationMirrors() { return _env == null ? Factory.EMPTY_ANNOTATION_MIRRORS : _env.getFactory().getAnnotationMirrors(getPackedAnnotationBindings()); }
public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) { A [] annotations = _env.getFactory().getAnnotationsByType(Factory.getUnpackedAnnotationBindings(getPackedAnnotationBindings()), annotationType); if (annotations.length != 0 || this.getKind() != ElementKind.CLASS || annotationType.getAnnotation(Inherited.class) == null) return annotations; ElementImpl superClass = (ElementImpl) _env.getFactory().newElement(((ReferenceBinding) this._binding).superclass()); return superClass == null ? annotations : superClass.getAnnotationsByType(annotationType); }
@Override public TypeMirror asType() { return this._env.getFactory().getErrorType((ReferenceBinding) this._binding); }
switch(checkBits[i]) { case ClassFileConstants.AccPublic : appendModifier(result, modifiers, checkBits[i], Modifier.PUBLIC); break; case ClassFileConstants.AccProtected: appendModifier(result, modifiers, checkBits[i], Modifier.PROTECTED); break; case ClassFileConstants.AccPrivate : appendModifier(result, modifiers, checkBits[i], Modifier.PRIVATE); break; case ClassFileConstants.AccAbstract : appendModifier(result, modifiers, checkBits[i], Modifier.ABSTRACT); break; case ClassFileConstants.AccStatic : appendModifier(result, modifiers, checkBits[i], Modifier.STATIC); break; case ClassFileConstants.AccFinal : appendModifier(result, modifiers, checkBits[i], Modifier.FINAL); break; case ClassFileConstants.AccSynchronized : appendModifier(result, modifiers, checkBits[i], Modifier.SYNCHRONIZED); break; case ClassFileConstants.AccNative : appendModifier(result, modifiers, checkBits[i], Modifier.NATIVE); break; case ClassFileConstants.AccStrictfp : appendModifier(result, modifiers, checkBits[i], Modifier.STRICTFP); break; case ClassFileConstants.AccTransient :
case METHOD : decodeModifiers(result, modifiers, new int[] { ClassFileConstants.AccPublic, ClassFileConstants.AccProtected, case ENUM_CONSTANT : decodeModifiers(result, modifiers, new int[] { ClassFileConstants.AccPublic, ClassFileConstants.AccProtected, case ENUM : if (isFromBinary) { decodeModifiers(result, modifiers, new int[] { ClassFileConstants.AccPublic, ClassFileConstants.AccProtected, } else { decodeModifiers(result, modifiers, new int[] { ClassFileConstants.AccPublic, ClassFileConstants.AccProtected, decodeModifiers(result, modifiers, new int[] { ClassFileConstants.AccPublic, ClassFileConstants.AccProtected,
@Override public <A extends Annotation> A getAnnotation(Class<A> annotationClass) { A annotation = _env.getFactory().getAnnotation(getPackedAnnotationBindings(), annotationClass); if (annotation != null || this.getKind() != ElementKind.CLASS || annotationClass.getAnnotation(Inherited.class) == null) return annotation; ElementImpl superClass = (ElementImpl) _env.getFactory().newElement(((ReferenceBinding) this._binding).superclass()); return superClass == null ? null : superClass.getAnnotation(annotationClass); }
@Override public TypeMirror getSuperclass() { return this._env.getFactory().getNoType(TypeKind.NONE); }
return avoidReflectException ? getMatchingDummyValue(expectedType) : null; case 's': return avoidReflectException ? getMatchingDummyValue(expectedType) : value; case 'd': return new Double(l); // widening. case 'l': return avoidReflectException ? getMatchingDummyValue(expectedType) : value; case 'd': return new Double(f); // widening. return value; // exact match else{ return avoidReflectException ? getMatchingDummyValue(expectedType) : value; // completely wrong. return value; else return avoidReflectException ? getMatchingDummyValue(expectedType) : value; // completely wrong. return avoidReflectException ? getMatchingDummyValue(expectedType) : value;
case Binding.VARIABLE: return newTypeMirror(((VariableBinding)binding).type); return getNoType(TypeKind.PACKAGE); ReferenceBinding referenceBinding = (ReferenceBinding) binding; if ((referenceBinding.tagBits & TagBits.HasMissingType) != 0) { return getErrorType(referenceBinding); switch (btb.id) { case TypeIds.T_void: return getNoType(TypeKind.VOID); case TypeIds.T_null: return getNullType(); default: return getPrimitiveType(btb);