File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
src/test/java/org/eclipse/yasson/internal/model Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
3+ *
4+ * This program and the accompanying materials are made available under the
5+ * terms of the Eclipse Public License v. 2.0 which is available at
6+ * http://www.eclipse.org/legal/epl-2.0,
7+ * or the Eclipse Distribution License v. 1.0 which is available at
8+ * http://www.eclipse.org/org/documents/edl-v10.php.
9+ *
10+ * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
11+ */
12+
13+ package org .eclipse .yasson .internal .model ;
14+
15+ import java .lang .invoke .MethodHandles ;
16+
17+ /**
18+ * Why is this class here?.
19+ *
20+ * This class is here to replace existing classes in test-runtime:
21+ * - src/main/java/org/eclipse/yasson/internal/model/ModulesUtil.java
22+ * - src/main/java9/org/eclipse/yasson/internal/model/ModulesUtil.java
23+ *
24+ * When tests are executed with maven-surefire-plugin the content of
25+ * 'classes' is in a different module-path than 'test-classes'.
26+ *
27+ * This causes the MethodHandles#publicLookup to fail. The reason is that
28+ * test classes to serialize/deserialize are coming from module 'test-classes'
29+ * and the module 'classes' has no access to it. The 'publicLookup' makes some
30+ * validations and because of this different modules, it fails.
31+ *
32+ * It should work if 'classes' and 'test-classes' are merged in one unique module.
33+ *
34+ */
35+ class ModulesUtil {
36+
37+ private ModulesUtil () {
38+ }
39+
40+ static MethodHandles .Lookup lookup (){
41+ return MethodHandles .lookup ();
42+ }
43+ }
You can’t perform that action at this time.
0 commit comments