You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2019/10/25 13:12:14 UTC
[isis] branch v2 updated: ISIS-2158: commons: cleaning up
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch v2
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/v2 by this push:
new 9de5ebc ISIS-2158: commons: cleaning up
9de5ebc is described below
commit 9de5ebcb435a44753a3b41ee0567bc8bbf799535
Author: Andi Huber <ah...@apache.org>
AuthorDate: Fri Oct 25 15:12:03 2019 +0200
ISIS-2158: commons: cleaning up
---
.../internal/assertions/IsisAssertException.java | 35 -------
.../isis/commons/internal/assertions/_Assert.java | 8 +-
.../isis/commons/internal/assertions/_Ensure.java | 107 ---------------------
.../commons/internal/assertions/package-info.java | 30 ------
.../commons/internal/encoding/package-info.java | 30 ------
.../environment/IsisSystemEnvironment.java | 7 +-
.../isis/commons/internal/ioc/IocContainer.java | 11 ---
.../internal/ioc/spring/IocContainerSpring.java | 14 ---
.../Ensure_GivenValueThatDoesMatchTest.java | 60 ------------
.../Ensure_GivenValueThatDoesNotMatchTest.java | 61 ------------
.../isis/metamodel/adapter/oid/Oid_Marshaller.java | 6 +-
.../confmenu/ConfigurationViewServiceDefault.java | 1 -
.../adaptermanager/ObjectAdapterContext.java | 6 +-
...ctAdapterContext_ObjectAdapterByIdProvider.java | 4 +-
14 files changed, 17 insertions(+), 363 deletions(-)
diff --git a/core/commons/src/main/java/org/apache/isis/commons/internal/assertions/IsisAssertException.java b/core/commons/src/main/java/org/apache/isis/commons/internal/assertions/IsisAssertException.java
deleted file mode 100644
index cf65648..0000000
--- a/core/commons/src/main/java/org/apache/isis/commons/internal/assertions/IsisAssertException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.commons.internal.assertions;
-
-import org.apache.isis.commons.exceptions.IsisException;
-
-public class IsisAssertException extends IsisException {
-
- private static final long serialVersionUID = 1L;
-
- public IsisAssertException() {
- super();
- }
-
- public IsisAssertException(final String s) {
- super(s);
- }
-}
diff --git a/core/commons/src/main/java/org/apache/isis/commons/internal/assertions/_Assert.java b/core/commons/src/main/java/org/apache/isis/commons/internal/assertions/_Assert.java
index 125ae58..3b17ed9 100644
--- a/core/commons/src/main/java/org/apache/isis/commons/internal/assertions/_Assert.java
+++ b/core/commons/src/main/java/org/apache/isis/commons/internal/assertions/_Assert.java
@@ -21,6 +21,8 @@ package org.apache.isis.commons.internal.assertions;
import java.util.Objects;
+import org.apache.isis.commons.internal.exceptions._Exceptions;
+
public final class _Assert {
public static void assertFalse(final String message, final boolean flag) {
@@ -45,19 +47,19 @@ public final class _Assert {
public static void assertTrue(final String message, final Object target, final boolean flag) {
if (!flag) {
- throw new IsisAssertException(message + (target == null ? "" : (": " + target)));
+ throw _Exceptions.unrecoverable(message + (target == null ? "" : (": " + target)));
}
}
public static void assertEquals(final String message, Object left, Object right) {
if (!Objects.equals(left, right)) {
- throw new IsisAssertException(message + String.format(": '%s' != '%s' ", ""+left, ""+right));
+ throw _Exceptions.unrecoverable(message + String.format(": '%s' != '%s' ", ""+left, ""+right));
}
}
public static void assertTypeIsInstanceOf(Class<?> type, Class<?> requiredType) {
if(!requiredType.isAssignableFrom(type)) {
- throw new IsisAssertException(String.format(
+ throw _Exceptions.unrecoverable(String.format(
"unexpected type: '%s' is not an instance of '%s' ", ""+type, ""+requiredType));
}
}
diff --git a/core/commons/src/main/java/org/apache/isis/commons/internal/assertions/_Ensure.java b/core/commons/src/main/java/org/apache/isis/commons/internal/assertions/_Ensure.java
deleted file mode 100644
index a249d18..0000000
--- a/core/commons/src/main/java/org/apache/isis/commons/internal/assertions/_Ensure.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.commons.internal.assertions;
-
-import java.util.function.Function;
-import java.util.function.Predicate;
-
-import static org.apache.isis.commons.internal.base._With.requires;
-
-
-/**
- * Utility for verifying arguments and so on.
- */
-public final class _Ensure {
-
- private _Ensure() {
- }
-
- /**
- * To ensure that the provided assertion is true
- *
- * @throws IllegalArgumentException
- */
- public static void ensure(final String expectation, final boolean expression) {
- if (!expression) {
- throw new IllegalArgumentException("illegal argument, expected: " + expectation);
- }
- }
-
- /**
- * To ensure that the provided argument is correct.
- *
- * @throws IllegalArgumentException
- * if predicate tests to false.
- * @deprecated might break build on OpenJDK-11 (or cross compilation builds in general)
- */
- @Deprecated
- public static <T> T ensureThatArg(
- final T arg,
- final Predicate<? super T> predicate,
- final Function<T, String> messageFunction) {
-
- requires(predicate, "predicate");
- if (!predicate.test(arg)) {
- requires(messageFunction, "messageFunction");
- throw new IllegalArgumentException(messageFunction.apply(arg));
- }
- return arg;
- }
-
-// public static <T> T ensureThatArg(final T arg, final Predicate<T> predicate, final Supplier<String> messageSupplier) {
-// requires(predicate, "predicate");
-// if (!predicate.test(arg)) {
-// requires(messageSupplier, "messageSupplier");
-// throw new IllegalArgumentException(messageSupplier.get());
-// }
-// return arg;
-// }
-
- /**
- * To ensure that the current state of this object (instance fields) is
- * correct.
- *
- * @throws IllegalStateException
- * if predicate tests to false.
- */
- public static <T> T ensureThatState(final T field, final Predicate<? super T> predicate, final String message) {
- requires(predicate, "predicate");
- if (!predicate.test(field)) {
- throw new IllegalStateException(message);
- }
- return field;
- }
-
- /**
- * To ensure that the current context (<tt>IsisContext</tt>) is correct.
- *
- * @throws IllegalThreadStateException
- * if predicate tests to false.
- */
- public static <T> T ensureThatContext(final T contextProperty, final Predicate<? super T> predicate, final String message) {
- requires(predicate, "predicate");
- if (!predicate.test(contextProperty)) {
- throw new IllegalThreadStateException(message);
- }
- return contextProperty;
- }
-
-
-}
diff --git a/core/commons/src/main/java/org/apache/isis/commons/internal/assertions/package-info.java b/core/commons/src/main/java/org/apache/isis/commons/internal/assertions/package-info.java
deleted file mode 100644
index 179321a..0000000
--- a/core/commons/src/main/java/org/apache/isis/commons/internal/assertions/package-info.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Provides an infrastructure for encoding {@link org.apache.isis.commons.internal.encoding.Encodable}
- * into an {@link org.apache.isis.commons.internal.encoding.DataOutputExtended output stream}
- * or from an {@link org.apache.isis.commons.internal.encoding.DataInputExtended input stream}.
- *
- * <p>
- * This is primarily for remoting (marshalling objects across the wire) but
- * is also used in various other places, including the creation of
- * mementos (to capture state at a point in time).
- */
-package org.apache.isis.commons.internal.assertions;
\ No newline at end of file
diff --git a/core/commons/src/main/java/org/apache/isis/commons/internal/encoding/package-info.java b/core/commons/src/main/java/org/apache/isis/commons/internal/encoding/package-info.java
deleted file mode 100644
index dc22eee..0000000
--- a/core/commons/src/main/java/org/apache/isis/commons/internal/encoding/package-info.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * The {@link org.apache.isis.commons.internal.assertions._Ensure} and {@link org.junit.Assert}
- * classes provide the ability to specify assertions about state,
- * throwing an exception ("fail early") if the assertion fails.
- *
- * <p>
- * The {@link org.apache.isis.commons.internal.assertions._Ensure} class
- * uses {@link org.hamcrest.Matcher Hamcrest matcher}s and is
- * more powerful so generally to be preferred.
- */
-package org.apache.isis.commons.internal.encoding;
\ No newline at end of file
diff --git a/core/commons/src/main/java/org/apache/isis/commons/internal/environment/IsisSystemEnvironment.java b/core/commons/src/main/java/org/apache/isis/commons/internal/environment/IsisSystemEnvironment.java
index 35491e4..2922bea 100644
--- a/core/commons/src/main/java/org/apache/isis/commons/internal/environment/IsisSystemEnvironment.java
+++ b/core/commons/src/main/java/org/apache/isis/commons/internal/environment/IsisSystemEnvironment.java
@@ -38,15 +38,16 @@ import lombok.val;
import lombok.extern.log4j.Log4j2;
/**
- * Represents configuration, that is available in an early phase of bootstrapping.
- * It is regarded immutable for an application's life-cycle.
+ * Represents configuration, that is required in an early bootstrapping phase.
+ * Regarded immutable during an application's life-cycle.
*
* @since 2.0
+ * @implNote acts as the framework's bootstrapping entry-point for Spring
*/
@Service @Singleton @Log4j2
public class IsisSystemEnvironment {
- public static final String VERSION = "2.0.0-M3";
+ public static final String VERSION = "2.0.0-M3"; // landed here, but could be anywhere else if reasonable
@Inject private ApplicationContext springContext;
diff --git a/core/commons/src/main/java/org/apache/isis/commons/internal/ioc/IocContainer.java b/core/commons/src/main/java/org/apache/isis/commons/internal/ioc/IocContainer.java
index 7fda149..15d88ee 100644
--- a/core/commons/src/main/java/org/apache/isis/commons/internal/ioc/IocContainer.java
+++ b/core/commons/src/main/java/org/apache/isis/commons/internal/ioc/IocContainer.java
@@ -19,7 +19,6 @@
package org.apache.isis.commons.internal.ioc;
import java.lang.annotation.Annotation;
-import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Optional;
import java.util.Set;
@@ -27,8 +26,6 @@ import java.util.stream.Stream;
import javax.annotation.Nullable;
-import org.springframework.core.env.ConfigurableEnvironment;
-
import org.apache.isis.commons.collections.Bin;
import org.apache.isis.commons.internal.exceptions._Exceptions;
@@ -39,14 +36,6 @@ import org.apache.isis.commons.internal.exceptions._Exceptions;
*/
public interface IocContainer {
- /**
- * Returns a key/value pair copy of Spring's environment
- * @see {@linkplain <a href="https://jira.spring.io/browse/SPR-10241">https://jira.spring.io/browse/SPR-10241</a>}
- * @param configurableEnvironment
- * @deprecated alternative solution {@linkplain <a href="https://stackoverflow.com/a/53950574/56880">stack-overflow</a>}
- */
- Map<String, String> copyEnvironmentToMap(ConfigurableEnvironment configurableEnvironment);
-
Stream<ManagedBeanAdapter> streamAllBeans();
<T> Bin<T> select(Class<T> requiredType);
diff --git a/core/commons/src/main/java/org/apache/isis/commons/internal/ioc/spring/IocContainerSpring.java b/core/commons/src/main/java/org/apache/isis/commons/internal/ioc/spring/IocContainerSpring.java
index f50aede..381aa67 100644
--- a/core/commons/src/main/java/org/apache/isis/commons/internal/ioc/spring/IocContainerSpring.java
+++ b/core/commons/src/main/java/org/apache/isis/commons/internal/ioc/spring/IocContainerSpring.java
@@ -19,9 +19,6 @@
package org.apache.isis.commons.internal.ioc.spring;
import java.lang.annotation.Annotation;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Stream;
@@ -30,12 +27,10 @@ import javax.annotation.Nullable;
import org.springframework.context.ApplicationContext;
import org.springframework.core.ResolvableType;
-import org.springframework.core.env.ConfigurableEnvironment;
import org.apache.isis.commons.collections.Bin;
import org.apache.isis.commons.internal.base._NullSafe;
import org.apache.isis.commons.internal.collections._Sets;
-import org.apache.isis.commons.internal.exceptions._Exceptions;
import org.apache.isis.commons.internal.ioc.IocContainer;
import org.apache.isis.commons.internal.ioc.ManagedBeanAdapter;
@@ -55,15 +50,6 @@ public class IocContainerSpring implements IocContainer {
@NonNull private final ApplicationContext springContext;
-
- @Override
- public Map<String, String> copyEnvironmentToMap(
- ConfigurableEnvironment configurableEnvironment) {
-
- // TODO Auto-generated method stub
- return _Spring.copySpringEnvironmentToMap(configurableEnvironment);
- }
-
@Override
public Stream<ManagedBeanAdapter> streamAllBeans() {
diff --git a/core/commons/src/test/java/org/apache/isis/commons/internal/assertions/Ensure_GivenValueThatDoesMatchTest.java b/core/commons/src/test/java/org/apache/isis/commons/internal/assertions/Ensure_GivenValueThatDoesMatchTest.java
deleted file mode 100644
index 4892ef2..0000000
--- a/core/commons/src/test/java/org/apache/isis/commons/internal/assertions/Ensure_GivenValueThatDoesMatchTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.commons.internal.assertions;
-
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.not;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.CoreMatchers.sameInstance;
-import static org.junit.Assert.assertThat;
-
-public class Ensure_GivenValueThatDoesMatchTest {
-
- @Test
- public void whenCallEnsureThatArgThenShouldReturnOriginalObject() {
- final String object = "foo";
- final String returnedObject = _Ensure.ensureThatArg(object, is(not(nullValue(String.class)))::matches, $->String.format("some message %s", $));
- assertThat(returnedObject, sameInstance(object));
- }
-
- @Test
- public void whenCallEnsureThatArgWithOverloadedShouldReturnOriginalObject() {
- final String object = "foo";
- final String returnedObject = _Ensure.ensureThatArg(object, is(not(nullValue(String.class)))::matches, $->"some message");
- assertThat(returnedObject, sameInstance(object));
- }
-
- @Test
- public void whenCallEnsureThatStateWithOverloadedShouldReturnOriginalObject() {
- final String object = "foo";
- final String returnedObject = _Ensure.ensureThatState(object, is(not(nullValue(String.class)))::matches, "some message");
- assertThat(returnedObject, sameInstance(object));
- }
-
- @Test
- public void whenCallEnsureThatContextWithOverloadedShouldReturnOriginalObject() {
- final String object = "foo";
- final String returnedObject = _Ensure.ensureThatContext(object, is(not(nullValue(String.class)))::matches, "some message");
- assertThat(returnedObject, sameInstance(object));
- }
-
-}
diff --git a/core/commons/src/test/java/org/apache/isis/commons/internal/assertions/Ensure_GivenValueThatDoesNotMatchTest.java b/core/commons/src/test/java/org/apache/isis/commons/internal/assertions/Ensure_GivenValueThatDoesNotMatchTest.java
deleted file mode 100644
index a95648f..0000000
--- a/core/commons/src/test/java/org/apache/isis/commons/internal/assertions/Ensure_GivenValueThatDoesNotMatchTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.commons.internal.assertions;
-
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-public class Ensure_GivenValueThatDoesNotMatchTest {
-
- @Test
- public void whenCallEnsureThatArgOverloadedShouldThrowIllegalArgumentExceptionUsingSuppliedMessage() {
- try {
- _Ensure.ensureThatArg("foo", is(nullValue())::matches, $->"my message");
- fail();
- } catch (final IllegalArgumentException ex) {
- assertThat(ex.getMessage(), is("my message"));
- }
- }
-
- @Test
- public void whenCallEnsureThatStateOverloadedShouldThrowIllegalStateExceptionUsingSuppliedMessage() {
- try {
- _Ensure.ensureThatState("foo", is(nullValue())::matches, "my message");
- fail();
- } catch (final IllegalStateException ex) {
- assertThat(ex.getMessage(), is("my message"));
- }
- }
-
- @Test
- public void whenCallEnsureThatContextOverloadedShouldThrowIllegalThreadStateExceptionUsingSuppliedMessage() {
- try {
- _Ensure.ensureThatContext("foo", is(nullValue())::matches, "my message");
- fail();
- } catch (final IllegalThreadStateException ex) {
- assertThat(ex.getMessage(), is("my message"));
- }
- }
-
-}
diff --git a/core/metamodel/src/main/java/org/apache/isis/metamodel/adapter/oid/Oid_Marshaller.java b/core/metamodel/src/main/java/org/apache/isis/metamodel/adapter/oid/Oid_Marshaller.java
index 894ec2f..dbd4587 100644
--- a/core/metamodel/src/main/java/org/apache/isis/metamodel/adapter/oid/Oid_Marshaller.java
+++ b/core/metamodel/src/main/java/org/apache/isis/metamodel/adapter/oid/Oid_Marshaller.java
@@ -25,7 +25,7 @@ import java.util.regex.Pattern;
import java.util.stream.Stream;
import org.apache.isis.applib.services.bookmark.Bookmark;
-import org.apache.isis.commons.internal.assertions._Ensure;
+import org.apache.isis.commons.internal.assertions._Assert;
import org.apache.isis.commons.internal.base._Casts;
import org.apache.isis.commons.internal.base._Strings;
import org.apache.isis.commons.internal.collections._Lists;
@@ -252,13 +252,13 @@ final class Oid_Marshaller implements Oid.Marshaller, Oid.Unmarshaller {
// -- marshal
@Override
public final String marshal(RootOid rootOid) {
- _Ensure.ensure("can not marshal values", !rootOid.isValue());
+ _Assert.assertFalse("can not marshal values", rootOid.isValue());
return marshalNoVersion(rootOid) + marshal(rootOid.getVersion());
}
@Override
public final String marshalNoVersion(RootOid rootOid) {
- _Ensure.ensure("can not marshal values", !rootOid.isValue());
+ _Assert.assertFalse("can not marshal values", rootOid.isValue());
final String transientIndicator = rootOid.isTransient()? TRANSIENT_INDICATOR : "";
final String viewModelIndicator = rootOid.isViewModel()? VIEWMODEL_INDICATOR : "";
return transientIndicator + viewModelIndicator + rootOid.getObjectSpecId() + SEPARATOR + rootOid.getIdentifier();
diff --git a/core/runtime-services/src/main/java/org/apache/isis/runtime/services/confmenu/ConfigurationViewServiceDefault.java b/core/runtime-services/src/main/java/org/apache/isis/runtime/services/confmenu/ConfigurationViewServiceDefault.java
index bbfa623..868da79 100644
--- a/core/runtime-services/src/main/java/org/apache/isis/runtime/services/confmenu/ConfigurationViewServiceDefault.java
+++ b/core/runtime-services/src/main/java/org/apache/isis/runtime/services/confmenu/ConfigurationViewServiceDefault.java
@@ -20,7 +20,6 @@ package org.apache.isis.runtime.services.confmenu;
import java.util.Map;
import java.util.Set;
-import java.util.TreeMap;
import java.util.TreeSet;
import javax.annotation.PostConstruct;
diff --git a/core/runtime/src/main/java/org/apache/isis/runtime/system/persistence/adaptermanager/ObjectAdapterContext.java b/core/runtime/src/main/java/org/apache/isis/runtime/system/persistence/adaptermanager/ObjectAdapterContext.java
index bf68552..8cdbe61 100644
--- a/core/runtime/src/main/java/org/apache/isis/runtime/system/persistence/adaptermanager/ObjectAdapterContext.java
+++ b/core/runtime/src/main/java/org/apache/isis/runtime/system/persistence/adaptermanager/ObjectAdapterContext.java
@@ -21,8 +21,8 @@ package org.apache.isis.runtime.system.persistence.adaptermanager;
import java.util.Objects;
import org.apache.isis.applib.services.inject.ServiceInjector;
-import org.apache.isis.commons.internal.assertions.IsisAssertException;
import org.apache.isis.commons.internal.assertions._Assert;
+import org.apache.isis.commons.internal.exceptions._Exceptions;
import org.apache.isis.metamodel.MetaModelContext;
import org.apache.isis.metamodel.adapter.ObjectAdapter;
import org.apache.isis.metamodel.adapter.ObjectAdapterByIdProvider;
@@ -278,12 +278,12 @@ final public class ObjectAdapterContext {
Objects.requireNonNull(persistentOid);
_Assert.assertFalse("expected to not be a parented collection", rootAdapter.isParentedCollection());
if(persistentOid.isTransient()) {
- throw new IsisAssertException("hintRootOid must be persistent");
+ throw _Exceptions.unrecoverable("hintRootOid must be persistent");
}
final ObjectSpecId hintRootOidObjectSpecId = persistentOid.getObjectSpecId();
final ObjectSpecId adapterObjectSpecId = rootAdapter.getSpecification().getSpecId();
if(!hintRootOidObjectSpecId.equals(adapterObjectSpecId)) {
- throw new IsisAssertException("hintRootOid's objectType must be same as that of adapter " +
+ throw _Exceptions.unrecoverable("hintRootOid's objectType must be same as that of adapter " +
"(was: '" + hintRootOidObjectSpecId + "'; adapter's is " + adapterObjectSpecId + "'");
}
}
diff --git a/core/runtime/src/main/java/org/apache/isis/runtime/system/persistence/adaptermanager/ObjectAdapterContext_ObjectAdapterByIdProvider.java b/core/runtime/src/main/java/org/apache/isis/runtime/system/persistence/adaptermanager/ObjectAdapterContext_ObjectAdapterByIdProvider.java
index 67a38d6..9685042 100644
--- a/core/runtime/src/main/java/org/apache/isis/runtime/system/persistence/adaptermanager/ObjectAdapterContext_ObjectAdapterByIdProvider.java
+++ b/core/runtime/src/main/java/org/apache/isis/runtime/system/persistence/adaptermanager/ObjectAdapterContext_ObjectAdapterByIdProvider.java
@@ -22,7 +22,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
-import org.apache.isis.commons.internal.assertions._Ensure;
+import org.apache.isis.commons.internal.assertions._Assert;
import org.apache.isis.commons.internal.collections._Lists;
import org.apache.isis.commons.internal.collections._Maps;
import org.apache.isis.metamodel.adapter.ObjectAdapter;
@@ -211,7 +211,7 @@ class ObjectAdapterContext_ObjectAdapterByIdProvider implements ObjectAdapterByI
pojo = objectAdapterContext.instantiateAndInjectServices(spec);
}
- _Ensure.ensure("Pojo most likely should not be an Oid", !(pojo instanceof Oid));
+ _Assert.assertFalse("Pojo most likely should not be an Oid", (pojo instanceof Oid));
return pojo;
}