8194143: remove unneeded casts in LocationImpl and MirrorImpl classes

Remove unneeded casts in LocationImpl and MirrorImpl classes

Reviewed-by: sspitsyn, dholmes
This commit is contained in:
Egor Ushakov 2018-01-22 14:14:26 -08:00 committed by Serguei Spitsyn
parent 23d7131895
commit 25515e11c8
2 changed files with 7 additions and 17 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -79,8 +79,7 @@ public class LocationImpl extends MirrorImpl implements Location {
return method().hashCode() + (int)codeIndex();
}
public int compareTo(Location object) {
LocationImpl other = (LocationImpl)object;
public int compareTo(Location other) {
int rc = method().compareTo(other.method());
if (rc == 0) {
long diff = codeIndex() - other.codeIndex();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,6 @@
package com.sun.tools.jdi;
import java.util.Collection;
import java.util.Iterator;
import com.sun.jdi.Mirror;
import com.sun.jdi.VMMismatchException;
@ -87,12 +86,8 @@ abstract class MirrorImpl extends Object implements Mirror {
* Throw VMMismatchException on wrong VM.
*/
void validateMirrors(Collection<? extends Mirror> mirrors) {
Iterator<? extends Mirror> iter = mirrors.iterator();
while (iter.hasNext()) {
MirrorImpl mirror = (MirrorImpl)iter.next();
if (!vm.equals(mirror.vm)) {
throw new VMMismatchException(mirror.toString());
}
for (Mirror mirror : mirrors) {
validateMirror(mirror);
}
}
@ -101,12 +96,8 @@ abstract class MirrorImpl extends Object implements Mirror {
* Throw VMMismatchException on wrong VM.
*/
void validateMirrorsOrNulls(Collection<? extends Mirror> mirrors) {
Iterator<? extends Mirror> iter = mirrors.iterator();
while (iter.hasNext()) {
MirrorImpl mirror = (MirrorImpl)iter.next();
if ((mirror != null) && !vm.equals(mirror.vm)) {
throw new VMMismatchException(mirror.toString());
}
for (Mirror mirror : mirrors) {
validateMirrorOrNull(mirror);
}
}
}