Skip to content

Classes and Types

Alexey Volkov edited this page Mar 24, 2023 · 3 revisions

Classes

JcClassOrInterface represents class file. As a result there is no JcClassOrInterfaces for arrays and primitives.

classDiagram
    JcByteCodeLocation  *-- JcClassOrInterface
    JcClassOrInterface  *-- JcMethod
    JcClassOrInterface  *-- JcField
    JcMethod  *-- JcParameter
    
    
    class TypeName{
      +String typeName
    }

    class JcByteCodeLocation {
       +Map<String, InputStream> classes 
    }

    class JcDeclaration {
        +JcByteCodeLocation location
        +String relativePath 
    }

    class JcClassOrInterface {
      +JcMethod[] methods
      +JcField[] fields
      +JcDeclaration declaration
    }

    class JcParameter {
      +Int index
      +String name
      +TypeName type
    }


    class JcMethod {
      +JcClassOrInterface enclosingClass
      +JcParameter[] parameters
      +TypeName returnType
      +JcDeclaration declaration
    }

    class JcField {
      +JcClassOrInterface enclosingClass
      +TypeName type
      +JcField field
      +JcDeclaration declaration
    }
Loading

Types

JcType represents type from JVM runtime.

classDiagram
    JcType <|-- JcPrimitiveType
    JcType <|-- JcRefType
    JcRefType <|-- JcUnboundWildcard
    JcRefType <|-- JcBoundedWildcard
    JcRefType <|-- JcArrayType
    JcRefType <|-- JcClassType
    JcRefType <|-- JcTypeVariable
    class JcType {
      +bool nullable
      +String typeName
    }

    class JcRefType {
    }
    class JcArrayType {
       +JcType elementType
    }

    class JcTypedMethod {
      +JcType[] parameters
      +JcType returnType
      +JcMethod method
    }

    class JcTypedField {
      +JcType type
      +JcField field
    }
    class JcClassType {
      +JcClassOrInterface jcClass
      +JcRefType[] typeParameters
      +JcRefType[] typeArguments
    }
    class JcTypeVariable {
      +String symbol
      +JcRefType[] bounds
    }
    class JcBoundedWildcard {
      +JcRefType lowerBound
      +JcRefType upperBound
    }
Loading

JcClasspath is an entry point for both classes and types.

JcClassType#methods contains:

  • all the public/protected/private methods of an enclosing class
  • all the ancestor methods visible at compile time
  • only constructor methods from the declaring class

JcClassType#fields contains:

  • all the public/protected/private fields of an enclosing class
  • all the ancestor fields visible at compile time
Clone this wiki locally