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

.kotlin.kotlin-compiler.1.0.0-beta-3595.source-code.jvm_descriptors.proto Maven / Gradle / Ivy

/*
 * 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.jvm;

import "core/deserialization/src/ext_options.proto";
import "core/deserialization/src/descriptors.proto";

option java_outer_classname = "JvmProtoBuf";
option optimize_for = LITE_RUNTIME;

message StringTableTypes {
  message Record {
    // The number of times this record should be repeated; this is used to collapse identical subsequent records in the list
    optional int32 range = 1 [default = 1];

    // Index of the predefined constant. If this field is present, the associated string is ignored
    optional int32 predefined_index = 2;

    // A string which should be used. If this field is present, both the associated string and the predefined string index are ignored
    optional string string = 6;

    enum Operation {
      NONE = 0;

      // replaceAll('$', '.')
      // java/util/Map$Entry -> java/util/Map.Entry;
      INTERNAL_TO_CLASS_ID = 1;

      // substring(1, length - 1) and then replaceAll('$', '.')
      // Ljava/util/Map$Entry; -> java/util/Map.Entry
      DESC_TO_CLASS_ID = 2;
    }

    // Perform a described operation on the string
    optional Operation operation = 3 [default = NONE];

    // If this field is present, the "substring" operation must be performed with the first element of this list as the start index,
    // and the second element as the end index.
    // If an operation is not NONE, it's applied _after_ this substring operation
    repeated int32 substring_index = 4 [packed = true];

    // If this field is present, the "replaceAll" operation must be performed with the first element of this list as the code point
    // of the character to replace, and the second element as the code point of the replacement character
    repeated int32 replace_char = 5 [packed = true];
  }

  repeated Record record = 1;

  // Indices of strings which are names of local classes or anonymous objects
  repeated int32 local_name = 5 [packed = true];
}

message JvmMethodSignature {
  optional int32 name = 1 [(string_id_in_table) = true];

  // JVM descriptor of the method, e.g. '(Ljava/util/List;)[Ljava/lang/Object;'
  optional int32 desc = 2 [(string_id_in_table) = true];
}

message JvmFieldSignature {
  optional int32 name = 1 [(string_id_in_table) = true];

  // JVM descriptor of the field type, e.g. 'Ljava/lang/String;'
  optional int32 desc = 2 [(string_id_in_table) = true];

  // True iff this field is a backing field for a companion object and is really present as a static
  // field in the outer class, not as an instance field here
  optional bool is_static_in_outer = 3 [default = false];
}

message JvmPropertySignature {
  optional JvmFieldSignature field = 1;

  // Annotations on properties are written on a synthetic method with this signature
  optional JvmMethodSignature synthetic_method = 2;

  optional JvmMethodSignature getter = 3;
  optional JvmMethodSignature setter = 4;
}

extend Constructor {
  optional JvmMethodSignature constructor_signature = 100;
}

extend Function {
  optional JvmMethodSignature method_signature = 100;

  // Package-less name of the class with the callable's body and annotations, if it differs from the class it's serialized into.
  // E.g. for a class "A/B/C$D" this would be "C$D".
  // This is needed to find the class to load annotations from in the following cases:
  // 1) annotations on top-level members are written to compiled package part classes
  // 2) annotations on properties in traits are written to TImpl classes
  optional int32 method_impl_class_name = 101 [(string_id_in_table) = true];
}

extend Property {
  optional JvmPropertySignature property_signature = 100;

  // see Function#method_impl_class_name
  optional int32 property_impl_class_name = 101 [(string_id_in_table) = true];
}

extend Type {
  repeated Annotation type_annotation = 100;
  optional bool is_raw = 101;
}

extend TypeParameter {
  repeated Annotation type_parameter_annotation = 100;
}

extend ValueParameter {
  // Index of the corresponding parameter of this method in JVM (counting receiver parameters, enum constructor synthetic parameters, etc.)
  optional int32 index = 100;
}

extend Class {
  repeated Annotation class_annotation = 100;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy