Skip to content

Commit eff0c05

Browse files
committed
merge: #4148 again?
2 parents fa04a55 + 7890da9 commit eff0c05

File tree

4 files changed

+7
-78
lines changed

4 files changed

+7
-78
lines changed

engine-tests/src/test/java/org/terasology/persistence/typeHandling/reflection/ModuleEnvironmentSandboxTest.java

Lines changed: 0 additions & 37 deletions
This file was deleted.

engine/src/main/java/org/terasology/persistence/typeHandling/reflection/ModuleEnvironmentSandbox.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,6 @@ private boolean doesSubclassMatch(Class<?> subclass, String subTypeIdentifier) {
8989
return Objects.equals(givenModuleName, providingModule) && subTypeName.toString().equals(subclass.getSimpleName());
9090
}
9191

92-
@Override
93-
public <T> String getSubTypeIdentifier(Class<? extends T> subType, Class<T> baseType) {
94-
return subType.getName();
95-
}
96-
9792
@Override
9893
public <T> boolean isValidTypeHandlerDeclaration(TypeInfo<T> type, TypeHandler<T> typeHandler) {
9994
Name moduleDeclaringHandler = getModuleProviding(typeHandler.getClass());

engine/src/main/java/org/terasology/persistence/typeHandling/reflection/ReflectionsSandbox.java

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
1-
/*
2-
* Copyright 2019 MovingBlocks
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
1+
// Copyright 2020 The Terasology Foundation
2+
// SPDX-License-Identifier: Apache-2.0
163
package org.terasology.persistence.typeHandling.reflection;
174

185
import org.reflections.Reflections;
@@ -43,11 +30,6 @@ public <T> Optional<Class<? extends T>> findSubTypeOf(String subTypeIdentifier,
4330
return Optional.empty();
4431
}
4532

46-
@Override
47-
public <T> String getSubTypeIdentifier(Class<? extends T> subType, Class<T> baseType) {
48-
return subType.getName();
49-
}
50-
5133
@Override
5234
public <T> boolean isValidTypeHandlerDeclaration(TypeInfo<T> type, TypeHandler<T> typeHandler) {
5335
return true;

engine/src/main/java/org/terasology/persistence/typeHandling/reflection/SerializationSandbox.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
1-
/*
2-
* Copyright 2019 MovingBlocks
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
1+
// Copyright 2020 The Terasology Foundation
2+
// SPDX-License-Identifier: Apache-2.0
163
package org.terasology.persistence.typeHandling.reflection;
174

185
import org.terasology.persistence.typeHandling.TypeHandler;
@@ -46,7 +33,9 @@ public interface SerializationSandbox {
4633
* @param <T> The base type whose subtype needs to be identified.
4734
* @return The unique identifier for {@code subType}.
4835
*/
49-
<T> String getSubTypeIdentifier(Class<? extends T> subType, Class<T> baseType);
36+
default <T> String getSubTypeIdentifier(Class<? extends T> subType, Class<T> baseType) {
37+
return subType.getName();
38+
}
5039

5140
/**
5241
* Checks whether the given {@link TypeHandler} should be allowed to handle instances of

0 commit comments

Comments
 (0)