Skip to content

Commit

Permalink
Suppress warnings for fields hiding other fields
Browse files Browse the repository at this point in the history
There are several fields that hide fields of superclasses because of
having the same name and produce according warnings. In some cases this
is intended or necessary, so the warnings should be suppressed. These
cases comprise:
* Class-specific IDs and default objects (like EMPTY)
* Fields hiding superclass fields that should not be accessed

This change adds the according suppressions.
  • Loading branch information
HeikoKlare committed Dec 21, 2023
1 parent 771d0b4 commit f897258
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public void run() {
@Inject
Logger logger;

@SuppressWarnings("hiding")
@Inject
private IEclipseContext context;

Expand All @@ -129,6 +130,7 @@ public void run() {

private ThemeDefinitionChangedHandler themeDefinitionChanged;

@SuppressWarnings("hiding")
@Inject
private EModelService modelService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class TreeSelection extends StructuredSelection implements ITreeSelection
* The canonical empty selection. This selection should be used instead of
* <code>null</code>.
*/
@SuppressWarnings("hiding")
public static final TreeSelection EMPTY = new TreeSelection();

private static final TreePath[] EMPTY_TREE_PATHS= new TreePath[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class CloseUnrelatedProjectsAction extends CloseResourceAction {
/**
* The id of this action.
*/
@SuppressWarnings("hiding")
public static final String ID = PlatformUI.PLUGIN_ID + ".CloseUnrelatedProjectsAction"; //$NON-NLS-1$

private List<IResource> projectsToClose = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class MoveProjectAction extends CopyProjectAction {
/**
* The id of this action.
*/
@SuppressWarnings("hiding")
public static final String ID = PlatformUI.PLUGIN_ID + ".MoveProjectAction";//$NON-NLS-1$

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class MoveResourceAction extends CopyResourceAction {
/**
* The id of this action.
*/
@SuppressWarnings("hiding")
public static final String ID = PlatformUI.PLUGIN_ID
+ ".MoveResourceAction"; //$NON-NLS-1$

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class OpenFileAction extends OpenSystemEditorAction {
/**
* The id of this action.
*/
@SuppressWarnings("hiding")
public static final String ID = PlatformUI.PLUGIN_ID + ".OpenFileAction";//$NON-NLS-1$

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/
public class PerspectiveWithMultiViewPlaceholdersInFolder extends PerspectiveWithMultiViewPlaceholdersInPlaceholderFolder {

@SuppressWarnings("hiding")
public static String PERSP_ID = "org.eclipse.ui.tests.PerspectiveWithMultiViewPlaceholdersInFolder"; //$NON-NLS-1$

public PerspectiveWithMultiViewPlaceholdersInFolder() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
public class SaveableMockViewPart extends MockViewPart implements
ISaveablePart, ISaveablesSource {

@SuppressWarnings("hiding")
public static String ID = "org.eclipse.ui.tests.api.SaveableMockViewPart";

private boolean isDirty = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
public class UserSaveableMockViewPart extends MockViewPart implements
ISaveablePart2 {

@SuppressWarnings("hiding")
public static String ID = "org.eclipse.ui.tests.api.UserSaveableMockViewPart";

private boolean isDirty = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class UserSaveableSharedViewPart extends MockViewPart implements
/**
* The shared ID.
*/
@SuppressWarnings("hiding")
public static String ID = "org.eclipse.ui.tests.api.UserSaveableSharedViewPart";

public static class SharedModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
import org.eclipse.core.resources.IResource;

public class TestResourceDecoratorContributor extends TestAdaptableDecoratorContributor {
@SuppressWarnings("hiding")
public static final String SUFFIX = "IResource.1";
@SuppressWarnings("hiding")
public static final String ID = "org.eclipse.ui.tests.decorators.resourceDescorator";
public TestResourceDecoratorContributor() {
setExpectedElementType(IResource.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

public class TestResourceMappingDecoratorContributor extends
TestAdaptableDecoratorContributor {
@SuppressWarnings("hiding")
public static final String SUFFIX = "ResourceMapping.1";
@SuppressWarnings("hiding")
public static final String ID = "org.eclipse.ui.tests.decorators.resourceMappingDescorator";
public TestResourceMappingDecoratorContributor() {
setExpectedElementType(ResourceMapping.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
* Decorator used to test an unadaptaed contribution
*/
public class TestUnadaptableDecoratorContributor extends TestAdaptableDecoratorContributor {
@SuppressWarnings("hiding")
public static final String SUFFIX = "ICommon.2";
@SuppressWarnings("hiding")
public static final String ID = "org.eclipse.ui.tests.decorators.generalAdaptabilityOff";
public TestUnadaptableDecoratorContributor() {
setSuffix(SUFFIX);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/
public class TestNewPropertySheetHandler extends NewPropertySheetHandler {

@SuppressWarnings("hiding")
public static final String ID = NewPropertySheetHandler.ID + "Test";

@Override
Expand Down

0 comments on commit f897258

Please sign in to comment.