RFR: 8194143: remove unneeded casts in LocationImpl and MirrorImpl classes
Egor Ushakov
egor.ushakov at jetbrains.com
Wed Jan 17 17:32:50 UTC 2018
Is the link http://cr.openjdk.java.net/~avu/egor.ushakov/cast_fix
broken? for me it works well.
attaching the patch just in case.
It was created on jdk10, do I need to recreate it based on jdk11 with
the 2018 copyrights?
On 17-Jan-18 20:26, serguei.spitsyn at oracle.com wrote:
> Hi Egor and David,
>
> Both webrevs below are from Daniil Titov on the JVMTI bug: JDK-8153629.
> Also, I expect new webrev is based on the JDK 11 jdk/hs repository and
> with 2018 copyright comments updated.
>
> Thanks,
> Serguei
>
>
> On 1/17/18 02:24, David Holmes wrote:
>> Hi Egor,
>>
>> On 17/01/2018 7:15 PM, Egor Ushakov wrote:
>>> Hello,
>>>
>>> Please review and push the fix.
>>> This is a formal letter after the discussion on the alias.
>>>
>>> Bug:https://bugs.openjdk.java.net/browse/JDK-8194143
>>> Webrev:http://cr.openjdk.java.net/~avu/egor.ushakov/cast_fix/
>>
>> The underlying link actually pointed to:
>>
>> http://cr.openjdk.java.net/%7Edtitov/8153629/webrev.00
>>
>> :)
>>
>> Real webrev looks fine.
>>
>> Thanks,
>> David
>>
>>> --
>>> Egor Ushakov
>>> Software Developer
>>> JetBrains
>>> http://www.jetbrains.com
>>> The Drive to Develop
>>>
>
--
Egor Ushakov
Software Developer
JetBrains
http://www.jetbrains.com
The Drive to Develop
-------------- next part --------------
--- old/src/jdk.jdi/share/classes/com/sun/tools/jdi/LocationImpl.java 2017-12-22 17:06:43.000000000 +0300
+++ new/src/jdk.jdi/share/classes/com/sun/tools/jdi/LocationImpl.java 2017-12-22 17:06:43.000000000 +0300
@@ -79,8 +79,7 @@
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();
--- old/src/jdk.jdi/share/classes/com/sun/tools/jdi/MirrorImpl.java 2017-12-22 17:06:44.000000000 +0300
+++ new/src/jdk.jdi/share/classes/com/sun/tools/jdi/MirrorImpl.java 2017-12-22 17:06:43.000000000 +0300
@@ -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 @@
* 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 @@
* 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);
}
}
}
More information about the serviceability-dev
mailing list