8242808: Fix all remaining deprecation warnings in jdk.hotspot.agent

Reviewed-by: sspitsyn
This commit is contained in:
Magnus Ihse Bursie 2020-04-16 12:54:29 +02:00
parent d295762f4c
commit 3cc1fdf2b6
5 changed files with 15 additions and 12 deletions

View File

@ -303,7 +303,7 @@ jdk.compiler_CLEAN_FILES += $(wildcard \
################################################################################
jdk.hotspot.agent_DISABLED_WARNINGS += deprecation rawtypes serial unchecked \
jdk.hotspot.agent_DISABLED_WARNINGS += rawtypes serial unchecked \
cast static overrides fallthrough
jdk.hotspot.agent_COPY += .gif .png sa.js .properties

View File

@ -553,7 +553,7 @@ public class ConstantPool extends Metadata implements ClassConstants {
int cpConstType = tags.at(ci);
if(cpConstType == JVM_CONSTANT_Utf8) {
Symbol sym = getSymbolAt(ci);
utf8ToIndex.put(sym.asString(), new Short((short) ci));
utf8ToIndex.put(sym.asString(), (short) ci);
}
else if(cpConstType == JVM_CONSTANT_Long ||
cpConstType == JVM_CONSTANT_Double) {

View File

@ -260,10 +260,10 @@ public class HighPrecisionJScrollBar extends JScrollBar {
BigInteger range2 = new BigInteger(Integer.toString(BIG_RANGE));
if (rangeHP.compareTo(range2) >= 0 ) {
down = true;
scaleFactor = new BigDecimal(rangeHP, SCALE).divide(new BigDecimal(range2, SCALE), BigDecimal.ROUND_DOWN).max(new BigDecimal(BigInteger.ONE));
scaleFactor = new BigDecimal(rangeHP, SCALE).divide(new BigDecimal(range2, SCALE), RoundingMode.DOWN).max(new BigDecimal(BigInteger.ONE));
} else {
down = false;
scaleFactor = new BigDecimal(range2, SCALE).divide(new BigDecimal(rangeHP, SCALE), BigDecimal.ROUND_DOWN).max(new BigDecimal(BigInteger.ONE));
scaleFactor = new BigDecimal(range2, SCALE).divide(new BigDecimal(rangeHP, SCALE), RoundingMode.DOWN).max(new BigDecimal(BigInteger.ONE));
}
// FIXME: should put in original scaling algorithm (shifting by
// number of bits) as alternative when scale between low and high
@ -288,12 +288,12 @@ public class HighPrecisionJScrollBar extends JScrollBar {
private BigInteger scaleToHP(int i) {
BigDecimal ib = new BigDecimal(Integer.toString(i));
if (down) return ib.multiply(getScaleFactor()).toBigInteger();
else return ib.divide(getScaleFactor(), BigDecimal.ROUND_DOWN).toBigInteger();
else return ib.divide(getScaleFactor(), RoundingMode.DOWN).toBigInteger();
}
private int scaleToUnderlying(BigInteger i) {
BigDecimal d = new BigDecimal(i);
if (down) return d.divide(getScaleFactor(), BigDecimal.ROUND_DOWN).intValue();
if (down) return d.divide(getScaleFactor(), RoundingMode.DOWN).intValue();
else return d.multiply(getScaleFactor()).intValue();
}

View File

@ -26,6 +26,7 @@ package sun.jvm.hotspot.ui;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.Rectangle2D;
import java.io.*;
import java.net.*;
import java.util.*;
@ -255,10 +256,12 @@ public class SourceCodePanel extends JPanel {
public void showLineNumber(int lineNo) {
try {
int offset = source.getLineStartOffset(lineNo - 1);
Rectangle rect = source.modelToView(offset);
if (rect == null) {
Rectangle2D rect2d = source.modelToView2D(offset);
if (rect2d == null) {
return;
}
Rectangle rect = new Rectangle((int) rect2d.getX(), (int) rect2d.getY(),
(int) rect2d.getWidth(), (int) rect2d.getHeight());
source.scrollRectToVisible(rect);
} catch (BadLocationException e) {
e.printStackTrace();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, 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
@ -440,14 +440,14 @@ public class JTreeTable extends JTable {
// selection remaining the same. To avoid this, we
// only dispatch when the modifiers are 0 (or the left mouse
// button).
if (me.getModifiers() == 0 ||
me.getModifiers() == InputEvent.BUTTON1_MASK) {
if (me.getModifiersEx() == 0 ||
me.getModifiersEx() == InputEvent.BUTTON1_DOWN_MASK) {
for (int counter = getColumnCount() - 1; counter >= 0;
counter--) {
if (getColumnClass(counter) == TreeTableModel.class) {
MouseEvent newME = new MouseEvent
(JTreeTable.this.tree, me.getID(),
me.getWhen(), me.getModifiers(),
me.getWhen(), me.getModifiersEx(),
me.getX() - getCellRect(0, counter, true).x,
me.getY(), me.getClickCount(),
me.isPopupTrigger());