-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make validator tests work also in OSGI and Maven/Tycho
- Loading branch information
1 parent
4fca018
commit a9e6e30
Showing
2 changed files
with
37 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...e/xtext/xbase/tests/validation/JvmGenericTypeValidatorTestLangInjectorProviderCustom.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 itemis AG (http://www.itemis.eu) and others. | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package org.eclipse.xtext.xbase.tests.validation; | ||
|
||
import org.eclipse.xtext.xbase.testlanguages.JvmGenericTypeValidatorTestLangRuntimeModule; | ||
import org.eclipse.xtext.xbase.testlanguages.tests.JvmGenericTypeValidatorTestLangInjectorProvider; | ||
|
||
/** | ||
* To let the validator/scoping/linking find the Java classes of "testdata" referred in some tests also in an OSGI and Maven/Tycho | ||
* environment. This is required because the original {@link JvmGenericTypeValidatorTestLangInjectorProvider} is not in this bundle. | ||
* | ||
* @author Lorenzo Bettini - Initial contribution and API | ||
*/ | ||
public class JvmGenericTypeValidatorTestLangInjectorProviderCustom extends JvmGenericTypeValidatorTestLangInjectorProvider { | ||
|
||
@Override | ||
protected JvmGenericTypeValidatorTestLangRuntimeModule createRuntimeModule() { | ||
// make it work also with Maven/Tycho and OSGI | ||
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=493672 | ||
return new JvmGenericTypeValidatorTestLangRuntimeModule() { | ||
@Override | ||
public ClassLoader bindClassLoaderToInstance() { | ||
return JvmGenericTypeValidatorTestLangInjectorProviderCustom.class.getClassLoader(); | ||
} | ||
}; | ||
} | ||
} |