diff --git a/org.eclipse.corrosion/src/org/eclipse/corrosion/sourcelookup/CargoProjectSourceContainer.java b/org.eclipse.corrosion/src/org/eclipse/corrosion/sourcelookup/CargoProjectSourceContainer.java index 65879bc..4663c7c 100644 --- a/org.eclipse.corrosion/src/org/eclipse/corrosion/sourcelookup/CargoProjectSourceContainer.java +++ b/org.eclipse.corrosion/src/org/eclipse/corrosion/sourcelookup/CargoProjectSourceContainer.java @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) 2020, 2021 Red Hat Inc. and others. + * Copyright (c) 2020, 2022 Red Hat Inc. and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -167,8 +167,7 @@ public String getName() { @Override public boolean equals(Object obj) { - if (obj instanceof CargoProjectSourceContainer) { - CargoProjectSourceContainer loc = (CargoProjectSourceContainer) obj; + if (obj instanceof CargoProjectSourceContainer loc) { return fProject == null ? loc.fProject == null : fProject.equals(loc.fProject); } return false; diff --git a/org.eclipse.corrosion/src/org/eclipse/corrosion/wizards/newproject/NewCargoProjectWizard.java b/org.eclipse.corrosion/src/org/eclipse/corrosion/wizards/newproject/NewCargoProjectWizard.java index 3887f5f..351f5c2 100644 --- a/org.eclipse.corrosion/src/org/eclipse/corrosion/wizards/newproject/NewCargoProjectWizard.java +++ b/org.eclipse.corrosion/src/org/eclipse/corrosion/wizards/newproject/NewCargoProjectWizard.java @@ -1,5 +1,5 @@ /********************************************************************* - * Copyright (c) 2017, 2021 Red Hat Inc. and others. + * Copyright (c) 2017, 2022 Red Hat Inc. and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -265,10 +265,10 @@ private static Set getWorkingSets(IResource resource) { } private static IResource toResource(Object o) { - if (o instanceof IResource) { - return (IResource) o; - } else if (o instanceof IAdaptable) { - return ((IAdaptable) o).getAdapter(IResource.class); + if (o instanceof IResource resource) { + return resource; + } else if (o instanceof IAdaptable adaptable) { + return adaptable.getAdapter(IResource.class); } else { return null; }