8030087: Avoid public native methods in sun.awt packages
Reviewed-by: azvegint, prr
This commit is contained in:
parent
828fc948f2
commit
8be69405fd
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2015, 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
|
||||
@ -29,7 +29,7 @@ import java.awt.Point;
|
||||
import java.awt.Window;
|
||||
import java.awt.peer.MouseInfoPeer;
|
||||
|
||||
public class DefaultMouseInfoPeer implements MouseInfoPeer {
|
||||
public final class DefaultMouseInfoPeer implements MouseInfoPeer {
|
||||
|
||||
/**
|
||||
* Package-private constructor to prevent instantiation.
|
||||
|
@ -45,8 +45,7 @@ import java.util.Properties;
|
||||
* with the HeadlessToolkit. It is primarily used
|
||||
* in embedded JRE's that do not have sun/awt/X11 classes.
|
||||
*/
|
||||
public class HToolkit extends SunToolkit
|
||||
implements ComponentFactory {
|
||||
public final class HToolkit extends SunToolkit implements ComponentFactory {
|
||||
|
||||
private static final KeyboardFocusManagerPeer kfmPeer = new KeyboardFocusManagerPeer() {
|
||||
@Override
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -98,8 +98,7 @@ public class FcFontManager extends SunFontManager {
|
||||
return info;
|
||||
}
|
||||
|
||||
protected native String getFontPathNative(boolean noType1Fonts,
|
||||
boolean isX11GE);
|
||||
native String getFontPathNative(boolean noType1Fonts, boolean isX11GE);
|
||||
|
||||
protected synchronized String getFontPath(boolean noType1Fonts) {
|
||||
return getFontPathNative(noType1Fonts, false);
|
||||
|
@ -44,7 +44,6 @@ import sun.font.MFontConfiguration;
|
||||
import sun.font.CompositeFont;
|
||||
import sun.font.FontManager;
|
||||
import sun.font.SunFontManager;
|
||||
import sun.font.FontConfigManager;
|
||||
import sun.font.FcFontConfiguration;
|
||||
import sun.font.FontAccess;
|
||||
import sun.font.FontUtilities;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, 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
|
||||
@ -27,7 +27,6 @@ package sun.awt;
|
||||
|
||||
import java.awt.AWTException;
|
||||
import java.awt.BufferCapabilities;
|
||||
import java.awt.BufferCapabilities.FlipContents;
|
||||
import java.awt.Component;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
@ -35,7 +34,6 @@ import java.awt.GraphicsDevice;
|
||||
import java.awt.Image;
|
||||
import java.awt.ImageCapabilities;
|
||||
import java.awt.Transparency;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.color.ColorSpace;
|
||||
import java.awt.image.ComponentColorModel;
|
||||
@ -55,7 +53,6 @@ import sun.java2d.x11.X11SurfaceData;
|
||||
import sun.awt.image.OffScreenImage;
|
||||
import sun.awt.image.SunVolatileImage;
|
||||
import sun.awt.image.SurfaceManager;
|
||||
import sun.awt.X11ComponentPeer;
|
||||
|
||||
/**
|
||||
* This is an implementation of a GraphicsConfiguration object for a
|
||||
@ -314,7 +311,7 @@ public class X11GraphicsConfig extends GraphicsConfiguration
|
||||
return pGetBounds(screen.getScreen());
|
||||
}
|
||||
|
||||
public native Rectangle pGetBounds(int screenNum);
|
||||
private native Rectangle pGetBounds(int screenNum);
|
||||
|
||||
private static class XDBECapabilities extends BufferCapabilities {
|
||||
public XDBECapabilities() {
|
||||
|
@ -52,10 +52,8 @@ import sun.misc.InnocuousThread;
|
||||
* @see GraphicsEnvironment
|
||||
* @see GraphicsConfiguration
|
||||
*/
|
||||
public class X11GraphicsDevice
|
||||
extends GraphicsDevice
|
||||
implements DisplayChangedListener
|
||||
{
|
||||
public final class X11GraphicsDevice extends GraphicsDevice
|
||||
implements DisplayChangedListener {
|
||||
int screen;
|
||||
HashMap<SurfaceType, Object> x11ProxyKeyMap = new HashMap<>();
|
||||
|
||||
@ -201,16 +199,15 @@ public class X11GraphicsDevice
|
||||
/*
|
||||
* Returns the depth for the given index of graphics configurations.
|
||||
*/
|
||||
public native int getConfigDepth (int index, int screen);
|
||||
private native int getConfigDepth(int index, int screen);
|
||||
|
||||
/*
|
||||
* Returns the colormap for the given index of graphics configurations.
|
||||
*/
|
||||
public native int getConfigColormap (int index, int screen);
|
||||
|
||||
private native int getConfigColormap(int index, int screen);
|
||||
|
||||
// Whether or not double-buffering extension is supported
|
||||
public static native boolean isDBESupported();
|
||||
static native boolean isDBESupported();
|
||||
// Callback for adding a new double buffer visual into our set
|
||||
private void addDoubleBufferVisual(int visNum) {
|
||||
doubleBufferVisuals.add(Integer.valueOf(visNum));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, 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
|
||||
@ -29,13 +29,6 @@ import java.awt.AWTError;
|
||||
import java.awt.GraphicsDevice;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.StreamTokenizer;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
@ -43,11 +36,6 @@ import java.net.UnknownHostException;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import sun.font.MFontConfiguration;
|
||||
import sun.font.FcFontConfiguration;
|
||||
import sun.font.Font2D;
|
||||
import sun.font.FontManager;
|
||||
import sun.font.NativeFont;
|
||||
import sun.java2d.SunGraphicsEnvironment;
|
||||
import sun.java2d.SurfaceManagerFactory;
|
||||
import sun.java2d.UnixSurfaceManagerFactory;
|
||||
@ -62,9 +50,8 @@ import sun.java2d.xr.XRSurfaceData;
|
||||
* @see GraphicsDevice
|
||||
* @see GraphicsConfiguration
|
||||
*/
|
||||
public class X11GraphicsEnvironment
|
||||
extends SunGraphicsEnvironment
|
||||
{
|
||||
public final class X11GraphicsEnvironment extends SunGraphicsEnvironment {
|
||||
|
||||
private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.X11GraphicsEnvironment");
|
||||
private static final PlatformLogger screenLog = PlatformLogger.getLogger("sun.awt.screen.X11GraphicsEnvironment");
|
||||
|
||||
@ -200,7 +187,7 @@ public class X11GraphicsEnvironment
|
||||
return new X11GraphicsDevice(screennum);
|
||||
}
|
||||
|
||||
protected native int getDefaultScreenNum();
|
||||
private native int getDefaultScreenNum();
|
||||
/**
|
||||
* Returns the default screen graphics device.
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, 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
|
||||
@ -35,16 +35,9 @@ import java.awt.Component;
|
||||
import java.awt.Container;
|
||||
import java.awt.EventQueue;
|
||||
import java.awt.Window;
|
||||
import java.awt.im.InputContext;
|
||||
import java.awt.im.InputMethodHighlight;
|
||||
import java.awt.im.spi.InputMethodContext;
|
||||
import sun.awt.im.InputMethodAdapter;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.InputMethodEvent;
|
||||
import java.awt.font.TextAttribute;
|
||||
import java.awt.font.TextHitInfo;
|
||||
@ -1095,7 +1088,7 @@ public abstract class X11InputMethod extends InputMethodAdapter {
|
||||
/*
|
||||
* Native methods
|
||||
*/
|
||||
protected native String resetXIC();
|
||||
private native String resetXIC();
|
||||
private native void disposeXIC();
|
||||
private native boolean setCompositionEnabledNative(boolean enable);
|
||||
private native boolean isCompositionEnabledNative();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2015, 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
|
||||
@ -279,9 +279,9 @@ public final class Win32FontManager extends SunFontManager {
|
||||
});
|
||||
}
|
||||
|
||||
protected static native void registerFontWithPlatform(String fontName);
|
||||
private static native void registerFontWithPlatform(String fontName);
|
||||
|
||||
protected static native void deRegisterFontWithPlatform(String fontName);
|
||||
private static native void deRegisterFontWithPlatform(String fontName);
|
||||
|
||||
/**
|
||||
* populate the map with the most common windows fonts.
|
||||
|
@ -226,7 +226,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
|
||||
* are disabled. Do not call this function with an index of 0.
|
||||
* @param index a PixelFormat index
|
||||
*/
|
||||
protected native boolean isPixFmtSupported(int index, int screen);
|
||||
private native boolean isPixFmtSupported(int index, int screen);
|
||||
|
||||
/**
|
||||
* Returns the PixelFormatID of the default graphics configuration
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, 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
|
||||
@ -28,19 +28,11 @@ package sun.awt;
|
||||
import java.awt.AWTError;
|
||||
import java.awt.GraphicsConfiguration;
|
||||
import java.awt.GraphicsDevice;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.peer.ComponentPeer;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ListIterator;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.StringTokenizer;
|
||||
import sun.awt.DisplayChangedListener;
|
||||
import sun.awt.SunDisplayChanger;
|
||||
import sun.awt.windows.WPrinterJob;
|
||||
|
||||
import sun.awt.windows.WToolkit;
|
||||
import sun.java2d.SunGraphicsEnvironment;
|
||||
import sun.java2d.SurfaceManagerFactory;
|
||||
@ -57,9 +49,8 @@ import sun.java2d.windows.WindowsFlags;
|
||||
* @see GraphicsConfiguration
|
||||
*/
|
||||
|
||||
public class Win32GraphicsEnvironment
|
||||
extends SunGraphicsEnvironment
|
||||
{
|
||||
public final class Win32GraphicsEnvironment extends SunGraphicsEnvironment {
|
||||
|
||||
static {
|
||||
// Ensure awt is loaded already. Also, this forces static init
|
||||
// of WToolkit and Toolkit, which we depend upon
|
||||
@ -91,7 +82,7 @@ public class Win32GraphicsEnvironment
|
||||
}
|
||||
|
||||
protected native int getNumScreens();
|
||||
protected native int getDefaultScreen();
|
||||
private native int getDefaultScreen();
|
||||
|
||||
public GraphicsDevice getDefaultScreenDevice() {
|
||||
GraphicsDevice[] screens = getScreenDevices();
|
||||
|
Loading…
Reference in New Issue
Block a user