dotty.tools.dotc.util

Type members

Classlikes

object Attachment

A class inheriting from Attachment.Container supports adding, removing and lookup of attachments. Attachments are typed key/value pairs.

A class inheriting from Attachment.Container supports adding, removing and lookup of attachments. Attachments are typed key/value pairs.

Attachments whose key is an instance of StickyKey will be kept when the attachments are copied using withAttachmentsFrom.

class CharBuffer(initialSize: Int)

A character buffer that exposes the internal array for reading. That way we can avoid copying when converting to names.

A character buffer that exposes the internal array for reading. That way we can avoid copying when converting to names.

object Chars

Contains constants and classifier methods for characters

Contains constants and classifier methods for characters

The comment parsing in dotc is used by both the comment cooking and the dottydoc tool.

The comment parsing in dotc is used by both the comment cooking and the dottydoc tool.

The comment cooking is used to expand comments with <invalid inheritdoc annotation> and @define annotations. The rest of the comment is untouched and later handled by dottydoc.

object DiffUtil
class DotClass

Adds standard functionality to a class. For now: Just the unsupported method.

Adds standard functionality to a class. For now: Just the unsupported method.

class EqHashMap[Key, Value](initialCapacity: Int, capacityMultiple: Int) extends GenericHashMap[Key, Value]

A specialized implementation of GenericHashMap with identity hash and eq as comparison.

A specialized implementation of GenericHashMap with identity hash and eq as comparison.

abstract class FreshNameCreator
Companion
object
Companion
class
Companion
class
abstract class GenericHashMap[Key, Value](initialCapacity: Int, capacityMultiple: Int) extends MutableMap[Key, Value]

A hash table using open hashing with linear scan which is also very space efficient at small sizes. The implementations of hash and isEqual are left open. They have to be provided by subclasses.

A hash table using open hashing with linear scan which is also very space efficient at small sizes. The implementations of hash and isEqual are left open. They have to be provided by subclasses.

Value Params
capacityMultiple

The minimum multiple of capacity relative to used elements. The hash table will be re-sized once the number of elements multiplied by capacityMultiple exceeds the current size of the hash table. However, a table of size up to DenseLimit will be re-sized only once the number of elements reaches the table's size.

initialCapacity

Indicates the initial number of slots in the hash table. The actual number of slots is always a power of 2, so the initial size of the table will be the smallest power of two that is equal or greater than the given initialCapacity. Minimum value is 4.

Companion
object
class HashMap[Key, Value](initialCapacity: Int, capacityMultiple: Int) extends GenericHashMap[Key, Value]

A specialized implementation of GenericHashMap with standard hashCode and equals as comparison

A specialized implementation of GenericHashMap with standard hashCode and equals as comparison

object HashSet
Companion
class
class HashSet[T](initialCapacity: Int, capacityMultiple: Int) extends MutableSet[T]

A hash set that allows some privileged protected access to its internals

A hash set that allows some privileged protected access to its internals

Value Params
capacityMultiple

The minimum multiple of capacity relative to used elements. The hash table will be re-sized once the number of elements multiplied by capacityMultiple exceeds the current size of the hash table. However, a table of size up to DenseLimit will be re-sized only once the number of elements reaches the table's size.

initialCapacity

Indicates the initial number of slots in the hash table. The actual number of slots is always a power of 2, so the initial size of the table will be the smallest power of two that is equal or greater than the given initialCapacity. Minimum value is 4.

Companion
object
final class IntMap[Key](initialCapacity: Int, capacityMultiple: Int) extends PerfectHashing[Key]

A dense map from some Key type to Int. Dense means: All keys and values are stored in arrays from 0 up to the size of the map. Keys and values can be obtained by index usingkey(index)andvalue(index). Values can also be stored usingsetValue(index, value)`.

A dense map from some Key type to Int. Dense means: All keys and values are stored in arrays from 0 up to the size of the map. Keys and values can be obtained by index usingkey(index)andvalue(index). Values can also be stored usingsetValue(index, value)`.

ome privileged protected access to its internals

Value Params
capacityMultiple

The minimum multiple of capacity relative to used elements. The hash table will be re-sized once the number of elements multiplied by capacityMultiple exceeds the current size of the hash table. However, a table of size up to DenseLimit will be re-sized only once the number of elements reaches the table's size.

initialCapacity

Indicates the initial number of slots in the hash table. The actual number of slots is always a power of 2, so the initial size of the table will be the smallest power of two that is equal or greater than the given initialCapacity. Minimum value is 4.

class LRUCache[Key >: Null <: AnyRef, Value >: Null]

A least-recently-used cache for Key -> Value computations It currently keeps the last 8 associations, but this can be changed to anywhere between 2 and 16 by changing LRUCache.Retained.

A least-recently-used cache for Key -> Value computations It currently keeps the last 8 associations, but this can be changed to anywhere between 2 and 16 by changing LRUCache.Retained.

Implementation: We keep a ring of eight places, linked with the next data structure. The ring models a priority queue. last points to the last element of the queue, and next(last) to the first one. Lookups compare keys sequentially from first to last. Elements with successful lookup get promoted to be first in the queue. Elements are evicted at the last position.

Companion
object
object LRUCache
Companion
class
object LinearMap
object LinearSet
abstract class MutableMap[Key, Value] extends ReadOnlyMap[Key, Value]

A common class for lightweight mutable maps.

A common class for lightweight mutable maps.

abstract class MutableSet[T] extends ReadOnlySet[T]

A common class for lightweight mutable sets.

A common class for lightweight mutable sets.

Provides functions to encode and decode Scala symbolic names.

Provides functions to encode and decode Scala symbolic names.

object NoSource extends SourceFile

A sentinel for a non-existing source position

A sentinel for a non-existing source position

class ParsedComment(val comment: Comment)

A parsed doc comment.

A parsed doc comment.

Value Params
comment

The doc comment to parse

Companion
object
Companion
class
Companion
class
class PerfectHashing[Key](initialCapacity: Int, capacityMultiple: Int)

A map that maps keys to unique integers in a dense interval starting at 0.

A map that maps keys to unique integers in a dense interval starting at 0.

Value Params
capacityMultiple

The minimum multiple of capacity relative to used elements. The hash table will be re-sized once the number of elements multiplied by capacityMultiple exceeds the current size of the hash table. However, a table of size up to DenseLimit will be re-sized only once the number of elements reaches the table's size.

initialCapacity

Indicates the initial number of slots in the hash table. The actual number of slots is always a power of 2, so the initial size of the table will be the smallest power of two that is equal or greater than the given initialCapacity. Minimum value is 4.

Companion
object
object Property

Defines a key type with which to tag properties, such as attachments or context properties

Defines a key type with which to tag properties, such as attachments or context properties

abstract class ReadOnlyMap[Key, Value]

A class for the reading part of mutable or immutable maps.

A class for the reading part of mutable or immutable maps.

abstract class ReadOnlySet[T]

A class for the readonly part of mutable sets.

A class for the readonly part of mutable sets.

Companion
object
object ReadOnlySet
Companion
class
final class ReusableInstance[T <: AnyRef]

A wrapper for a list of cached instances of a type T. The wrapper is recursion-reentrant: several instances are kept, so at each depth of reentrance we are reusing the instance for that.

A wrapper for a list of cached instances of a type T. The wrapper is recursion-reentrant: several instances are kept, so at each depth of reentrance we are reusing the instance for that.

An instance is created upon creating this object, and more instances are allocated dynamically, on demand, when reentrance occurs.

Not thread safe.

Ported from scala.reflect.internal.util.ReusableInstance

Companion
object
Companion
class
object ShowPickled
object Signatures
abstract class SimpleIdentityMap[K <: AnyRef, +V >: Null <: AnyRef] extends K => V

A simple linked map with eq as the key comparison, optimized for small maps. It has linear complexity for apply, updated, and remove.

A simple linked map with eq as the key comparison, optimized for small maps. It has linear complexity for apply, updated, and remove.

Companion
object
Companion
class
abstract class SimpleIdentitySet[+Elem <: AnyRef]

A simple linked set with eq as the comparison, optimized for small sets. It has linear complexity for contains, +, and -.

A simple linked set with eq as the comparison, optimized for small sets. It has linear complexity for contains, +, and -.

Companion
object
Companion
class
final class SixteenNibbles(val bits: Long) extends AnyVal

An efficient implementation of sequences of 16 indexed elements with values 0..15 in a single Long.

An efficient implementation of sequences of 16 indexed elements with values 0..15 in a single Long.

Companion
object
Companion
class
class SourceFile(val file: AbstractFile, computeContent: => Array[Char]) extends SourceFile
Companion
object
object SourceFile
Companion
class
case class SourcePosition(source: SourceFile, span: Span, outer: SourcePosition) extends SrcPos with SourcePosition with Showable

A source position is comprised of a span and a source file

A source position is comprised of a span and a source file

object Spans

The offsets part of a full position, consisting of 2 or 3 entries:

The offsets part of a full position, consisting of 2 or 3 entries:

  • start: the start offset of the span, in characters from start of file
  • end : the end offset of the span
  • point: if given, the offset where a single ^ would be logically placed

Spans are encoded according to the following format in little endian: Start: unsigned 26 Bits (works for source files up to 64M) End: unsigned 26 Bits Point: unsigned 12 Bits relative to start NoSpan encoded as -1L (this is a normally invalid span because point would lie beyond end).

trait SrcPos

Things that can produce a source position and a span

Things that can produce a source position and a span

object Stats
object Store
Companion
class
final class Store(elems: Array[AnyRef]) extends AnyVal
Companion
object
object Util
final class WeakHashSet[A <: AnyRef](initialCapacity: Int, loadFactor: Double) extends Set[A]

A HashSet where the elements are stored weakly. Elements in this set are eligible for GC if no other hard references are associated with them. Its primary use case is as a canonical reference identity holder (aka "hash-consing") via findEntryOrUpdate

A HashSet where the elements are stored weakly. Elements in this set are eligible for GC if no other hard references are associated with them. Its primary use case is as a canonical reference identity holder (aka "hash-consing") via findEntryOrUpdate

This Set implementation cannot hold null. Any attempt to put a null in it will result in a NullPointerException

This set implementation is not in general thread safe without external concurrency control. However it behaves properly when GC concurrently collects elements in this set.

Companion
object
object WeakHashSet

Companion object for WeakHashSet

Companion object for WeakHashSet

Companion
class
object common

Common values hoisted out for performance

Common values hoisted out for performance

Types

opaque type LinearMap[K <: AnyRef, V >: Null <: AnyRef]

A linear map is a map where after an updated the previous map value cannot be used anymore. The map is implemented as an immutable map for sizes <= 4 (where immutable maps have specialized, compact representations) and as a HashMap for larger sizes.

A linear map is a map where after an updated the previous map value cannot be used anymore. The map is implemented as an immutable map for sizes <= 4 (where immutable maps have specialized, compact representations) and as a HashMap for larger sizes.

opaque type LinearSet[Elem >: Null <: AnyRef]

A linear set is a set where after a + the previous set value cannot be used anymore. The set is implemented as an immutable set for sizes <= 4 and as a HashSet for larger sizes.

A linear set is a set where after a + the previous set value cannot be used anymore. The set is implemented as an immutable set for sizes <= 4 and as a HashSet for larger sizes.