Skip to content

Commit 29545c2

Browse files
committed
Fix findbugs warnings
1 parent 741b928 commit 29545c2

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

org.metaborg.spoofax.shell.core/src/main/java/org/metaborg/spoofax/shell/core/ClassPathInterpreterLoader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public PolyglotEngine loadInterpreterForLanguage(ILanguageImpl langImpl)
4545
.config(mimeType, DynSemLanguage.TERM_REGISTRY, termRegistry).build();
4646
try {
4747
InputStreamReader specTermReader =
48-
new InputStreamReader(entryPoint.getSpecificationTerm());
48+
new InputStreamReader(entryPoint.getSpecificationTerm(), "UTF-8");
4949
builtEngine.eval(Source.fromReader(specTermReader, "Evaluate to interpreter.")
5050
.withMimeType(mimeType));
5151
} catch (IOException e) {

org.metaborg.spoofax.shell.core/src/test/java/org/metaborg/spoofax/shell/core/ClassPathInterpreterLoaderTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,12 @@ public class ClassPathInterpreterLoaderTest {
5959
private static final String NO_EXCEPTION = "No exception should be thrown";
6060
protected static final String SPEC_TERM_CONSTANT = "specification term";
6161
protected ClassPathInterpreterLoader cpInterpLoader = new ClassPathInterpreterLoader();
62-
protected static RuleRoot mockRuleRoot;
62+
protected static final RuleRoot MOCK_RULE_ROOT = Mockito.mock(RuleRoot.class);
6363
protected ILanguageImpl mockLangImpl;
64+
@SuppressWarnings("unused")
65+
private static final TestCPLoaderLanguage LANG = TestCPLoaderLanguage.INSTANCE;
6466

65-
protected static boolean reachedLanguageParse = false;
67+
private static boolean reachedLanguageParse = false;
6668
private Iterable<FileObject> langImplLocations;
6769
private String expectedExceptionMessage;
6870
private Class<?> expectedExceptionCauseClass;
@@ -254,7 +256,7 @@ public void testLoadInterpreterForLanguage() throws Exception {
254256
engine.findGlobalSymbol(RuleRegistry.makeKey("testrule", "TestCtor", 0));
255257
DynSemRule testRule = testRuleValue.as(DynSemRule.class);
256258

257-
assertEquals(testRule.getRuleTarget(), mockRuleRoot);
259+
assertEquals(testRule.getRuleTarget(), MOCK_RULE_ROOT);
258260

259261
// Assert that the parse method of the test language class was reached.
260262
assertTrue(reachedLanguageParse);
@@ -297,7 +299,7 @@ private static ITermRegistry mockTermRegistry() {
297299

298300
private static RuleRegistry mockRuleRegistry() {
299301
RuleRegistry mock = Mockito.mock(RuleRegistry.class);
300-
Mockito.when(mock.lookupRule("testrule", "TestCtor", 0)).thenReturn(mockRuleRoot);
302+
Mockito.when(mock.lookupRule("testrule", "TestCtor", 0)).thenReturn(MOCK_RULE_ROOT);
301303
return mock;
302304
}
303305

0 commit comments

Comments
 (0)