Class ScalaMethodElement

java.lang.Object
io.micronaut.scala.processing.visitor.ScalaMethodElement
All Implemented Interfaces:
io.micronaut.core.annotation.AnnotatedElement, io.micronaut.core.annotation.AnnotationMetadata, io.micronaut.core.annotation.AnnotationMetadataDelegate, io.micronaut.core.annotation.AnnotationMetadataProvider, io.micronaut.core.annotation.AnnotationSource, io.micronaut.core.naming.Described, io.micronaut.core.naming.Named, io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate<io.micronaut.inject.ast.Element>, io.micronaut.inject.ast.Element, io.micronaut.inject.ast.MemberElement, io.micronaut.inject.ast.MethodElement
Direct Known Subclasses:
ScalaConstructorElement

public class ScalaMethodElement extends Object implements io.micronaut.inject.ast.MethodElement
Scala method element.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final ScalaClassElement
     
    protected final ScalaMethodData
     
    protected final ScalaVisitorContext
     

    Fields inherited from interface io.micronaut.core.annotation.AnnotationMetadata

    CLASS_NAME_SUFFIX, EMPTY_METADATA, VALUE_MEMBER

    Fields inherited from interface io.micronaut.core.annotation.AnnotationSource

    EMPTY

    Fields inherited from interface io.micronaut.inject.ast.Element

    EMPTY_ELEMENT_ARRAY

    Fields inherited from interface io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate

    EMPTY
  • Method Summary

    Modifier and Type
    Method
    Description
    io.micronaut.inject.ast.beans.BeanElementBuilder
    addAssociatedBean(io.micronaut.inject.ast.ClassElement type)
     
    <T extends Annotation>
    io.micronaut.inject.ast.Element
    annotate(io.micronaut.core.annotation.AnnotationValue<T> annotationValue)
     
    <T extends Annotation>
    io.micronaut.inject.ast.Element
    annotate(String annotationType, Consumer<io.micronaut.core.annotation.AnnotationValueBuilder<T>> consumer)
     
    protected Object
     
    protected Class<?>
     
    boolean
     
    io.micronaut.core.annotation.AnnotationMetadata
     
    protected io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate<?>
     
    Map<String, io.micronaut.inject.ast.ClassElement>
     
    List<? extends io.micronaut.inject.ast.GenericPlaceholderElement>
     
    io.micronaut.inject.ast.ClassElement
     
    getDocumentation(boolean parse)
     
    protected io.micronaut.inject.ast.annotation.ElementAnnotationMetadata
     
    io.micronaut.inject.ast.ClassElement
    The return type with the declaring type's variables bound as they were where the method was reached; getReturnType() stays the declared type, the JVM signature.
    io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate<io.micronaut.core.annotation.AnnotationMetadata>
     
    Set<io.micronaut.inject.ast.ElementModifier>
     
     
     
    io.micronaut.inject.ast.ClassElement
    The class this method was reached through.
    io.micronaut.inject.ast.ParameterElement[]
     
    io.micronaut.inject.ast.ClassElement
     
    io.micronaut.inject.ast.ClassElement[]
     
    int
     
    protected boolean
    Whether an absent nullability annotation on this member means non-null.
    boolean
    hides(io.micronaut.inject.ast.MethodElement hiddenMethod)
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
    overrides(io.micronaut.inject.ast.MethodElement overridden)
     
    protected Optional<String>
     
    io.micronaut.inject.ast.Element
    removeAnnotation(String annotationType)
     
    <T extends Annotation>
    io.micronaut.inject.ast.Element
    removeAnnotationIf(Predicate<io.micronaut.core.annotation.AnnotationValue<T>> predicate)
     
    io.micronaut.inject.ast.Element
    removeStereotype(String annotationType)
     
    protected final void
    replaceParameters(io.micronaut.inject.ast.ParameterElement[] parameters)
     
    io.micronaut.inject.ast.MethodElement
    withAnnotationMetadata(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
     
    io.micronaut.inject.ast.MethodElement
    withNewOwningType(io.micronaut.inject.ast.ClassElement owningType)
     
    io.micronaut.inject.ast.MethodElement
    withParameters(io.micronaut.inject.ast.ParameterElement... newParameters)
     

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.micronaut.core.annotation.AnnotatedElement

    isDeclaredNonNull, isDeclaredNullable, isNonNull, isNullable

    Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadata

    enumValuesSet, enumValuesSet, getValues, hasDeclaredStereotype, hasStereotypeNonRepeating, isAnnotationPresent, isDeclaredAnnotationPresent

    Methods inherited from interface io.micronaut.core.annotation.AnnotationMetadataDelegate

    booleanValue, booleanValue, booleanValue, booleanValue, classValue, classValue, classValue, classValue, classValues, classValues, classValues, classValues, copyAnnotationMetadata, doubleValue, doubleValue, doubleValue, enumValue, enumValue, enumValue, enumValue, enumValues, enumValues, enumValues, enumValues, findAnnotation, findAnnotation, findDeclaredAnnotation, findDeclaredAnnotation, findRepeatableAnnotation, findRepeatableAnnotation, getAnnotation, getAnnotation, getAnnotationNameByStereotype, getAnnotationNameByStereotype, getAnnotationNames, getAnnotationNamesByStereotype, getAnnotationNamesByStereotype, getAnnotationType, getAnnotationType, getAnnotationTypeByStereotype, getAnnotationTypeByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationTypesByStereotype, getAnnotationValuesByName, getAnnotationValuesByStereotype, getAnnotationValuesByType, getDeclaredAnnotation, getDeclaredAnnotation, getDeclaredAnnotationNameByStereotype, getDeclaredAnnotationNames, getDeclaredAnnotationNamesByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationTypeByStereotype, getDeclaredAnnotationValuesByName, getDeclaredAnnotationValuesByType, getDeclaredMetadata, getDeclaredStereotypeAnnotationNames, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValue, getDefaultValues, getStereotypeAnnotationNames, getTargetAnnotationMetadata, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValues, getValues, hasAnnotation, hasAnnotation, hasDeclaredAnnotation, hasDeclaredAnnotation, hasDeclaredStereotype, hasDeclaredStereotype, hasDeclaredStereotype, hasEvaluatedExpressions, hasPropertyExpressions, hasSimpleAnnotation, hasSimpleDeclaredAnnotation, hasStereotype, hasStereotype, hasStereotype, hasStereotype, intValue, intValue, intValue, isAnnotationPresent, isDeclaredAnnotationPresent, isEmpty, isFalse, isFalse, isPresent, isPresent, isRepeatableAnnotation, isRepeatableAnnotation, isTrue, isTrue, longValue, longValue, stringValue, stringValue, stringValue, stringValue, stringValues, stringValues, stringValues, stringValues, synthesize, synthesize, synthesizeAll, synthesizeAnnotationsByType, synthesizeDeclared, synthesizeDeclared, synthesizeDeclared, synthesizeDeclaredAnnotationsByType

    Methods inherited from interface io.micronaut.inject.ast.Element

    annotate, annotate, annotate, annotate, annotate, getDescription, getDocumentation, getDocumentation, getName, getNativeType, getSimpleName, isAbstract, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isSynthetic, removeAnnotation, removeAnnotation, removeAnnotationIf, removeStereotype, removeStereotype

    Methods inherited from interface io.micronaut.inject.ast.MemberElement

    getDeclaringType, getModifiers, isAccessible, isAccessible, isAccessible, isReflectionRequired, isReflectionRequired

    Methods inherited from interface io.micronaut.inject.ast.MethodElement

    findParameterIndex, getDeclaredMethodAnnotationMetadata, getDescription, getOverriddenMethods, getParameter, getReceiverType, getSuspendParameters, getTypeArguments, hasParameters, hides, isSubSignature, isSuspend, isVarArgs, withNewParameters
  • Field Details

  • Method Details

    • getAnnotationMetadata

      public io.micronaut.core.annotation.AnnotationMetadata getAnnotationMetadata()
      Specified by:
      getAnnotationMetadata in interface io.micronaut.core.annotation.AnnotationMetadataProvider
    • getAnnotationMetadataToWrite

      protected io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate<?> getAnnotationMetadataToWrite()
    • getMethodAnnotationMetadata

      public io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate<io.micronaut.core.annotation.AnnotationMetadata> getMethodAnnotationMetadata()
      Specified by:
      getMethodAnnotationMetadata in interface io.micronaut.inject.ast.MethodElement
    • getReturnType

      public io.micronaut.inject.ast.ClassElement getReturnType()
      Specified by:
      getReturnType in interface io.micronaut.inject.ast.MethodElement
    • getGenericReturnType

      public io.micronaut.inject.ast.ClassElement getGenericReturnType()
      The return type with the declaring type's variables bound as they were where the method was reached; getReturnType() stays the declared type, the JVM signature.
      Specified by:
      getGenericReturnType in interface io.micronaut.inject.ast.MethodElement
    • getDeclaredTypeVariables

      public List<? extends io.micronaut.inject.ast.GenericPlaceholderElement> getDeclaredTypeVariables()
      Specified by:
      getDeclaredTypeVariables in interface io.micronaut.inject.ast.MethodElement
    • getDeclaredTypeArguments

      public Map<String, io.micronaut.inject.ast.ClassElement> getDeclaredTypeArguments()
      Specified by:
      getDeclaredTypeArguments in interface io.micronaut.inject.ast.MethodElement
    • getThrownTypes

      public io.micronaut.inject.ast.ClassElement[] getThrownTypes()
      Specified by:
      getThrownTypes in interface io.micronaut.inject.ast.MethodElement
    • getParameters

      public io.micronaut.inject.ast.ParameterElement[] getParameters()
      Specified by:
      getParameters in interface io.micronaut.inject.ast.MethodElement
    • replaceParameters

      protected final void replaceParameters(io.micronaut.inject.ast.ParameterElement[] parameters)
    • withParameters

      public io.micronaut.inject.ast.MethodElement withParameters(io.micronaut.inject.ast.ParameterElement... newParameters)
      Specified by:
      withParameters in interface io.micronaut.inject.ast.MethodElement
    • withNewOwningType

      public io.micronaut.inject.ast.MethodElement withNewOwningType(io.micronaut.inject.ast.ClassElement owningType)
      Specified by:
      withNewOwningType in interface io.micronaut.inject.ast.MethodElement
    • withAnnotationMetadata

      public io.micronaut.inject.ast.MethodElement withAnnotationMetadata(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata)
      Specified by:
      withAnnotationMetadata in interface io.micronaut.inject.ast.Element
      Specified by:
      withAnnotationMetadata in interface io.micronaut.inject.ast.MemberElement
      Specified by:
      withAnnotationMetadata in interface io.micronaut.inject.ast.MethodElement
    • addAssociatedBean

      public io.micronaut.inject.ast.beans.BeanElementBuilder addAssociatedBean(io.micronaut.inject.ast.ClassElement type)
      Specified by:
      addAssociatedBean in interface io.micronaut.inject.ast.MethodElement
    • isDefault

      public boolean isDefault()
      Specified by:
      isDefault in interface io.micronaut.inject.ast.MethodElement
    • getOwningType

      public io.micronaut.inject.ast.ClassElement getOwningType()
      The class this method was reached through.

      This used to answer declaringType for a default method, which is every concrete trait method, so withNewOwningType was a no-op for exactly the case it exists for. Class-level AOP advice reaches a method through the owning type's metadata, so a method inherited from a trait and not overridden was never advised: the bean was proxied, the proxy declared the method, and the interceptor chain for it was empty -- @Transactional or @Cacheable on such a method did nothing, silently.

      Specified by:
      getOwningType in interface io.micronaut.inject.ast.MemberElement
    • overrides

      public boolean overrides(io.micronaut.inject.ast.MethodElement overridden)
      Specified by:
      overrides in interface io.micronaut.inject.ast.MethodElement
    • hides

      public boolean hides(io.micronaut.inject.ast.MethodElement hiddenMethod)
      Specified by:
      hides in interface io.micronaut.inject.ast.MethodElement
    • equalityKey

      protected Object equalityKey()
    • getDeclaringType

      public io.micronaut.inject.ast.ClassElement getDeclaringType()
      Specified by:
      getDeclaringType in interface io.micronaut.inject.ast.MemberElement
    • hasNullMarked

      protected boolean hasNullMarked()
      Whether an absent nullability annotation on this member means non-null.

      `@NullMarked` annotates nothing itself: it changes what saying nothing means for everything inside it. Core leaves that to the language module -- `isNonNull()` on the shared `AnnotatedElement` only asks whether the stereotype is present -- and the Java module implements it by walking from the member out to its owning type. Without the same walk here, every unannotated member of a `@NullMarked` Scala class reported neither nullable nor non-null, so binding and validation treated it as unconstrained.

      Returns:
      true when this member, or the type declaring it, is null-marked
    • isNonNull

      public boolean isNonNull()
      Specified by:
      isNonNull in interface io.micronaut.core.annotation.AnnotatedElement
    • rawDocumentation

      protected Optional<String> rawDocumentation()
      Returns:
      The raw Scaladoc comment written on this element, if any
    • getDocumentation

      public Optional<String> getDocumentation(boolean parse)
      Specified by:
      getDocumentation in interface io.micronaut.inject.ast.Element
    • getName

      public String getName()
      Specified by:
      getName in interface io.micronaut.inject.ast.Element
      Specified by:
      getName in interface io.micronaut.core.naming.Named
    • isProtected

      public boolean isProtected()
      Specified by:
      isProtected in interface io.micronaut.inject.ast.Element
    • isPublic

      public boolean isPublic()
      Specified by:
      isPublic in interface io.micronaut.inject.ast.Element
    • isPrivate

      public boolean isPrivate()
      Specified by:
      isPrivate in interface io.micronaut.inject.ast.Element
    • isPackagePrivate

      public boolean isPackagePrivate()
      Specified by:
      isPackagePrivate in interface io.micronaut.inject.ast.Element
    • isAbstract

      public boolean isAbstract()
      Specified by:
      isAbstract in interface io.micronaut.inject.ast.Element
    • isStatic

      public boolean isStatic()
      Specified by:
      isStatic in interface io.micronaut.inject.ast.Element
    • isFinal

      public boolean isFinal()
      Specified by:
      isFinal in interface io.micronaut.inject.ast.Element
    • getModifiers

      public Set<io.micronaut.inject.ast.ElementModifier> getModifiers()
      Specified by:
      getModifiers in interface io.micronaut.inject.ast.Element
    • getNativeType

      public Object getNativeType()
      Specified by:
      getNativeType in interface io.micronaut.inject.ast.Element
    • getElementAnnotationMetadata

      protected io.micronaut.inject.ast.annotation.ElementAnnotationMetadata getElementAnnotationMetadata()
    • annotate

      public <T extends Annotation> io.micronaut.inject.ast.Element annotate(String annotationType, Consumer<io.micronaut.core.annotation.AnnotationValueBuilder<T>> consumer)
      Specified by:
      annotate in interface io.micronaut.inject.ast.Element
      Specified by:
      annotate in interface io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate<io.micronaut.inject.ast.Element>
    • annotate

      public <T extends Annotation> io.micronaut.inject.ast.Element annotate(io.micronaut.core.annotation.AnnotationValue<T> annotationValue)
      Specified by:
      annotate in interface io.micronaut.inject.ast.Element
      Specified by:
      annotate in interface io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate<io.micronaut.inject.ast.Element>
    • removeAnnotation

      public io.micronaut.inject.ast.Element removeAnnotation(String annotationType)
      Specified by:
      removeAnnotation in interface io.micronaut.inject.ast.Element
      Specified by:
      removeAnnotation in interface io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate<io.micronaut.inject.ast.Element>
    • removeAnnotationIf

      public <T extends Annotation> io.micronaut.inject.ast.Element removeAnnotationIf(Predicate<io.micronaut.core.annotation.AnnotationValue<T>> predicate)
      Specified by:
      removeAnnotationIf in interface io.micronaut.inject.ast.Element
      Specified by:
      removeAnnotationIf in interface io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate<io.micronaut.inject.ast.Element>
    • removeStereotype

      public io.micronaut.inject.ast.Element removeStereotype(String annotationType)
      Specified by:
      removeStereotype in interface io.micronaut.inject.ast.Element
      Specified by:
      removeStereotype in interface io.micronaut.inject.ast.annotation.MutableAnnotationMetadataDelegate<io.micronaut.inject.ast.Element>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equalityType

      protected Class<?> equalityType()