8236506: [macosx] Some datatransfer classes were loaded on startup

Reviewed-by: prr
This commit is contained in:
Sergey Bylokhov 2019-12-25 10:15:32 +03:00
parent 4cb20ae300
commit e13f184eb3
4 changed files with 45 additions and 25 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2019, 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
@ -38,8 +38,11 @@ import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
import javax.swing.TransferHandler;
import javax.swing.text.Document;
import sun.awt.AWTAccessor;
/**
* Lightweight implementation of {@link TextAreaPeer}. Delegates most of the
* work to the {@link JTextArea} inside {@link JScrollPane}.
@ -237,6 +240,17 @@ final class LWTextAreaPeer
public Point getLocationOnScreen() {
return LWTextAreaPeer.this.getLocationOnScreen();
}
@Override
public void setTransferHandler(final TransferHandler newHandler) {
// override the default implementation to avoid loading
// SystemFlavorMap and associated classes
Object key = AWTAccessor.getClientPropertyKeyAccessor()
.getJComponent_TRANSFER_HANDLER();
Object oldHandler = getClientProperty(key);
putClientProperty(key, newHandler);
firePropertyChange("transferHandler", oldHandler, newHandler);
}
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2019, 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
@ -23,7 +23,6 @@
* questions.
*/
package sun.lwawt;
import java.awt.Dimension;
@ -37,6 +36,8 @@ import java.awt.peer.TextFieldPeer;
import javax.swing.*;
import javax.swing.text.JTextComponent;
import sun.awt.AWTAccessor;
/**
* Lightweight implementation of {@link TextFieldPeer}. Delegates most of the
* work to the {@link JPasswordField}.
@ -140,5 +141,16 @@ final class LWTextFieldPeer
public Point getLocationOnScreen() {
return LWTextFieldPeer.this.getLocationOnScreen();
}
@Override
public void setTransferHandler(final TransferHandler newHandler) {
// override the default implementation to avoid loading
// SystemFlavorMap and associated classes
Object key = AWTAccessor.getClientPropertyKeyAccessor()
.getJComponent_TRANSFER_HANDLER();
Object oldHandler = getClientProperty(key);
putClientProperty(key, newHandler);
firePropertyChange("transferHandler", oldHandler, newHandler);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2019, 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
@ -971,17 +971,14 @@ final class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
setUI(ui);
}
// Fix for 4915454 - override the default implementation to avoid
// loading SystemFlavorMap and associated classes.
@Override
public void setTransferHandler(TransferHandler newHandler) {
TransferHandler oldHandler = (TransferHandler)
getClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
.getJComponent_TRANSFER_HANDLER());
putClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
.getJComponent_TRANSFER_HANDLER(),
newHandler);
public void setTransferHandler(final TransferHandler newHandler) {
// override the default implementation to avoid loading
// SystemFlavorMap and associated classes
Object key = AWTAccessor.getClientPropertyKeyAccessor()
.getJComponent_TRANSFER_HANDLER();
Object oldHandler = getClientProperty(key);
putClientProperty(key, newHandler);
firePropertyChange("transferHandler", oldHandler, newHandler);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2019, 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
@ -642,17 +642,14 @@ final class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
processMouseMotionEvent(e);
}
// Fix for 4915454 - override the default implementation to avoid
// loading SystemFlavorMap and associated classes.
@Override
public void setTransferHandler(TransferHandler newHandler) {
TransferHandler oldHandler = (TransferHandler)
getClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
.getJComponent_TRANSFER_HANDLER());
putClientProperty(AWTAccessor.getClientPropertyKeyAccessor()
.getJComponent_TRANSFER_HANDLER(),
newHandler);
public void setTransferHandler(final TransferHandler newHandler) {
// override the default implementation to avoid loading
// SystemFlavorMap and associated classes
Object key = AWTAccessor.getClientPropertyKeyAccessor()
.getJComponent_TRANSFER_HANDLER();
Object oldHandler = getClientProperty(key);
putClientProperty(key, newHandler);
firePropertyChange("transferHandler", oldHandler, newHandler);
}