--- a/jdk/make/common/Program.gmk Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/make/common/Program.gmk Tue Aug 28 12:20:26 2012 -0700
@@ -126,6 +126,26 @@
endif
#
+# Applications expect to be able to link against libjawt without invoking
+# System.loadLibrary("jawt") first. This was the behaviour described in the
+# devloper documentation of JAWT and what worked with OpenJDK6.
+#
+ifeq ($(PLATFORM), solaris)
+ ifeq ($(ARCH_DATA_MODEL), 32)
+ LDFLAGS += -R \$$ORIGIN/../lib/$(LIBARCH)
+ LDFLAGS += -R \$$ORIGIN/../jre/lib/$(LIBARCH)
+ else # ! ARCH_DATA_MODEL 64-bit
+ LDFLAGS += -R \$$ORIGIN/../../lib/$(LIBARCH)
+ LDFLAGS += -R \$$ORIGIN/../../jre/lib/$(LIBARCH)
+ endif # ARCH_DATA_MODEL
+endif # PLATFORM SOLARIS
+ifeq ($(PLATFORM), linux)
+ LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../lib/$(LIBARCH)
+ LDFLAGS += -Wl,-rpath -Wl,\$$ORIGIN/../jre/lib/$(LIBARCH)
+endif # PLATFORM LINUX
+
+
+#
# Launcher specific files.
#
FILES_o = $(OBJDIR)/main.$(OBJECT_SUFFIX)
--- a/jdk/make/sun/jawt/Makefile Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/make/sun/jawt/Makefile Tue Aug 28 12:20:26 2012 -0700
@@ -31,6 +31,13 @@
include $(BUILDDIR)/common/Defs.gmk
#
+# libjawt links to other programs, but nothing links to it directly. An RPATH
+# entry has been added to the launcher so third-party programs linked against
+# it will be able to find it no matter where the JDK or the third-party program
+# is located.
+#
+
+#
# Files
#
ifeq ($(PLATFORM), windows)
--- a/jdk/src/macosx/classes/com/apple/laf/ScreenMenuItem.java Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/ScreenMenuItem.java Tue Aug 28 12:20:26 2012 -0700
@@ -34,7 +34,7 @@
import sun.lwawt.macosx.CMenuItem;
-class ScreenMenuItem extends MenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler {
+final class ScreenMenuItem extends MenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler {
ScreenMenuPropertyListener fListener;
JMenuItem fMenuItem;
@@ -96,19 +96,29 @@
fMenuItem.removeComponentListener(this);
}
- public void setAccelerator(final KeyStroke ks) {
- if (ks == null) {
- setShortcut(null);
+ static void syncLabelAndKS(MenuItem menuItem, String label, KeyStroke ks) {
+ final MenuComponentPeer peer = menuItem.getPeer();
+ if (!(peer instanceof CMenuItem)) {
+ //Is it possible?
return;
}
+ final CMenuItem cmi = (CMenuItem) peer;
+ if (ks == null) {
+ cmi.setLabel(label);
+ } else {
+ cmi.setLabel(label, ks.getKeyChar(), ks.getKeyCode(),
+ ks.getModifiers());
+ }
+ }
- final MenuComponentPeer peer = getPeer();
- if (peer instanceof CMenuItem) {
- final CMenuItem ourPeer = (CMenuItem)peer;
- ourPeer.setLabel(fMenuItem.getText(), ks.getKeyChar(), ks.getKeyCode(), ks.getModifiers());
- } else {
- setShortcut(new MenuShortcut(ks.getKeyCode(), (ks.getModifiers() & InputEvent.SHIFT_MASK) != 0));
- }
+ @Override
+ public synchronized void setLabel(final String label) {
+ syncLabelAndKS(this, label, fMenuItem.getAccelerator());
+ }
+
+ @Override
+ public void setAccelerator(final KeyStroke ks) {
+ syncLabelAndKS(this, fMenuItem.getText(), ks);
}
public void actionPerformed(final ActionEvent e) {
--- a/jdk/src/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.java Tue Aug 28 12:20:26 2012 -0700
@@ -36,7 +36,7 @@
import sun.lwawt.macosx.*;
-class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler, ItemListener {
+final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler, ItemListener {
JMenuItem fMenuItem;
MenuContainer fParent;
@@ -110,19 +110,14 @@
super.removeNotify();
}
- public void setAccelerator(final KeyStroke ks) {
- if (ks == null) {
- setShortcut(null);
- return;
- }
+ @Override
+ public synchronized void setLabel(final String label) {
+ ScreenMenuItem.syncLabelAndKS(this, label, fMenuItem.getAccelerator());
+ }
- final MenuComponentPeer peer = getPeer();
- if (peer instanceof CMenuItem) {
- final CMenuItem ourPeer = (CMenuItem)peer;
- ourPeer.setLabel(fMenuItem.getText(), ks.getKeyChar(), ks.getKeyCode(), ks.getModifiers());
- } else {
- setShortcut(new MenuShortcut(ks.getKeyCode(), (ks.getModifiers() & InputEvent.SHIFT_MASK) != 0));
- }
+ @Override
+ public void setAccelerator(final KeyStroke ks) {
+ ScreenMenuItem.syncLabelAndKS(this, fMenuItem.getText(), ks);
}
public void actionPerformed(final ActionEvent e) {
--- a/jdk/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java Tue Aug 28 12:20:26 2012 -0700
@@ -31,8 +31,12 @@
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
import java.awt.Image;
import java.awt.ImageCapabilities;
+import java.awt.Rectangle;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
import java.awt.image.BufferedImage;
@@ -44,6 +48,7 @@
import sun.awt.CGraphicsConfig;
import sun.awt.CGraphicsDevice;
+import sun.awt.TextureSizeConstraining;
import sun.awt.image.OffScreenImage;
import sun.awt.image.SunVolatileImage;
import sun.awt.image.SurfaceManager;
@@ -65,7 +70,7 @@
import sun.lwawt.macosx.CPlatformView;
public class CGLGraphicsConfig extends CGraphicsConfig
- implements OGLGraphicsConfig
+ implements OGLGraphicsConfig, TextureSizeConstraining
{
//private static final int kOpenGLSwapInterval = RuntimeOptions.getCurrentOptions().OpenGLSwapInterval;
private static final int kOpenGLSwapInterval = 0; // TODO
@@ -242,6 +247,8 @@
} finally {
rq.unlock();
}
+
+ updateTotalDisplayBounds();
}
@Override
@@ -478,4 +485,50 @@
public void removeDeviceEventListener(AccelDeviceEventListener l) {
AccelDeviceEventNotifier.removeListener(l);
}
+
+ private static final Rectangle totalDisplayBounds = new Rectangle();
+
+ private static void updateTotalDisplayBounds() {
+ synchronized (totalDisplayBounds) {
+ Rectangle virtualBounds = new Rectangle();
+ for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
+ for (GraphicsConfiguration gc : gd.getConfigurations()) {
+ virtualBounds = virtualBounds.union(gc.getBounds());
+ }
+ }
+ totalDisplayBounds.setBounds(virtualBounds);
+ }
+ }
+
+ // 7160609: GL still fails to create a square texture of this size,
+ // so we use this value to cap the total display bounds.
+ native private static int getMaxTextureSize();
+
+ @Override
+ public int getMaxTextureWidth() {
+ int width;
+
+ synchronized (totalDisplayBounds) {
+ if (totalDisplayBounds.width == 0) {
+ updateTotalDisplayBounds();
+ }
+ width = totalDisplayBounds.width;
+ }
+
+ return Math.min(width, getMaxTextureSize());
+ }
+
+ @Override
+ public int getMaxTextureHeight() {
+ int height;
+
+ synchronized (totalDisplayBounds) {
+ if (totalDisplayBounds.height == 0) {
+ updateTotalDisplayBounds();
+ }
+ height = totalDisplayBounds.height;
+ }
+
+ return Math.min(height, getMaxTextureSize());
+ }
}
--- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java Tue Aug 28 12:20:26 2012 -0700
@@ -282,7 +282,7 @@
* Note that we call setVisible() at the end of initialization.
*/
public final void initialize() {
- platformComponent.initialize(target, this, getPlatformWindow());
+ platformComponent.initialize(getPlatformWindow());
initializeImpl();
setVisible(target.isVisible());
}
--- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java Tue Aug 28 12:20:26 2012 -0700
@@ -338,6 +338,18 @@
h = MINIMUM_HEIGHT;
}
+ if (graphicsConfig instanceof TextureSizeConstraining) {
+ final int maxW = ((TextureSizeConstraining)graphicsConfig).getMaxTextureWidth();
+ final int maxH = ((TextureSizeConstraining)graphicsConfig).getMaxTextureHeight();
+
+ if (w > maxW) {
+ w = maxW;
+ }
+ if (h > maxH) {
+ h = maxH;
+ }
+ }
+
// Don't post ComponentMoved/Resized and Paint events
// until we've got a notification from the delegate
setBounds(x, y, w, h, op, false, false);
@@ -405,14 +417,33 @@
@Override
public void updateMinimumSize() {
- Dimension d = null;
+ final Dimension min;
if (getTarget().isMinimumSizeSet()) {
- d = getTarget().getMinimumSize();
+ min = getTarget().getMinimumSize();
+ min.width = Math.max(min.width, MINIMUM_WIDTH);
+ min.height = Math.max(min.height, MINIMUM_HEIGHT);
+ } else {
+ min = new Dimension(MINIMUM_WIDTH, MINIMUM_HEIGHT);
}
- if (d == null) {
- d = new Dimension(MINIMUM_WIDTH, MINIMUM_HEIGHT);
+
+ final int maxW, maxH;
+ if (graphicsConfig instanceof TextureSizeConstraining) {
+ maxW = ((TextureSizeConstraining)graphicsConfig).getMaxTextureWidth();
+ maxH = ((TextureSizeConstraining)graphicsConfig).getMaxTextureHeight();
+ } else {
+ maxW = maxH = Integer.MAX_VALUE;
}
- platformWindow.setMinimumSize(d.width, d.height);
+
+ final Dimension max;
+ if (getTarget().isMaximumSizeSet()) {
+ max = getTarget().getMaximumSize();
+ max.width = Math.min(max.width, maxW);
+ max.height = Math.min(max.height, maxH);
+ } else {
+ max = new Dimension(maxW, maxH);
+ }
+
+ platformWindow.setSizeConstraints(min.width, min.height, max.width, max.height);
}
@Override
--- a/jdk/src/macosx/classes/sun/lwawt/PlatformComponent.java Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/PlatformComponent.java Tue Aug 28 12:20:26 2012 -0700
@@ -23,15 +23,38 @@
* questions.
*/
+
package sun.lwawt;
-import java.awt.Component;
-
+/**
+ * Can be used to store information about native resource related to the
+ * lightweight component.
+ */
public interface PlatformComponent {
- public void initialize(Component target, LWComponentPeer peer, PlatformWindow platformWindow);
+ /**
+ * Initializes platform component.
+ *
+ * @param platformWindow already initialized {@code PlatformWindow}.
+ */
+ void initialize(PlatformWindow platformWindow);
- public void setBounds(int x, int y, int w, int h);
+ /**
+ * Moves and resizes this component. The new location of the top-left corner
+ * is specified by {@code x} and {@code y}, and the new size is specified by
+ * {@code w} and {@code h}. The location is specified relative to the {@code
+ * platformWindow}.
+ *
+ * @param x the X location of the component
+ * @param y the Y location of the component
+ * @param w the width of the component
+ * @param h the height of the component
+ */
+ void setBounds(int x, int y, int w, int h);
- public void dispose();
+ /**
+ * Releases all of the native resources used by this {@code
+ * PlatformComponent}.
+ */
+ void dispose();
}
--- a/jdk/src/macosx/classes/sun/lwawt/PlatformWindow.java Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/PlatformWindow.java Tue Aug 28 12:20:26 2012 -0700
@@ -131,7 +131,10 @@
public void setResizable(boolean resizable);
- public void setMinimumSize(int width, int height);
+ /**
+ * Applies the minimum and maximum size to the platform window.
+ */
+ public void setSizeConstraints(int minW, int minH, int maxW, int maxH);
/**
* Transforms the given Graphics object according to the native
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CFRetainedResource.java Tue Aug 28 12:20:26 2012 -0700
@@ -33,8 +33,8 @@
public class CFRetainedResource {
private static native void nativeCFRelease(final long ptr, final boolean disposeOnAppKitThread);
- final boolean disposeOnAppKitThread;
- protected long ptr;
+ private final boolean disposeOnAppKitThread;
+ protected volatile long ptr;
/**
* @param ptr CFRetained native object pointer
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java Tue Aug 28 12:20:26 2012 -0700
@@ -30,12 +30,14 @@
import java.awt.BufferCapabilities.FlipContents;
import java.awt.event.*;
import java.awt.image.*;
+import java.security.AccessController;
import java.util.List;
import java.io.*;
import sun.awt.CausedFocusEvent.Cause;
import sun.awt.AWTAccessor;
import sun.java2d.pipe.Region;
+import sun.security.action.GetBooleanAction;
class CFileDialog implements FileDialogPeer {
@@ -53,11 +55,14 @@
if (title == null) {
title = " ";
}
+ Boolean chooseDirectories = AccessController.doPrivileged(
+ new GetBooleanAction("apple.awt.fileDialogForDirectories"));
String[] userFileNames = nativeRunFileDialog(title,
dialogMode,
target.isMultipleMode(),
navigateApps,
+ chooseDirectories,
target.getFilenameFilter() != null,
target.getDirectory(),
target.getFile());
@@ -142,7 +147,8 @@
}
private native String[] nativeRunFileDialog(String title, int mode,
- boolean multipleMode, boolean shouldNavigateApps, boolean hasFilenameFilter,
+ boolean multipleMode, boolean shouldNavigateApps,
+ boolean canChooseDirectories, boolean hasFilenameFilter,
String directory, String file);
@Override
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformComponent.java Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformComponent.java Tue Aug 28 12:20:26 2012 -0700
@@ -23,27 +23,24 @@
* questions.
*/
+
package sun.lwawt.macosx;
-import java.awt.Component;
import java.awt.Insets;
import sun.lwawt.PlatformComponent;
import sun.lwawt.PlatformWindow;
-import sun.lwawt.LWComponentPeer;
-
-import sun.lwawt.macosx.CFRetainedResource;
-
-public class CPlatformComponent extends CFRetainedResource implements PlatformComponent {
- Component target;
- LWComponentPeer peer;
- PlatformWindow platformWindow;
+/**
+ * On OSX {@code CPlatformComponent} stores pointer to the native CAlayer which
+ * can be used from JAWT.
+ */
+final class CPlatformComponent extends CFRetainedResource
+ implements PlatformComponent {
- private native long nativeCreateComponent(long windowLayer);
- private native long nativeSetBounds(long ptr, int x, int y, int width, int height);
+ private volatile PlatformWindow platformWindow;
- public CPlatformComponent() {
+ CPlatformComponent() {
super(0, true);
}
@@ -51,27 +48,28 @@
return ptr;
}
- public void initialize(Component target, LWComponentPeer peer, PlatformWindow platformWindow) {
- this.target = target;
- this.peer = peer;
+ @Override
+ public void initialize(final PlatformWindow platformWindow) {
this.platformWindow = platformWindow;
-
- long windowLayerPtr = platformWindow.getLayerPtr();
- setPtr(nativeCreateComponent(windowLayerPtr));
+ setPtr(nativeCreateComponent(platformWindow.getLayerPtr()));
}
// TODO: visibility, z-order
@Override
- public void setBounds(int x, int y, int width, int height) {
+ public void setBounds(final int x, final int y, final int w, final int h) {
// translates values from the coordinate system of the top-level window
// to the coordinate system of the content view
- Insets insets = platformWindow.getPeer().getInsets();
- nativeSetBounds(getPointer(), x - insets.left, y - insets.top, width, height);
+ final Insets insets = platformWindow.getPeer().getInsets();
+ nativeSetBounds(getPointer(), x - insets.left, y - insets.top, w, h);
}
@Override
public void dispose() {
super.dispose();
}
+
+ private native long nativeCreateComponent(long windowLayer);
+
+ private native void nativeSetBounds(long ptr, int x, int y, int w, int h);
}
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformEmbeddedFrame.java Tue Aug 28 12:20:26 2012 -0700
@@ -180,7 +180,7 @@
public void setResizable(boolean resizable) {}
@Override
- public void setMinimumSize(int width, int height) {}
+ public void setSizeConstraints(int minW, int minH, int maxW, int maxH) {}
@Override
public Graphics transformGraphics(Graphics g) {
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java Tue Aug 28 12:20:26 2012 -0700
@@ -672,20 +672,15 @@
// Re-apply the size constraints and the size to ensure the space
// occupied by the grow box is counted properly
- setMinimumSize(1, 1); // the method ignores its arguments
+ peer.updateMinimumSize();
Rectangle bounds = peer.getBounds();
setBounds(bounds.x, bounds.y, bounds.width, bounds.height);
}
@Override
- public void setMinimumSize(int width, int height) {
- //TODO width, height should be used
- //NOTE: setResizable() calls setMinimumSize(1,1) relaying on the logic below
- final long nsWindowPtr = getNSWindowPtr();
- final Dimension min = target.getMinimumSize();
- final Dimension max = target.getMaximumSize();
- nativeSetNSWindowMinMax(nsWindowPtr, min.getWidth(), min.getHeight(), max.getWidth(), max.getHeight());
+ public void setSizeConstraints(int minW, int minH, int maxW, int maxH) {
+ nativeSetNSWindowMinMax(getNSWindowPtr(), minW, minH, maxW, maxH);
}
@Override
--- a/jdk/src/macosx/native/sun/awt/AWTSurfaceLayers.m Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/macosx/native/sun/awt/AWTSurfaceLayers.m Tue Aug 28 12:20:26 2012 -0700
@@ -78,11 +78,10 @@
// translates values to the coordinate system of the "root" layer
CGFloat newY = windowLayer.bounds.size.height - rect.origin.y - rect.size.height;
+ CGRect newRect = CGRectMake(rect.origin.x, newY, rect.size.width, rect.size.height);
- // REMIND: why do we need to inverse position?
- CGRect newRect = CGRectMake(-rect.origin.x, -newY, rect.size.width, rect.size.height);
+ layer.frame = newRect;
- layer.bounds = newRect;
[AWTSurfaceLayers repaintLayersRecursively:layer];
}
--- a/jdk/src/macosx/native/sun/awt/CFileDialog.h Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/macosx/native/sun/awt/CFileDialog.h Tue Aug 28 12:20:26 2012 -0700
@@ -52,6 +52,9 @@
// Should we navigate into apps?
BOOL fNavigateApps;
+ // Can the dialog choose directories ?
+ BOOL fChooseDirectories;
+
// Contains the absolute paths of the selected files as URLs
NSArray *fURLs;
}
@@ -65,6 +68,7 @@
mode:(jint)inMode
multipleMode:(BOOL)inMultipleMode
shouldNavigate:(BOOL)inNavigateApps
+ canChooseDirectories:(BOOL)inChooseDirectories
withEnv:(JNIEnv*)env;
// Invoked from the main thread
--- a/jdk/src/macosx/native/sun/awt/CFileDialog.m Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/macosx/native/sun/awt/CFileDialog.m Tue Aug 28 12:20:26 2012 -0700
@@ -43,6 +43,7 @@
mode:(jint)inMode
multipleMode:(BOOL)inMultipleMode
shouldNavigate:(BOOL)inNavigateApps
+canChooseDirectories:(BOOL)inChooseDirectories
withEnv:(JNIEnv*)env;
{
if (self == [super init]) {
@@ -57,6 +58,7 @@
fMode = inMode;
fMultipleMode = inMultipleMode;
fNavigateApps = inNavigateApps;
+ fChooseDirectories = inChooseDirectories;
fPanelResult = NSCancelButton;
}
@@ -109,7 +111,7 @@
NSOpenPanel *openPanel = (NSOpenPanel *)thePanel;
[openPanel setAllowsMultipleSelection:fMultipleMode];
[openPanel setCanChooseFiles:YES];
- [openPanel setCanChooseDirectories:NO];
+ [openPanel setCanChooseDirectories:fChooseDirectories];
[openPanel setCanCreateDirectories:YES];
}
@@ -182,7 +184,8 @@
JNIEXPORT jobjectArray JNICALL
Java_sun_lwawt_macosx_CFileDialog_nativeRunFileDialog
(JNIEnv *env, jobject peer, jstring title, jint mode, jboolean multipleMode,
- jboolean navigateApps, jboolean hasFilter, jstring directory, jstring file)
+ jboolean navigateApps, jboolean chooseDirectories, jboolean hasFilter,
+ jstring directory, jstring file)
{
jobjectArray returnValue = NULL;
@@ -200,6 +203,7 @@
mode:mode
multipleMode:multipleMode
shouldNavigate:navigateApps
+ canChooseDirectories:chooseDirectories
withEnv:env];
[JNFRunLoop performOnMainThread:@selector(safeSaveOrLoad)
--- a/jdk/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m Tue Aug 28 12:20:26 2012 -0700
@@ -447,3 +447,20 @@
return cglinfo->context->caps;
}
}
+
+JNIEXPORT jint JNICALL
+Java_sun_java2d_opengl_CGLGraphicsConfig_getMaxTextureSize
+ (JNIEnv *env, jclass cglgc)
+{
+ J2dTraceLn(J2D_TRACE_INFO, "CGLGraphicsConfig_getMaxTextureSize");
+
+ __block int max = 0;
+
+ [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
+ [sharedContext makeCurrentContext];
+ j2d_glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max);
+ }];
+
+ return (jint)max;
+}
+
--- a/jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.h Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.h Tue Aug 28 12:20:26 2012 -0700
@@ -28,7 +28,6 @@
@interface NSApplicationAWT : NSApplication {
NSString *fApplicationName;
- BOOL fUseDefaultIcon;
NSWindow *eventTransparentWindow;
}
--- a/jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.m Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/macosx/native/sun/osxapp/NSApplicationAWT.m Tue Aug 28 12:20:26 2012 -0700
@@ -52,7 +52,6 @@
AWT_ASSERT_APPKIT_THREAD;
fApplicationName = nil;
- fUseDefaultIcon = NO;
// NSApplication will call _RegisterApplication with the application's bundle, but there may not be one.
// So, we need to call it ourselves to ensure the app is set up properly.
@@ -147,10 +146,6 @@
if (appName != NULL) {
fApplicationName = [NSString stringWithUTF8String:appName];
unsetenv(envVar);
-
- // If this environment variable was set we were launched from the command line, so we
- // should use a generic app icon if one wasn't set.
- fUseDefaultIcon = YES;
}
// If it wasn't specified as an argument, see if it was specified as a system property.
@@ -171,9 +166,6 @@
if (lastPeriod.location != NSNotFound) {
fApplicationName = [fApplicationName substringFromIndex:lastPeriod.location + 1];
}
- // If this environment variable was set we were launched from the command line, so we
- // should use a generic app icon if one wasn't set.
- fUseDefaultIcon = YES;
}
}
@@ -266,8 +258,11 @@
// If the icon file wasn't specified as an argument and we need to get an icon
// we'll use the generic java app icon.
NSString *defaultIconPath = [NSString stringWithFormat:@"%@%@", SHARED_FRAMEWORK_BUNDLE, @"/Resources/GenericApp.icns"];
- if (fUseDefaultIcon && (theIconPath == nil)) {
- theIconPath = defaultIconPath;
+ if (theIconPath == nil) {
+ NSString* bundleIcon = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIconFile"];
+ if (bundleIcon == nil) {
+ theIconPath = defaultIconPath;
+ }
}
// Set up the dock icon if we have an icon name.
--- a/jdk/src/share/classes/java/awt/Component.java Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/share/classes/java/awt/Component.java Tue Aug 28 12:20:26 2012 -0700
@@ -150,7 +150,7 @@
* import java.awt.event.*;
* import java.io.Serializable;
*
- * class MyApp java.io.Serializable
+ * class MyApp implements java.io.Serializable
* {
* BigObjectThatShouldNotBeSerializedWithAButton bigOne;
* Button aButton = new Button();
--- a/jdk/src/share/classes/java/awt/EventQueue.java Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/share/classes/java/awt/EventQueue.java Tue Aug 28 12:20:26 2012 -0700
@@ -36,6 +36,8 @@
import java.security.PrivilegedAction;
import java.util.EmptyStackException;
+
+import sun.awt.dnd.SunDropTargetEvent;
import sun.util.logging.PlatformLogger;
import sun.awt.AppContext;
@@ -464,7 +466,9 @@
case MouseEvent.MOUSE_MOVED:
return MOVE;
case MouseEvent.MOUSE_DRAGGED:
- return DRAG;
+ // Return -1 for SunDropTargetEvent since they are usually synchronous
+ // and we don't want to skip them by coalescing with MouseEvent or other drag events
+ return e instanceof SunDropTargetEvent ? -1 : DRAG;
default:
return e instanceof PeerEvent ? PEER : -1;
}
--- a/jdk/src/share/classes/java/beans/PropertyDescriptor.java Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/share/classes/java/beans/PropertyDescriptor.java Tue Aug 28 12:20:26 2012 -0700
@@ -657,7 +657,7 @@
throw new IntrospectionException("bad write method arg count: "
+ writeMethod);
}
- if (propertyType != null && propertyType != params[0]) {
+ if (propertyType != null && !params[0].isAssignableFrom(propertyType)) {
throw new IntrospectionException("type mismatch between read and write methods");
}
propertyType = params[0];
--- a/jdk/src/share/classes/javax/swing/JTable.java Mon Aug 27 11:28:08 2012 -0700
+++ b/jdk/src/share/classes/javax/swing/JTable.java Tue Aug 28 12:20:26 2012 -0700
@@ -8590,7 +8590,7 @@
* <code>null</code> if this object is not on the screen
*/
public Point getLocationOnScreen() {
- if (parent != null) {
+ if (parent != null && parent.isShowing()) {
Point parentLocation = parent.getLocationOnScreen();
Point componentLocation = getLocation();
componentLocation.translate(parentLocation.x, parentLocation.y);
@@ -9391,7 +9391,7 @@
* <code>null</code> if this object is not on the screen
*/
public Point getLocationOnScreen() {
- if (parent != null) {
+ if (parent != null && parent.isShowing()) {
Point parentLocation = parent.getLocationOnScreen();
Point componentLocation = getLocation();
componentLocation.translate(parentLocation.x, parentLocation.y);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/share/classes/sun/awt/TextureSizeConstraining.java Tue Aug 28 12:20:26 2012 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2012, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.awt;
+
+/**
+ * A GraphicsConfiguration implements the TextureSizeConstraining
+ * interface to indicate that it imposes certain limitations on the
+ * maximum size of supported textures.
+ */
+public interface TextureSizeConstraining {
+
+ /**
+ * Returns the maximum width of any texture image.
+ */
+ public int getMaxTextureWidth();
+
+ /**
+ * Returns the maximum height of any texture image.
+ */
+ public int getMaxTextureHeight();
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Frame/HugeFrame/HugeFrame.java Tue Aug 28 12:20:26 2012 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2012, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ @test
+ @bug 7160609
+ @summary A window with huge dimensions shouldn't crash JVM
+ @author anthony.petrov@oracle.com: area=awt.toplevel
+ @run main HugeFrame
+*/
+
+import java.awt.*;
+
+public class HugeFrame {
+ public static void main(String[] args) throws Exception {
+ Frame f = new Frame("Huge");
+
+ // 8193+ should already produce a crash, but let's go extreme...
+ f.setBounds(10, 10, 30000, 500000);
+ f.setVisible(true);
+
+ // We would crash by now if the bug wasn't fixed
+ Thread.sleep(1000);
+ System.err.println(f.getBounds());
+
+ // Cleanup
+ f.dispose();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Introspector/Test7189112.java Tue Aug 28 12:20:26 2012 -0700
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2012, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7189112
+ * @summary Tests overridden getter
+ * @author Sergey Malenkov
+ */
+
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+
+public class Test7189112 {
+
+ public static void main(String[] args) throws IntrospectionException {
+ for (PropertyDescriptor pd : Introspector.getBeanInfo(MyBean.class).getPropertyDescriptors()) {
+ if (pd.getName().equals("value") && (null == pd.getWriteMethod())) {
+ throw new Error("The property setter is not found");
+ }
+ }
+ }
+
+ public static class BaseBean {
+
+ private Object value;
+
+ public Object getValue() {
+ return this.value;
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+ }
+
+ public static class MyBean extends BaseBean {
+ @Override
+ public String getValue() {
+ return (String) super.getValue();
+ }
+ }
+}
--- a/jdk/test/javax/swing/JColorChooser/Test4380468.html Mon Aug 27 11:28:08 2012 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<html>
-<body>
-1. Click the HSB tab at the ColorChooser.
-2. Click in the lower left corner of the gradient palette
- in order to select a color such that all three RGB values
- are single digit colors (such as 0, 0, 0 or 5, 3, 1).
-3. Click another tab, then click back to the HSB tab.
-4. Now click the lighter colors that should have
- 2 and 3 digit RGB values (in the upper right corner).
-
-If all digits of each RGB value are shown then test passes.
-If only the last digit of their values are shown then test fails.
-
-<applet width="500" height="400" code="Test4380468.class">
-</applet>
-</body>
-</html>
--- a/jdk/test/javax/swing/JColorChooser/Test4380468.java Mon Aug 27 11:28:08 2012 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2000, 2008, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * @test
- * @bug 4380468
- * @summary JColorChooser's HSB panel should display all RGB digits
- * @author Andrey Pikalev
- * @run applet/manual=yesno Test4380468.html
- */
-
-import java.awt.Color;
-import javax.swing.JApplet;
-import javax.swing.JColorChooser;
-
-public class Test4380468 extends JApplet {
- public void init() {
- add(new JColorChooser(Color.GREEN));
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JSplitPane/4201995/bug4201995.java Tue Aug 28 12:20:26 2012 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2012, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4201995
+ * @summary Tests that JSplitPane is opaque
+ * @author Scott Violet
+ */
+
+import javax.swing.*;
+
+public class bug4201995 {
+ public static void main(String[] args) throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ boolean expectedOpaqueValue = !"Nimbus".equals(UIManager.getLookAndFeel().getName());
+ JSplitPane sp = new JSplitPane();
+
+ if (sp.isOpaque() != expectedOpaqueValue) {
+ throw new RuntimeException("JSplitPane has incorrect default opaque value");
+ }
+ }
+ });
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTable/4235420/bug4235420.java Tue Aug 28 12:20:26 2012 -0700
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2012 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ @bug 4235420
+ @summary Tests that JTable delays creating Renderers and Editors
+ @author Peter Zhelezniakov
+*/
+
+import javax.swing.*;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+public class bug4235420 {
+
+ public static void main(String[] argv) throws Exception {
+ if ("Nimbus".equals(UIManager.getLookAndFeel().getName())) {
+ System.out.println("The test is skipped for Nimbus");
+
+ return;
+ }
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ Table table = new Table();
+
+ table.test();
+ }
+ });
+ }
+
+ private static class Table extends JTable {
+ public void test() {
+ // Renderers
+ Class[] rendererClasses = {Object.class, Number.class, Date.class, ImageIcon.class, Boolean.class};
+
+ Map copy = new HashMap(defaultRenderersByColumnClass);
+
+ for (Class rendererClass : rendererClasses) {
+ Object obj = copy.get(rendererClass);
+
+ if (obj instanceof TableCellRenderer) {
+ throw new Error("Failed: TableCellRenderer created for " +
+ rendererClass.getClass().getName());
+ }
+ }
+
+ // Editors
+ Class[] editorClasses = {Object.class, Number.class, Boolean.class};
+
+ copy = new HashMap(defaultEditorsByColumnClass);
+
+ for (Class editorClass : editorClasses) {
+ Object obj = copy.get(editorClass);
+
+ if (obj instanceof TableCellEditor) {
+ throw new Error("Failed: TableCellEditor created for " +
+ editorClass.getClass().getName());
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTable/7188612/JTableAccessibleGetLocationOnScreen.java Tue Aug 28 12:20:26 2012 -0700
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2012 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Portions Copyright (c) 2012 IBM Corporation
+ */
+
+/* @test
+ * @bug 7188612
+ * @summary AccessibleTableHeader and AccessibleJTableCell should stick to
+ * AccessibleComponent.getLocationOnScreen api.
+ * @author Frank Ding
+ */
+
+import javax.accessibility.AccessibleComponent;
+import javax.accessibility.AccessibleTable;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JTable;
+import javax.swing.SwingUtilities;
+
+public class JTableAccessibleGetLocationOnScreen {
+ private static JFrame frame;
+ private static JTable table;
+
+ public static void main(String[] args) throws Exception {
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ constructInEDT();
+ try {
+ assertGetLocation();
+ } finally {
+ frame.dispose();
+ }
+ }
+ });
+
+ }
+
+ private static void constructInEDT() {
+ String[] columnNames = { "col1", "col2", };
+ Object[][] data = { { "row1, col1", "row1, col2" },
+ { "row2, col1", "row2, col2" }, };
+
+ frame = new JFrame(
+ "JTable AccessibleTableHeader and AccessibleJTableCell test");
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ table = new JTable(data, columnNames);
+ frame.add(table);
+ frame.pack();
+ }
+
+ private static void assertGetLocation() {
+ // the frame is now invisible
+ // test getLocationOnScreen() of
+ // JTable$AccessibleJTable$AccessibleJTableHeaderCell
+ // and JTable$AccessibleJTable$AccessibleJTableCell
+ AccessibleTable accessibleTable = (AccessibleTable) table
+ .getAccessibleContext();
+ AccessibleTable header = accessibleTable.getAccessibleColumnHeader();
+ AccessibleComponent accessibleComp1 = (AccessibleComponent) header
+ .getAccessibleAt(0, 0);
+ // getLocation() must be null according to its javadoc and no exception
+ // is thrown
+ if (null != accessibleComp1.getLocationOnScreen()) {
+ throw new RuntimeException(
+ "JTable$AccessibleJTable$AccessibleJTableHeaderCell."
+ + "getLocation() must be null");
+ }
+
+ JComponent.AccessibleJComponent accessibleJComponent =
+ (JComponent.AccessibleJComponent) table.getAccessibleContext();
+ AccessibleComponent accessibleComp2 = (AccessibleComponent)
+ accessibleJComponent.getAccessibleChild(3);
+ // getLocation() must be null according to its javadoc and no exception
+ // is thrown
+ if (null != accessibleComp2.getLocationOnScreen()) {
+ throw new RuntimeException("JTable$AccessibleJTable$"
+ + "AccessibleJTableCell.getLocation() must be null");
+ }
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/tools/launcher/RunpathTest.java Tue Aug 28 12:20:26 2012 -0700
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2012, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7190813
+ * @summary Check for extended RPATHs on *nixes
+ * @compile -XDignore.symbol.file RunpathTest.java
+ * @run main RunpathTest
+ * @author ksrini
+ */
+
+import java.io.File;
+
+public class RunpathTest extends TestHelper {
+
+ final String elfreaderCmd;
+ RunpathTest() {
+ elfreaderCmd = findElfReader();
+ }
+
+ final String findElfReader() {
+ String[] paths = {"/bin", "/sbin", "/usr/bin", "/usr/sbin", "/usr/ccs/bin"};
+ final String cmd = isSolaris ? "elfdump" : "readelf";
+ for (String x : paths) {
+ File p = new File(x);
+ File e = new File(p, cmd);
+ if (e.canExecute()) {
+ return e.getAbsolutePath();
+ }
+ }
+ System.err.println("Warning: no suitable elf reader!");
+ return null;
+ }
+
+ void elfCheck(String javacmd, String expectedRpath) {
+ final TestResult tr = doExec(elfreaderCmd, "-d", javacmd);
+ if (!tr.matches(expectedRpath)) {
+ System.out.println(tr);
+ throw new RuntimeException("FAILED: RPATH strings " +
+ expectedRpath + " not found in " + javaCmd);
+ }
+ System.out.println(javacmd + " contains expected RPATHS");
+ }
+
+ void testRpath() {
+ if (isDualMode && is64Bit) {
+ String expectedRpath = ".*RPATH.*\\$ORIGIN/../../lib/" + getJreArch()
+ + ":\\$ORIGIN/../../jre/lib/" + getJreArch() + ".*";
+ elfCheck(java64Cmd, expectedRpath);
+ } else {
+ String expectedRpath = ".*RPATH.*\\$ORIGIN/../lib/" + getJreArch()
+ + ":\\$ORIGIN/../jre/lib/" + getJreArch() + ".*";
+ elfCheck(javaCmd, expectedRpath);
+ }
+ }
+
+ public static void main(String... args) throws Exception {
+ if (isSolaris || isLinux) {
+ RunpathTest rp = new RunpathTest();
+ rp.testRpath();
+ }
+ }
+}