Package org.eclipse.jdi.hcr

# Interface ReferenceType

public interface ReferenceType
Hot code replacement extension to `com.sun.jdi.ReferenceType`.

## Method Summary

Modifier and Type
Method
Description
`int`
`getClassFileVersion()`
An HCR-eligible class file may now be loaded and reloaded at some later point(s).
`boolean`
`isHCREligible()`
Returns whether this reference type is eligible for hot code replacement.
`boolean`
`isVersionKnown()`
Returns whether this reference type knows its class file version.

## Method Details

### getClassFileVersion

int getClassFileVersion()
An HCR-eligible class file may now be loaded and reloaded at some later point(s). Methods on the stack may come from any of several versions of the same HCR-eligible class. The debugger can query any class file related object (class, method, or field) for information about the version of the class file from which it came.

Classes loaded by a cooperating class loader are flagged as HCR-eligible for hot code replacement.

Class file versions are identified by the CRC-32 of the entire class file contents.

The VM typically computes and remembers the CRC when it digests a class file. Note this behavior is optional; VM need not retain any CRCs. A debugger can query any class for its class CRC and eligibility:

- The query can be made at at time.
- This is not directed to any specific thread.
- Threads may be running at the time; they are not stopped.
- Other JDI-level operations may be in progress.
- If a debugger knows only about a method or a field, it must first query its defining class first to find out what is the CRC for this method or field.

All information returned does not change over the lifetime of the reference type object (replacing the class results in a new reference type object). This info can therefore be cached client-side with impunity.

This simple mechanism allows the IDE to detect that an object does not belong to the current class file base (debugger computes CRC of current class file and queries VM and compares to its CRC). It also allows the debugger to quickly detect whether two objects come from the same class file (debugger queries VM and compares CRCs). By checking the HCR-eligibility bit, the debugger can determine whether the class could be hot replaced in principle.

Returns:
  the CRC-32 of the entire class file contents for this reference type.
See Also:
  - `VirtualMachine.classesHaveChanged(java.lang.String[])`

### isHCREligible

boolean isHCREligible()
Returns whether this reference type is eligible for hot code replacement.

Returns:
  whether this reference type is eligible for hot code replacement
See Also:
  - `getClassFileVersion()`

### isVersionKnown

boolean isVersionKnown()
Returns whether this reference type knows its class file version. Returns false for `ArrayType`s.

Returns:
  whether this reference type knows its class file version