Skip to content

Commit bb64d66

Browse files
committed
Reviewer comments
1 parent 3e248ce commit bb64d66

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/reflect/serialize/SerializationSupport.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ private StubForAbstractClass() {
108108
}
109109

110110
private DynamicHub stubConstructorClass;
111+
@Platforms(Platform.HOSTED_ONLY.class) //
111112
private DynamicHub serializedLambdaClass;
112113

113114
public record HostedSerializationLookupKey(DynamicHubKey declaringClassId, DynamicHubKey targetConstructorClassId) {
@@ -133,30 +134,33 @@ public SerializationSupport() {
133134
constructorAccessors = null;
134135
}
135136

137+
@Platforms(Platform.HOSTED_ONLY.class)
136138
public void setStubConstructor(DynamicHub stubConstructorClass) {
137139
VMError.guarantee(this.stubConstructorClass == null, "Cannot set stubConstructor again");
138140
this.stubConstructorClass = stubConstructorClass;
139141
}
140142

143+
@Platforms(Platform.HOSTED_ONLY.class)
141144
public void setSerializedLambdaClass(DynamicHub serializedLambdaClass) {
142145
VMError.guarantee(this.serializedLambdaClass == null, "Cannot set serializedLambdaClass again");
143146
this.serializedLambdaClass = serializedLambdaClass;
144147
}
145148

149+
@Platforms(Platform.HOSTED_ONLY.class)
146150
private DynamicHub getSerializedLambdaClass() {
147151
return serializedLambdaClass;
148152
}
149153

150154
@Platforms(Platform.HOSTED_ONLY.class)
151155
public void setObjectRescanner(Consumer<Object> objectRescanner) {
152-
VMError.guarantee(this.serializedLambdaClass == null, "Cannot set objectRescanner again");
156+
VMError.guarantee(this.objectRescanner == null, "Cannot set objectRescanner again");
153157
this.objectRescanner = objectRescanner;
154158
}
155159

156160
@Platforms(Platform.HOSTED_ONLY.class)
157161
public Object addConstructorAccessor(DynamicHub declaringClass, DynamicHub targetConstructorClass, Object constructorAccessor) {
158162
VMError.guarantee(constructorAccessor instanceof SubstrateConstructorAccessor, "Not a SubstrateConstructorAccessor: %s", constructorAccessor);
159-
VMError.guarantee(!BuildPhaseProvider.isHostedUniverseBuilt());
163+
VMError.guarantee(!BuildPhaseProvider.isHostedUniverseBuilt(), "Called too early");
160164
HostedSerializationLookupKey key = new HostedSerializationLookupKey(new DynamicHubKey(declaringClass), new DynamicHubKey(targetConstructorClass));
161165
objectRescanner.accept(constructorAccessor);
162166
synchronized (hostedConstructorAccessors) {
@@ -236,6 +240,8 @@ public void registerSerializationTargetClass(AccessCondition cnd, DynamicHub hub
236240
}
237241

238242
public void replaceHubKeyWithTypeID() {
243+
VMError.guarantee(classes == null && hostedClasses != null, "The maps should only be replaced once");
244+
VMError.guarantee(constructorAccessors == null && hostedConstructorAccessors != null, "The maps should only be replaced once");
239245
classes = EconomicMap.create();
240246
replaceHubKeyWithTypeID(hostedClasses, classes, SerializationSupport::getTypeID);
241247
hostedClasses = null;

0 commit comments

Comments
 (0)