Skip to content

Commit

Permalink
fix "hiding" warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
EcljpseB0T authored and merks committed Jan 31, 2024
1 parent c055fef commit 36fd2c4
Show file tree
Hide file tree
Showing 36 changed files with 287 additions and 262 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
*
* Contributors: Genuitec, LLC - initial API and implementation
* IBM Corporation - ongoing maintenance
******************************************************************************/
Expand All @@ -22,17 +22,15 @@
public class DownloadJob extends Job {
static final Object FAMILY = new Object();

private LinkedList<IArtifactRequest> requestsPending;
private SimpleArtifactRepository repository;
private IProgressMonitor masterMonitor;
private MultiStatus overallStatus;
private final LinkedList<IArtifactRequest> requestsPending;
private final SimpleArtifactRepository repository;
private final IProgressMonitor masterMonitor;
private final MultiStatus overallStatus;

DownloadJob(String name) {
DownloadJob(String name, SimpleArtifactRepository repository, LinkedList<IArtifactRequest> requestsPending,
IProgressMonitor masterMonitor, MultiStatus overallStatus) {
super(name);
setSystem(true);
}

void initialize(SimpleArtifactRepository repository, LinkedList<IArtifactRequest> requestsPending, IProgressMonitor masterMonitor, MultiStatus overallStatus) {
this.repository = repository;
this.requestsPending = requestsPending;
this.masterMonitor = masterMonitor;
Expand All @@ -46,7 +44,7 @@ public boolean belongsTo(Object family) {

@Override
protected IStatus run(IProgressMonitor jobMonitor) {
jobMonitor.beginTask("Downloading software", IProgressMonitor.UNKNOWN);
jobMonitor.beginTask("Downloading software", IProgressMonitor.UNKNOWN); //$NON-NLS-1$
do {
// get the request we are going to process
IArtifactRequest request;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -917,8 +917,8 @@ public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monito
try {
DownloadJob jobs[] = new DownloadJob[numberOfJobs];
for (int i = 0; i < numberOfJobs; i++) {
jobs[i] = new DownloadJob(Messages.sar_downloadJobName + i);
jobs[i].initialize(this, requestsPending, monitor, overallStatus);
jobs[i] = new DownloadJob(Messages.sar_downloadJobName + i, this, requestsPending, monitor,
overallStatus);
jobs[i].schedule();
}
// wait for all the jobs to complete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public void initialize(IProvisioningAgent agent, IProcessingStepDescriptor descr
* @param destination the stream into which to write the processed data
* @param monitor the progress monitor to use for reporting activity
*/
@SuppressWarnings("hiding")
public void link(OutputStream destination, IProgressMonitor monitor) {
public void link(@SuppressWarnings("hiding") OutputStream destination,
@SuppressWarnings("hiding") IProgressMonitor monitor) {
this.destination = destination;
this.monitor = monitor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,13 @@ public TarEntry getNextEntry() throws TarException, IOException {
// We get a file called ././@LongLink which just contains
// the real pathname.
byte[] longNameData = new byte[(int) entry.getSize()];
int bytesread = 0;
while (bytesread < longNameData.length) {
int cur = read(longNameData, bytesread, longNameData.length - bytesread);
int bytesRead = 0;
while (bytesRead < longNameData.length) {
int cur = read(longNameData, bytesRead, longNameData.length - bytesRead);
if (cur < 0) {
throw new IOException("early end of stream"); //$NON-NLS-1$
}
bytesread += cur;
bytesRead += cur;
}

int pos = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/
public class AddChildTask extends AbstractMDRTask {

@SuppressWarnings("hiding")
URI location; // location of the composite repository
URI child; // address of the child to add

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
@SuppressWarnings("nls")
public class CreateCompositeMetadataRepositoryTask extends AbstractMDRTask {

@SuppressWarnings("hiding")
URI location; // desired location of the composite repository
String name = "Composite Metadata Repository";
boolean atomic = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*/
public class RemoveChildTask extends AbstractMDRTask {

@SuppressWarnings("hiding")
URI location; // location of the composite repository
URI child; // address of the child to be removed
boolean allChildren; // should we remove all the children?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public static IInstallableUnit createBundleIU(BundleDescription bd, IArtifactKey
return new BundlesAction(new BundleDescription[] { bd }).doCreateBundleIU(bd, key, info);
}

protected IInstallableUnit doCreateBundleIU(BundleDescription bd, IArtifactKey key, IPublisherInfo info) {
protected IInstallableUnit doCreateBundleIU(BundleDescription bd, IArtifactKey key, IPublisherInfo publisherInfo) {
@SuppressWarnings("unchecked")
Map<String, String> manifest = (Map<String, String>) bd.getUserObject();

Expand Down Expand Up @@ -298,8 +298,8 @@ protected IInstallableUnit doCreateBundleIU(BundleDescription bd, IArtifactKey k
iu.setCapabilities(providedCapabilities.toArray(new IProvidedCapability[providedCapabilities.size()]));

// Process advice
processUpdateDescriptorAdvice(iu, info);
processCapabilityAdvice(iu, info);
processUpdateDescriptorAdvice(iu, publisherInfo);
processCapabilityAdvice(iu, publisherInfo);

// Set certain properties from the manifest header attributes as IU properties.
// The values of these attributes may be localized (strings starting with '%')
Expand All @@ -322,13 +322,13 @@ protected IInstallableUnit doCreateBundleIU(BundleDescription bd, IArtifactKey k
// that this is something that will not impact the configuration.
Map<String, String> touchpointData = new HashMap<>();
touchpointData.put("manifest", toManifestString(manifest)); //$NON-NLS-1$
if (isDir(bd, info)) {
if (isDir(bd, publisherInfo)) {
touchpointData.put("zipped", "true"); //$NON-NLS-1$ //$NON-NLS-2$
}

// Process more advice
processTouchpointAdvice(iu, touchpointData, info);
processInstallableUnitPropertiesAdvice(iu, info);
processTouchpointAdvice(iu, touchpointData, publisherInfo);
processInstallableUnitPropertiesAdvice(iu, publisherInfo);

return MetadataFactory.createInstallableUnit(iu);
}
Expand Down Expand Up @@ -995,12 +995,12 @@ protected void generateBundleIUs(BundleDescription[] bundleDescriptions, IPublis
*
* @param bundleDescriptions Equinox framework descriptions of the bundles to
* publish.
* @param info Configuration and publication advice information.
* @param publisherInfo Configuration and publication advice information.
* @param result Used to attach status for the publication
* operation.
* @param monitor Used to fire progress events.
*/
protected void generateBundleIUs(BundleDescription[] bundleDescriptions, IPublisherInfo info,
protected void generateBundleIUs(BundleDescription[] bundleDescriptions, IPublisherInfo publisherInfo,
IPublisherResult result, IProgressMonitor monitor) {
// This assumes that hosts are processed before fragments because for each
// fragment the host
Expand All @@ -1019,20 +1019,20 @@ protected void generateBundleIUs(BundleDescription[] bundleDescriptions, IPublis
PublisherHelper.fromOSGiVersion(bd.getVersion()));
IArtifactKey bundleArtKey = createBundleArtifactKey(bd.getSymbolicName(), bd.getVersion().toString());
if (bundleIU == null) {
createAdviceFileAdvice(bd, info);
createAdviceFileAdvice(bd, publisherInfo);
// Create the bundle IU according to any shape advice we have
bundleIU = doCreateBundleIU(bd, bundleArtKey, info);
bundleIU = doCreateBundleIU(bd, bundleArtKey, publisherInfo);
}

File bundleLocation = new File(bd.getLocation());
IArtifactDescriptor ad = PublisherHelper.createArtifactDescriptor(info, bundleArtKey, bundleLocation);
processArtifactPropertiesAdvice(bundleIU, ad, info);
IArtifactDescriptor ad = PublisherHelper.createArtifactDescriptor(publisherInfo, bundleArtKey, bundleLocation);
processArtifactPropertiesAdvice(bundleIU, ad, publisherInfo);

// Publish according to the shape on disk
if (bundleLocation.isDirectory()) {
publishArtifact(ad, bundleLocation, bundleLocation.listFiles(), info);
publishArtifact(ad, bundleLocation, bundleLocation.listFiles(), publisherInfo);
} else {
publishArtifact(ad, bundleLocation, info);
publishArtifact(ad, bundleLocation, publisherInfo);
}

IInstallableUnit fragment = null;
Expand All @@ -1057,7 +1057,7 @@ protected void generateBundleIUs(BundleDescription[] bundleDescriptions, IPublis
result.addIU(fragment, IPublisherResult.NON_ROOT);
}

InstallableUnitDescription[] others = processAdditionalInstallableUnitsAdvice(bundleIU, info);
InstallableUnitDescription[] others = processAdditionalInstallableUnitsAdvice(bundleIU, publisherInfo);
for (int iuIndex = 0; others != null && iuIndex < others.length; iuIndex++) {
result.addIU(MetadataFactory.createInstallableUnit(others[iuIndex]), IPublisherResult.ROOT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1429,14 +1429,14 @@ static class ImageData {
* within the logical screen (this field corresponds to
* the GIF89a Image Left Position value).
*/
public int x;
public int topLeftX;

/**
* The y coordinate of the top left corner of the image
* within the logical screen (this field corresponds to
* the GIF89a Image Top Position value).
*/
public int y;
public int topLeftY;

/**
* A description of how to dispose of the current image
Expand Down Expand Up @@ -1555,7 +1555,7 @@ public ImageData(ImageData[] data) {
if (data.length < 1)
SWT.error(SWT.ERROR_INVALID_IMAGE);
ImageData i = data[0];
setAllFields(i.width, i.height, i.depth, i.scanlinePad, i.bytesPerLine, i.data, i.palette, i.transparentPixel, i.maskData, i.maskPad, i.alphaData, i.alpha, i.type, i.x, i.y, i.disposalMethod, i.delayTime);
setAllFields(i.width, i.height, i.depth, i.scanlinePad, i.bytesPerLine, i.data, i.palette, i.transparentPixel, i.maskData, i.maskPad, i.alphaData, i.alpha, i.type, i.topLeftX, i.topLeftY, i.disposalMethod, i.delayTime);
}

/**
Expand Down Expand Up @@ -1584,8 +1584,9 @@ public ImageData(ImageData[] data) {
if (scanlinePad == 0)
SWT.error(SWT.ERROR_CANNOT_BE_ZERO);

int bytesPerLine = (((width * depth + 7) / 8) + (scanlinePad - 1)) / scanlinePad * scanlinePad;
setAllFields(width, height, depth, scanlinePad, bytesPerLine, data != null ? data : new byte[bytesPerLine * height], palette, transparentPixel, maskData, maskPad, alphaData, alpha, type, x, y, disposalMethod, delayTime);
int bpl = (((width * depth + 7) / 8) + (scanlinePad - 1)) / scanlinePad * scanlinePad; // bytesPerLine
setAllFields(width, height, depth, scanlinePad, bpl, data != null ? data : new byte[bpl * height], palette,
transparentPixel, maskData, maskPad, alphaData, alpha, type, x, y, disposalMethod, delayTime);
}

/**
Expand All @@ -1612,8 +1613,8 @@ void setAllFields(int width, int height, int depth, int scanlinePad, int bytesPe
this.alphaData = alphaData;
this.alpha = alpha;
this.type = type;
this.x = x;
this.y = y;
this.topLeftX = x;
this.topLeftY = y;
this.disposalMethod = disposalMethod;
this.delayTime = delayTime;
}
Expand All @@ -1639,16 +1640,16 @@ public static ImageData internal_new(int width, int height, int depth, PaletteDa
ImageData colorMaskImage(int pixel) {
ImageData mask = new ImageData(width, height, 1, bwPalette(), 2, null, 0, null, null, -1, -1, SWT.IMAGE_UNDEFINED, 0, 0, 0, 0);
int[] row = new int[width];
for (int y = 0; y < height; y++) {
getPixels(0, y, width, row, 0);
for (int h = 0; h < height; h++) {
getPixels(0, h, width, row, 0);
for (int i = 0; i < width; i++) {
if (pixel != -1 && row[i] == pixel) {
row[i] = 0;
} else {
row[i] = 1;
}
}
mask.setPixels(0, y, width, row, 0);
mask.setPixels(0, h, width, row, 0);
}
return mask;
}
Expand Down Expand Up @@ -2743,19 +2744,19 @@ private int readData(byte[] buffer, int offset, int length) throws IOException {
* four bytes of the input stream.
*/
public int readInt() throws IOException {
byte[] buf = new byte[4];
read(buf);
return ((((((buf[3] & 0xFF) << 8) | (buf[2] & 0xFF)) << 8) | (buf[1] & 0xFF)) << 8) | (buf[0] & 0xFF);
byte[] b = new byte[4];
read(b);
return ((((((b[3] & 0xFF) << 8) | (b[2] & 0xFF)) << 8) | (b[1] & 0xFF)) << 8) | (b[0] & 0xFF);
}

/**
* Answer a short comprised of the next
* two bytes of the input stream.
*/
public short readShort() throws IOException {
byte[] buf = new byte[2];
read(buf);
return (short) (((buf[1] & 0xFF) << 8) | (buf[0] & 0xFF));
byte[] b = new byte[2];
read(b);
return (short) (((b[1] & 0xFF) << 8) | (b[0] & 0xFF));
}

/**
Expand Down Expand Up @@ -2826,7 +2827,6 @@ public static ImageData[] load(InputStream is, ImageLoader loader) {

static class WinBMPFileFormat extends FileFormat {
static final int BMPFileHeaderSize = 14;
static final int BMPHeaderFixedSize = 40;
int importantColors;

void decompressData(byte[] src, byte[] dest, int stride, int cmp) {
Expand Down Expand Up @@ -3166,7 +3166,7 @@ int iconSize(ImageData i) {
int maskDataStride = (i.width + 31) / 32 * 4;
int dataSize = (shapeDataStride + maskDataStride) * i.height;
int paletteSize = i.palette.colors != null ? i.palette.colors.length * 4 : 0;
return WinBMPFileFormat.BMPHeaderFixedSize + paletteSize + dataSize;
return BMPHeaderFixedSize + paletteSize + dataSize;
}

@Override
Expand Down Expand Up @@ -3302,7 +3302,7 @@ byte[] loadInfoHeader(int[] iconHeader) {
return null;
}
}
byte[] infoHeader = new byte[WinBMPFileFormat.BMPHeaderFixedSize];
byte[] infoHeader = new byte[BMPHeaderFixedSize];
try {
inputStream.read(infoHeader);
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map<
@SuppressWarnings("unchecked")
List<IArtifactRequest> artifactRequests = (List<IArtifactRequest>) parameters.get(NATIVE_ARTIFACTS);
ProvisioningContext context = (ProvisioningContext) parameters.get(PARM_CONTEXT);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
DownloadManager dm = new DownloadManager(context, agent);
IProvisioningAgent pa = (IProvisioningAgent) parameters.get(PARM_AGENT);
DownloadManager dm = new DownloadManager(context, pa);
for (IArtifactRequest request : artifactRequests) {
dm.add(request);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void latestVersionOnly(boolean latest) {
this.latestVersion = latest;
}

public void installTimeLikeResolution(boolean resolve) {
public void setResolve(boolean resolve) {
this.resolve = resolve;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public void analyzeIU(IInstallableUnit iu) {
}

@Override
public void preAnalysis(IMetadataRepository repository) {
this.repository = repository;
public void preAnalysis(IMetadataRepository repo) {
this.repository = repo;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
@SuppressWarnings("nls")
public class CreateCompositeArtifactRepositoryTask extends Task {

@SuppressWarnings("hiding")
URI location; // desired location of the composite repository
String name = "Composite Artifact Repository";
boolean atomic = true; // bug 356561: newly created repositories shall be atomic (by default)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public SlicingOption() {
options.everythingGreedy(true);
options.includeOptionalDependencies(true);
options.followOnlyFilteredRequirements(false);
options.installTimeLikeResolution(false);
options.setResolve(false);
setIncludeFeatures(true);
}

Expand Down Expand Up @@ -106,7 +106,7 @@ public void setLatestVersionOnly(boolean latest) {
}

public void setResolve(boolean resolve) {
options.installTimeLikeResolution(resolve);
options.setResolve(resolve);
}

public SlicingOptions getOptions() {
Expand Down
Loading

0 comments on commit 36fd2c4

Please sign in to comment.