Skip to content

Commit

Permalink
Clean-up of the Javadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
spoto committed Aug 31, 2023
1 parent 0ad332c commit f28fd27
Show file tree
Hide file tree
Showing 42 changed files with 294 additions and 108 deletions.
1 change: 1 addition & 0 deletions io-hotmoka-annotations/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<packaging>jar</packaging>
<name>io-hotmoka-annotations</name>
<version>${hotmoka.version}</version>
<description>This module defines some standard annotations.</description>

<parent>
<groupId>io.hotmoka</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,11 @@
@Target( { ElementType.FIELD, ElementType.METHOD })
@Retention(RetentionPolicy.SOURCE)
public @interface GuardedBy {
String value();

/**
* Yields the description of the lock that must be held to access the annotated element.
*
* @return the description of the lock
*/
String value();
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,11 @@
@Target( { ElementType.CONSTRUCTOR, ElementType.METHOD })
@Retention(RetentionPolicy.SOURCE)
public @interface OnThread {

/**
* Yields the description of the thread of executor service that executes the annotated element.
*
* @return the description of the thread of executor service
*/
String value();
}
3 changes: 3 additions & 0 deletions io-hotmoka-annotations/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
limitations under the License.
*/

/**
* This module defines some standard annotations.
*/
module io.hotmoka.annotations {
exports io.hotmoka.annotations;
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void write(FieldSignature field, MarshallingContext context) throws IOExc

context.writeByte(255);
field.definingClass.into(context);
context.writeUTF(field.name);
context.writeStringUnshared(field.name);
field.type.into(context);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public FieldSignature read(UnmarshallingContext context) throws IOException {
selector = 256 + selector;

if (selector == 255) {
var field = new FieldSignature((ClassType) StorageType.from(context), context.readUTF(), StorageType.from(context));
var field = new FieldSignature((ClassType) StorageType.from(context), context.readStringUnshared(), StorageType.from(context));
memory.put(memory.size(), field);
return field;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public int hashCode() {
@Override
public void intoWithoutSignature(MarshallingContext context) throws IOException {
context.writeByte(SELECTOR);
context.writeUTF(chainId);
context.writeStringUnshared(chainId);
super.intoWithoutSignature(context);
constructor.into(context);
}
Expand All @@ -187,7 +187,7 @@ public void intoWithoutSignature(MarshallingContext context) throws IOException
* @throws IOException if the request cannot be unmarshalled
*/
public static ConstructorCallTransactionRequest from(UnmarshallingContext context) throws IOException {
String chainId = context.readUTF();
String chainId = context.readStringUnshared();
StorageReference caller = StorageReference.from(context);
BigInteger gasLimit = context.readBigInteger();
BigInteger gasPrice = context.readBigInteger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public void into(MarshallingContext context) throws IOException {
classpath.into(context);
context.writeBigInteger(initialAmount);
context.writeBigInteger(redInitialAmount);
context.writeUTF(publicKey);
context.writeStringUnshared(publicKey);
}

/**
Expand All @@ -136,7 +136,7 @@ public static GameteCreationTransactionRequest from(UnmarshallingContext context
TransactionReference classpath = TransactionReference.from(context);
BigInteger initialAmount = context.readBigInteger();
BigInteger redInitialAmount = context.readBigInteger();
String publicKey = context.readUTF();
String publicKey = context.readStringUnshared();

return new GameteCreationTransactionRequest(classpath, initialAmount, redInitialAmount, publicKey);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ else if (receiveBigInteger)
else
context.writeByte(SELECTOR);

context.writeUTF(chainId);
context.writeStringUnshared(chainId);

if (receiveInt || receiveLong || receiveBigInteger) {
caller.intoWithoutSelector(context);
Expand Down Expand Up @@ -220,7 +220,7 @@ else if (receiveLong)
*/
public static InstanceMethodCallTransactionRequest from(UnmarshallingContext context, byte selector) throws IOException {
if (selector == SELECTOR) {
String chainId = context.readUTF();
String chainId = context.readStringUnshared();
StorageReference caller = StorageReference.from(context);
BigInteger gasLimit = context.readBigInteger();
BigInteger gasPrice = context.readBigInteger();
Expand All @@ -234,7 +234,7 @@ public static InstanceMethodCallTransactionRequest from(UnmarshallingContext con
return new InstanceMethodCallTransactionRequest(signature, caller, nonce, chainId, gasLimit, gasPrice, classpath, method, receiver, actuals);
}
else if (selector == SELECTOR_TRANSFER_INT || selector == SELECTOR_TRANSFER_LONG || selector == SELECTOR_TRANSFER_BIG_INTEGER) {
String chainId = context.readUTF();
String chainId = context.readStringUnshared();
StorageReference caller = StorageReference.from(context);
BigInteger gasLimit = context.readBigInteger();
BigInteger gasPrice = context.readBigInteger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public int hashCode() {
@Override
public void intoWithoutSignature(MarshallingContext context) throws IOException {
context.writeByte(SELECTOR);
context.writeUTF(chainId);
context.writeStringUnshared(chainId);
super.intoWithoutSignature(context);
context.writeCompactInt(jar.length);
context.write(jar);
Expand All @@ -225,7 +225,7 @@ public void intoWithoutSignature(MarshallingContext context) throws IOException
* @throws IOException if the request could noy be unmarshalled
*/
public static JarStoreTransactionRequest from(UnmarshallingContext context) throws IOException {
String chainId = context.readUTF();
String chainId = context.readStringUnshared();
StorageReference caller = StorageReference.from(context);
BigInteger gasLimit = context.readBigInteger();
BigInteger gasPrice = context.readBigInteger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public final void into(MarshallingContext context) throws IOException {
@Override
public void intoWithoutSignature(MarshallingContext context) throws IOException {
context.writeByte(SELECTOR);
context.writeUTF(chainId);
context.writeStringUnshared(chainId);
super.intoWithoutSignature(context);
}

Expand Down Expand Up @@ -176,7 +176,7 @@ public String getChainId() {
* @throws IOException if the request could not be unmarshalled
*/
public static StaticMethodCallTransactionRequest from(UnmarshallingContext context) throws IOException {
String chainId = context.readUTF();
String chainId = context.readStringUnshared();
StorageReference caller = StorageReference.from(context);
BigInteger gasLimit = context.readBigInteger();
BigInteger gasPrice = context.readBigInteger();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public static TransactionRequest<?> from(UnmarshallingContext context) throws IO
// this case deals with requests that only exist in a specific type of node;
// hence their fully-qualified name must be available after the expansion selector

String className = context.readUTF();
String className = context.readStringUnshared();
Class<?> clazz;

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ public void into(MarshallingContext context) throws IOException {
context.writeByte(SELECTOR);
super.into(context);
intoArrayWithoutSelector(events, context);
context.writeUTF(classNameOfCause);
context.writeUTF(messageOfCause);
context.writeUTF(where);
context.writeStringUnshared(classNameOfCause);
context.writeStringUnshared(messageOfCause);
context.writeStringUnshared(where);
}

/**
Expand All @@ -140,9 +140,9 @@ public static ConstructorCallTransactionExceptionResponse from(UnmarshallingCont
BigInteger gasConsumedForRAM = context.readBigInteger();
BigInteger gasConsumedForStorage = context.readBigInteger();
Stream<StorageReference> events = Stream.of(context.readArray(StorageReference::from, StorageReference[]::new));
String classNameOfCause = context.readUTF();
String messageOfCause = context.readUTF();
String where = context.readUTF();
String classNameOfCause = context.readStringUnshared();
String messageOfCause = context.readStringUnshared();
String where = context.readStringUnshared();
return new ConstructorCallTransactionExceptionResponse(classNameOfCause, messageOfCause, where, updates, events, gasConsumedForCPU, gasConsumedForRAM, gasConsumedForStorage);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ public void into(MarshallingContext context) throws IOException {
context.writeByte(SELECTOR);
super.into(context);
context.writeBigInteger(gasConsumedForPenalty);
context.writeUTF(classNameOfCause);
context.writeUTF(messageOfCause);
context.writeUTF(where);
context.writeStringUnshared(classNameOfCause);
context.writeStringUnshared(messageOfCause);
context.writeStringUnshared(where);
}

/**
Expand All @@ -150,9 +150,9 @@ public static ConstructorCallTransactionFailedResponse from(UnmarshallingContext
BigInteger gasConsumedForRAM = context.readBigInteger();
BigInteger gasConsumedForStorage = context.readBigInteger();
BigInteger gasConsumedForPenalty = context.readBigInteger();
String classNameOfCause = context.readUTF();
String messageOfCause = context.readUTF();
String where = context.readUTF();
String classNameOfCause = context.readStringUnshared();
String messageOfCause = context.readStringUnshared();
String where = context.readStringUnshared();
return new ConstructorCallTransactionFailedResponse(classNameOfCause, messageOfCause, where, updates, gasConsumedForCPU, gasConsumedForRAM, gasConsumedForStorage, gasConsumedForPenalty);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ public void into(MarshallingContext context) throws IOException {
context.writeByte(SELECTOR);
super.into(context);
context.writeBigInteger(gasConsumedForPenalty);
context.writeUTF(classNameOfCause);
context.writeUTF(messageOfCause);
context.writeStringUnshared(classNameOfCause);
context.writeStringUnshared(messageOfCause);
}

/**
Expand All @@ -138,8 +138,8 @@ public static JarStoreTransactionFailedResponse from(UnmarshallingContext contex
BigInteger gasConsumedForRAM = context.readBigInteger();
BigInteger gasConsumedForStorage = context.readBigInteger();
BigInteger gasConsumedForPenalty = context.readBigInteger();
String classNameOfCause = context.readUTF();
String messageOfCause = context.readUTF();
String classNameOfCause = context.readStringUnshared();
String messageOfCause = context.readStringUnshared();
return new JarStoreTransactionFailedResponse(classNameOfCause, messageOfCause, updates, gasConsumedForCPU, gasConsumedForRAM, gasConsumedForStorage, gasConsumedForPenalty);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ public void into(MarshallingContext context) throws IOException {
super.into(context);
context.writeBoolean(selfCharged);
intoArrayWithoutSelector(events, context);
context.writeUTF(classNameOfCause);
context.writeUTF(messageOfCause);
context.writeUTF(where);
context.writeStringUnshared(classNameOfCause);
context.writeStringUnshared(messageOfCause);
context.writeStringUnshared(where);
}

/**
Expand All @@ -145,9 +145,9 @@ public static MethodCallTransactionExceptionResponse from(UnmarshallingContext c
BigInteger gasConsumedForStorage = context.readBigInteger();
boolean selfCharged = context.readBoolean();
Stream<StorageReference> events = Stream.of(context.readArray(StorageReference::from, StorageReference[]::new));
String classNameOfCause = context.readUTF();
String messageOfCause = context.readUTF();
String where = context.readUTF();
String classNameOfCause = context.readStringUnshared();
String messageOfCause = context.readStringUnshared();
String where = context.readStringUnshared();
return new MethodCallTransactionExceptionResponse(classNameOfCause, messageOfCause, where, selfCharged, updates, events, gasConsumedForCPU, gasConsumedForRAM, gasConsumedForStorage);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ public void into(MarshallingContext context) throws IOException {
super.into(context);
context.writeBigInteger(gasConsumedForPenalty);
context.writeBoolean(selfCharged);
context.writeUTF(classNameOfCause);
context.writeUTF(messageOfCause);
context.writeUTF(where);
context.writeStringUnshared(classNameOfCause);
context.writeStringUnshared(messageOfCause);
context.writeStringUnshared(where);
}

/**
Expand All @@ -153,9 +153,9 @@ public static MethodCallTransactionFailedResponse from(UnmarshallingContext cont
BigInteger gasConsumedForStorage = context.readBigInteger();
BigInteger gasConsumedForPenalty = context.readBigInteger();
boolean selfCharged = context.readBoolean();
String classNameOfCause = context.readUTF();
String messageOfCause = context.readUTF();
String where = context.readUTF();
String classNameOfCause = context.readStringUnshared();
String messageOfCause = context.readStringUnshared();
String where = context.readStringUnshared();

return new MethodCallTransactionFailedResponse(classNameOfCause, messageOfCause, where, selfCharged, updates, gasConsumedForCPU, gasConsumedForRAM, gasConsumedForStorage, gasConsumedForPenalty);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static TransactionResponse from(UnmarshallingContext context) throws IOEx
// this case deals with responses that only exist in a specific type of node;
// hence their fully-qualified name must be available after the expansion selector

String className = context.readUTF();
String className = context.readStringUnshared();
Class<?> clazz;

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@ else if (selector == VoidMethodSignature.SELECTOR_REWARD)

switch (selector) {
case ConstructorSignature.SELECTOR: return new ConstructorSignature(definingClass, formals);
case VoidMethodSignature.SELECTOR: return new VoidMethodSignature(definingClass, context.readUTF(), formals);
case NonVoidMethodSignature.SELECTOR: return new NonVoidMethodSignature(definingClass, context.readUTF(), StorageType.from(context), formals);
case VoidMethodSignature.SELECTOR: return new VoidMethodSignature(definingClass, context.readStringUnshared(), formals);
case NonVoidMethodSignature.SELECTOR: return new NonVoidMethodSignature(definingClass, context.readStringUnshared(), StorageType.from(context), formals);
default: throw new IOException("unexpected code signature selector: " + selector);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ public int hashCode() {
@Override
public void into(MarshallingContext context) throws IOException {
super.into(context);
context.writeUTF(methodName);
context.writeStringUnshared(methodName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ public static Update from(UnmarshallingContext context) throws IOException {
case UpdateOfByte.SELECTOR: return new UpdateOfByte(StorageReference.from(context), FieldSignature.from(context), context.readByte());
case UpdateOfChar.SELECTOR: return new UpdateOfChar(StorageReference.from(context), FieldSignature.from(context), context.readChar());
case UpdateOfDouble.SELECTOR: return new UpdateOfDouble(StorageReference.from(context), FieldSignature.from(context), context.readDouble());
case UpdateOfEnumEager.SELECTOR: return new UpdateOfEnumEager(StorageReference.from(context), FieldSignature.from(context), context.readUTF(), context.readUTF());
case UpdateOfEnumLazy.SELECTOR: return new UpdateOfEnumLazy(StorageReference.from(context), FieldSignature.from(context), context.readUTF(), context.readUTF());
case UpdateOfEnumEager.SELECTOR: return new UpdateOfEnumEager(StorageReference.from(context), FieldSignature.from(context), context.readStringUnshared(), context.readStringUnshared());
case UpdateOfEnumLazy.SELECTOR: return new UpdateOfEnumLazy(StorageReference.from(context), FieldSignature.from(context), context.readStringUnshared(), context.readStringUnshared());
case UpdateOfFloat.SELECTOR: return new UpdateOfFloat(StorageReference.from(context), FieldSignature.from(context), context.readFloat());
case UpdateOfInt.SELECTOR: return new UpdateOfInt(StorageReference.from(context), FieldSignature.from(context), context.readInt());
case UpdateOfInt.SELECTOR_SMALL: return new UpdateOfInt(StorageReference.from(context), FieldSignature.from(context), context.readShort());
Expand All @@ -153,8 +153,8 @@ public static Update from(UnmarshallingContext context) throws IOException {
case UpdateOfStorage.SELECTOR_STORAGE_TREE_INTMAP_NODE_RIGHT: return new UpdateOfStorage(StorageReference.from(context), FieldSignature.STORAGE_TREE_INTMAP_NODE_RIGHT_FIELD, StorageReference.from(context));
case UpdateOfStorage.SELECTOR_STORAGE_TREE_MAP_ROOT: return new UpdateOfStorage(StorageReference.from(context), FieldSignature.STORAGE_TREE_MAP_ROOT_FIELD, StorageReference.from(context));
case UpdateOfStorage.SELECTOR_EVENT_CREATOR: return new UpdateOfStorage(StorageReference.from(context), FieldSignature.EVENT_CREATOR_FIELD, StorageReference.from(context));
case UpdateOfString.SELECTOR_PUBLIC_KEY: return new UpdateOfString(StorageReference.from(context), FieldSignature.EOA_PUBLIC_KEY_FIELD, context.readUTF());
case UpdateOfString.SELECTOR: return new UpdateOfString(StorageReference.from(context), FieldSignature.from(context), context.readUTF());
case UpdateOfString.SELECTOR_PUBLIC_KEY: return new UpdateOfString(StorageReference.from(context), FieldSignature.EOA_PUBLIC_KEY_FIELD, context.readStringUnshared());
case UpdateOfString.SELECTOR: return new UpdateOfString(StorageReference.from(context), FieldSignature.from(context), context.readStringUnshared());
case UpdateToNullEager.SELECTOR: return new UpdateToNullEager(StorageReference.from(context), FieldSignature.from(context));
case UpdateToNullLazy.SELECTOR: return new UpdateToNullLazy(StorageReference.from(context), FieldSignature.from(context));
default: throw new IOException("unexpected update selector: " + selector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public boolean isEager() {
public void into(MarshallingContext context) throws IOException {
context.writeByte(SELECTOR);
super.into(context);
context.writeUTF(enumClassName);
context.writeUTF(name);
context.writeStringUnshared(enumClassName);
context.writeStringUnshared(name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public boolean isEager() {
public void into(MarshallingContext context) throws IOException {
context.writeByte(SELECTOR);
super.into(context);
context.writeUTF(enumClassName);
context.writeUTF(name);
context.writeStringUnshared(enumClassName);
context.writeStringUnshared(name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ public void into(MarshallingContext context) throws IOException {
super.into(context);
}

context.writeUTF(value);
context.writeStringUnshared(value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public int compareTo(StorageValue other) {
@Override
public void into(MarshallingContext context) throws IOException {
context.writeByte(SELECTOR);
context.writeUTF(enumClassName);
context.writeUTF(name);
context.writeStringUnshared(enumClassName);
context.writeStringUnshared(name);
}
}
Loading

0 comments on commit f28fd27

Please sign in to comment.