All Downloads are FREE. Search and download functionalities are using the official Maven repository.

.kotlin.kotlin-reflect.0.12.200.source-code.descriptors.proto Maven / Gradle / Ivy

There is a newer version: 2.1.0-RC
Show newest version
/*
 * Copyright 2010-2015 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.jetbrains.kotlin.serialization;

option java_outer_classname = "ProtoBuf";
option optimize_for = LITE_RUNTIME; // Smaller runtime
option java_generic_services = false; // Less code

message StringTable {
  repeated string string = 1;
}

message QualifiedNameTable {

  message QualifiedName {
    optional int32 parent_qualified_name = 1 [default = -1];
    // Id in the StringTable
    required int32 short_name = 2;
    optional Kind kind = 3 [default = PACKAGE];

    enum Kind {
      CLASS = 0;
      PACKAGE = 1;
      LOCAL = 2;
    }
  }

  repeated QualifiedName qualified_name = 1;
}

message Annotation {
  message Argument {
    message Value {
      enum Type {
        BYTE = 0;
        CHAR = 1;
        SHORT = 2;
        INT = 3;
        LONG = 4;
        FLOAT = 5;
        DOUBLE = 6;
        BOOLEAN = 7;

        STRING = 8;
        CLASS = 9;
        ENUM = 10;
        ANNOTATION = 11;
        ARRAY = 12;
      }

      // Note: a *Value* has a Type, not an Argument! This is done for future language features which may involve using arrays
      // of elements of different types. Such entries are allowed in the constant pool of JVM class files.
      // However, to save space, this field is optional: in case of homogeneous arrays, only the type of the first element is required
      optional Type type = 1;

      // Only one of the following values should be present. Consider using `oneof` instead when we upgrade to protobuf 2.6.0+

      optional sint64 int_value = 2;
      optional float float_value = 3;
      optional double double_value = 4;

      // id in StringTable
      optional int32 string_value = 5;

      // If type = CLASS, FQ name id of the referenced class; if type = ENUM, FQ name id of the enum class
      optional int32 class_id = 6;

      // id in StringTable
      optional int32 enum_value_id = 7;

      optional Annotation annotation = 8;

      repeated Value array_element = 9;
    }

    // id in StringTable
    required int32 name_id = 1;
    required Value value = 2;
  }

  // Class FQ name id
  required int32 id = 1;

  repeated Argument argument = 2;
}

message Type {
  message Constructor {
    enum Kind {
      CLASS = 0;
      TYPE_PARAMETER = 1;
    }

    optional Kind kind = 1 [default = CLASS];

    required int32 id = 2; // CLASS - fqName id, TYPE_PARAMETER - type parameter id
  }

  required Constructor constructor = 1;

  message Argument {
    enum Projection {
      IN = 0;
      OUT = 1;
      INV = 2;
      STAR = 3;
    }

    optional Projection projection = 1 [default = INV];
    optional Type type = 2; // when projection is STAR, no type is written, otherwise type must be specified
  }

  repeated Argument argument = 2;

  optional bool nullable = 3 [default = false];

  // Id in the StringTable
  // If this field is set, the type is flexible.
  // All the other fields and extensions represent its lower bound, and flexible_upper_bound must be set and represents its upper bound.
  optional int32 flexible_type_capabilities_id = 4;

  // While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
  // we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
  // to represent flexible types is too many wasted bytes.
  optional Type flexible_upper_bound = 5;

  extensions 100 to 199;
}

message TypeParameter {
  required int32 id = 1;
  // Id in the StringTable
  required int32 name = 2;

  optional bool reified = 3 [default = false];

  enum Variance {
    IN = 0;
    OUT = 1;
    INV = 2;
  }
  optional Variance variance = 4 [default = INV];

  repeated Type upper_bound = 5;
}

message Class {
  enum Kind {
    // 3 bits
    CLASS = 0;
    TRAIT = 1;
    ENUM_CLASS = 2;
    ENUM_ENTRY = 3;
    ANNOTATION_CLASS = 4;
    OBJECT = 5;
    CLASS_OBJECT = 6;
  }

  /*
      Visibility
      Modality
      has_annotation
      ClassKind
      is_inner
   */
  optional int32 flags = 1 [default = 0 /*internal final class, no annotations*/];

  required int32 fq_name = 3;

  // If this field is present, it contains the name of companion object.
  optional int32 companion_object_name = 4;

  repeated TypeParameter type_parameter = 5;
  repeated Type supertype = 6;

  // we store only names, because the actual information must reside in the corresponding .class files,
  // to be obtainable through reflection at runtime
  repeated int32 nested_class_name = 7;

  repeated Callable member = 11;

  repeated int32 enum_entry = 12;

  message PrimaryConstructor {
    // If this field is present, it contains serialized data for the primary constructor.
    // Otherwise it's default and can be created manually upon deserialization
    // Note: currently only objects have default primary constructor
    optional Callable data = 1;
  }

  // This field is present if and only if the class has a primary constructor
  optional PrimaryConstructor primary_constructor = 13;
  repeated Callable secondary_constructor = 14;

  extensions 100 to 199;
}

message Package {
  repeated Callable member = 1;

  extensions 100 to 199;
}

message Callable {
  enum MemberKind {
    // 2 bits
    DECLARATION = 0;
    FAKE_OVERRIDE = 1;
    DELEGATION = 2;
    SYNTHESIZED = 3;
  }

  enum CallableKind {
    // 2 bits
    FUN = 0;
    VAL = 1;
    VAR = 2;
    CONSTRUCTOR = 3;
  }

  /*
     Visibility
     Modality
     has_annotations
     CallableKind
     MemberKind
     hasGetter
     hasSetter
     hasConstant
   */
  optional int32 flags = 1;

  /*
     isNotDefault
     Visibility
     Modality
     has_annotations
   */
  optional int32 getter_flags = 9 /* absent => same as property */;
  optional int32 setter_flags = 10 /* absent => same as property */;

  repeated TypeParameter type_parameter = 4;

  optional Type receiver_type = 5;

  // Id in the StringTable
  required int32 name = 6;

  message ValueParameter {
    /*
       declaresDefault
       has_annotations
    */
    optional int32 flags = 1;

    // Id in the StringTable
    required int32 name = 2;
    required Type type = 3;
    optional Type vararg_element_type = 4;

    extensions 100 to 199;
  }

  // Value parameters for functions and constructors, or setter value parameter for properties
  repeated ValueParameter value_parameter = 7;

  required Type return_type = 8;

  extensions 100 to 199;
}

enum Modality {
  // 2 bits
  FINAL = 0x00;
  OPEN = 0x01;
  ABSTRACT = 0x02;
}

enum Visibility {
  // 3 bits
  INTERNAL = 0x00;
  PRIVATE = 0x01;
  PROTECTED = 0x02;
  PUBLIC = 0x03;
  PRIVATE_TO_THIS = 0x04;
  LOCAL = 0x05;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy