Skip to content

Commit

Permalink
Fix warning in I-build
Browse files Browse the repository at this point in the history
It can be seen at
https://download.eclipse.org/eclipse/downloads/drops4/I20230103-1800/compilelogs/plugins/org.eclipse.e4.tools.compatibility.migration.tests_1.0.0.v20221220-0825/@dot.html#OTHER_WARNINGS
:
1. WARNING in /src/org/eclipse/e4/tools/compatibility/migration/tests/E4MigrationToolTest.java
 (at line 90)
MElementContainer<MPerspectiveStack> windowContainer =
(MElementContainer<MPerspectiveStack>)mWindowElement;
Type safety: Unchecked cast from MWindowElement to
MElementContainer<MPerspectiveStack>

As it's test code it's fine to cast thus suppress warning.
Some other minor code improvements done too.
  • Loading branch information
akurtakov committed Jan 4, 2023
1 parent fb53ad7 commit 9072e8b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.annotationPath.allLocations=disabled
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
org.eclipse.jdt.core.builder.invalidClasspath=abort
Expand Down Expand Up @@ -27,6 +28,7 @@ org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
Expand Down Expand Up @@ -102,12 +104,13 @@ org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed=info
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
Expand All @@ -118,6 +121,7 @@ org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2022 EclipseSource GmbH and others.
* Copyright (c) 2022, 2023 EclipseSource GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -21,6 +21,7 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Paths;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
Expand Down Expand Up @@ -65,7 +66,7 @@ void testConvert() throws FileNotFoundException, IOException, WorkbenchException
IMemento memento;
try (FileInputStream input = new FileInputStream(
Paths.get("resources/perspective_3x.xml").toAbsolutePath().toString())) {
BufferedReader reader = new BufferedReader(new InputStreamReader(input, "utf-8")); //$NON-NLS-1$
BufferedReader reader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8));
memento = XMLMemento.createReadRoot(reader);
}

Expand All @@ -87,6 +88,7 @@ public void postWindowOpen(IWorkbenchWindowConfigurer configurer) {
assertEquals(1, mApplication.getChildren().size());

MWindowElement mWindowElement = mApplication.getChildren().get(0).getChildren().get(0);
@SuppressWarnings("unchecked")
MElementContainer<MPerspectiveStack> windowContainer = (MElementContainer<MPerspectiveStack>)mWindowElement;
assertEquals(3, windowContainer.getChildren().get(0).getChildren().size());
MPerspective resourceExportPerspective = windowContainer.getChildren().get(0).getChildren().get(0);
Expand All @@ -107,7 +109,6 @@ public void postWindowOpen(IWorkbenchWindowConfigurer configurer) {
E4MigrationTool.convert(Paths.get("resources/perspective_3x.xml").toFile(),
Paths.get("resources/e4_test.xml").toFile());
} catch (WorkbenchException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
future.complete(false);
PlatformUI.getWorkbench().close();
Expand Down

0 comments on commit 9072e8b

Please sign in to comment.