Skip to content

Commit

Permalink
interfaces -> final classes
Browse files Browse the repository at this point in the history
  • Loading branch information
spoto committed Aug 29, 2023
1 parent 62676cf commit 7aa8564
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
/**
* Providers of marshalling contexts.
*/
public interface MarshallingContexts {
public final class MarshallingContexts {

private MarshallingContexts() {}

/**
* Yields a marshalling context that writes to the given output stream.
Expand All @@ -34,7 +36,7 @@ public interface MarshallingContexts {
* @return the marshalling context
* @throws IOException if the context cannot be created
*/
static MarshallingContext of(OutputStream os) throws IOException {
public static MarshallingContext of(OutputStream os) throws IOException {
return new MarshallingContextImpl(os);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@
/**
* Providers of unmarshalling contexts.
*/
public interface UnmarshallingContexts {
public final class UnmarshallingContexts {

private UnmarshallingContexts() {}

/**
* Creates an unmarshalling context.
*
* @param is the input stream of the context
* @throws IOException if the context cannot be created
*/
static UnmarshallingContext of(InputStream is) throws IOException {
public static UnmarshallingContext of(InputStream is) throws IOException {
return new UnmarshallingContextImpl(is);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -616,10 +616,9 @@ protected ConsensusConfigBuilderImpl(Toml toml) throws NoSuchAlgorithmException
if (maxErrorLength != null)
setMaxErrorLength(maxErrorLength);

// TODO: remove all type conversions below
var maxDependencies = toml.getLong("max_dependencies");
if (maxDependencies != null)
setMaxDependencies((int) (long) maxDependencies);
setMaxDependencies(maxDependencies);

var maxCumulativeSizeOfDependencies = toml.getLong("max_cumulative_size_of_dependencies");
if (maxCumulativeSizeOfDependencies != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
/**
* A provider of class loaders used to access the definition of the classes of a Takamaka program.
*/
public interface TakamakaClassLoaders {
public final class TakamakaClassLoaders {

private TakamakaClassLoaders() {}

/**
* Yields a class loader with the given jars, given as byte arrays.
Expand All @@ -35,7 +37,7 @@ public interface TakamakaClassLoaders {
* @return the class loader
* @throws ClassNotFoundException if some class of the Takamaka runtime cannot be loaded
*/
static TakamakaClassLoader of(Stream<byte[]> jars, long verificationVersion) throws ClassNotFoundException {
public static TakamakaClassLoader of(Stream<byte[]> jars, long verificationVersion) throws ClassNotFoundException {
return new TakamakaClassLoaderImpl(jars, verificationVersion);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
/**
* A provider of jars that have undergone static verification, before being installed into blockchain.
*/
public interface VerifiedJars {
public final class VerifiedJars {

private VerifiedJars() {}

/**
* Creates a verified jar from the given file. This verification
Expand All @@ -43,7 +45,7 @@ public interface VerifiedJars {
* @throws ClassNotFoundException if some class of the Takamaka program cannot be loaded
* @throws UnsupportedVerificationVersionException if the verification version is not available
*/
static VerifiedJar of(byte[] jar, TakamakaClassLoader classLoader, boolean duringInitialization, boolean allowSelfCharged, boolean skipsVerification) throws IOException, ClassNotFoundException, UnsupportedVerificationVersionException {
public static VerifiedJar of(byte[] jar, TakamakaClassLoader classLoader, boolean duringInitialization, boolean allowSelfCharged, boolean skipsVerification) throws IOException, ClassNotFoundException, UnsupportedVerificationVersionException {
return new VerifiedJarImpl(jar, classLoader, duringInitialization, allowSelfCharged, skipsVerification);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
/**
* A provider of resolving class loaders.
*/
public interface ResolvingClassLoaders {
public final class ResolvingClassLoaders {

private ResolvingClassLoaders() {}

/**
* Yields a resolving class loader that loads classes from the given jars, provided as byte arrays.
Expand All @@ -34,7 +36,7 @@ public interface ResolvingClassLoaders {
* set of white-listing annotations used by the class loader
* @return the class loader
*/
static ResolvingClassLoader of(Stream<byte[]> jars, long verificationVersion) {
public static ResolvingClassLoader of(Stream<byte[]> jars, long verificationVersion) {
return new ResolvingClassLoaderImpl(jars, verificationVersion);
}
}

0 comments on commit 7aa8564

Please sign in to comment.