You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(97) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(127) |
Feb
(34) |
Mar
(16) |
Apr
(26) |
May
(55) |
Jun
(107) |
Jul
(36) |
Aug
(72) |
Sep
(90) |
Oct
(41) |
Nov
(27) |
Dec
(13) |
2008 |
Jan
(37) |
Feb
(39) |
Mar
(98) |
Apr
(115) |
May
(134) |
Jun
(120) |
Jul
(86) |
Aug
(149) |
Sep
(68) |
Oct
(66) |
Nov
(104) |
Dec
(49) |
2009 |
Jan
(131) |
Feb
(132) |
Mar
(125) |
Apr
(172) |
May
(161) |
Jun
(43) |
Jul
(47) |
Aug
(38) |
Sep
(18) |
Oct
(6) |
Nov
(1) |
Dec
(15) |
2010 |
Jan
(21) |
Feb
(8) |
Mar
(10) |
Apr
(4) |
May
(9) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(4) |
2011 |
Jan
(23) |
Feb
(10) |
Mar
(13) |
Apr
(3) |
May
|
Jun
(19) |
Jul
(11) |
Aug
(22) |
Sep
|
Oct
(4) |
Nov
(2) |
Dec
(12) |
2012 |
Jan
(3) |
Feb
(4) |
Mar
(7) |
Apr
(3) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(30) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(8) |
2013 |
Jan
(3) |
Feb
(40) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(12) |
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: <ls...@us...> - 2007-01-11 19:29:16
|
Revision: 3069 http://jnode.svn.sourceforge.net/jnode/?rev=3069&view=rev Author: lsantha Date: 2007-01-11 11:29:15 -0800 (Thu, 11 Jan 2007) Log Message: ----------- Added support for transparency, based on a patch from Andrei Dore. Modified Paths: -------------- trunk/gui/src/awt/org/jnode/awt/util/BitmapGraphics.java Modified: trunk/gui/src/awt/org/jnode/awt/util/BitmapGraphics.java =================================================================== --- trunk/gui/src/awt/org/jnode/awt/util/BitmapGraphics.java 2007-01-11 19:27:07 UTC (rev 3068) +++ trunk/gui/src/awt/org/jnode/awt/util/BitmapGraphics.java 2007-01-11 19:29:15 UTC (rev 3069) @@ -29,7 +29,7 @@ import java.awt.image.DataBufferShort; import java.awt.image.DataBufferUShort; import java.awt.image.Raster; -import java.awt.Rectangle; +import java.awt.*; import javax.naming.NamingException; @@ -212,18 +212,23 @@ private byte[] alphaBuffer; + protected final int transparency; + /** * @param mem * @param width * @param height * @param offset * @param bytesPerLine + * @param transparency */ public BitmapGraphics32bpp(MemoryResource mem, int width, int height, - int offset, int bytesPerLine) { + int offset, int bytesPerLine, int transparency) { super(mem, width, height, offset, bytesPerLine); + this.transparency = transparency; } + /** * @see org.jnode.awt.util.BitmapGraphics#doCopyArea(int, int, int, int, * int, int) @@ -241,12 +246,14 @@ protected void doDrawImage(Raster src, int srcX, int srcY, int dstX, int dstY, int width, int height) { - final int[] buf = new int[width]; + final int[] buf = getPixelBuffer(width); for (int row = 0; row < height; row++) { - final int ofs = offset + ((dstY + row) * bytesPerLine) - + (dstX << 2); + final int ofs = offset + ((dstY + row) * bytesPerLine) + (dstX << 2); src.getDataElements(srcX, srcY + row, width, 1, buf); - mem.setInts(buf, 0, ofs, width); + if(transparency == Transparency.TRANSLUCENT) + mem.setARGB32bpp(buf, 0, ofs, width); + else + mem.setInts(buf, 0, ofs, width); } } @@ -482,10 +489,24 @@ */ public static BitmapGraphics create32bppInstance(MemoryResource mem, int width, int height, int bytesPerLine, int offset) { - return new BitmapGraphics32bpp(mem, width, height, offset, bytesPerLine); + return new BitmapGraphics32bpp(mem, width, height, offset, bytesPerLine, Transparency.OPAQUE); } /** + * Create a new instance for 32 bits/pixel layout + * + * @param mem + * @param width + * @param height + * @param bytesPerLine + * @param offset + * @return The created instance + */ + public static BitmapGraphics create32bppInstance(MemoryResource mem, + int width, int height, int bytesPerLine, int offset, int transparency) { + return new BitmapGraphics32bpp(mem, width, height, offset, bytesPerLine, transparency); + } + /** * Create a new instance for 8 bits/pixel layout * * @param mem @@ -510,7 +531,7 @@ * @return The created instance */ public static BitmapGraphics createInstance(DataBuffer dataBuffer, - int width, int height, int bytesPerLine) { + int width, int height, int bytesPerLine, int transparency) { final ResourceManager rm; try { rm = (ResourceManager) InitialNaming.lookup(ResourceManager.NAME); @@ -537,7 +558,7 @@ case DataBuffer.TYPE_INT: { final int[] data = ((DataBufferInt) dataBuffer).getData(); return new BitmapGraphics32bpp(rm.asMemoryResource(data), width, - height, dbOffset * 4, bytesPerLine); + height, dbOffset * 4, bytesPerLine, transparency); } default: { throw new RuntimeException("Unimplemented databuffer type " This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2007-01-11 19:27:12
|
Revision: 3068 http://jnode.svn.sourceforge.net/jnode/?rev=3068&view=rev Author: lsantha Date: 2007-01-11 11:27:07 -0800 (Thu, 11 Jan 2007) Log Message: ----------- Added support for transparency, based on a patch from Andrei Dore. Modified Paths: -------------- trunk/gui/src/awt/org/jnode/awt/JNodeGraphicsConfiguration.java trunk/gui/src/awt/org/jnode/awt/image/BufferedImageSurface.java Modified: trunk/gui/src/awt/org/jnode/awt/JNodeGraphicsConfiguration.java =================================================================== --- trunk/gui/src/awt/org/jnode/awt/JNodeGraphicsConfiguration.java 2007-01-10 20:59:25 UTC (rev 3067) +++ trunk/gui/src/awt/org/jnode/awt/JNodeGraphicsConfiguration.java 2007-01-11 19:27:07 UTC (rev 3068) @@ -67,7 +67,7 @@ * @return The image */ public BufferedImage createCompatibleImage(int w, int h) { - return createCompatibleImage(w, h, Transparency.OPAQUE); + return createCompatibleImage(w, h, config.getColorModel().getTransparency()); } /** Modified: trunk/gui/src/awt/org/jnode/awt/image/BufferedImageSurface.java =================================================================== --- trunk/gui/src/awt/org/jnode/awt/image/BufferedImageSurface.java 2007-01-10 20:59:25 UTC (rev 3067) +++ trunk/gui/src/awt/org/jnode/awt/image/BufferedImageSurface.java 2007-01-11 19:27:07 UTC (rev 3068) @@ -35,7 +35,7 @@ final int dataType = dataBuffer.getDataType(); final int dataTypeSize = DataBuffer.getDataTypeSize(dataType); log.debug("dataTypeSize=" + dataTypeSize + ", dataType=" + dataType); - this.bitmapGraphics = BitmapGraphics.createInstance(dataBuffer, width, height, sppSM.getScanlineStride() * dataTypeSize / 8); + this.bitmapGraphics = BitmapGraphics.createInstance(dataBuffer, width, height, sppSM.getScanlineStride() * dataTypeSize / 8, model.getTransparency()); } else { this.bitmapGraphics = null; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2007-01-10 20:59:28
|
Revision: 3067 http://jnode.svn.sourceforge.net/jnode/?rev=3067&view=rev Author: lsantha Date: 2007-01-10 12:59:25 -0800 (Wed, 10 Jan 2007) Log Message: ----------- Still keep the compiler settings on 1.5 level for some time. Modified Paths: -------------- trunk/all/build.xml Modified: trunk/all/build.xml =================================================================== --- trunk/all/build.xml 2007-01-10 16:08:14 UTC (rev 3066) +++ trunk/all/build.xml 2007-01-10 20:59:25 UTC (rev 3067) @@ -7,8 +7,8 @@ <property name="jnode-ver" value="0.2.5-dev"/> <!-- Java target and source version --> - <property name="java.target" value="1.6"/> - <property name="java.source" value="1.6"/> + <property name="java.target" value="1.5"/> + <property name="java.source" value="1.5"/> <property name="java.encoding" value="US-ASCII"/> <property name="root.dir" value="${basedir}/.."/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kon...@us...> - 2007-01-10 16:08:17
|
Revision: 3066 http://jnode.svn.sourceforge.net/jnode/?rev=3066&view=rev Author: konkubinaten Date: 2007-01-10 08:08:14 -0800 (Wed, 10 Jan 2007) Log Message: ----------- created a new branch to test the new networking implementation from jpg Added Paths: ----------- branches/newNetworkingImpl/ Copied: branches/newNetworkingImpl (from rev 3065, trunk) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kon...@us...> - 2007-01-10 16:03:02
|
Revision: 3065 http://jnode.svn.sourceforge.net/jnode/?rev=3065&view=rev Author: konkubinaten Date: 2007-01-10 08:02:50 -0800 (Wed, 10 Jan 2007) Log Message: ----------- The net_packet branch is out of date and not needed any more Removed Paths: ------------- branches/net_packet/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hag...@us...> - 2007-01-10 14:22:28
|
Revision: 3064 http://jnode.svn.sourceforge.net/jnode/?rev=3064&view=rev Author: hagar-wize Date: 2007-01-10 06:22:26 -0800 (Wed, 10 Jan 2007) Log Message: ----------- updated to java 1.6 dnsjava 2.0.3 Modified Paths: -------------- trunk/all/build.xml Modified: trunk/all/build.xml =================================================================== --- trunk/all/build.xml 2007-01-10 14:00:35 UTC (rev 3063) +++ trunk/all/build.xml 2007-01-10 14:22:26 UTC (rev 3064) @@ -7,8 +7,8 @@ <property name="jnode-ver" value="0.2.5-dev"/> <!-- Java target and source version --> - <property name="java.target" value="1.5"/> - <property name="java.source" value="1.5"/> + <property name="java.target" value="1.6"/> + <property name="java.source" value="1.6"/> <property name="java.encoding" value="US-ASCII"/> <property name="root.dir" value="${basedir}/.."/> @@ -30,11 +30,11 @@ <property name="jnode-net.jar" value="${root.dir}/net/build/classes"/> <property name="jnode-shell.jar" value="${root.dir}/shell/build/classes"/> <property name="jnode-fonts.jar" value="${build.dir}/descriptors/jnode-fonts.jar"/> - <property name="jnode-images.jar" value="${build.dir}/descriptors/jnode-images.jar"/> + <property name="jnode-images.jar" value="${build.dir}/descriptors/jnode-images.jar"/> - <property name="jnode-mmtk-genrc.jar" value="${root.dir}/core/build/classes-plan/org.jnode.vm.memmgr.mmtk.genrc"/> - <property name="jnode-mmtk-ms.jar" value="${root.dir}/core/build/classes-plan/org.jnode.vm.memmgr.mmtk.ms"/> - <property name="jnode-mmtk-nogc.jar" value="${root.dir}/core/build/classes-plan/org.jnode.vm.memmgr.mmtk.nogc"/> + <property name="jnode-mmtk-genrc.jar" value="${root.dir}/core/build/classes-plan/org.jnode.vm.memmgr.mmtk.genrc"/> + <property name="jnode-mmtk-ms.jar" value="${root.dir}/core/build/classes-plan/org.jnode.vm.memmgr.mmtk.ms"/> + <property name="jnode-mmtk-nogc.jar" value="${root.dir}/core/build/classes-plan/org.jnode.vm.memmgr.mmtk.nogc"/> <property name="mx4j.jar" value="${root.dir}/core/lib/mx4j.jar"/> <property name="mx4j-remote.jar" value="${root.dir}/core/lib/mx4j-remote.jar"/> @@ -42,11 +42,11 @@ <property name="ant.jar" value="${root.dir}/core/lib/ant.jar"/> <property name="ant-launcher.jar" value="${root.dir}/core/lib/ant-launcher.jar"/> <property name="commons-net.jar" value="${root.dir}/core/lib/commons-net-1.1.0.jar"/> - <property name="dnsjava.jar" value="${root.dir}/net/lib/dnsjava-2.0.1a.jar"/> + <property name="dnsjava.jar" value="${root.dir}/net/lib/dnsjava-2.0.3.jar"/> <property name="jsch.jar" value="${root.dir}/net/lib/jsch-0.1.24.jar"/> <property name="junit.jar" value="${root.dir}/core/lib/junit.jar"/> <property name="mmtk.jar" value="${root.dir}/core/lib/mmtk/mmtk.jar"/> - <property name="mauve.jar" value="${root.dir}/core/lib/mauve.jar"/> + <property name="mauve.jar" value="${root.dir}/core/lib/mauve.jar"/> <property name="edtftpj.jar" value="${root.dir}/fs/lib/edtftpj-1.5.2.jar"/> <property name="jcifs.jar" value="${root.dir}/fs/lib/jcifs-1.2.6.jar"/> <property name="ejc.jar" value="${root.dir}/core/lib/ejc-3.1.1.jar"/> @@ -56,8 +56,8 @@ <property name="jmock.jar" value="${root.dir}/core/lib/jmock-1.0.1.jar"/> <property name="cglib.jar" value="${root.dir}/core/lib/cglib-2.1.jar"/> <property name="asm.jar" value="${root.dir}/core/lib/asm.jar"/> - <property name="jcfe.jar" value="${root.dir}/core/lib/jcfe.jar"/> - <property name="jfunc.jar" value="${root.dir}/core/lib/jfunc.jar"/> + <property name="jcfe.jar" value="${root.dir}/core/lib/jcfe.jar"/> + <property name="jfunc.jar" value="${root.dir}/core/lib/jfunc.jar"/> <property name="log4j.jar" value="${root.dir}/core/lib/log4j-1.2.8.jar"/> <property name="gnu-crypto.jar" value="${root.dir}/core/lib/gnu-crypto.jar"/> @@ -183,7 +183,7 @@ <libalias name="mx4j-remote.jar" alias="${mx4j-remote.jar}"/> <libalias name="commons-net-1.1.0.jar" alias="${commons-net.jar}"/> - <libalias name="dnsjava-1.5.0.jar" alias="${dnsjava.jar}"/> + <libalias name="dnsjava-2.0.3.jar" alias="${dnsjava.jar}"/> <libalias name="jsch-0.1.24.jar" alias="${jsch.jar}"/> <libalias name="gnu-crypto.jar" alias="${gnu-crypto.jar}"/> <libalias name="javax-crypto.jar" alias="${javax-crypto.jar}"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hag...@us...> - 2007-01-10 14:00:38
|
Revision: 3063 http://jnode.svn.sourceforge.net/jnode/?rev=3063&view=rev Author: hagar-wize Date: 2007-01-10 06:00:35 -0800 (Wed, 10 Jan 2007) Log Message: ----------- updated to dnsjava 2.0.3 Modified Paths: -------------- trunk/net/descriptors/org.xbill.dns.xml Added Paths: ----------- trunk/net/lib/dnsjava-2.0.3.jar Removed Paths: ------------- trunk/net/lib/dnsjava-1.5.0.jar trunk/net/lib/dnsjava-2.0.1a.jar Modified: trunk/net/descriptors/org.xbill.dns.xml =================================================================== --- trunk/net/descriptors/org.xbill.dns.xml 2007-01-09 20:25:48 UTC (rev 3062) +++ trunk/net/descriptors/org.xbill.dns.xml 2007-01-10 14:00:35 UTC (rev 3063) @@ -3,7 +3,7 @@ <plugin id="org.xbill.dns" name="DNSJava" - version="1.5.0" + version="2.0.3" provider-name="XBill.org" provider-url="http://www.dnsjava.org" license-name="BSD like" @@ -11,7 +11,7 @@ <runtime> - <library name="dnsjava-1.5.0.jar"> + <library name="dnsjava-2.0.3.jar"> <export name="*"/> </library> </runtime> Deleted: trunk/net/lib/dnsjava-1.5.0.jar =================================================================== (Binary files differ) Deleted: trunk/net/lib/dnsjava-2.0.1a.jar =================================================================== (Binary files differ) Added: trunk/net/lib/dnsjava-2.0.3.jar =================================================================== (Binary files differ) Property changes on: trunk/net/lib/dnsjava-2.0.3.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2007-01-09 20:25:51
|
Revision: 3062 http://jnode.svn.sourceforge.net/jnode/?rev=3062&view=rev Author: lsantha Date: 2007-01-09 12:25:48 -0800 (Tue, 09 Jan 2007) Log Message: ----------- Classpath patches. Modified Paths: -------------- trunk/core/src/classpath/javax/javax/swing/AbstractButton.java trunk/core/src/classpath/javax/javax/swing/AbstractListModel.java trunk/core/src/classpath/javax/javax/swing/AbstractSpinnerModel.java trunk/core/src/classpath/javax/javax/swing/ButtonGroup.java trunk/core/src/classpath/javax/javax/swing/DefaultBoundedRangeModel.java trunk/core/src/classpath/javax/javax/swing/DefaultButtonModel.java trunk/core/src/classpath/javax/javax/swing/DefaultComboBoxModel.java trunk/core/src/classpath/javax/javax/swing/DefaultListModel.java trunk/core/src/classpath/javax/javax/swing/DefaultListSelectionModel.java trunk/core/src/classpath/javax/javax/swing/DefaultSingleSelectionModel.java trunk/core/src/classpath/javax/javax/swing/JButton.java trunk/core/src/classpath/javax/javax/swing/JComboBox.java trunk/core/src/classpath/javax/javax/swing/JEditorPane.java trunk/core/src/classpath/javax/javax/swing/JFileChooser.java trunk/core/src/classpath/javax/javax/swing/JFormattedTextField.java trunk/core/src/classpath/javax/javax/swing/JList.java trunk/core/src/classpath/javax/javax/swing/JMenuBar.java trunk/core/src/classpath/javax/javax/swing/JRootPane.java trunk/core/src/classpath/javax/javax/swing/JScrollPane.java trunk/core/src/classpath/javax/javax/swing/JTabbedPane.java trunk/core/src/classpath/javax/javax/swing/JToggleButton.java trunk/core/src/classpath/javax/javax/swing/JToolTip.java trunk/core/src/classpath/javax/javax/swing/JWindow.java trunk/core/src/classpath/javax/javax/swing/LookAndFeel.java trunk/core/src/classpath/javax/javax/swing/Popup.java trunk/core/src/classpath/javax/javax/swing/SizeSequence.java trunk/core/src/classpath/javax/javax/swing/SortingFocusTraversalPolicy.java trunk/core/src/classpath/javax/javax/swing/SpinnerListModel.java trunk/core/src/classpath/javax/javax/swing/Timer.java trunk/core/src/classpath/javax/javax/swing/UIDefaults.java Modified: trunk/core/src/classpath/javax/javax/swing/AbstractButton.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/AbstractButton.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/AbstractButton.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -37,8 +37,6 @@ package javax.swing; -import gnu.classpath.NotImplementedException; - import java.awt.Component; import java.awt.Graphics; import java.awt.Image; @@ -74,7 +72,10 @@ import javax.swing.plaf.basic.BasicHTML; import javax.swing.text.AttributeSet; import javax.swing.text.BadLocationException; +import javax.swing.text.Document; +import javax.swing.text.Element; import javax.swing.text.Position; +import javax.swing.text.StyledDocument; import javax.swing.text.View; @@ -804,22 +805,127 @@ return -1; } - public String getAtIndex(int value0, int value1) - throws NotImplementedException + /** + * Returns the character, word or sentence at the specified index. The + * <code>part</code> parameter determines what is returned, the character, + * word or sentence after the index. + * + * @param part one of {@link AccessibleText#CHARACTER}, + * {@link AccessibleText#WORD} or + * {@link AccessibleText#SENTENCE}, specifying what is returned + * @param index the index + * + * @return the character, word or sentence after <code>index</code> + */ + public String getAtIndex(int part, int index) { - return null; // TODO + String result = ""; + int startIndex = -1; + int endIndex = -1; + switch(part) + { + case AccessibleText.CHARACTER: + result = String.valueOf(text.charAt(index)); + break; + case AccessibleText.WORD: + startIndex = text.lastIndexOf(' ', index); + endIndex = text.indexOf(' ', startIndex + 1); + if (endIndex == -1) + endIndex = startIndex + 1; + result = text.substring(startIndex + 1, endIndex); + break; + case AccessibleText.SENTENCE: + default: + startIndex = text.lastIndexOf('.', index); + endIndex = text.indexOf('.', startIndex + 1); + if (endIndex == -1) + endIndex = startIndex + 1; + result = text.substring(startIndex + 1, endIndex); + break; + } + return result; } - public String getAfterIndex(int value0, int value1) - throws NotImplementedException + /** + * Returns the character, word or sentence after the specified index. The + * <code>part</code> parameter determines what is returned, the character, + * word or sentence after the index. + * + * @param part one of {@link AccessibleText#CHARACTER}, + * {@link AccessibleText#WORD} or + * {@link AccessibleText#SENTENCE}, specifying what is returned + * @param index the index + * + * @return the character, word or sentence after <code>index</code> + */ + public String getAfterIndex(int part, int index) { - return null; // TODO + String result = ""; + int startIndex = -1; + int endIndex = -1; + switch(part) + { + case AccessibleText.CHARACTER: + result = String.valueOf(text.charAt(index + 1)); + break; + case AccessibleText.WORD: + startIndex = text.indexOf(' ', index); + endIndex = text.indexOf(' ', startIndex + 1); + if (endIndex == -1) + endIndex = startIndex + 1; + result = text.substring(startIndex + 1, endIndex); + break; + case AccessibleText.SENTENCE: + default: + startIndex = text.indexOf('.', index); + endIndex = text.indexOf('.', startIndex + 1); + if (endIndex == -1) + endIndex = startIndex + 1; + result = text.substring(startIndex + 1, endIndex); + break; + } + return result; } - public String getBeforeIndex(int value0, int value1) - throws NotImplementedException + /** + * Returns the character, word or sentence before the specified index. The + * <code>part</code> parameter determines what is returned, the character, + * word or sentence before the index. + * + * @param part one of {@link AccessibleText#CHARACTER}, + * {@link AccessibleText#WORD} or + * {@link AccessibleText#SENTENCE}, specifying what is returned + * @param index the index + * + * @return the character, word or sentence before <code>index</code> + */ + public String getBeforeIndex(int part, int index) { - return null; // TODO + String result = ""; + int startIndex = -1; + int endIndex = -1; + switch(part) + { + case AccessibleText.CHARACTER: + result = String.valueOf(text.charAt(index - 1)); + break; + case AccessibleText.WORD: + endIndex = text.lastIndexOf(' ', index); + if (endIndex == -1) + endIndex = 0; + startIndex = text.lastIndexOf(' ', endIndex - 1); + result = text.substring(startIndex + 1, endIndex); + break; + case AccessibleText.SENTENCE: + default: + endIndex = text.lastIndexOf('.', index); + if (endIndex == -1) + endIndex = 0; + startIndex = text.lastIndexOf('.', endIndex - 1); + result = text.substring(startIndex + 1, endIndex); + break; + } + return result; } /** @@ -837,7 +943,14 @@ View view = (View) getClientProperty(BasicHTML.propertyKey); if (view != null) { - + Document doc = view.getDocument(); + if (doc instanceof StyledDocument) + { + StyledDocument sDoc = (StyledDocument) doc; + Element charEl = sDoc.getCharacterElement(i); + if (charEl != null) + atts = charEl.getAttributes(); + } } return atts; } @@ -904,7 +1017,10 @@ setDisplayedMnemonicIndex(-1); setOpaque(true); text = ""; - updateUI(); + // testing on JRE1.5 shows that the iconTextGap default value is + // hard-coded here and the 'Button.iconTextGap' setting in the + // UI defaults is ignored, at least by the MetalLookAndFeel + iconTextGap = 4; } /** @@ -965,6 +1081,8 @@ if (icon != null) default_icon = icon; + + updateUI(); } /** Modified: trunk/core/src/classpath/javax/javax/swing/AbstractListModel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/AbstractListModel.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/AbstractListModel.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -164,7 +164,7 @@ * * @return The set of listeners of the specified type */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } Modified: trunk/core/src/classpath/javax/javax/swing/AbstractSpinnerModel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/AbstractSpinnerModel.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/AbstractSpinnerModel.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -1,5 +1,5 @@ /* AbstractSpinnerModel.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2006, Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -48,12 +48,15 @@ * Provides standard implementations for some of the methods in * {@link SpinnerModel}. * + * @since 1.4 + * * @author Ka-Hing Cheung */ public abstract class AbstractSpinnerModel implements SpinnerModel { private ChangeEvent changeEvent = new ChangeEvent(this); + /** Stores the listeners registered with the model. */ protected EventListenerList listenerList = new EventListenerList(); /** @@ -65,9 +68,10 @@ } /** - * Adds a <code>ChangeListener</code>. + * Registers a <code>ChangeListener</code> with the model so that it will + * receive {@link ChangeEvent} notifications when the model changes. * - * @param listener the listener to add + * @param listener the listener to add (<code>null</code> is ignored). */ public void addChangeListener(ChangeListener listener) { @@ -80,7 +84,7 @@ * @param c the type of listener * @return the listeners that are of the specific type */ - public EventListener[] getListeners(Class c) + public <T extends EventListener> T[] getListeners(Class<T> c) { return listenerList.getListeners(c); } Modified: trunk/core/src/classpath/javax/javax/swing/ButtonGroup.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/ButtonGroup.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/ButtonGroup.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -68,7 +68,7 @@ private static final long serialVersionUID = 4259076101881721375L; /** Stores references to the buttons added to this button group. */ - protected Vector buttons = new Vector(); + protected Vector<AbstractButton> buttons = new Vector<AbstractButton>(); /** The currently selected button model. */ ButtonModel sel; @@ -129,7 +129,7 @@ * * @return <code>Enumeration</code> over all added buttons */ - public Enumeration getElements() + public Enumeration<AbstractButton> getElements() { return buttons.elements(); } @@ -183,6 +183,10 @@ if (old != null) old.setSelected(false); + + if (m != null) + sel.setSelected(true); + AbstractButton button = findButton(old); if (button != null) button.repaint(); Modified: trunk/core/src/classpath/javax/javax/swing/DefaultBoundedRangeModel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/DefaultBoundedRangeModel.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/DefaultBoundedRangeModel.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -424,7 +424,7 @@ * * @since 1.3 */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } Modified: trunk/core/src/classpath/javax/javax/swing/DefaultButtonModel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/DefaultButtonModel.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/DefaultButtonModel.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -166,7 +166,7 @@ * * @return array of listeners */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } Modified: trunk/core/src/classpath/javax/javax/swing/DefaultComboBoxModel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/DefaultComboBoxModel.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/DefaultComboBoxModel.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -104,7 +104,7 @@ * * @throws NullPointerException if <code>vector</code> is <code>null</code>. */ - public DefaultComboBoxModel(Vector vector) + public DefaultComboBoxModel(Vector<?> vector) { this.list = vector; if (getSize() > 0) @@ -224,16 +224,24 @@ */ public void setSelectedItem(Object object) { - if (selectedItem == null) - { - if (object == null) + // No item is selected and object is null, so no change required. + if (selectedItem == null && object == null) return; - } - else - { - if (selectedItem.equals(object)) + + // object is already selected so no change required. + if (selectedItem != null && selectedItem.equals(object)) return; - } + + // Simply return if object is not in the list. + if (object != null && getIndexOf(object) == -1) + return; + + // Here we know that object is either an item in the list or null. + + // Handle the three change cases: selectedItem is null, object is + // non-null; selectedItem is non-null, object is null; + // selectedItem is non-null, object is non-null and they're not + // equal. selectedItem = object; fireContentsChanged(this, -1, -1); } Modified: trunk/core/src/classpath/javax/javax/swing/DefaultListModel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/DefaultListModel.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/DefaultListModel.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -309,7 +309,7 @@ * * @return A new enumeration which iterates over the list */ - public Enumeration elements() + public Enumeration<?> elements() { return elements.elements(); } Modified: trunk/core/src/classpath/javax/javax/swing/DefaultListSelectionModel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/DefaultListSelectionModel.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/DefaultListSelectionModel.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -815,7 +815,7 @@ * @see #getListSelectionListeners * @since 1.3 */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } Modified: trunk/core/src/classpath/javax/javax/swing/DefaultSingleSelectionModel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/DefaultSingleSelectionModel.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/DefaultSingleSelectionModel.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -174,7 +174,7 @@ * * @since 1.3 */ - public EventListener[] getListeners(Class listenerClass) + public <T extends EventListener> T[] getListeners(Class<T> listenerClass) { return listenerList.getListeners(listenerClass); } Modified: trunk/core/src/classpath/javax/javax/swing/JButton.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/JButton.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/JButton.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -132,8 +132,8 @@ public JButton(String text, Icon icon) { super(); + setModel(new DefaultButtonModel()); init(text, icon); - setModel(new DefaultButtonModel()); defaultCapable = true; } Modified: trunk/core/src/classpath/javax/javax/swing/JComboBox.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/JComboBox.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/JComboBox.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -196,7 +196,7 @@ * * @param itemVector vector containing list of items for this JComboBox. */ - public JComboBox(Vector itemVector) + public JComboBox(Vector<?> itemVector) { this(new DefaultComboBoxModel(itemVector)); Modified: trunk/core/src/classpath/javax/javax/swing/JEditorPane.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/JEditorPane.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/JEditorPane.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -712,7 +712,7 @@ public JEditorPane(URL url) throws IOException { init(); - setEditorKit(createEditorKitForContentType("text/html"));; + setEditorKit(createEditorKitForContentType("text/html")); setPage(url); } Modified: trunk/core/src/classpath/javax/javax/swing/JFileChooser.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/JFileChooser.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/JFileChooser.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -43,6 +43,8 @@ import java.awt.HeadlessException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowAdapter; import java.beans.PropertyChangeEvent; import java.io.File; import java.util.ArrayList; @@ -351,7 +353,7 @@ * The file selection mode. * @see #setFileSelectionMode(int) */ - private int fileSelectionMode = FILES_AND_DIRECTORIES; + private int fileSelectionMode = FILES_ONLY; /** * The file view. @@ -744,10 +746,16 @@ JDialog dialog = new JDialog(toUse); setSelectedFile(null); dialog.getContentPane().add(this); + dialog.addWindowListener( new WindowAdapter() + { + public void windowClosing(WindowEvent e) + { + cancelSelection(); + } + }); dialog.setModal(true); dialog.invalidate(); dialog.repaint(); - return dialog; } Modified: trunk/core/src/classpath/javax/javax/swing/JFormattedTextField.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/JFormattedTextField.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/JFormattedTextField.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -415,7 +415,7 @@ // to create a new formatter. Object oldValue = this.value; - this.value = formatter.stringToValue(getText());; + this.value = formatter.stringToValue(getText()); editValid = true; firePropertyChange("value", oldValue, this.value); Modified: trunk/core/src/classpath/javax/javax/swing/JList.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/JList.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/JList.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -1041,7 +1041,7 @@ * * @param items the initial list items. */ - public JList(Vector items) + public JList(Vector<?> items) { init(createListModel(items)); } @@ -1643,9 +1643,20 @@ * @param listData The object array to build a new list model on * @see #setModel */ - public void setListData(Vector listData) + public void setListData(final Vector<?> listData) { - setModel(createListModel(listData)); + setModel(new AbstractListModel() + { + public int getSize() + { + return listData.size(); + } + + public Object getElementAt(int i) + { + return listData.elementAt(i); + } + }); } /** Modified: trunk/core/src/classpath/javax/javax/swing/JMenuBar.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/JMenuBar.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/JMenuBar.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -298,19 +298,25 @@ } /** - * DOCUMENT ME! + * This method is not implemented and will throw an {@link Error} if called. * - * @return DOCUMENT ME! + * @return This method never returns anything, it throws an exception. */ public JMenu getHelpMenu() { - return null; + // the following error matches the behaviour of the reference + // implementation... + throw new Error("getHelpMenu() is not implemented"); } /** - * Returns margin betweeen menu bar's border and its menues + * Returns the margin between the menu bar's border and its menus. If the + * margin is <code>null</code>, this method returns + * <code>new Insets(0, 0, 0, 0)</code>. * - * @return margin between menu bar's border and its menues + * @return The margin (never <code>null</code>). + * + * @see #setMargin(Insets) */ public Insets getMargin() { @@ -617,13 +623,12 @@ } /** - * Sets the menu bar's "margin" bound property, which represents - * distance between the menubar's border and its menus. - * icon. When marging property is modified, PropertyChangeEvent will - * be fired to menuBar's PropertyChangeListener's. + * Sets the margin between the menu bar's border and its menus (this is a + * bound property with the name 'margin'). * - * @param m distance between the menubar's border and its menus. + * @param m the margin (<code>null</code> permitted). * + * @see #getMargin() */ public void setMargin(Insets m) { Modified: trunk/core/src/classpath/javax/javax/swing/JRootPane.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/JRootPane.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/JRootPane.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -505,12 +505,18 @@ } /** - * DOCUMENT ME! + * Set the layered pane for the root pane. * - * @param f DOCUMENT ME! + * @param f The JLayeredPane to be used. + * + * @throws IllegalComponentStateException if JLayeredPane + * parameter is null. */ public void setLayeredPane(JLayeredPane f) { + if (f == null) + throw new IllegalComponentStateException(); + if (layeredPane != null) remove(layeredPane); Modified: trunk/core/src/classpath/javax/javax/swing/JScrollPane.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/JScrollPane.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/JScrollPane.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -162,9 +162,10 @@ protected JViewport viewport; - Border viewportBorder; - boolean wheelScrollingEnabled; + private Border viewportBorder; + private boolean wheelScrollingEnabled; + public JViewport getColumnHeader() { return columnHeader; @@ -595,6 +596,7 @@ */ public JScrollPane(Component view, int vsbPolicy, int hsbPolicy) { + wheelScrollingEnabled = true; setVerticalScrollBarPolicy(vsbPolicy); setVerticalScrollBar(createVerticalScrollBar()); setHorizontalScrollBarPolicy(hsbPolicy); Modified: trunk/core/src/classpath/javax/javax/swing/JTabbedPane.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/JTabbedPane.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/JTabbedPane.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -887,7 +887,7 @@ if (model != null) { - if (changeListener != null) + if (changeListener == null) changeListener = createChangeListener(); model.addChangeListener(changeListener); } @@ -1054,7 +1054,10 @@ } if (getSelectedIndex() == -1) + { setSelectedIndex(0); + fireStateChanged(); + } revalidate(); repaint(); Modified: trunk/core/src/classpath/javax/javax/swing/JToggleButton.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/JToggleButton.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/JToggleButton.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -1,5 +1,5 @@ /* JToggleButton.java -- - Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -291,9 +291,8 @@ public JToggleButton (String text, Icon icon, boolean selected) { super(); - init(text, icon); - setModel(new ToggleButtonModel()); + init(text, icon); model.setSelected(selected); setAlignmentX(LEFT_ALIGNMENT); } Modified: trunk/core/src/classpath/javax/javax/swing/JToolTip.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/JToolTip.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/JToolTip.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -181,7 +181,7 @@ { StringBuffer sb = new StringBuffer(super.paramString()); sb.append(",tiptext="); - if (text != null); + if (text != null) sb.append(text); return sb.toString(); } Modified: trunk/core/src/classpath/javax/javax/swing/JWindow.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/JWindow.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/JWindow.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -38,6 +38,7 @@ package javax.swing; +import java.awt.AWTEvent; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Container; @@ -158,6 +159,10 @@ protected void windowInit() { + // We need to explicitly enable events here so that our processKeyEvent() + // and processWindowEvent() gets called. + enableEvents(AWTEvent.KEY_EVENT_MASK); + super.setLayout(new BorderLayout(1, 1)); getRootPane(); // will do set/create // Now we're done init stage, adds and layouts go to content pane. Modified: trunk/core/src/classpath/javax/javax/swing/LookAndFeel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/LookAndFeel.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/LookAndFeel.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -284,7 +284,7 @@ * @return A {@link UIDefaults.LazyValue} that serves up an * {@link IconUIResource}. */ - public static Object makeIcon(Class baseClass, String gifFile) + public static Object makeIcon(Class<?> baseClass, String gifFile) { final URL file = baseClass.getResource(gifFile); return new UIDefaults.LazyValue() Modified: trunk/core/src/classpath/javax/javax/swing/Popup.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/Popup.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/Popup.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -284,7 +284,7 @@ panel.setSize(contents.getSize()); Point layeredPaneLoc = layeredPane.getLocationOnScreen(); panel.setLocation(x - layeredPaneLoc.x, y - layeredPaneLoc.y); - layeredPane.add(panel, JLayeredPane.POPUP_LAYER); + layeredPane.add(panel, JLayeredPane.POPUP_LAYER, 0); panel.repaint(); } Modified: trunk/core/src/classpath/javax/javax/swing/SizeSequence.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/SizeSequence.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/SizeSequence.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -129,14 +129,18 @@ } /** - * Returns the size of the specified element. + * Returns the size of the specified element, or 0 if the element index is + * outside the defined range. * * @param index the element index. * - * @return The size of the specified element. + * @return The size of the specified element, or 0 if the element index is + * outside the defined range. */ public int getSize(int index) { + if (index < 0 || index >= sizes.length) + return 0; return sizes[index]; } Modified: trunk/core/src/classpath/javax/javax/swing/SortingFocusTraversalPolicy.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/SortingFocusTraversalPolicy.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/SortingFocusTraversalPolicy.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -91,7 +91,7 @@ * * @param comparator the comparator to set */ - public SortingFocusTraversalPolicy(Comparator comparator) + public SortingFocusTraversalPolicy(Comparator<? super Component> comparator) { this.comparator = comparator; } @@ -119,7 +119,7 @@ * * @see #setComparator */ - protected Comparator getComparator() + protected Comparator<? super Component> getComparator() { return comparator; } @@ -131,7 +131,7 @@ * * @see #getComparator */ - protected void setComparator(Comparator comparator) + protected void setComparator(Comparator<? super Component> comparator) { this.comparator = comparator; } Modified: trunk/core/src/classpath/javax/javax/swing/SpinnerListModel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/SpinnerListModel.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/SpinnerListModel.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -118,7 +118,7 @@ * @see SpinnerListModel#getNextValue() * @see SpinnerListModel#getValue() */ - public SpinnerListModel(List list) + public SpinnerListModel(List<?> list) { // Retain a reference to the valid list. setList(list); @@ -163,7 +163,7 @@ * * @return The backing list. */ - public List getList() + public List<?> getList() { return list; } @@ -239,7 +239,7 @@ * * @see ChangeEvent */ - public void setList(List list) + public void setList(List<?> list) { // Check for null or zero size list. if (list == null || list.size() == 0) Modified: trunk/core/src/classpath/javax/javax/swing/Timer.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/Timer.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/Timer.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -228,7 +228,7 @@ * fired by this timer * @since 1.3 */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } Modified: trunk/core/src/classpath/javax/javax/swing/UIDefaults.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/UIDefaults.java 2007-01-09 20:25:00 UTC (rev 3061) +++ trunk/core/src/classpath/javax/javax/swing/UIDefaults.java 2007-01-09 20:25:48 UTC (rev 3062) @@ -63,7 +63,7 @@ * * @author Ronald Veldema (rve...@cs...) */ -public class UIDefaults extends Hashtable +public class UIDefaults extends Hashtable<Object, Object> { /** Our ResourceBundles. */ @@ -672,7 +672,7 @@ * * @return the UI class for <code>id</code> */ - public Class getUIClass(String id, ClassLoader loader) + public Class<? extends ComponentUI> getUIClass(String id, ClassLoader loader) { String className = (String) get(id); if (className == null) @@ -681,7 +681,7 @@ { if (loader == null) loader = ClassLoader.getSystemClassLoader(); - return loader.loadClass (className); + return (Class<? extends ComponentUI>) loader.loadClass (className); } catch (Exception e) { @@ -698,7 +698,7 @@ * * @return the UI class for <code>id</code> */ - public Class getUIClass(String id) + public Class<? extends ComponentUI> getUIClass(String id) { return getUIClass (id, null); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2007-01-09 20:25:14
|
Revision: 3061 http://jnode.svn.sourceforge.net/jnode/?rev=3061&view=rev Author: lsantha Date: 2007-01-09 12:25:00 -0800 (Tue, 09 Jan 2007) Log Message: ----------- Classpath patches. Modified Paths: -------------- trunk/core/src/classpath/java/java/awt/AlphaComposite.java trunk/core/src/classpath/java/java/awt/Dialog.java trunk/core/src/classpath/java/java/awt/Graphics2D.java trunk/core/src/classpath/java/java/awt/Rectangle.java trunk/core/src/classpath/java/java/awt/RenderingHints.java trunk/core/src/classpath/java/java/awt/dnd/DragGestureEvent.java trunk/core/src/classpath/java/java/awt/dnd/DragGestureRecognizer.java trunk/core/src/classpath/java/java/awt/dnd/DragSource.java trunk/core/src/classpath/java/java/awt/dnd/DragSourceContext.java trunk/core/src/classpath/java/java/awt/dnd/DropTarget.java trunk/core/src/classpath/java/java/awt/dnd/DropTargetContext.java trunk/core/src/classpath/java/java/awt/dnd/DropTargetDragEvent.java trunk/core/src/classpath/java/java/awt/dnd/DropTargetDropEvent.java trunk/core/src/classpath/java/java/awt/dnd/DropTargetEvent.java trunk/core/src/classpath/java/java/awt/im/InputContext.java trunk/core/src/classpath/java/java/awt/im/InputMethodHighlight.java trunk/core/src/classpath/java/java/awt/im/spi/InputMethodContext.java trunk/core/src/classpath/java/java/awt/image/renderable/ParameterBlock.java trunk/core/src/classpath/java/java/awt/image/renderable/RenderableImage.java trunk/core/src/classpath/java/java/awt/image/renderable/RenderableImageOp.java trunk/core/src/classpath/java/java/awt/print/PrinterJob.java trunk/core/src/classpath/java/java/io/FileDescriptor.java trunk/core/src/classpath/java/java/io/FileInputStream.java trunk/core/src/classpath/java/java/io/FileOutputStream.java trunk/core/src/classpath/java/java/io/ObjectStreamField.java trunk/core/src/classpath/java/java/io/OutputStreamWriter.java trunk/core/src/classpath/java/java/io/PipedInputStream.java trunk/core/src/classpath/java/java/io/PipedReader.java trunk/core/src/classpath/java/java/io/PrintStream.java trunk/core/src/classpath/java/java/io/RandomAccessFile.java trunk/core/src/classpath/java/java/nio/ByteBuffer.java trunk/core/src/classpath/java/java/nio/DoubleBuffer.java trunk/core/src/classpath/java/java/nio/FloatBuffer.java trunk/core/src/classpath/java/java/nio/IntBuffer.java trunk/core/src/classpath/java/java/nio/LongBuffer.java trunk/core/src/classpath/java/java/nio/ShortBuffer.java trunk/core/src/classpath/java/java/util/logging/LoggingMXBean.java trunk/core/src/classpath/java/java/util/prefs/AbstractPreferences.java trunk/core/src/classpath/java/java/util/prefs/Preferences.java Modified: trunk/core/src/classpath/java/java/awt/AlphaComposite.java =================================================================== --- trunk/core/src/classpath/java/java/awt/AlphaComposite.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/AlphaComposite.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -1,5 +1,5 @@ /* AlphaComposite.java -- provides a context for performing alpha compositing - Copyright (C) 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -61,8 +61,8 @@ private static final int MAX_CACHE_SIZE = 2048; /** Prune stale entries. */ - protected boolean removeEldestEntry(Map.Entry eldest) - { // XXX - FIXME Use Map.Entry, not just Entry as gcj 3.1 workaround. + protected boolean removeEldestEntry(Entry eldest) + { return size() > MAX_CACHE_SIZE; } }; Modified: trunk/core/src/classpath/java/java/awt/Dialog.java =================================================================== --- trunk/core/src/classpath/java/java/awt/Dialog.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/Dialog.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -97,6 +97,11 @@ private EventQueue eq2 = null; /** + * The number used to generate the name returned by getName. + */ + private static transient long next_dialog_number; + + /** * Initializes a new instance of <code>Dialog</code> with the specified * parent, that is resizable and not modal, and which has no title. * @@ -190,6 +195,7 @@ visible = false; setLayout(new BorderLayout()); + setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } /** @@ -273,6 +279,7 @@ visible = false; setLayout(new BorderLayout()); + setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } /** @@ -531,4 +538,18 @@ return accessibleContext; } + /** + * Generate a unique name for this <code>Dialog</code>. + * + * @return A unique name for this <code>Dialog</code>. + */ + String generateName() + { + return "dialog" + getUniqueLong(); + } + + private static synchronized long getUniqueLong() + { + return next_dialog_number++; + } } Modified: trunk/core/src/classpath/java/java/awt/Graphics2D.java =================================================================== --- trunk/core/src/classpath/java/java/awt/Graphics2D.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/Graphics2D.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -227,14 +227,14 @@ * * @see #addRenderingHints(Map) */ - public abstract void setRenderingHints(Map hints); + public abstract void setRenderingHints(Map<?,?> hints); /** * Adds/updates the rendering hint. * * @param hints the hints to add or update. */ - public abstract void addRenderingHints(Map hints); + public abstract void addRenderingHints(Map<?,?> hints); /** * Returns the current rendering hints. Modified: trunk/core/src/classpath/java/java/awt/Rectangle.java =================================================================== --- trunk/core/src/classpath/java/java/awt/Rectangle.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/Rectangle.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -119,14 +119,10 @@ * coordinates of the specified rectangle. * * @param r the rectangle to copy from - * @throws NullPointerException if r is null * @since 1.1 */ public Rectangle(Rectangle r) { - if (r == null) - throw new NullPointerException(); - x = r.x; y = r.y; width = r.width; @@ -171,13 +167,9 @@ * * @param p the upper left corner of the rectangle * @param d the width and height of the rectangle - * @throws NullPointerException if p or d is null */ public Rectangle(Point p, Dimension d) { - if (p == null || d == null) - throw new NullPointerException(); - x = p.x; y = p.y; width = d.width; @@ -189,13 +181,9 @@ * corner at the specified point and a width and height of zero. * * @param p the upper left corner of the rectangle - * @throws NullPointerException if p is null */ public Rectangle(Point p) { - if (p == null) - throw new NullPointerException(); - x = p.x; y = p.y; } @@ -206,13 +194,9 @@ * by the specified dimension. * * @param d the width and height of the rectangle - * @throws NullPointerException if d is null */ public Rectangle(Dimension d) { - if (d == null) - throw new NullPointerException(); - width = d.width; height = d.height; } Modified: trunk/core/src/classpath/java/java/awt/RenderingHints.java =================================================================== --- trunk/core/src/classpath/java/java/awt/RenderingHints.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/RenderingHints.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -54,7 +54,8 @@ * @author Rolf W. Rasmussen (ro...@ii...) * @author Eric Blake (eb...@em...) */ -public class RenderingHints implements Map, Cloneable +public class RenderingHints + implements Map<Object,Object>, Cloneable { /** * The base class used to represent keys. @@ -550,7 +551,7 @@ * @param init a map containing a collection of hints (<code>null</code> * permitted). */ - public RenderingHints(Map init) + public RenderingHints(Map<Key,?> init) { if (init != null) putAll(init); @@ -704,7 +705,7 @@ * @throws IllegalArgumentException if the map contains a value that is * not compatible with its key. */ - public void putAll(Map m) + public void putAll(Map<?,?> m) { // preprocess map to generate appropriate exceptions Iterator iterator = m.keySet().iterator(); @@ -723,7 +724,7 @@ * * @return A set of keys. */ - public Set keySet() + public Set<Object> keySet() { return hintMap.keySet(); } @@ -735,7 +736,7 @@ * * @return A collection of values. */ - public Collection values() + public Collection<Object> values() { return hintMap.values(); } @@ -745,7 +746,7 @@ * * @return A set of entries. */ - public Set entrySet() + public Set<Map.Entry<Object,Object>> entrySet() { return Collections.unmodifiableSet(hintMap.entrySet()); } Modified: trunk/core/src/classpath/java/java/awt/dnd/DragGestureEvent.java =================================================================== --- trunk/core/src/classpath/java/java/awt/dnd/DragGestureEvent.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/dnd/DragGestureEvent.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -59,7 +59,7 @@ private Component component; private final Point origin; private final int action; - private List events; + private List<InputEvent> events; private DragGestureRecognizer dgr; /** @@ -71,7 +71,7 @@ * @throws IllegalArgumentException - if input parameters are null */ public DragGestureEvent(DragGestureRecognizer dgr, int action, Point origin, - List events) + List<? extends InputEvent> events) { super(dgr); if (origin == null || events == null || dgr == null) @@ -79,7 +79,7 @@ this.origin = origin; this.action = action; - this.events = events; + this.events = (List<InputEvent>) events; this.dgr = dgr; this.component = dgr.getComponent(); this.dragSource = dgr.getDragSource(); @@ -130,7 +130,7 @@ * * @return an iterator representation of the List of events. */ - public Iterator iterator() + public Iterator<InputEvent> iterator() { return events.iterator(); } Modified: trunk/core/src/classpath/java/java/awt/dnd/DragGestureRecognizer.java =================================================================== --- trunk/core/src/classpath/java/java/awt/dnd/DragGestureRecognizer.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/dnd/DragGestureRecognizer.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -1,5 +1,5 @@ /* DragGestureRecognizer.java -- - Copyright (C) 2002,2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,8 +38,6 @@ package java.awt.dnd; -import gnu.classpath.NotImplementedException; - import java.awt.Component; import java.awt.Point; import java.awt.event.InputEvent; @@ -52,6 +50,8 @@ /** * STUBBED + * @author Michael Koch (kon...@gm...) + * @author Andrew John Hughes (gnu...@me...) * @since 1.2 */ public abstract class DragGestureRecognizer implements Serializable @@ -65,7 +65,7 @@ protected Component component; protected transient DragGestureListener dragGestureListener; protected int sourceActions; - protected ArrayList events = new ArrayList(); + protected ArrayList<InputEvent> events = new ArrayList<InputEvent>(); protected DragGestureRecognizer(DragSource ds, Component c, int sa, DragGestureListener dgl) @@ -127,11 +127,12 @@ return events.size() > 0 ? (InputEvent) events.get(0) : null; } + /** + * Resets the recognizer. If a gesture is currently recognize, discard it. + */ public void resetRecognizer() - throws NotImplementedException { - events = new ArrayList(); - // FIXME: Not implemented fully. + events.clear(); } /** Modified: trunk/core/src/classpath/java/java/awt/dnd/DragSource.java =================================================================== --- trunk/core/src/classpath/java/java/awt/dnd/DragSource.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/dnd/DragSource.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -226,12 +226,13 @@ return flavorMap; } - public DragGestureRecognizer createDragGestureRecognizer(Class recognizer, + public <T extends DragGestureRecognizer> T + createDragGestureRecognizer(Class<T> recognizer, Component c, int actions, DragGestureListener dgl) { - return Toolkit.getDefaultToolkit().createDragGestureRecognizer(recognizer, + return (T) Toolkit.getDefaultToolkit().createDragGestureRecognizer(recognizer, this, c, actions, dgl); } @@ -296,7 +297,7 @@ /** * @since 1.4 */ - public EventListener[] getListeners (Class listenerType) + public <T extends EventListener> T[] getListeners (Class<T> listenerType) { if (listenerType == DragSourceListener.class) return DnDEventMulticaster.getListeners (dragSourceListener, @@ -307,7 +308,7 @@ listenerType); // Return an empty EventListener array. - return new EventListener [0]; + return (T[]) new EventListener [0]; } /** Modified: trunk/core/src/classpath/java/java/awt/dnd/DragSourceContext.java =================================================================== --- trunk/core/src/classpath/java/java/awt/dnd/DragSourceContext.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/dnd/DragSourceContext.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -38,8 +38,6 @@ package java.awt.dnd; -import gnu.classpath.NotImplementedException; - import java.awt.Component; import java.awt.Cursor; import java.awt.Image; @@ -268,7 +266,8 @@ for (int i = 0; i < dsl.length; i++) dsl[i].dragExit(e); - updateCurrentCursor(0, 0, DEFAULT); + updateCurrentCursor(DnDConstants.ACTION_NONE, DnDConstants.ACTION_NONE, + DEFAULT); } /** @@ -340,26 +339,45 @@ * @param status - the status of the cursor (constant). */ protected void updateCurrentCursor(int dropOp, int targetAct, int status) - throws NotImplementedException { - // FIXME: Not implemented fully - if (!useCustomCursor) + if (! useCustomCursor) { - Cursor cursor = null; + Cursor newCursor = null; switch (status) { + default: + targetAct = DnDConstants.ACTION_NONE; case ENTER: - break; case CHANGED: - break; case OVER: - break; - default: - break; + int action = dropOp & targetAct; + if (action == DnDConstants.ACTION_NONE) + { + if ((dropOp & DnDConstants.ACTION_LINK) != 0) + newCursor = DragSource.DefaultLinkNoDrop; + else if ((dropOp & DnDConstants.ACTION_MOVE) != 0) + newCursor = DragSource.DefaultMoveNoDrop; + else + newCursor = DragSource.DefaultCopyNoDrop; + } + else + { + if ((dropOp & DnDConstants.ACTION_LINK) != 0) + newCursor = DragSource.DefaultLinkDrop; + else if ((dropOp & DnDConstants.ACTION_MOVE) != 0) + newCursor = DragSource.DefaultMoveDrop; + else + newCursor = DragSource.DefaultCopyDrop; + } } - this.cursor = cursor; - peer.setCursor(cursor); + if (cursor == null || ! cursor.equals(newCursor)) + { + cursor = newCursor; + DragSourceContextPeer p = peer; + if (p != null) + p.setCursor(cursor); + } } } } // class DragSourceContext Modified: trunk/core/src/classpath/java/java/awt/dnd/DropTarget.java =================================================================== --- trunk/core/src/classpath/java/java/awt/dnd/DropTarget.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/dnd/DropTarget.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -38,12 +38,12 @@ package java.awt.dnd; -import gnu.classpath.NotImplementedException; - import java.awt.Component; import java.awt.GraphicsEnvironment; import java.awt.HeadlessException; +import java.awt.Insets; import java.awt.Point; +import java.awt.Rectangle; import java.awt.datatransfer.FlavorMap; import java.awt.datatransfer.SystemFlavorMap; import java.awt.dnd.peer.DropTargetPeer; @@ -55,6 +55,8 @@ import java.util.EventListener; import java.util.TooManyListenersException; +import javax.swing.Timer; + /** * @author Michael Koch * @since 1.2 @@ -70,30 +72,87 @@ protected static class DropTargetAutoScroller implements ActionListener { + /** + * The threshold that keeps the autoscroller running. + */ + private static final int HYSTERESIS = 10; + + /** + * The initial timer delay. + */ + private static final int DELAY = 100; + private Component component; private Point point; + /** + * The timer that triggers autoscrolling. + */ + private Timer timer; + + /** + * The outer region of the scroller. This is the component's size. + */ + private Rectangle outer; + + /** + * The inner region of the scroller. This is the component size without + * the autoscroll insets. + */ + private Rectangle inner; + protected DropTargetAutoScroller (Component c, Point p) { component = c; point = p; + timer = new Timer(DELAY, this); + timer.setCoalesce(true); + timer.start(); } protected void updateLocation (Point newLocn) { + Point previous = point; point = newLocn; + if (Math.abs(point.x - previous.x) > HYSTERESIS + || Math.abs(point.y - previous.y) > HYSTERESIS) + { + if (timer.isRunning()) + timer.stop(); + } + else + { + if (! timer.isRunning()) + timer.start(); + } } protected void stop () - throws NotImplementedException { - // FIXME: implement this + timer.start(); } public void actionPerformed (ActionEvent e) - throws NotImplementedException { - // FIXME: implement this + Autoscroll autoScroll = (Autoscroll) component; + + // First synchronize the inner and outer rectangles. + Insets i = autoScroll.getAutoscrollInsets(); + int width = component.getWidth(); + int height = component.getHeight(); + if (width != outer.width || height != outer.height) + outer.setBounds(0, 0, width, height); + if (inner.x != i.left || inner.y != i.top) + inner.setLocation(i.left, i.top); + int inWidth = width - i.left - i.right; + int inHeight = height - i.top - i.bottom; + if (inWidth != inner.width || inHeight != inner.height) + inner.setSize(inWidth, inHeight); + + // Scroll if the outer rectangle contains the location, but the + // inner doesn't. + if (outer.contains(point) && ! inner.contains(point)) + autoScroll.autoscroll(point); } } @@ -182,6 +241,8 @@ */ public void setComponent (Component c) { + if (component != null) + clearAutoscroll(); component = c; } @@ -212,6 +273,8 @@ public void setActive (boolean active) { this.active = active; + if (! active) + clearAutoscroll(); } public boolean isActive() @@ -250,30 +313,47 @@ public void dragEnter(DropTargetDragEvent dtde) { + if (active) + { if (dropTargetListener != null) dropTargetListener.dragEnter(dtde); + initializeAutoscrolling(dtde.getLocation()); + } } public void dragOver(DropTargetDragEvent dtde) { + if (active) + { if (dropTargetListener != null) dropTargetListener.dragOver(dtde); + updateAutoscroll(dtde.getLocation()); + } } public void dropActionChanged(DropTargetDragEvent dtde) { + if (active) + { if (dropTargetListener != null) dropTargetListener.dropActionChanged(dtde); + updateAutoscroll(dtde.getLocation()); + } } public void dragExit(DropTargetEvent dte) { + if (active) + { if (dropTargetListener != null) dropTargetListener.dragExit(dte); + clearAutoscroll(); + } } public void drop(DropTargetDropEvent dtde) { + clearAutoscroll(); if (dropTargetListener != null) dropTargetListener.drop(dtde); } @@ -332,15 +412,13 @@ protected DropTarget.DropTargetAutoScroller createDropTargetAutoScroller (Component c, Point p) { - if (autoscroller == null) - autoscroller = new DropTarget.DropTargetAutoScroller (c, p); - - return autoscroller; + return new DropTarget.DropTargetAutoScroller (c, p); } protected void initializeAutoscrolling(Point p) { - createDropTargetAutoScroller (component, p); + if (component instanceof Autoscroll) // Checks for null too. + autoscroller = createDropTargetAutoScroller (component, p); } protected void updateAutoscroll(Point dragCursorLocn) @@ -351,6 +429,10 @@ protected void clearAutoscroll() { + if (autoscroller != null) + { + autoscroller.stop(); autoscroller = null; } + } } // class DropTarget Modified: trunk/core/src/classpath/java/java/awt/dnd/DropTargetContext.java =================================================================== --- trunk/core/src/classpath/java/java/awt/dnd/DropTargetContext.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/dnd/DropTargetContext.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -1,5 +1,5 @@ /* DropTargetContext.java -- - Copyright (C) 2002, 2003, 2004, 2006, Free Software Foundation + Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation This file is part of GNU Classpath. @@ -49,6 +49,7 @@ /** * @author Michael Koch (kon...@gm...) + * @author Andrew John Hughes (gnu...@me...) * @since 1.2 */ public class DropTargetContext implements Serializable @@ -128,51 +129,51 @@ * * @exception InvalidDnDOperationException If a drop is not outstanding. */ - public void dropComplete(boolean success) + public void dropComplete (boolean success) { if (dtcp != null) dtcp.dropComplete(success); } - protected void acceptDrag(int dragOperation) + protected void acceptDrag (int dragOperation) { if (dtcp != null) dtcp.acceptDrag(dragOperation); } - protected void rejectDrag() + protected void rejectDrag () { if (dtcp != null) dtcp.rejectDrag(); } - protected void acceptDrop(int dropOperation) + protected void acceptDrop (int dropOperation) { if (dtcp != null) dtcp.acceptDrop(dropOperation); } - protected void rejectDrop() + protected void rejectDrop () { if (dtcp != null) dtcp.rejectDrop(); } - protected DataFlavor[] getCurrentDataFlavors() + protected DataFlavor[] getCurrentDataFlavors () { if (dtcp != null) dtcp.getTransferDataFlavors(); return null; } - protected List getCurrentDataFlavorsAsList() + protected List<DataFlavor> getCurrentDataFlavorsAsList () { - return Arrays.asList(getCurrentDataFlavors()); + return Arrays.asList(getCurrentDataFlavors ()); } - protected boolean isDataFlavorSupported(DataFlavor flavor) + protected boolean isDataFlavorSupported (DataFlavor flavor) { - return getCurrentDataFlavorsAsList().contains(flavor); + return getCurrentDataFlavorsAsList().contains (flavor); } /** Modified: trunk/core/src/classpath/java/java/awt/dnd/DropTargetDragEvent.java =================================================================== --- trunk/core/src/classpath/java/java/awt/dnd/DropTargetDragEvent.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/dnd/DropTargetDragEvent.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -108,7 +108,7 @@ return context.getCurrentDataFlavors (); } - public List getCurrentDataFlavorsAsList () + public List<DataFlavor> getCurrentDataFlavorsAsList () { return context.getCurrentDataFlavorsAsList (); } Modified: trunk/core/src/classpath/java/java/awt/dnd/DropTargetDropEvent.java =================================================================== --- trunk/core/src/classpath/java/java/awt/dnd/DropTargetDropEvent.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/dnd/DropTargetDropEvent.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -1,5 +1,5 @@ /* DropTargetDropEvent.java -- - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -123,7 +123,7 @@ return context.getCurrentDataFlavors(); } - public List getCurrentDataFlavorsAsList() + public List<DataFlavor> getCurrentDataFlavorsAsList() { return context.getCurrentDataFlavorsAsList(); } Modified: trunk/core/src/classpath/java/java/awt/dnd/DropTargetEvent.java =================================================================== --- trunk/core/src/classpath/java/java/awt/dnd/DropTargetEvent.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/dnd/DropTargetEvent.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -41,6 +41,10 @@ public class DropTargetEvent extends EventObject { + + /** + * Serialization identifier for Sun 1.5 compatability + */ private static final long serialVersionUID = 2821229066521922993L; protected DropTargetContext context; Modified: trunk/core/src/classpath/java/java/awt/im/InputContext.java =================================================================== --- trunk/core/src/classpath/java/java/awt/im/InputContext.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/im/InputContext.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -76,6 +76,7 @@ * java.awt.im.spi.InputMethodDescriptor. * * @author Eric Blake (eb...@em...) + * @author Andrew John Hughes (gnu...@me...) * @see Component#getInputContext() * @see Component#enableInputMethods(boolean) * @since 1.2 @@ -86,7 +87,9 @@ /** * The list of installed input method descriptors. */ - private static final ArrayList descriptors = new ArrayList(); + private static final ArrayList<InputMethodDescriptor> descriptors + = new ArrayList<InputMethodDescriptor>(); + static { Enumeration e; @@ -123,7 +126,7 @@ { if (line.charAt(0) != '#') { - Class c = Class.forName(line); + Class<?> c = Class.forName(line); descriptors.add((InputMethodDescriptor) c.newInstance()); } line = in.readLine().trim(); @@ -143,7 +146,8 @@ private InputMethod im; /** Map of locales to the most recently selected input method. */ - private final HashMap recent = new HashMap(); + private final HashMap<Locale,InputMethod> recent + = new HashMap<Locale,InputMethod>(); /** The list of acceptable character subsets. */ private Character.Subset[] subsets; Modified: trunk/core/src/classpath/java/java/awt/im/InputMethodHighlight.java =================================================================== --- trunk/core/src/classpath/java/java/awt/im/InputMethodHighlight.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/im/InputMethodHighlight.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -41,6 +41,7 @@ import java.text.Annotation; import java.text.AttributedCharacterIterator; import java.util.Map; +import java.awt.font.TextAttribute; /** * This describes the highlight attributes of text composed in an input method. @@ -95,7 +96,7 @@ private final int variation; /** The unmodifiable map of rendering styles. */ - private final Map style; + private final Map<TextAttribute, ?> style; /** * Create an input method highlight style, with variation 0 and null style @@ -134,7 +135,7 @@ * @since 1.3 */ public InputMethodHighlight(boolean selected, int state, int variation, - Map style) + Map<TextAttribute, ?> style) { if (state != RAW_TEXT && state != CONVERTED_TEXT) throw new IllegalArgumentException(); @@ -181,7 +182,7 @@ * @return the style map * @since 1.3 */ - public Map getStyle() + public Map<TextAttribute, ?> getStyle() { return style; } Modified: trunk/core/src/classpath/java/java/awt/im/spi/InputMethodContext.java =================================================================== --- trunk/core/src/classpath/java/java/awt/im/spi/InputMethodContext.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/im/spi/InputMethodContext.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -1,5 +1,5 @@ /* InputMethodContext.java -- communication between an input method and client - Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -53,6 +53,7 @@ * {@link InputMethod#setInputMethodContext(InputMethodContext)}. * * @author Eric Blake (eb...@em...) + * @author Andrew John Hughes (gnu...@me...) * @since 1.3 * @status updated to 1.4 */ Modified: trunk/core/src/classpath/java/java/awt/image/renderable/ParameterBlock.java =================================================================== --- trunk/core/src/classpath/java/java/awt/image/renderable/ParameterBlock.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/image/renderable/ParameterBlock.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -45,20 +45,20 @@ public class ParameterBlock implements Cloneable, Serializable { private static final long serialVersionUID = -7577115551785240750L; - protected Vector sources; - protected Vector parameters; + protected Vector<Object> sources; + protected Vector<Object> parameters; public ParameterBlock() { - this(new Vector(), new Vector()); + this(new Vector<Object>(), new Vector<Object>()); } - public ParameterBlock(Vector sources) + public ParameterBlock(Vector<Object> sources) { - this(sources, new Vector()); + this(sources, new Vector<Object>()); } - public ParameterBlock(Vector sources, Vector parameters) + public ParameterBlock(Vector<Object> sources, Vector<Object> parameters) { this.sources = sources; this.parameters = parameters; @@ -80,9 +80,9 @@ { ParameterBlock pb = (ParameterBlock) shallowClone(); if (sources != null) - pb.sources = (Vector) sources.clone(); + pb.sources = (Vector<Object>) sources.clone(); if (parameters != null) - pb.parameters = (Vector) parameters.clone(); + pb.parameters = (Vector<Object>) parameters.clone(); return pb; } @@ -119,12 +119,12 @@ return sources.size(); } - public Vector getSources() + public Vector<Object> getSources() { return sources; } - public void setSources(Vector sources) + public void setSources(Vector<Object> sources) { this.sources = sources; } @@ -140,12 +140,12 @@ return parameters.size(); } - public Vector getParameters() + public Vector<Object> getParameters() { return parameters; } - public void setParameters(Vector parameters) + public void setParameters(Vector<Object> parameters) { this.parameters = parameters; } Modified: trunk/core/src/classpath/java/java/awt/image/renderable/RenderableImage.java =================================================================== --- trunk/core/src/classpath/java/java/awt/image/renderable/RenderableImage.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/image/renderable/RenderableImage.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -46,7 +46,7 @@ { String HINTS_OBSERVED = "HINTS_OBSERVED"; - Vector getSources(); + Vector<RenderableImage> getSources(); Object getProperty(String name); String[] getPropertyNames(); boolean isDynamic(); Modified: trunk/core/src/classpath/java/java/awt/image/renderable/RenderableImageOp.java =================================================================== --- trunk/core/src/classpath/java/java/awt/image/renderable/RenderableImageOp.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/image/renderable/RenderableImageOp.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -55,7 +55,7 @@ this.block = (ParameterBlock) block.clone(); } - public Vector getSources() + public Vector<RenderableImage> getSources() { if (block.sources == null) return null; Modified: trunk/core/src/classpath/java/java/awt/print/PrinterJob.java =================================================================== --- trunk/core/src/classpath/java/java/awt/print/PrinterJob.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/awt/print/PrinterJob.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -38,6 +38,8 @@ package java.awt.print; +import gnu.java.awt.print.JavaPrinterJob; + import java.awt.HeadlessException; import javax.print.PrintService; import javax.print.PrintServiceLookup; @@ -62,8 +64,7 @@ */ public static PrinterJob getPrinterJob() { - // FIXME: Need to fix this to load a default implementation instance. - return new NoPrinterJob(); + return new JavaPrinterJob(); } /** Modified: trunk/core/src/classpath/java/java/io/FileDescriptor.java =================================================================== --- trunk/core/src/classpath/java/java/io/FileDescriptor.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/io/FileDescriptor.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -134,6 +134,7 @@ */ public boolean valid () { - return channel != null && channel.isOpen(); + ByteChannel c = channel; + return (c != null) && (c.isOpen()); } } Modified: trunk/core/src/classpath/java/java/io/FileInputStream.java =================================================================== --- trunk/core/src/classpath/java/java/io/FileInputStream.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/io/FileInputStream.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -40,6 +40,7 @@ import gnu.java.nio.channels.FileChannelImpl; +import java.nio.ByteBuffer; import java.nio.channels.FileChannel; /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 @@ -107,8 +108,21 @@ if (s != null) s.checkRead(file.getPath()); + try + { ch = FileChannelImpl.create(file, FileChannelImpl.READ); } + catch (FileNotFoundException fnfe) + { + throw fnfe; + } + catch (IOException ioe) + { + FileNotFoundException fnfe = new FileNotFoundException(file.getPath()); + fnfe.initCause(ioe); + throw fnfe; + } + } /** * This method initializes a <code>FileInputStream</code> to read from the @@ -266,7 +280,7 @@ || offset + len > buf.length) throw new ArrayIndexOutOfBoundsException(); - return ch.read(buf, offset, len); + return ch.read(ByteBuffer.wrap(buf, offset, len)); } /** Modified: trunk/core/src/classpath/java/java/io/FileOutputStream.java =================================================================== --- trunk/core/src/classpath/java/java/io/FileOutputStream.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/io/FileOutputStream.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -40,6 +40,7 @@ import gnu.java.nio.channels.FileChannelImpl; +import java.nio.ByteBuffer; import java.nio.channels.FileChannel; /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 @@ -155,11 +156,24 @@ if (s != null) s.checkWrite(file.getPath()); + try + { ch = FileChannelImpl.create(file, (append ? FileChannelImpl.WRITE | FileChannelImpl.APPEND : FileChannelImpl.WRITE)); } + catch (FileNotFoundException fnfe) + { + throw fnfe; + } + catch (IOException ioe) + { + FileNotFoundException fnfe = new FileNotFoundException(file.getPath()); + fnfe.initCause(ioe); + throw fnfe; + } + } /** * This method initializes a <code>FileOutputStream</code> object to write @@ -266,7 +280,7 @@ || offset + len > buf.length) throw new ArrayIndexOutOfBoundsException (); - ch.write (buf, offset, len); + ch.write(ByteBuffer.wrap(buf, offset, len)); } /** Modified: trunk/core/src/classpath/java/java/io/ObjectStreamField.java =================================================================== --- trunk/core/src/classpath/java/java/io/ObjectStreamField.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/io/ObjectStreamField.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -65,7 +65,7 @@ private boolean unshared; private boolean persistent = false; private boolean toset = true; - private Field field; + Field field; ObjectStreamField (Field field) { Modified: trunk/core/src/classpath/java/java/io/OutputStreamWriter.java =================================================================== --- trunk/core/src/classpath/java/java/io/OutputStreamWriter.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/io/OutputStreamWriter.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -223,6 +223,7 @@ encoder.onMalformedInput(CodingErrorAction.REPLACE); encoder.onUnmappableCharacter(CodingErrorAction.REPLACE); outputBuffer = CharBuffer.allocate(BUFFER_SIZE); + encodingName = EncodingHelper.getOldCanonical(cs.name()); } /** @@ -240,6 +241,11 @@ this.out = out; encoder = enc; outputBuffer = CharBuffer.allocate(BUFFER_SIZE); + Charset cs = enc.charset(); + if (cs == null) + encodingName = "US-ASCII"; + else + encodingName = EncodingHelper.getOldCanonical(cs.name()); } /** Modified: trunk/core/src/classpath/java/java/io/PipedInputStream.java =================================================================== --- trunk/core/src/classpath/java/java/io/PipedInputStream.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/io/PipedInputStream.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -279,6 +279,10 @@ if (closed) throw new IOException ("Pipe closed"); + // Don't block if nothing was requested. + if (len == 0) + return 0; + // If the buffer is empty, wait until there is something in the pipe // to read. try Modified: trunk/core/src/classpath/java/java/io/PipedReader.java =================================================================== --- trunk/core/src/classpath/java/java/io/PipedReader.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/io/PipedReader.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -261,6 +261,10 @@ if (closed) throw new IOException ("Pipe closed"); + // Don't block if nothing was requested. + if (len == 0) + return 0; + // If the buffer is empty, wait until there is something in the pipe // to read. try Modified: trunk/core/src/classpath/java/java/io/PrintStream.java =================================================================== --- trunk/core/src/classpath/java/java/io/PrintStream.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/io/PrintStream.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -71,7 +71,7 @@ // Line separator string. private static final char[] line_separator - = SystemProperties.getProperty("line.separator").toCharArray(); + = SystemProperties.getProperty("line.separator", "\n").toCharArray(); /** * Encoding name Modified: trunk/core/src/classpath/java/java/io/RandomAccessFile.java =================================================================== --- trunk/core/src/classpath/java/java/io/RandomAccessFile.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/io/RandomAccessFile.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -122,7 +122,20 @@ s.checkWrite(fileName); } + try + { ch = FileChannelImpl.create(file, fdmode); + } + catch (FileNotFoundException fnfe) + { + throw fnfe; + } + catch (IOException ioe) + { + FileNotFoundException fnfe = new FileNotFoundException(file.getPath()); + fnfe.initCause(ioe); + throw fnfe; + } fd = new FileDescriptor(ch); if ((fdmode & FileChannelImpl.WRITE) != 0) out = new DataOutputStream (new FileOutputStream (fd)); Modified: trunk/core/src/classpath/java/java/nio/ByteBuffer.java =================================================================== --- trunk/core/src/classpath/java/java/nio/ByteBuffer.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/nio/ByteBuffer.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -1,5 +1,5 @@ /* ByteBuffer.java -- - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -42,7 +42,7 @@ * @since 1.4 */ public abstract class ByteBuffer extends Buffer - implements Comparable + implements Comparable<ByteBuffer> { ByteOrder endian = ByteOrder.BIG_ENDIAN; @@ -290,7 +290,7 @@ { if (obj instanceof ByteBuffer) { - return compareTo (obj) == 0; + return compareTo ((ByteBuffer) obj) == 0; } return false; @@ -302,10 +302,8 @@ * @exception ClassCastException If obj is not an object derived from * <code>ByteBuffer</code>. */ - public int compareTo (Object obj) + public int compareTo (ByteBuffer other) { - ByteBuffer other = (ByteBuffer) obj; - int num = Math.min(remaining(), other.remaining()); int pos_this = position(); int pos_other = other.position(); Modified: trunk/core/src/classpath/java/java/nio/DoubleBuffer.java =================================================================== --- trunk/core/src/classpath/java/java/nio/DoubleBuffer.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/nio/DoubleBuffer.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -1,5 +1,5 @@ /* DoubleBuffer.java -- - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -42,7 +42,7 @@ * @since 1.4 */ public abstract class DoubleBuffer extends Buffer - implements Comparable + implements Comparable<DoubleBuffer> { int array_offset; double[] backing_buffer; @@ -273,7 +273,7 @@ { if (obj instanceof DoubleBuffer) { - return compareTo (obj) == 0; + return compareTo ((DoubleBuffer) obj) == 0; } return false; @@ -285,10 +285,8 @@ * @exception ClassCastException If obj is not an object derived from * <code>DoubleBuffer</code>. */ - public int compareTo (Object obj) + public int compareTo (DoubleBuffer other) { - DoubleBuffer other = (DoubleBuffer) obj; - int num = Math.min(remaining(), other.remaining()); int pos_this = position(); int pos_other = other.position(); Modified: trunk/core/src/classpath/java/java/nio/FloatBuffer.java =================================================================== --- trunk/core/src/classpath/java/java/nio/FloatBuffer.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/nio/FloatBuffer.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -1,5 +1,5 @@ /* FloatBuffer.java -- - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -42,7 +42,7 @@ * @since 1.4 */ public abstract class FloatBuffer extends Buffer - implements Comparable + implements Comparable<FloatBuffer> { int array_offset; float[] backing_buffer; @@ -273,7 +273,7 @@ { if (obj instanceof FloatBuffer) { - return compareTo (obj) == 0; + return compareTo ((FloatBuffer) obj) == 0; } return false; @@ -285,10 +285,8 @@ * @exception ClassCastException If obj is not an object derived from * <code>FloatBuffer</code>. */ - public int compareTo (Object obj) + public int compareTo (FloatBuffer other) { - FloatBuffer other = (FloatBuffer) obj; - int num = Math.min(remaining(), other.remaining()); int pos_this = position(); int pos_other = other.position(); Modified: trunk/core/src/classpath/java/java/nio/IntBuffer.java =================================================================== --- trunk/core/src/classpath/java/java/nio/IntBuffer.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/nio/IntBuffer.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -1,5 +1,5 @@ /* IntBuffer.java -- - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -42,7 +42,7 @@ * @since 1.4 */ public abstract class IntBuffer extends Buffer - implements Comparable + implements Comparable<IntBuffer> { int array_offset; int[] backing_buffer; @@ -273,7 +273,7 @@ { if (obj instanceof IntBuffer) { - return compareTo (obj) == 0; + return compareTo ((IntBuffer) obj) == 0; } return false; @@ -285,10 +285,8 @@ * @exception ClassCastException If obj is not an object derived from * <code>IntBuffer</code>. */ - public int compareTo (Object obj) + public int compareTo (IntBuffer other) { - IntBuffer other = (IntBuffer) obj; - int num = Math.min(remaining(), other.remaining()); int pos_this = position(); int pos_other = other.position(); Modified: trunk/core/src/classpath/java/java/nio/LongBuffer.java =================================================================== --- trunk/core/src/classpath/java/java/nio/LongBuffer.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/nio/LongBuffer.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -1,5 +1,5 @@ /* LongBuffer.java -- - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -42,7 +42,7 @@ * @since 1.4 */ public abstract class LongBuffer extends Buffer - implements Comparable + implements Comparable<LongBuffer> { int array_offset; long[] backing_buffer; @@ -273,7 +273,7 @@ { if (obj instanceof LongBuffer) { - return compareTo (obj) == 0; + return compareTo ((LongBuffer) obj) == 0; } return false; @@ -285,10 +285,8 @@ * @exception ClassCastException If obj is not an object derived from * <code>LongBuffer</code>. */ - public int compareTo (Object obj) + public int compareTo (LongBuffer other) { - LongBuffer other = (LongBuffer) obj; - int num = Math.min(remaining(), other.remaining()); int pos_this = position(); int pos_other = other.position(); Modified: trunk/core/src/classpath/java/java/nio/ShortBuffer.java =================================================================== --- trunk/core/src/classpath/java/java/nio/ShortBuffer.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/nio/ShortBuffer.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -1,5 +1,5 @@ /* ShortBuffer.java -- - Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -42,7 +42,7 @@ * @since 1.4 */ public abstract class ShortBuffer extends Buffer - implements Comparable + implements Comparable<ShortBuffer> { int array_offset; short[] backing_buffer; @@ -273,7 +273,7 @@ { if (obj instanceof ShortBuffer) { - return compareTo (obj) == 0; + return compareTo ((ShortBuffer) obj) == 0; } return false; @@ -285,10 +285,8 @@ * @exception ClassCastException If obj is not an object derived from * <code>ShortBuffer</code>. */ - public int compareTo (Object obj) + public int compareTo (ShortBuffer other) { - ShortBuffer other = (ShortBuffer) obj; - int num = Math.min(remaining(), other.remaining()); int pos_this = position(); int pos_other = other.position(); Modified: trunk/core/src/classpath/java/java/util/logging/LoggingMXBean.java =================================================================== --- trunk/core/src/classpath/java/java/util/logging/LoggingMXBean.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/util/logging/LoggingMXBean.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -60,7 +60,7 @@ /** * Return a list of all logger names. */ - List/*<String>*/ getLoggerNames(); + List<String> getLoggerNames(); /** * Return the name of the parent of the indicated logger. Modified: trunk/core/src/classpath/java/java/util/prefs/AbstractPreferences.java =================================================================== --- trunk/core/src/classpath/java/java/util/prefs/AbstractPreferences.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/util/prefs/AbstractPreferences.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -45,6 +45,7 @@ import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.TreeSet; @@ -97,17 +98,18 @@ * accessed by earlier <code>getChild()</code> or <code>childSpi()</code> * invocations and that have not been removed. */ - private HashMap childCache = new HashMap(); + private HashMap<String, AbstractPreferences> childCache + = new HashMap<String, AbstractPreferences>(); /** * A list of all the registered NodeChangeListener objects. */ - private ArrayList nodeListeners; + private ArrayList<NodeChangeListener> nodeListeners; /** * A list of all the registered PreferenceChangeListener objects. */ - private ArrayList preferenceListeners; + private ArrayList<PreferenceChangeListener> preferenceListeners; // constructor @@ -202,7 +204,8 @@ */ protected final AbstractPreferences[] cachedChildren() { - return (AbstractPreferences[]) childCache.values().toArray(); + Collection<AbstractPreferences> vals = childCache.values(); + return vals.toArray(new AbstractPreferences[vals.size()]); } /** @@ -228,7 +231,7 @@ if (isRemoved()) throw new IllegalStateException("Node removed"); - TreeSet childrenNames = new TreeSet(); + TreeSet<String> childrenNames = new TreeSet<String>(); // First get all cached node names childrenNames.addAll(childCache.keySet()); @@ -1165,7 +1168,7 @@ if (listener == null) throw new NullPointerException("listener is null"); if (nodeListeners == null) - nodeListeners = new ArrayList(); + nodeListeners = new ArrayList<NodeChangeListener>(); nodeListeners.add(listener); } } @@ -1184,7 +1187,7 @@ if (listener == null) throw new NullPointerException("listener is null"); if (preferenceListeners == null) - preferenceListeners = new ArrayList(); + preferenceListeners = new ArrayList<PreferenceChangeListener>(); preferenceListeners.add(listener); } } Modified: trunk/core/src/classpath/java/java/util/prefs/Preferences.java =================================================================== --- trunk/core/src/classpath/java/java/util/prefs/Preferences.java 2007-01-09 20:23:23 UTC (rev 3060) +++ trunk/core/src/classpath/java/java/util/prefs/Preferences.java 2007-01-09 20:25:00 UTC (rev 3061) @@ -183,9 +183,9 @@ // Get the factory if (factory == null) { // Caller might not have enough permissions - factory = (PreferencesFactory) AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { + factory = AccessController.doPrivileged( + new PrivilegedAction<PreferencesFactory>() { + public PreferencesFactory run() { PreferencesFactory pf = null; String className = System.getProperty ("java.util.prefs.PreferencesFactory"); @@ -251,7 +251,7 @@ * @exception SecurityException when a security manager is installed and * the caller does not have <code>RuntimePermission("preferences")</code>. */ - public static Preferences systemNodeForPackage(Class c) + public static Preferences systemNodeForPackage(Class<?> c) throws SecurityException { return nodeForPackage(c, systemRoot()); @@ -270,7 +270,7 @@ * @exception SecurityException when a security manager is installed and * the caller does not have <code>RuntimePermission("preferences")</code>. */ - public static Preferences userNodeForPackage(Class c) + public static Preferences userNodeForPackage(Class<?> c) throws SecurityException { return nodeForPackage(c, userRoot()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2007-01-09 20:23:31
|
Revision: 3060 http://jnode.svn.sourceforge.net/jnode/?rev=3060&view=rev Author: lsantha Date: 2007-01-09 12:23:23 -0800 (Tue, 09 Jan 2007) Log Message: ----------- Classpath patches. Modified Paths: -------------- trunk/core/descriptors/org.classpath.ext.core.xml Modified: trunk/core/descriptors/org.classpath.ext.core.xml =================================================================== --- trunk/core/descriptors/org.classpath.ext.core.xml 2007-01-09 20:23:01 UTC (rev 3059) +++ trunk/core/descriptors/org.classpath.ext.core.xml 2007-01-09 20:23:23 UTC (rev 3060) @@ -20,6 +20,7 @@ <export name="gnu.java.awt.peer.*"/> <export name="gnu.java.awt.image.*"/> <export name="gnu.java.awt.java2d.*"/> + <export name="gnu.java.awt.print.*"/> <export name="gnu.java.beans.*"/> <export name="gnu.java.beans.decoder.*"/> <export name="gnu.java.beans.editors.*"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2007-01-09 20:23:03
|
Revision: 3059 http://jnode.svn.sourceforge.net/jnode/?rev=3059&view=rev Author: lsantha Date: 2007-01-09 12:23:01 -0800 (Tue, 09 Jan 2007) Log Message: ----------- Classpath patches. Modified Paths: -------------- trunk/core/src/classpath/gnu/gnu/java/nio/SelectorImpl.java Added Paths: ----------- trunk/core/src/classpath/gnu/gnu/java/awt/print/ trunk/core/src/classpath/gnu/gnu/java/awt/print/JavaPrinterJob.java trunk/core/src/classpath/gnu/gnu/java/awt/print/PostScriptGraphics2D.java trunk/core/src/classpath/gnu/gnu/java/awt/print/SpooledDocument.java Added: trunk/core/src/classpath/gnu/gnu/java/awt/print/JavaPrinterJob.java =================================================================== --- trunk/core/src/classpath/gnu/gnu/java/awt/print/JavaPrinterJob.java (rev 0) +++ trunk/core/src/classpath/gnu/gnu/java/awt/print/JavaPrinterJob.java 2007-01-09 20:23:01 UTC (rev 3059) @@ -0,0 +1,403 @@ +/* JavaPrinterJob.java -- AWT printing implemented on javax.print. + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath 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 for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.java.awt.print; + +import java.awt.HeadlessException; +import java.awt.print.PageFormat; +import java.awt.print.Pageable; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import java.util.Locale; + +import javax.print.CancelablePrintJob; +import javax.print.DocFlavor; +import javax.print.DocPrintJob; +import javax.print.PrintException; +import javax.print.PrintService; +import javax.print.PrintServiceLookup; +import javax.print.ServiceUI; +import javax.print.attribute.HashPrintRequestAttributeSet; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintRequestAttributeSet; +import javax.print.attribute.TextSyntax; +import javax.print.attribute.standard.Copies; +import javax.print.attribute.standard.JobName; +import javax.print.attribute.standard.OrientationRequested; +import javax.print.attribute.standard.RequestingUserName; + +/** + * This is the default implementation of PrinterJob + * + * @author Sven de Marothy + */ +public class JavaPrinterJob extends PrinterJob +{ + /** + * The print service associated with this job + */ + private PrintService printer = null; + + /** + * Printing options; + */ + private PrintRequestAttributeSet attributes; + + /** + * Available print services + */ + private static PrintService[] services; + + /** + * The actual print job. + */ + private DocPrintJob printJob; + + /** + * The Printable object to print. + */ + private Printable printable; + + /** + * Page format. + */ + private PageFormat pageFormat; + + /** + * A pageable, or null + */ + private Pageable pageable = null; + + /** + * Cancelled or not + */ + private boolean cancelled = false; + + static + { + // lookup all services without any constraints + services = PrintServiceLookup.lookupPrintServices + (DocFlavor.INPUT_STREAM.POSTSCRIPT, null); + } + + private static final Class copyClass = (new Copies(1)).getClass(); + private static final Class jobNameClass = (new JobName("", null)).getClass(); + private static final Class userNameClass = (new RequestingUserName("", null)).getClass(); + + /** + * Initializes a new instance of <code>PrinterJob</code>. + */ + public JavaPrinterJob() + { + attributes = new HashPrintRequestAttributeSet(); + setCopies(1); + setJobName("Java Printing"); + pageFormat = new PageFormat(); // default page format. + } + + private void getPageAttributes() + { + OrientationRequested orientation = (OrientationRequested) + attributes.get( OrientationRequested.LANDSCAPE.getCategory() ); + if( orientation == null) + return; + + if( orientation.equals(OrientationRequested.PORTRAIT) ) + pageFormat.setOrientation(PageFormat.PORTRAIT); + else if( orientation.equals(OrientationRequested.LANDSCAPE) ) + pageFormat.setOrientation(PageFormat.LANDSCAPE); + else if( orientation.equals(OrientationRequested.REVERSE_LANDSCAPE) ) + pageFormat.setOrientation(PageFormat.REVERSE_LANDSCAPE); + } + + /** + * Returns the number of copies to be printed. + * + * @return The number of copies to be printed. + */ + public int getCopies() + { + return ((IntegerSyntax)attributes.get( jobNameClass )).getValue(); + } + + /** + * Sets the number of copies to be printed. + * + * @param copies The number of copies to be printed. + */ + public void setCopies(int copies) + { + attributes.add( new Copies( copies ) ); + } + + /** + * Returns the name of the print job. + * + * @return The name of the print job. + */ + public String getJobName() + { + return ((TextSyntax)attributes.get( jobNameClass )).getValue(); + } + + /** + * Sets the name of the print job. + * + * @param job_name The name of the print job. + */ + public void setJobName(String job_name) + { + attributes.add( new JobName(job_name, Locale.getDefault()) ); + } + + /** + * Returns the printing user name. + * + * @return The printing username. + */ + public String getUserName() + { + return ((TextSyntax)attributes.get( userNameClass )).getValue(); + } + + /** + * Cancels an in progress print job. + */ + public void cancel() + { + try + { + if(printJob != null && (printJob instanceof CancelablePrintJob)) + { + ((CancelablePrintJob)printJob).cancel(); + cancelled = true; + } + } + catch(PrintException pe) + { + } + } + + /** + * Tests whether or not this job has been cancelled. + * + * @return <code>true</code> if this job has been cancelled, <code>false</code> + * otherwise. + */ + public boolean isCancelled() + { + return cancelled; + } + + /** + * Clones the specified <code>PageFormat</code> object then alters the + * clone so that it represents the default page format. + * + * @param page_format The <code>PageFormat</code> to clone. + * + * @return A new default page format. + */ + public PageFormat defaultPage(PageFormat page_format) + { + return new PageFormat(); + } + + /** + * Displays a dialog box to the user which allows the page format + * attributes to be modified. + * + * @param page_format The <code>PageFormat</code> object to modify. + * + * @return The modified <code>PageFormat</code>. + */ + public PageFormat pageDialog(PageFormat page_format) + throws HeadlessException + { + return defaultPage(null); + } + + /** + * Prints the pages. + */ + public void print() throws PrinterException + { + if( printable == null && pageable == null ) // nothing to print? + return; + + PostScriptGraphics2D pg = new PostScriptGraphics2D( this ); + SpooledDocument doc = pg.spoolPostScript( printable, pageFormat, + pageable ); + + cancelled = false; + printJob = printer.createPrintJob(); + try + { + printJob.print(doc, attributes); + } + catch (PrintException pe) + { + PrinterException p = new PrinterException(); + p.initCause(pe); + throw p; + } + // no printjob active. + printJob = null; + } + + /** + * Prints the page with given attributes. + */ + public void print (PrintRequestAttributeSet attributes) + throws PrinterException + { + this.attributes = attributes; + print(); + } + + /** + * Displays a dialog box to the user which allows the print job + * attributes to be modified. + * + * @return <code>false</code> if the user cancels the dialog box, + * <code>true</code> otherwise. + */ + public boolean printDialog() throws HeadlessException + { + return printDialog( attributes ); + } + + /** + * Displays a dialog box to the user which allows the print job + * attributes to be modified. + * + * @return <code>false</code> if the user cancels the dialog box, + * <code>true</code> otherwise. + */ + public boolean printDialog(PrintRequestAttributeSet attributes) + throws HeadlessException + { + PrintService chosenPrinter = ServiceUI.printDialog + (null, 50, 50, services, null, + DocFlavor.INPUT_STREAM.POSTSCRIPT, attributes); + + getPageAttributes(); + + if( chosenPrinter != null ) + { + try + { + setPrintService( chosenPrinter ); + } + catch(PrinterException pe) + { + // Should not happen. + } + return true; + } + return false; + } + + /** + * This sets the pages that are to be printed. + * + * @param pageable The pages to be printed, which may not be <code>null</code>. + */ + public void setPageable(Pageable pageable) + { + if( pageable == null ) + throw new NullPointerException("Pageable cannot be null."); + this.pageable = pageable; + } + + /** + * Sets this specified <code>Printable</code> as the one to use for + * rendering the pages on the print device. + * + * @param printable The <code>Printable</code> for the print job. + */ + public void setPrintable(Printable printable) + { + this.printable = printable; + } + + /** + * Sets the <code>Printable</code> and the page format for the pages + * to be printed. + * + * @param printable The <code>Printable</code> for the print job. + * @param page_format The <code>PageFormat</code> for the print job. + */ + public void setPrintable(Printable printable, PageFormat page_format) + { + this.printable = printable; + this.pageFormat = page_format; + } + + /** + * Makes any alterations to the specified <code>PageFormat</code> + * necessary to make it work with the current printer. The alterations + * are made to a clone of the input object, which is then returned. + * + * @param page_format The <code>PageFormat</code> to validate. + * + * @return The validated <code>PageFormat</code>. + */ + public PageFormat validatePage(PageFormat page_format) + { + // FIXME + return page_format; + } + + /** + * Change the printer for this print job to service. Subclasses that + * support setting the print service override this method. Throws + * PrinterException when the class doesn't support setting the printer, + * the service doesn't support Pageable or Printable interfaces for 2D + * print output. + * @param service The new printer to use. + * @throws PrinterException if service is not valid. + */ + public void setPrintService(PrintService service) + throws PrinterException + { + if(!service.isDocFlavorSupported(DocFlavor.INPUT_STREAM.POSTSCRIPT)) + throw new PrinterException("This printer service is not supported."); + printer = service; + } +} Added: trunk/core/src/classpath/gnu/gnu/java/awt/print/PostScriptGraphics2D.java =================================================================== --- trunk/core/src/classpath/gnu/gnu/java/awt/print/PostScriptGraphics2D.java (rev 0) +++ trunk/core/src/classpath/gnu/gnu/java/awt/print/PostScriptGraphics2D.java 2007-01-09 20:23:01 UTC (rev 3059) @@ -0,0 +1,1350 @@ +/* PostScriptGraphics2D.java -- AWT printer rendering class. + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath 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 for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.awt.print; + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Composite; +import java.awt.Paint; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.GraphicsConfiguration; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Polygon; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.Shape; +import java.awt.Stroke; +import java.awt.geom.AffineTransform; +import java.awt.geom.Arc2D; +import java.awt.geom.Ellipse2D; +import java.awt.geom.RoundRectangle2D; +import java.awt.geom.PathIterator; +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; +import java.awt.font.FontRenderContext; +import java.awt.font.GlyphVector; +import java.awt.font.TextLayout; +import java.awt.image.BufferedImage; +import java.awt.image.BufferedImageOp; +import java.awt.image.renderable.RenderableImage; +import java.awt.image.RenderedImage; +import java.awt.image.ImageObserver; +import java.awt.image.PixelGrabber; +import java.awt.print.PageFormat; +import java.awt.print.Pageable; +import java.awt.print.Paper; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterGraphics; +import java.awt.print.PrinterJob; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.text.AttributedCharacterIterator; +import java.util.Map; + +/** + * Class PostScriptGraphics2D - Class that implements the Graphics2D object, + * writing the output to a PostScript or EPS file + * + * @author Sven de Marothy + * + */ +class PostScriptGraphics2D extends Graphics2D +{ + /** + * The associated printer job. + */ + private PrinterJob printerJob; + + /** + * Output file. + */ + private PrintWriter out; + + // Graphics data + private AffineTransform currentTransform = new AffineTransform(); + private AffineTransform pageTransform; + private RenderingHints renderingHints; + private Paint currentPaint = null; + private Shape clipShape = null; + private Font currentFont = null; + private Color currentColor = Color.black; + private Color backgroundColor = Color.white; + private Stroke currentStroke = null; + private static Stroke ordinaryStroke = new BasicStroke(0.0f, + BasicStroke.CAP_BUTT, + BasicStroke.JOIN_MITER); + private float cx; // current drawing position + private float cy; // current drawing position + private boolean currentFontIsPS; // set if currentFont is one of the above + + // settings + private double pageX = 595; + private double pageY = 842; + private double Y = pageY; + private boolean gradientOn = false; + + /** + * Constructor + * + */ + public PostScriptGraphics2D( PrinterJob pg ) + { + printerJob = pg; + // create transform objects + pageTransform = new AffineTransform(); + currentTransform = new AffineTransform(); + + /* + Create Rendering hints + No text aliasing + Quality color and rendering + Bicubic interpolation + Fractional metrics supported + */ + renderingHints = new RenderingHints(null); + renderingHints.put(RenderingHints.KEY_RENDERING, + RenderingHints.VALUE_RENDER_QUALITY); + renderingHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); + renderingHints.put(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_BICUBIC); + renderingHints.put(RenderingHints.KEY_FRACTIONALMETRICS, + RenderingHints.VALUE_FRACTIONALMETRICS_ON); + renderingHints.put(RenderingHints.KEY_COLOR_RENDERING, + RenderingHints.VALUE_COLOR_RENDER_QUALITY); + } + + /** + * Spool a document to PostScript. + * If Pageable is non-null, it will print that, otherwise it will use + * the supplied printable and pageFormat. + */ + public SpooledDocument spoolPostScript(Printable printable, + PageFormat pageFormat, + Pageable pageable) + throws PrinterException + { + try + { + // spool to a temporary file + File temp = File.createTempFile("cpspool", ".ps"); + temp.deleteOnExit(); + + out = new PrintWriter(new BufferedWriter + (new OutputStreamWriter + (new FileOutputStream(temp), + "ISO8859_1"), 1000000)); + + writePSHeader(); + + if(pageable != null) + { + for(int index = 0; index < pageable.getNumberOfPages(); index++) + spoolPage(out, pageable.getPrintable(index), + pageable.getPageFormat(index), index); + } + else + { + int index = 0; + while(spoolPage(out, printable, pageFormat, index++) == + Printable.PAGE_EXISTS) + ; + } + out.println("%%Trailer"); + out.println("%%EOF"); + out.close(); + return new SpooledDocument( temp ); + } + catch (IOException e) + { + PrinterException pe = new PrinterException(); + pe.initCause(e); + throw pe; + } + } + + //-------------------------------------------------------------------------- + + /** + * Write the postscript file header, + * setup the page format and transforms. + */ + private void writePSHeader() + { + out.println("%!PS-Adobe-3.0"); + out.println("%%Title: "+printerJob.getJobName()); + out.println("%%Creator: GNU Classpath "); + out.println("%%DocumentData: Clean8Bit"); + + out.println("%%DocumentNeededResources: font Times-Roman Helvetica Courier"); + out.println("%%EndComments"); + + out.println("%%BeginProlog"); + out.println("%%EndProlog"); + out.println("%%BeginSetup"); + + out.println("%%EndFeature"); + setupFonts(); + out.println("%%EndSetup"); + + // set default fonts and colors + setFont( new Font("Dialog", Font.PLAIN, 12) ); + currentColor = Color.white; + currentStroke = new BasicStroke(); + setPaint(currentColor); + setStroke(currentStroke); + } + + /** + * setupFonts - set up the font dictionaries for + * helvetica, times and courier + */ + private void setupFonts() + { + out.println("/helveticaISO"); + out.println("/Helvetica findfont dup length dict begin"); + out.println("{ 1 index /FID eq { pop pop } { def } ifelse } forall"); + out.println("/Encoding ISOLatin1Encoding def"); + out.println("currentdict end definefont pop"); + + out.println("/timesISO"); + out.println("/Times-Roman findfont dup length dict begin"); + out.println("{ 1 index /FID eq { pop pop } { def } ifelse } forall"); + out.println("/Encoding ISOLatin1Encoding def"); + out.println("currentdict end definefont pop"); + + out.println("/courierISO"); + out.println("/Courier findfont dup length dict begin"); + out.println("{ 1 index /FID eq { pop pop } { def } ifelse } forall"); + out.println("/Encoding ISOLatin1Encoding def"); + out.println("currentdict end definefont pop"); + } + + /** + * Spools a single page, returns NO_SUCH_PAGE unsuccessful, + * PAGE_EXISTS if it was. + */ + public int spoolPage(PrintWriter out, + Printable printable, + PageFormat pageFormat, + int index) throws IOException, PrinterException + { + out.println("%%BeginPageSetup"); + + Paper p = pageFormat.getPaper(); + pageX = p.getWidth(); + pageY = p.getHeight(); + + if( pageFormat.getOrientation() == PageFormat.PORTRAIT ) + out.println( "%%Orientation: Portrait" ); + else + { + out.println( "%%Orientation: Landscape" ); + double t = pageX; + pageX = pageY; + pageY = t; + } + + setClip(0, 0, (int)pageX, (int)pageY); + + out.println("gsave % first save"); + + // 595x842; 612x792 respectively + out.println("<< /PageSize [" +pageX + " "+pageY+ "] >> setpagedevice"); + + if( pageFormat.getOrientation() != PageFormat.LANDSCAPE ) + { + pageTransform.translate(pageX, 0); + pageTransform.scale(-1.0, 1.0); + } + + // save the original CTM + pushCTM(); + concatCTM(pageTransform); + setTransform(new AffineTransform()); + + out.println("%%EndPageSetup"); + + out.println("gsave"); + + if( printable.print(this, pageFormat, index) == Printable.NO_SUCH_PAGE ) + return Printable.NO_SUCH_PAGE; + + out.println("grestore"); + out.println("showpage"); + + return Printable.PAGE_EXISTS; + } + + /** push the Current Transformation Matrix onto the PS stack */ + private void pushCTM() + { + out.println("matrix currentmatrix % pushCTM()"); + } + + /** pop the Current Transformation Matrix from the PS stack */ + private void popCTM() + { + out.println("setmatrix % restore CTM"); + } + + /////////////////////////////////////////////////////////////////////////// + + public Graphics create() + { + return null; + } + + public void drawOval(int x, int y, int width, int height) + { + out.println("% drawOval()"); + setStroke(ordinaryStroke); + draw(new Ellipse2D.Double(x, y, width, height)); + setStroke(currentStroke); + } + + public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) + { + if (nPoints <= 0 || xPoints.length < nPoints || yPoints.length < nPoints) + return; + out.println("newpath % drawPolyLine()"); + out.println(xPoints[0] + " " + yPoints[0] + " moveto"); + for (int i = 1; i < nPoints; i++) + out.println(xPoints[i] + " " + yPoints[i] + " lineto"); + out.println("closepath"); + out.println("stroke"); + } + + public void drawRoundRect(int x, int y, int width, int height, int arcWidth, + int arcHeight) + { + out.println("% drawRoundRect()"); + RoundRectangle2D.Double rr = new RoundRectangle2D.Double(x, y, width, + height, arcWidth, + arcHeight); + setStroke(ordinaryStroke); + draw(rr); + setStroke(currentStroke); + } + + public void fillRoundRect(int x, int y, int width, int height, int arcWidth, + int arcHeight) + { + out.println("% fillRoundRect()"); + RoundRectangle2D.Double rr = new RoundRectangle2D.Double(x, y, width, + height, arcWidth, + arcHeight); + fill(rr); + } + + public void drawArc(int x, int y, int width, int height, int startAngle, + int arcAngle) + { + setStroke(ordinaryStroke); + draw(new Arc2D.Double(x, y, width, height, startAngle, arcAngle, Arc2D.OPEN)); + setStroke(currentStroke); + } + + public void fillArc(int x, int y, int width, int height, int startAngle, + int arcAngle) + { + fill(new Arc2D.Double(x, y, width, height, startAngle, arcAngle, Arc2D.PIE)); + } + + public void fillOval(int x, int y, int width, int height) + { + out.println("% fillOval()"); + fill( new Ellipse2D.Double(x, y, width, height) ); + } + + public void fillPolygon(int[] x, int[] y, int nPoints) + { + out.println("% fillPolygon()"); + fill( new Polygon(x, y, nPoints) ); + } + + public void drawLine(int x1, int y1, int x2, int y2) + { + out.println("% drawLine()"); + setStroke(ordinaryStroke); + out.println("newpath"); + out.println(x1 + " " + (y1) + " moveto"); + out.println(x2 + " " + (y2) + " lineto"); + out.println("stroke"); + setStroke(currentStroke); + } + + //--------------- Image drawing ------------------------------------------ + public boolean drawImage(Image img, int x, int y, Color bgcolor, + ImageObserver observer) + { + int w = img.getWidth(null); + int h = img.getHeight(null); + + return drawImage(img, x, y, x + w, y + h, 0, 0, w - 1, h - 1, bgcolor, + observer); + } + + public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, + int sx1, int sy1, int sx2, int sy2, Color bgcolor, + ImageObserver observer) + { + int n = 0; + boolean flipx = false; + boolean flipy = false; + + // swap X and Y's + if (sx1 > sx2) + { + n = sx1; + sx1 = sx2; + sx2 = n; + flipx = ! flipx; + } + if (sy1 > sy2) + { + n = sy1; + sy1 = sy2; + sy2 = n; + flipy = ! flipy; + } + if (dx1 > dx2) + { + n = dx1; + dx1 = dx2; + dx2 = n; + flipx = ! flipx; + } + if (dy1 > dy2) + { + n = dy1; + dy1 = dy2; + dy2 = n; + flipy = ! flipy; + } + n = 0; + int sw = sx2 - sx1; // source width + int sh = sy2 - sy1; // source height + int[] pixels = new int[sw * sh]; // pixel buffer + int dw = dx2 - dx1; // destination width + int dh = dy2 - dy1; // destination height + double x_scale = ((double) dw) / ((double) sw); + double y_scale = ((double) dh) / ((double) sh); + + out.println("% drawImage() 2"); + out.println("gsave"); + out.println(dx1 + " " + dy1 + " translate"); + out.println(dw + " " + dh + " scale"); + out.println(sw + " " + sh + " 8 [" + (flipx ? -sw : sw) + " 0 0 " + + (flipy ? -sh : sh) + " " + (flipx ? sw : 0) + " " + + (flipy ? sh : 0) + " ]"); + out.println("{currentfile 3 string readhexstring pop} bind"); + out.println("false 3 colorimage"); + + PixelGrabber pg = new PixelGrabber(img, sx1, sy1, sw, sh, pixels, 0, sw); + try + { + pg.grabPixels(); + } + catch (InterruptedException e) + { + System.err.println("interrupted waiting for pixels!"); + return (false); + } + + if ((pg.getStatus() & ImageObserver.ABORT) != 0) + { + System.err.println("image fetch aborted or errored"); + return (false); + } + + for (int j = 0; j < sh; j++) + { + for (int i = 0; i < sw; i++) + { + out.print(colorTripleHex(new Color(pixels[j * sw + i]))); + if (((++n) % 11) == 0) + out.println(); + } + } + + out.println(); + out.println("%%EOF"); + out.println("grestore"); + return true; + } + + public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, + int sx1, int sy1, int sx2, int sy2, + ImageObserver observer) + { + return drawImage(img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, null, + observer); + } + + public boolean drawImage(Image img, int x, int y, ImageObserver observer) + { + return drawImage(img, x, y, null, observer); + } + + public boolean drawImage(Image img, int x, int y, int width, int height, + Color bgcolor, ImageObserver observer) + { + int sw = img.getWidth(null); + int sh = img.getHeight(null); + return drawImage(img, x, y, x + width, y + height, /* destination */ + 0, 0, sw - 1, sh - 1, /* source */ + bgcolor, observer); + // correct? + } + + public boolean drawImage(Image img, int x, int y, int width, int height, + ImageObserver observer) + { + return drawImage(img, x, y, width, height, null, observer); + } + + /** Renders a BufferedImage that is filtered with a BufferedImageOp. */ + public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) + { + BufferedImage result = op.filter(img, null); + drawImage(result, x, y, null); + } + + /** Renders an image, applying a transform from image space + into user space before drawing. */ + public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs) + { + AffineTransform oldTransform = new AffineTransform(currentTransform); + boolean ret; + + transform(xform); + ret = drawImage(img, 0, 0, null, obs); + setTransform(oldTransform); + + return ret; + } + + /** Renders a RenderableImage, applying a transform from image + space into user space before drawing. */ + public void drawRenderableImage(RenderableImage img, AffineTransform xform) + { + // FIXME + } + + /** Renders a RenderedImage, applying a transform from + image space into user space before drawing. */ + public void drawRenderedImage(RenderedImage img, AffineTransform xform) + { + // FIXME + } + + //------------------------------------------------------------------------- + public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) + { + setStroke(ordinaryStroke); + draw(new Polygon(xPoints, yPoints, nPoints)); + setStroke(currentStroke); + } + + public void drawString(String str, int x, int y) + { + drawString(str, (float) x, (float) y); + } + + public void drawString(String str, float x, float y) + { + if( str.trim().equals("") ) + return; // don't draw whitespace, silly! + + if( currentFontIsPS ) + { + drawStringPSFont(str, x, y); + return; + } + + TextLayout text = new TextLayout(str, currentFont, getFontRenderContext()); + Shape s = text.getOutline(AffineTransform.getTranslateInstance(x, y)); + drawStringShape(s); + } + + private void drawStringPSFont(String str, float x, float y) + { + out.println("% drawString PS font"); + out.println(x + " " + y + " moveto"); + saveAndInvertAxis(); + out.println("(" + str + ") show"); + restoreAxis(); + } + + private void saveAndInvertAxis() + { + // Invert the Y axis of the CTM. + popCTM(); + pushCTM(); + + double[] test = + { + pageTransform.getScaleX(), pageTransform.getShearY(), + pageTransform.getShearX(), pageTransform.getScaleY(), + pageTransform.getTranslateX(), + -pageTransform.getTranslateY() + pageY + }; + + double[] test2 = + { + currentTransform.getScaleX(), + currentTransform.getShearY(), + -currentTransform.getShearX(), + -currentTransform.getScaleY(), + currentTransform.getTranslateX(), + currentTransform.getTranslateY() + }; + + AffineTransform total = new AffineTransform(test); + total.concatenate(new AffineTransform(test2)); + concatCTM(total); + } + + private void restoreAxis() + { + // reset the CTM + popCTM(); + pushCTM(); + AffineTransform total = new AffineTransform(pageTransform); + total.concatenate(currentTransform); + concatCTM(total); + } + + /** + * special drawing routine for string shapes, + * which need to be drawn with the Y axis uninverted. + */ + private void drawStringShape(Shape s) + { + saveAndInvertAxis(); + + // draw the shape s with an inverted Y axis. + PathIterator pi = s.getPathIterator(null); + float[] coords = new float[6]; + + while (! pi.isDone()) + { + switch (pi.currentSegment(coords)) + { + case PathIterator.SEG_MOVETO: + out.println((coords[0]) + " " + (Y - coords[1]) + " moveto"); + cx = coords[0]; + cy = coords[1]; + break; + case PathIterator.SEG_LINETO: + out.println((coords[0]) + " " + (Y - coords[1]) + " lineto"); + cx = coords[0]; + cy = coords[1]; + break; + case PathIterator.SEG_QUADTO: + // convert to cubic bezier points + float x1 = (cx + 2 * coords[0]) / 3; + float y1 = (cy + 2 * coords[1]) / 3; + float x2 = (2 * coords[2] + coords[0]) / 3; + float y2 = (2 * coords[3] + coords[1]) / 3; + + out.print((x1) + " " + (Y - y1) + " "); + out.print((x2) + " " + (Y - y2) + " "); + out.println((coords[2]) + " " + (Y - coords[3]) + " curveto"); + cx = coords[2]; + cy = coords[3]; + break; + case PathIterator.SEG_CUBICTO: + out.print((coords[0]) + " " + (Y - coords[1]) + " "); + out.print((coords[2]) + " " + (Y - coords[3]) + " "); + out.println((coords[4]) + " " + (Y - coords[5]) + " curveto"); + cx = coords[4]; + cy = coords[5]; + break; + case PathIterator.SEG_CLOSE: + out.println("closepath"); + break; + } + pi.next(); + } + out.println("fill"); + + restoreAxis(); + } + + public void setColor(Color c) + { + /* don't set the color if it's already set */ + if (c.equals(currentColor)) + return; + gradientOn = false; + currentColor = c; + currentPaint = c; // Graphics2D extends colors to paint + + out.println(colorTriple(c) + " setrgbcolor"); + } + + public void clearRect(int x, int y, int width, int height) + { + out.println("% clearRect"); + Color c = currentColor; + setColor(backgroundColor); + fill(new Rectangle2D.Double(x, y, width, height)); + setColor(c); + } + + public void clipRect(int x, int y, int width, int height) + { + clip(new Rectangle2D.Double(x, y, width, height)); + } + + public void copyArea(int x, int y, int width, int height, int dx, int dy) + { + // FIXME + } + + public void fillRect(int x, int y, int width, int height) + { + fill(new Rectangle2D.Double(x, y, width, height)); + } + + public void dispose() + { + } + + public void setClip(int x, int y, int width, int height) + { + out.println("% setClip()"); + setClip(new Rectangle2D.Double(x, y, width, height)); + } + + public void setClip(Shape s) + { + clip(s); + } + + public Shape getClip() + { + return clipShape; + } + + public Rectangle getClipBounds() + { + return clipShape.getBounds(); + } + + public Color getColor() + { + return currentColor; + } + + public Font getFont() + { + return currentFont; + } + + public FontMetrics getFontMetrics() + { + return getFontMetrics(currentFont); + } + + public FontMetrics getFontMetrics(Font f) + { + // FIXME + return null; + } + + public void setFont(Font font) + { + out.println("% setfont()"); + if (font == null) + // use the default font + font = new Font("Dialog", Font.PLAIN, 12); + currentFont = font; + setPSFont(); // set up the PostScript fonts + } + + /** + * Setup the postscript font if the current font is one + */ + private void setPSFont() + { + currentFontIsPS = false; + + String s = currentFont.getName(); + out.println("% setPSFont: Fontname: " + s); + if (s.equalsIgnoreCase("Helvetica") || s.equalsIgnoreCase("SansSerif")) + out.print("/helveticaISO findfont "); + else if (s.equalsIgnoreCase("Times New Roman")) + out.print("/timesISO findfont "); + else if (s.equalsIgnoreCase("Courier")) + out.print("/courierISO findfont "); + else + return; + + currentFontIsPS = true; + + out.print(currentFont.getSize() + " scalefont "); + out.println("setfont"); + } + + /** XOR mode is not supported */ + public void setPaintMode() + { + } + + /** XOR mode is not supported */ + public void setXORMode(Color c1) + { + } + + public void close() + { + out.println("showpage"); + out.println("%%Trailer"); + out.println("grestore % restore original stuff"); + out.println("%%EOF"); + + try + { + out.close(); + } + catch (Exception e) + { + } + out = null; + } + + //---------------------------------------------------------------- + // Graphics2D stuff ---------------------------------------------- + + /** Sets the values of an arbitrary number of + preferences for the rendering algorithms. */ + public void addRenderingHints(Map hints) + { + /* rendering hint changes are disallowed */ + } + + /** write a shape to the file */ + private void writeShape(Shape s) + { + PathIterator pi = s.getPathIterator(null); + float[] coords = new float[6]; + + while (! pi.isDone()) + { + switch (pi.currentSegment(coords)) + { + case PathIterator.SEG_MOVETO: + out.println(coords[0] + " " + (coords[1]) + " moveto"); + cx = coords[0]; + cy = coords[1]; + break; + case PathIterator.SEG_LINETO: + out.println(coords[0] + " " + (coords[1]) + " lineto"); + cx = coords[0]; + cy = coords[1]; + break; + case PathIterator.SEG_QUADTO: + // convert to cubic bezier points + float x1 = (cx + 2 * coords[0]) / 3; + float y1 = (cy + 2 * coords[1]) / 3; + float x2 = (2 * coords[2] + coords[0]) / 3; + float y2 = (2 * coords[3] + coords[1]) / 3; + + out.print(x1 + " " + (Y - y1) + " "); + out.print(x2 + " " + (Y - y2) + " "); + out.println(coords[2] + " " + (Y - coords[3]) + " curveto"); + cx = coords[2]; + cy = coords[3]; + break; + case PathIterator.SEG_CUBICTO: + out.print(coords[0] + " " + coords[1] + " "); + out.print(coords[2] + " " + coords[3] + " "); + out.println(coords[4] + " " + coords[5] + " curveto"); + cx = coords[4]; + cy = coords[5]; + break; + case PathIterator.SEG_CLOSE: + out.println("closepath"); + break; + } + pi.next(); + } + } + + /** Intersects the current Clip with the interior of + the specified Shape and sets the Clip to the resulting intersection. */ + public void clip(Shape s) + { + clipShape = s; + out.println("% clip INACTIVE"); + // writeShape(s); + // out.println("clip"); + } + + /** Strokes the outline of a Shape using the + settings of the current Graphics2D context.*/ + public void draw(Shape s) + { + if(!(currentStroke instanceof BasicStroke)) + fill(currentStroke.createStrokedShape(s)); + + out.println("% draw"); + writeShape(s); + out.println("stroke"); + } + + /** Renders the text of the specified GlyphVector using the + Graphics2D context's rendering attributes. */ + public void drawGlyphVector(GlyphVector gv, float x, float y) + { + out.println("% drawGlyphVector"); + Shape s = gv.getOutline(); + drawStringShape(AffineTransform.getTranslateInstance(x, y) + .createTransformedShape(s)); + } + + /** Renders the text of the specified iterator, + using the Graphics2D context's current Paint.*/ + public void drawString(AttributedCharacterIterator iterator, float x, float y) + { + TextLayout text = new TextLayout(iterator, getFontRenderContext()); + Shape s = text.getOutline(AffineTransform.getTranslateInstance(x, y)); + drawStringShape(s); + } + + /** Renders the text of the specified iterator, + using the Graphics2D context's current Paint. */ + public void drawString(AttributedCharacterIterator iterator, int x, int y) + { + drawString(iterator, (float) x, (float) y); + } + + /** Fills the interior of a Shape using the settings of the Graphics2D context. */ + public void fill(Shape s) + { + out.println("% fill"); + if (! gradientOn) + { + writeShape(s); + out.println("fill"); + } + else + { + out.println("gsave"); + writeShape(s); + out.println("clip"); + writeGradient(); + out.println("shfill"); + out.println("grestore"); + } + } + + /** Returns the background color used for clearing a region. */ + public Color getBackground() + { + return backgroundColor; + } + + /** Returns the current Composite in the Graphics2D context. */ + public Composite getComposite() + { + // FIXME + return null; + } + + /** Returns the device configuration associated with this Graphics2D. */ + public GraphicsConfiguration getDeviceConfiguration() + { + // FIXME + out.println("% getDeviceConfiguration()"); + return null; + } + + /** Get the rendering context of the Font within this Graphics2D context. */ + public FontRenderContext getFontRenderContext() + { + out.println("% getFontRenderContext()"); + + double[] scaling = + { + pageTransform.getScaleX(), 0, 0, + -pageTransform.getScaleY(), 0, 0 + }; + + return (new FontRenderContext(new AffineTransform(scaling), false, true)); + } + + /** Returns the current Paint of the Graphics2D context. */ + public Paint getPaint() + { + return currentPaint; + } + + /** Returns the value of a single preference for the rendering algorithms. */ + public Object getRenderingHint(RenderingHints.Key hintKey) + { + return renderingHints.get(hintKey); + } + + /** Gets the preferences for the rendering algorithms. */ + public RenderingHints getRenderingHints() + { + return renderingHints; + } + + /** Returns the current Stroke in the Graphics2D context. */ + public Stroke getStroke() + { + return currentStroke; + } + + /** Returns a copy of the current Transform in the Graphics2D context. */ + public AffineTransform getTransform() + { + return currentTransform; + } + + /** + * Checks whether or not the specified Shape intersects + * the specified Rectangle, which is in device space. + */ + public boolean hit(Rectangle rect, Shape s, boolean onStroke) + { + Rectangle2D.Double r = new Rectangle2D.Double(rect.getX(), rect.getY(), + rect.getWidth(), + rect.getHeight()); + return s.intersects(r); + } + + /** Sets the background color for the Graphics2D context.*/ + public void setBackground(Color color) + { + out.println("% setBackground(" + color + ")"); + backgroundColor = color; + } + + /** Sets the Composite for the Graphics2D context. + Not supported. */ + public void setComposite(Composite comp) + { + } + + /** Sets the Paint attribute for the Graphics2D context.*/ + public void setPaint(Paint paint) + { + currentPaint = paint; + gradientOn = false; + if (paint instanceof Color) + { + setColor((Color) paint); + return; + } + if (paint instanceof GradientPaint) + { + gradientOn = true; + return; + } + } + + /* get a space seperated 0.0 - 1.0 color RGB triple */ + private String colorTriple(Color c) + { + return (((double) c.getRed() / 255.0) + " " + + ((double) c.getGreen() / 255.0) + " " + + ((double) c.getBlue() / 255.0)); + } + + /** + * Get a nonsperated hex RGB triple, eg FFFFFF = white + * used by writeGradient and drawImage + */ + private String colorTripleHex(Color c) + { + String r = "00" + Integer.toHexString(c.getRed()); + r = r.substring(r.length() - 2); + String g = "00" + Integer.toHexString(c.getGreen()); + g = g.substring(g.length() - 2); + String b = "00" + Integer.toHexString(c.getBlue()); + b = b.substring(b.length() - 2); + return r + g + b; + } + + /* write the current gradient fill */ + private void writeGradient() + { + GradientPaint paint = (GradientPaint) currentPaint; + out.println("% writeGradient()"); + + int n = 1; + double x; + double y; + double dx; + double dy; + Point2D p1 = currentTransform.transform(paint.getPoint1(), null); + Point2D p2 = currentTransform.transform(paint.getPoint2(), null); + x = p1.getX(); + y = p1.getY(); + dx = p2.getX() - x; + dy = p2.getY() - y; + + // get number of repetitions + while (x + n * dx < pageY && y + n * dy < pageX && x + n * dx > 0 + && y + n * dy > 0) + n++; + + out.println("<<"); // start + out.println("/ShadingType 2"); // gradient fill + out.println("/ColorSpace [ /DeviceRGB ]"); // RGB colors + out.print("/Coords ["); + out.print(x + " " + y + " " + (x + n * dx) + " " + (y + n * dy) + " "); + out.println("]"); // coordinates defining the axis + out.println("/Function <<"); + out.println("/FunctionType 0"); + out.println("/Order 1"); + out.println("/Domain [ 0 1 ]"); + out.println("/Range [ 0 1 0 1 0 1 ]"); + out.println("/BitsPerSample 8"); + out.println("/Size [ " + (1 + n) + " ]"); + out.print("/DataSource < " + colorTripleHex(paint.getColor1()) + " " + + colorTripleHex(paint.getColor2()) + " "); + for (; n > 1; n--) + if (paint.isCyclic()) + { + if ((n % 2) == 1) + out.print(colorTripleHex(paint.getColor1()) + " "); + else + out.print(colorTripleHex(paint.getColor2()) + " "); + } + else + out.print(colorTripleHex(paint.getColor2()) + " "); + out.println(">"); + out.println(">>"); + out.println(">>"); + } + + /** Sets the value of a single preference for the rendering algorithms. */ + public void setRenderingHint(RenderingHints.Key hintKey, Object hintValue) + { + /* we don't allow the changing of rendering hints. */ + } + + /** Replaces the values of all preferences for the rendering algorithms + with the specified hints. */ + public void setRenderingHints(Map hints) + { + /* we don't allow the changing of rendering hints. */ + } + + /** + * Sets the Stroke for the Graphics2D context. BasicStroke fully implemented. + */ + public void setStroke(Stroke s) + { + currentStroke = s; + + if (! (s instanceof BasicStroke)) + return; + + BasicStroke bs = (BasicStroke) s; + out.println("% setStroke()"); + try + { + // set the line width + out.println(bs.getLineWidth() + " setlinewidth"); + + // set the line dash + float[] dashArray = bs.getDashArray(); + if (dashArray != null) + { + out.print("[ "); + for (int i = 0; i < dashArray.length; i++) + out.print(dashArray[i] + " "); + out.println("] " + bs.getDashPhase() + " setdash"); + } + else + out.println("[] 0 setdash"); // set solid + + // set the line cap + switch (bs.getEndCap()) + { + case BasicStroke.CAP_BUTT: + out.println("0 setlinecap"); + break; + case BasicStroke.CAP_ROUND: + out.println("1 setlinecap"); + break; + case BasicStroke.CAP_SQUARE: + out.println("2 setlinecap"); + break; + } + + // set the line join + switch (bs.getLineJoin()) + { + case BasicStroke.JOIN_BEVEL: + out.println("2 setlinejoin"); + break; + case BasicStroke.JOIN_MITER: + out.println("0 setlinejoin"); + out.println(bs.getMiterLimit() + " setmiterlimit"); + break; + case BasicStroke.JOIN_ROUND: + out.println("1 setlinejoin"); + break; + } + } + catch (Exception e) + { + out.println("% Exception in setStroke()"); + } + } + + //////////////////// TRANSFORM SETTING ///////////////////////////////////// + private void concatCTM(AffineTransform Tx) + { + double[] matrixElements = new double[6]; + Tx.getMatrix(matrixElements); + + out.print("[ "); + for (int i = 0; i < 6; i++) + out.print(matrixElements[i] + " "); + out.println("] concat"); + } + + /** Sets the Transform in the Graphics2D context. */ + public void setTransform(AffineTransform Tx) + { + // set the transformation matrix; + currentTransform = Tx; + + // concatenate the current transform and the page transform + AffineTransform totalTransform = new AffineTransform(pageTransform); + totalTransform.concatenate(currentTransform); + out.println("% setTransform()"); + out.println("% pageTransform:" + pageTransform); + out.println("% currentTransform:" + currentTransform); + out.println("% totalTransform:" + totalTransform); + + popCTM(); + pushCTM(); // set the CTM to it's original state + concatCTM(totalTransform); // apply our transforms + } + + /** Composes an AffineTransform object with the Transform + in this Graphics2D according to the rule last-specified-first-applied. */ + public void transform(AffineTransform Tx) + { + // concatenate the current transform + currentTransform.concatenate(Tx); + // and the PS CTM + concatCTM(Tx); + } + + ////////////////////////// TRANSFORMS ////////////////////////////////////// + + /** shear transform */ + public void shear(double shx, double shy) + { + out.println("% shear()"); + AffineTransform Tx = new AffineTransform(); + Tx.shear(shx, shy); + transform(Tx); + } + + /** Translates the origin of the Graphics2D context + to the point (x, y) in the current coordinate system. */ + public void translate(int x, int y) + { + out.println("% translate()"); + AffineTransform Tx = new AffineTransform(); + Tx.translate(x, y); + transform(Tx); + } + + /** Translates the origin of the Graphics2D context + to the point (x, y) in the current coordinate system. */ + public void translate(double x, double y) + { + out.println("% translate(" + x + ", " + y + ")"); + AffineTransform Tx = new AffineTransform(); + Tx.translate(x, y); + transform(Tx); + } + + /** Concatenates the current Graphics2D Transform with a rotation transform.*/ + public void rotate(double theta) + { + out.println("% rotate(" + theta + ")"); + AffineTransform Tx = new AffineTransform(); + Tx.rotate(theta); + transform(Tx); + } + + /** Concatenates the current Graphics2D Transform with + a translated rotation transform.*/ + public void rotate(double theta, double x, double y) + { + out.println("% rotate()"); + AffineTransform Tx = new AffineTransform(); + Tx.rotate(theta, x, y); + transform(Tx); + } + + /** Concatenates the current Graphics2D Transform with a scaling + transformation Subsequent rendering is resized according to the + specified scaling factors relative to the previous scaling.*/ + public void scale(double sx, double sy) + { + out.println("% scale(" + sx + ", " + sy + ")"); + AffineTransform Tx = new AffineTransform(); + Tx.scale(sx, sy); + transform(Tx); + } +} Added: trunk/core/src/classpath/gnu/gnu/java/awt/print/SpooledDocument.java =================================================================== --- trunk/core/src/classpath/gnu/gnu/java/awt/print/SpooledDocument.java (rev 0) +++ trunk/core/src/classpath/gnu/gnu/java/awt/print/SpooledDocument.java 2007-01-09 20:23:01 UTC (rev 3059) @@ -0,0 +1,91 @@ +/* SpooledDocument.java -- Reurgitate a spooled PostScript file + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath 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 for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.awt.print; + +import javax.print.Doc; +import javax.print.DocFlavor; +import javax.print.attribute.DocAttributeSet; +import java.io.File; +import java.io.IOException; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.Reader; +import java.io.InputStream; +import java.io.InputStreamReader; + +public class SpooledDocument implements Doc +{ + private FileInputStream fis; + + public SpooledDocument(File file) + { + try + { + fis = new FileInputStream(file); + } + catch (FileNotFoundException ffne) + { + // Shouldn't happen. + } + } + + public DocAttributeSet getAttributes() + { + return null; + } + + public DocFlavor getDocFlavor() + { + return DocFlavor.INPUT_STREAM.POSTSCRIPT; + } + + public Object getPrintData() + { + return fis; + } + + public Reader getReaderForText() + { + return new InputStreamReader(fis); + } + + public InputStream getStreamForBytes() + { + return fis; + } +} Modified: trunk/core/src/classpath/gnu/gnu/java/nio/SelectorImpl.java =================================================================== --- trunk/core/src/classpath/gnu/gnu/java/nio/SelectorImpl.java 2007-01-09 15:20:43 UTC (rev 3058) +++ trunk/core/src/classpath/gnu/gnu/java/nio/SelectorImpl.java 2007-01-09 20:23:01 UTC (rev 3059) @@ -54,8 +54,8 @@ public class SelectorImpl extends AbstractSelector { - private Set keys; - private Set selected; + private Set<SelectionKey> keys; + private Set<SelectionKey> selected; /** * A dummy object whose monitor regulates access to both our @@ -83,8 +83,8 @@ { super (provider); - keys = new HashSet (); - selected = new HashSet (); + keys = new HashSet<SelectionKey> (); + selected = new HashSet<SelectionKey> (); } protected void finalize() throws Throwable @@ -110,7 +110,7 @@ } } - public final Set keys() + public final Set<SelectionKey> keys() { if (!isOpen()) throw new ClosedSelectorException(); @@ -136,7 +136,7 @@ { int[] result; int counter = 0; - Iterator it = keys.iterator (); + Iterator<SelectionKey> it = keys.iterator (); // Count the number of file descriptors needed while (it.hasNext ()) @@ -253,7 +253,7 @@ selectThread = null; } - Iterator it = keys.iterator (); + Iterator<SelectionKey> it = keys.iterator (); while (it.hasNext ()) { @@ -317,7 +317,7 @@ } } - public final Set selectedKeys() + public final Set<SelectionKey> selectedKeys() { if (!isOpen()) throw new ClosedSelectorException(); @@ -350,10 +350,10 @@ private final void deregisterCancelledKeys() { - Set ckeys = cancelledKeys (); + Set<SelectionKey> ckeys = cancelledKeys (); synchronized (ckeys) { - Iterator it = ckeys.iterator(); + Iterator<SelectionKey> it = ckeys.iterator(); while (it.hasNext ()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2007-01-09 15:20:48
|
Revision: 3058 http://jnode.svn.sourceforge.net/jnode/?rev=3058&view=rev Author: lsantha Date: 2007-01-09 07:20:43 -0800 (Tue, 09 Jan 2007) Log Message: ----------- Applied bugfix by alea. Modified Paths: -------------- trunk/fs/src/fs/org/jnode/fs/jfat/FatDirectory.java Modified: trunk/fs/src/fs/org/jnode/fs/jfat/FatDirectory.java =================================================================== --- trunk/fs/src/fs/org/jnode/fs/jfat/FatDirectory.java 2007-01-09 08:51:34 UTC (rev 3057) +++ trunk/fs/src/fs/org/jnode/fs/jfat/FatDirectory.java 2007-01-09 15:20:43 UTC (rev 3058) @@ -105,7 +105,11 @@ if ( index > MAXENTRIES ) throw new IOException ( "Directory is full" ); getChain().allocateAndClear ( 1 ); - continue; + //restart the search, fixes infinite loop + //TODO review it for a better solution + i = 0; + index = 0; + continue; } if ( entry.isFreeDirEntry() || entry.isLastDirEntry() ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hag...@us...> - 2007-01-09 08:51:37
|
Revision: 3057 http://jnode.svn.sourceforge.net/jnode/?rev=3057&view=rev Author: hagar-wize Date: 2007-01-09 00:51:34 -0800 (Tue, 09 Jan 2007) Log Message: ----------- removed classpath/5.0 folder Modified Paths: -------------- trunk/core/.classpath Modified: trunk/core/.classpath =================================================================== --- trunk/core/.classpath 2007-01-08 08:40:57 UTC (rev 3056) +++ trunk/core/.classpath 2007-01-09 08:51:34 UTC (rev 3057) @@ -4,7 +4,6 @@ <classpathentry kind="src" path="src/classpath/java"/> <classpathentry kind="src" path="src/classpath/javax"/> <classpathentry kind="src" path="src/classpath/org"/> - <classpathentry kind="src" path="src/classpath/5.0"/> <classpathentry kind="src" path="src/classpath/ext"/> <classpathentry kind="src" path="src/classpath/vm"/> <classpathentry kind="src" path="src/core"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ans...@us...> - 2007-01-08 08:40:58
|
Revision: 3056 http://jnode.svn.sourceforge.net/jnode/?rev=3056&view=rev Author: ansari82 Date: 2007-01-08 00:40:57 -0800 (Mon, 08 Jan 2007) Log Message: ----------- Added capability of compilertest to generate text and binary output for compiled methods, and modified jikestest for testing float/double ops more thoroughly Modified Paths: -------------- branches/jikesRVM/core/src/test/org/jnode/test/JikesTest.java branches/jikesRVM/core/src/test/org/jnode/test/core/CompilerTest.java Modified: branches/jikesRVM/core/src/test/org/jnode/test/JikesTest.java =================================================================== --- branches/jikesRVM/core/src/test/org/jnode/test/JikesTest.java 2007-01-08 08:39:10 UTC (rev 3055) +++ branches/jikesRVM/core/src/test/org/jnode/test/JikesTest.java 2007-01-08 08:40:57 UTC (rev 3056) @@ -2,38 +2,68 @@ public class JikesTest { +public static float stFValue = 15.0F; +public static double stDValue = 30.0; + +public float FValue = 5.0F; +public double DValue = 10.0; + public static void main (String [] argv) { - int [] array = {1,2,3,4,5,6}; int i = 1;long j = 5; long t0, t1; - System.out.println("jikesReturns expect true, return "+!jikesReturns()); - System.out.println("jikesTakesParam expect true, return "+(jikesTakesParam(5)==5?true:false)); - System.out.println("jikesAccessLocalSTATICVar expect true, return "+(jikesAccessLocalSTATICVar()==true?true:false)); - System.out.println("jikesCallLocalSTATICMethod expect true, return "+(jikesCallLocalSTATICMethod(5)==true?true:false)); - System.out.println("jikesAccessLocalSTATICArray expect true, return "+(jikesAccessLocalSTATICArray(j)==0?true:false)); - System.out.println("jikesAccessArray expect true, return "+(jikesAccessArray(array)==array[0]?true:false)); - System.out.println("jikesAccessJTOC expect time, return "+jikesAccessJTOC()); - System.out.print( "jikesPrintInt expect 5, return ");jikesPrintInt(5); - System.out.print( "jikesPrintStr expect yaay, return ");jikesPrintStr(new String("yaay")); - System.out.println("jikesmulTest expect 15, return "+jikesmulTest(3,5)); - System.out.println("jikesshlTest expect 4, return "+jikesshlTest(2,1)); - System.out.println("jikesshrTest expect 4, return "+jikesshrTest(8,1)); - System.out.println("jikessarTest expect 4, return "+jikessarTest(8,1)); - System.out.println("jikesFloatTest expect true, return "+!jikesFloatTest((float)5.0, (float)1.0)); - System.out.println("jikesFloatTest expect true, return "+ jikesFloatTest((float)1.0, (float)5.0)); - System.out.println("jikesFloatTest expect true, return "+ jikesFloatTest((float)1.0, (float)1.0)); - System.out.println("jikesAllocPrimitiveArray expect true, return "+(jikesAllocPrimitiveArray()[1]==localSTATIC?true:false)); - System.out.println("jikesAllocObjectArray expect true, return "+(testInstanceOf(jikesAllocObjectArray()[1])?true:false)); - System.out.println("jikesAllocMultiArray expect true, return "+(jikesAllocMultiArray()[1][1]==localSTATIC?true:false)); - System.out.println("jikesMonitor expect true, return "+jikesMonitor()); - System.out.print( "jikesTryCatchException expect true, return ");jikesTryCatch(); - t0 = time();System.out.print("jikestestSmallLoop:"+jikestestsmallloop()+" time:");t1 = time();System.out.println(t1 - t0); - t0 = time();System.out.print("jikestestBigLoop: "+jikestestbigloop() +" time:");t1 = time();System.out.println(t1 - t0); - sayHi2(); - JikesTest myHello = new JikesTest();myHello.sayHi(); + int [] array = {1,2,3,4,5,6}; int i = 1;long j = 5; long t0, t1; + System.out.println("jikesReturns expect true, return "+!jikesReturns()); + System.out.println("jikesTakesParam expect true, return "+(jikesTakesParam(5)==5?true:false)); + System.out.println("jikesAccessLocalSTATICVar expect true, return "+(jikesAccessLocalSTATICVar()==true?true:false)); + System.out.println("jikesCallLocalSTATICMethod expect true, return "+(jikesCallLocalSTATICMethod(5)==true?true:false)); + System.out.println("jikesAccessLocalSTATICArray expect true, return "+(jikesAccessLocalSTATICArray(j)==0?true:false)); + System.out.println("jikesAccessArray expect true, return "+(jikesAccessArray(array)==array[0]?true:false)); + System.out.println("jikesAccessJTOC expect time, return "+jikesAccessJTOC()); + System.out.print( "jikesPrintInt expect 5, return ");jikesPrintInt(5); + System.out.print( "jikesPrintStr expect yaay, return ");jikesPrintStr(new String("yaay")); + System.out.println("jikesmulTest expect 15, return "+jikesmulTest(3,5)); + System.out.println("jikesshlTest expect 4, return "+jikesshlTest(2,1)); + System.out.println("jikesshrTest expect 4, return "+jikesshrTest(8,1)); + System.out.println("jikessarTest expect 4, return "+jikessarTest(8,1)); + System.out.println("jikesFloatTest expect true, return "+!jikesFloatTest((float)5.0, (float)1.0)); + System.out.println("jikesFloatTest expect true, return "+ jikesFloatTest((float)1.0, (float)5.0)); + System.out.println("jikesFloatTest expect true, return "+ jikesFloatTest((float)1.0, (float)1.0)); + System.out.println("jikesAllocPrimitiveArray expect true, return "+(jikesAllocPrimitiveArray()[1]==localSTATIC?true:false)); + System.out.println("jikesAllocObjectArray expect true, return "+(testInstanceOf(jikesAllocObjectArray()[1])?true:false)); + System.out.println("jikesAllocMultiArray expect true, return "+(jikesAllocMultiArray()[1][1]==localSTATIC?true:false)); + System.out.println("jikesMonitor expect true, return "+jikesMonitor()); + System.out.print( "jikesTryCatchException expect true, return ");jikesTryCatch(); + t0 = time();System.out.print("jikestestSmallLoop:"+jikestestsmallloop()+" time:");t1 = time();System.out.println(t1 - t0); + t0 = time();System.out.print("jikestestBigLoop: "+jikestestbigloop() +" time:");t1 = time();System.out.println(t1 - t0); + sayHi2(); + JikesTest myHello = new JikesTest();myHello.sayHi(); + + System.out.println("value before "+stFValue+" "+stDValue); + stFValue+=5.0F; + stDValue+=10.0; + System.out.println("value after "+stFValue+" "+stDValue); + System.out.println("obj value before "+myHello.FValue+" "+myHello.DValue); + float f = myHello.setF(myHello.FValue+=5.0F); + double d = myHello.setD(myHello.DValue+=10.0); + System.out.println("obj value after "+f+" "+d); System.out.println("throw array out of bounds"); array[10] = 0; - } +public float setF(float f) { + return realSetF(f); +} +public double setD(double d) { + return realSetD(d); +} + +public float realSetF(float f) { + FValue = f; + return FValue; +} +public double realSetD(double d) { + DValue = d; + return DValue; +} + private static void jikesTryException () { throw new NullPointerException("true"); } Modified: branches/jikesRVM/core/src/test/org/jnode/test/core/CompilerTest.java =================================================================== --- branches/jikesRVM/core/src/test/org/jnode/test/core/CompilerTest.java 2007-01-08 08:39:10 UTC (rev 3055) +++ branches/jikesRVM/core/src/test/org/jnode/test/core/CompilerTest.java 2007-01-08 08:40:57 UTC (rev 3056) @@ -28,7 +28,10 @@ import java.io.PrintStream; import org.jnode.assembler.ObjectResolver; +import org.jnode.assembler.x86.X86Assembler; +import org.jnode.assembler.x86.X86BinaryAssembler; import org.jnode.assembler.x86.X86TextAssembler; +import org.jnode.assembler.x86.X86Constants.Mode; import org.jnode.vm.Vm; import org.jnode.vm.VmArchitecture; import org.jnode.vm.VmSystemClassLoader; @@ -104,7 +107,17 @@ // "org.jnode.vm.bytecode.BytecodeParser", // "com.ibm.JikesRVM.VM_Runtime", // "org.jnode.test.JikesTest", - "org.jnode.vm.classmgr.VmConstFloat" +// "org.jnode.vm.classmgr.VmConstFloat", +// "org.jnode.vm.x86.compiler.l1a.ItemFactory", +// "org.jnode.vm.scheduler.IdleThread", +// "org.jnode.vm.classmgr.VmAnnotation", +// "com.ibm.JikesRVM.opt.OPT_LICM", +// "org.jnode.vm.scheduler.VmProcessor", +// "org.jnode.vm.scheduler.VmThread", +// "org.jnode.test.DoubleTest2", + "java.lang.String", + + }; public static void main(String[] args) throws Exception { @@ -126,7 +139,7 @@ vm.toString(); System.out.println("Architecture: " + arch.getFullName()); - //final ObjectResolver resolver = new DummyResolver(); + final ObjectResolver resolver = new DummyResolver(); final X86CpuID cpuId = X86CpuID.createID(processorId); //NativeCodeCompiler c = cs[0]; final NativeCodeCompiler[] cs = { @@ -148,8 +161,8 @@ for (int i = 0; i < cnt; i++) { final VmMethod method = type.getDeclaredMethod(i); counts[ci]++; -// if(method.getName().contains("is")) - compile(method, arch, cs[ci], cpuId, ci + 1); + if(method.getName().contains("init")) + compile(method, arch, cs[ci], cpuId, ci + 1, resolver); } } final long end = System.currentTimeMillis(); @@ -162,35 +175,45 @@ } static void compile(VmMethod method, VmArchitecture arch, NativeCodeCompiler c, X86CpuID cpuId, - int level) throws IOException { + int level, ObjectResolver resolver) throws IOException { + final String cname = method.getDeclaringClass().getName(); final String mname = method.getFullName(); - final String fname = mname.replace('<', '_').replace('>', '_').replace('/','.') + "." + c.getName() + final String fname = cname + "#" +mname.replace('<', '_').replace('>', '_').replace('/','.') + "." + c.getName() + ".method"; - final FileOutputStream out = new FileOutputStream(fname); + FileOutputStream out = new FileOutputStream(fname); + X86Assembler os [] = { + new X86TextAssembler(new OutputStreamWriter(out),cpuId, ((VmX86Architecture)arch).getMode(), method.getMangledName()), + new X86BinaryAssembler(cpuId, ((VmX86Architecture)arch).getMode(), 0), + }; + - try { - if (!method.isAbstract()) { - final PrintStream ps = new PrintStream(out); - BytecodeViewer viewer = new BytecodeViewer( - new ControlFlowGraph(method.getBytecode()), ps); - BytecodeParser.parse(method.getBytecode(), viewer); - ps.flush(); - } - - X86TextAssembler os = new X86TextAssembler(new OutputStreamWriter(out), - cpuId, ((VmX86Architecture)arch).getMode(), method.getMangledName()); + for(int i = 0; i < os.length; i++) { try { - c.compileBootstrap(method, os, level); - //c.compileRuntime(method, resolver, level, os); + if (!method.isAbstract()) { + if(!(os[i] instanceof X86BinaryAssembler)) { + final PrintStream ps = new PrintStream(out); + BytecodeViewer viewer = new BytecodeViewer( + new ControlFlowGraph(method.getBytecode()), ps); + BytecodeParser.parse(method.getBytecode(), viewer); + ps.flush(); + } + } + + if(!Vm.isRunningVm()) c.compileBootstrap(method, os[i], level); + else c.compileRuntime(method, resolver, level, os[i]); + if(os[i] instanceof X86TextAssembler) ((X86TextAssembler)os[i]).flush(); + if(os[i] instanceof X86BinaryAssembler) { + out = new FileOutputStream(fname+".bin"); + X86BinaryAssembler bos = (X86BinaryAssembler)os[i]; + out.write(bos.getBytes(), 0, bos.getLength()); + } + } catch (Throwable ex) { + System.out.println("Error in ### Method " + mname + " -> " + fname); + ex.printStackTrace(); + System.exit(1); } finally { - os.flush(); + out.close(); } - } catch (Throwable ex) { - System.out.println("Error in ### Method " + mname + " -> " + fname); - ex.printStackTrace(); - System.exit(1); - } finally { - out.close(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ans...@us...> - 2007-01-08 08:39:13
|
Revision: 3055 http://jnode.svn.sourceforge.net/jnode/?rev=3055&view=rev Author: ansari82 Date: 2007-01-08 00:39:10 -0800 (Mon, 08 Jan 2007) Log Message: ----------- Large update fixing several bugs. Fixes yieldpoint and stackoverflow code, adds support for atomic access, fixes some magic method implementations, correctly performs instanceof, correctly obtains class for static synchronized methods, fixes exception handler bug of not being at the correct location in stack before executing catch block, correctly stores exception handler in eax, forces only org.jnode.test to be allowed for jikesopt compilation (test), hack in NativeCodeCompiler to allow viewing output of runtime compiled code, removed warnings from VerifyingCompiler (debug) Modified Paths: -------------- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_CompiledMethod.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Statics.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Assembler.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BURS_Debug.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BURS_Helpers.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BURS_STATE.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_BURS_TreeNode.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_CallingConvention.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ComplexLIR2MIRExpansion.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ConvertLIRtoMIR.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ConvertToLowLevelIR.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_ExpandRuntimeServices.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_FinalMIRExpansion.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_GenericStackManager.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Options.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Simplifier.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_StackManager.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_AddressConstantOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_BC2IR.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateJnodeMagic.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerateMagic.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_GenerationContext.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_LocationOperand.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/ir/OPT_TrapCodeOperand.java branches/jikesRVM/core/src/core/org/jnode/vm/LoadCompileService.java branches/jikesRVM/core/src/core/org/jnode/vm/classmgr/VmField.java branches/jikesRVM/core/src/core/org/jnode/vm/classmgr/VmMethod.java branches/jikesRVM/core/src/core/org/jnode/vm/classmgr/VmStaticsBase.java branches/jikesRVM/core/src/core/org/jnode/vm/compiler/NativeCodeCompiler.java branches/jikesRVM/core/src/core/org/jnode/vm/compiler/VerifyingCompilerBytecodeVisitor.java Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java 2007-01-08 08:29:18 UTC (rev 3054) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/JikesRVMOptCompiler.java 2007-01-08 08:39:10 UTC (rev 3055) @@ -6,6 +6,7 @@ import org.jnode.assembler.UnresolvedObjectRefException; import org.jnode.assembler.x86.X86Assembler; import org.jnode.assembler.x86.X86BinaryAssembler; +import org.jnode.vm.Unsafe; import org.jnode.vm.Vm; import org.jnode.vm.VmAddress; import org.jnode.vm.VmMagic; @@ -26,6 +27,7 @@ import org.jnode.vm.x86.compiler.AbstractX86Compiler; import org.vmmagic.unboxed.Address; +import com.ibm.JikesRVM.classloader.VM_BootstrapClassLoader; import com.ibm.JikesRVM.classloader.VM_Method; import com.ibm.JikesRVM.classloader.VM_NormalMethod; import com.ibm.JikesRVM.classloader.VM_Type; @@ -53,21 +55,24 @@ public static OPT_Options options; public static OPT_OptimizationPlanElement[] optimizationPlan; + + private boolean init = false; public JikesRVMOptCompiler() { options = new OPT_Options(); optimizationPlan = OPT_OptimizationPlanner .createOptimizationPlan(options); - VM.getVM(); - OPT_Compiler.init(options); + OPT_Compiler.init(options); // VM_PreCompile.init();//Don't know what this is compilerEnabled = true; - } - + @Override protected CompiledMethod doCompile(VmMethod method, NativeStream nos, int level, boolean isBootstrap) { - + if(!init ) { + VM_BootstrapClassLoader.fromJikesCompiler = method.getDeclaringClass().getLoader(); + init = true; + } VM_Magic.jikesCompiled=true; final CompiledMethod cm; if (method.isNative()) { @@ -90,96 +95,19 @@ VM_CompiledMethod jikescm = optCompileWithFallBackInternal(jikesMethod, compPlan); //Build necessary result for JNode VM from Jikes compiled output cm = ((VM_OptCompiledMethod)jikescm).buildJnodeCM((X86Assembler)nos, getEntryPoints()); + //Uninitialise Jikes' VM_Magic +// VM_Magic.uninit(); compilationInProgress = false; } return cm; } - private static VM_CompiledMethod optCompileWithFallBackInternal( - VM_NormalMethod method, OPT_CompilationPlan plan) { - if (method.hasNoOptCompilePragma()) - return fallback(method); - try { - plan.method = method; - plan.options = options; - return OPT_Compiler.compile(plan); - } - catch (OPT_OptimizingCompilerException e) { - e.printStackTrace(); - } - return fallback(method); - - } - - private static VM_CompiledMethod fallback(VM_NormalMethod method) { - // Some methods geniunely can't be optcompiled, so we need - // a way to fall back gracefully, this is a skeleton start. - return null; - } - - public static boolean compilableMethod(VmMethod vmMethod) { - if ( -// vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.A") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.C") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.I") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.M") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.N") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.O") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.S") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.T") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmA") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmB") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmClass") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmCom") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmConstC") // -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmConstD") // -// vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmConstMember") // - vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmConstFl") // - && ( - vmMethod.getName().contains("get") - || vmMethod.getName().startsWith("float") - ) -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmConstI") // -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmCP") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmE") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmF") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmIm") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmIns") // -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmInt") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmIso") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmL") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmM") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmN") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmO") // -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmP") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmR") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmSh") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmSp") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmSt") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmT") -// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr.VmU") - - ) - { - return true; - } - else return false; - } - - public static boolean compilableClass(VmType vmClass) { - if (vmClass.getName().contains("org.jnode.vm.classmgr.Abstract") -// || vmClass.getName().contains("org.jnode.vm.classmgr.ClassDecoder") - || vmClass.getName().contains("org.jnode.vm.classmgr.CompiledCodeList") -// || vmClass.getName().contains("org.jnode.vm.classmgr.IMTBuilder") - || vmClass.getName().contains("org.jnode.vm.classmgr.MethodPragmaFlags") - - ) { - return true; - } - else return false; - } - - @Override + /** + * Create a native stream for the current architecture. + * + * @param resolver + * @return NativeStream + */ public NativeStream createNativeStream(ObjectResolver resolver) { X86CpuID cpuid = (X86CpuID) VmProcessor.current().getCPUID(); X86BinaryAssembler os = new X86BinaryAssembler(cpuid, getMode(), 0); @@ -187,6 +115,10 @@ return os; } + /* Not needed for opt compiler, here because we're forced + * to override abstract method + * @see org.jnode.vm.compiler.NativeCodeCompiler#createBytecodeVisitor(org.jnode.vm.classmgr.VmMethod, org.jnode.vm.compiler.CompiledMethod, org.jnode.assembler.NativeStream, int, boolean) + */ @Override protected CompilerBytecodeVisitor createBytecodeVisitor(VmMethod method, CompiledMethod cm, NativeStream os, int level, boolean isBootstrap) { @@ -195,41 +127,164 @@ @Override public int getMagic() { - return JIKES_COMPILER_MAGIC; + //This is a temporary value stolen from Jnode + //It's not really important what this is at the moment + return L2_COMPILER_MAGIC; } @Override public String getName() { - return "JikesOpt"; + return "JikesRVMOpt"; } + /* UPDATE: Apparently only needed for MMtk in JNode, so optional right now + * This is needed, but I haven't gotten round to importing OptGCMapIterator yet + * @see org.jnode.vm.compiler.NativeCodeCompiler#createGCMapIterator() + */ @Override public GCMapIterator createGCMapIterator() { // TODO return null; } + /** + * attempt to compile the passed method with the OPT_Compiler. Don't + * handle OPT_OptimizingCompilerExceptions (leave it up to caller to + * decide what to do) Precondition: compilationInProgress "lock" has + * been acquired + * + * @param method + * the method to compile + * @param plan + * the plan to use for compiling the method + */ + private static VM_CompiledMethod optCompile(VM_NormalMethod method, + OPT_CompilationPlan plan) throws OPT_OptimizingCompilerException { + plan.method = method; + plan.options = options; + VM_CompiledMethod cm = OPT_Compiler.compile(plan); + return cm; + } + /** + * This real method that performs the opt compilation. + * + * @param method + * the method to compile + * @param plan + * the compilation plan to use + */ + private static VM_CompiledMethod optCompileWithFallBackInternal( + VM_NormalMethod method, OPT_CompilationPlan plan) { + if (method.hasNoOptCompilePragma()) + return fallback(method); + try { + return optCompile(method, plan); + } + catch (OPT_OptimizingCompilerException e) { + String msg = "VM_RuntimeCompiler: can't optimize \"" + method + + "\" (error was: " + e + + "): reverting to baseline compiler\n"; + e.printStackTrace(); + VM.sysFail(msg); + } + return fallback(method); + + } + + private static VM_CompiledMethod fallback(VM_NormalMethod method) { + // Return null on purpose so that doCompile() progresses as necessary + // This is because we don't want to modify + // optCompileWithFallBackInternal() + return null; + } @Override public String[] getCompilerPackages() { - return new String[] { - "org.jnode.vm.x86.compiler", - "com.ibm.JikesRVM", - "com.ibm.JikesRVM.adaptive", - "com.ibm.JikesRVM.classloader", - "com.ibm.JikesRVM.memoryManagers.mmInterface", - //"com.ibm.JikesRVM.opt", - //"com.ibm.JikesRVM.opt.ir", - "com.ibm.JikesRVM.OSR", - "com.ibm.JikesRVM.util", - }; + return new String[] { "org.jnode.vm.x86.compiler", + "com.ibm.JikesRVM", + "com.ibm.JikesRVM.adaptive", + "com.ibm.JikesRVM.classloader", + "com.ibm.JikesRVM.memoryManagers.mmInterface", +// "com.ibm.JikesRVM.opt", +// "com.ibm.JikesRVM.opt.ir", + "com.ibm.JikesRVM.OSR", + "com.ibm.JikesRVM.util"}; } +//-------------------------------------------------------------------------------------------// +//-------------------------------------------------------------------------------------------// +//-------------------------------------------------------------------------------------------// +//-------------------------------------------------------------------------------------------// - + public static boolean compilableMethod(VmMethod vmMethod) { + if ( + +// && !( vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.x86.compiler.l1a.X86Byte") +// && vmMethod.getName().contains("other")) + vmMethod.getDeclaringClass().getName().startsWith("java.io") + || vmMethod.getDeclaringClass().getName().startsWith("java.lang") +// && !(vmMethod.getDeclaringClass().getName().startsWith("java.lang.ClassLoader") +// && vmMethod.getName().contains("loadClass")) +// && !(vmMethod.getDeclaringClass().getName().startsWith("java.lang.String") +// && vmMethod.getName().contains("init")) + || vmMethod.getDeclaringClass().getName().startsWith("java.net") + || vmMethod.getDeclaringClass().getName().startsWith("java.nio") + || vmMethod.getDeclaringClass().getName().startsWith("java.security") + && !vmMethod.getDeclaringClass().getName().startsWith("java.security.Permissions") + || vmMethod.getDeclaringClass().getName().startsWith("java.util") + || vmMethod.getDeclaringClass().getName().startsWith("javax") + || vmMethod.getDeclaringClass().getName().startsWith("gnu.classpath") + || vmMethod.getDeclaringClass().getName().startsWith("gnu.java") + || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.assembler") + && !vmMethod.getDeclaringClass().getName().startsWith("org.jnode.assembler.x86.X86B") + || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.boot.") + && !vmMethod.getDeclaringClass().getName().startsWith("org.jnode.boot.Main") + || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.naming") + || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.plugin") + || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.protocol") + || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.security") + || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.system") + || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.util") + || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.bytecode") + || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.classmgr") + || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.compiler") + || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.isolate") + || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.scheduler") + || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.x86.compiler") + && !vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.x86.compiler.l1a.X86Byte") +// || (vmMethod.getDeclaringClass().getName().lastIndexOf('.') > 0 ? +// vmMethod.getDeclaringClass().getName().substring(0, +// vmMethod.getDeclaringClass().getName().lastIndexOf('.')) +// : "").contentEquals("org.jnode.vm") + +// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.scheduler.I") +// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.scheduler.M") +// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.scheduler.P") +// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.scheduler.S") +// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.scheduler.VmP") +// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.scheduler.VmS") +// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.scheduler.VmThreadQ") +// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.scheduler.VmThreadV") +// || vmMethod.getDeclaringClass().getName().startsWith("org.jnode.vm.scheduler.VmThread") +// && ( +// vmMethod.isStatic() +// || vmMethod.getName().startsWith("a") +// || vmMethod.getName().startsWith("c") +// || vmMethod.getName().startsWith("d") +// || vmMethod.getName().startsWith("g") +// +// ) + ) + { + return true; + } + else return false; + } + public void compileBootstrap(VmMethod method, NativeStream os, int level) { +VM_BootstrapClassLoader.fromJikesCompiler = method.getDeclaringClass().getLoader(); System.out.println(method.getFullName()); int start = os.getLength(); final CompiledMethod cm; @@ -344,7 +399,9 @@ */ public void compileRuntime(VmMethod method, ObjectResolver resolver, int level, NativeStream os) { - +VM_BootstrapClassLoader.fromJikesCompiler = method.getDeclaringClass().getLoader(); +// Unsafe.die("NO COMPILERUNTIME FOR JIKES SHOULD OCCUR!!!"); + System.out.println(method.getFullName()); if (method.isNative()) { throw new IllegalArgumentException("Cannot compile native methods"); } @@ -361,7 +418,7 @@ } else { cm = doCompile(method, os, level, false); } - + if(!Vm.isRunningVm()) return; try { final int startOffset = cm.getCodeStart().getOffset(); final int size = cm.getCodeEnd().getOffset() - startOffset; Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_CompiledMethod.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_CompiledMethod.java 2007-01-08 08:29:18 UTC (rev 3054) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_CompiledMethod.java 2007-01-08 08:39:10 UTC (rev 3055) @@ -7,10 +7,12 @@ import org.jnode.assembler.x86.X86Constants; import org.jnode.assembler.x86.X86Register; import org.jnode.assembler.x86.X86TextAssembler; +import org.jnode.assembler.x86.X86Register.GPR; import org.jnode.vm.classmgr.VmArray; import org.jnode.vm.classmgr.VmCompiledCode; import org.jnode.vm.classmgr.VmMethod; import org.jnode.vm.classmgr.VmMethodCode; +import org.jnode.vm.classmgr.VmSharedStaticsEntry; import org.jnode.vm.compiler.CompiledExceptionHandler; import org.jnode.vm.compiler.CompiledMethod; import org.jnode.vm.compiler.EntryPoints; @@ -418,7 +420,7 @@ public CompiledMethod buildJnodeCM(X86Assembler os, EntryPoints ep) { - final VmMethod jnodeMethod = method.getJnodeMethod(); + final VmMethod jnodeMethod = (VmMethod)method.getJnodeMember(); jnodecm.setJikesCM(this); final VmMethodCode code = new VmMethodCode(); final Label startLabel = new Label(jnodeMethod.getMangledName()+"_"+"$$start"); @@ -482,7 +484,7 @@ bci = i.position.bcIndex; } if(bci >= 0 && mci >= ((VM_OptCompiledMethod)this).getEndPrologueOffset() && depth >= 0) - jnodecm.add(method.getJnodeMethod(), bci, mci+offset, 0); + jnodecm.add(jnodeMethod, bci, mci+offset, 0); //Print final IR if outputting to text instead of binary/machine code if(os.isTextStream()) { @@ -497,8 +499,34 @@ } // Now create the default exception handler - Label handlerLabel = new Label(method.getJnodeMethod().getMangledName()+"_$$def-ex-handler"); + Label handlerLabel = new Label(jnodeMethod.getMangledName()+"_$$def-ex-handler"); jnodecm.setDefExceptionHandler(os.setObjectRef(handlerLabel)); + if(temp_ir.stackManager.frameIsRequired()) { + int frameSize = temp_ir.stackManager.getFrameFixedSize()-INTSIZE; + os.writeLEA(X86Register.ESP, X86Register.EBP, -frameSize); + os.writePOP(X86Register.EBX); + os.writePOP(X86Register.ESI); + } + //Restore monitor lock if necessary (needed because of def-exhandling) + if(method.isSynchronized()) { + + final GPR aax = os.isCode32() ? (GPR)X86Register.EAX : X86Register.RAX; + final GPR adx = os.isCode32() ? (GPR)X86Register.EDX : X86Register.RDX; + + os.writePUSH(aax); + os.writePUSH(adx); + //System.out.println("synchr. " + method); + if (method.isStatic()) { + // Get declaring class + final int typeOfs = getSharedStaticsOffset(jnodeMethod.getDeclaringClass(), os); + os.writePUSH(os.isCode32() ? (GPR)X86Register.EDI : X86Register.RDI, typeOfs); + } else { + os.writePUSH(os.isCode32() ? (GPR)X86Register.EBP : X86Register.RBP, temp_ir.incomingParameterBytes()); + } + invokeJavaMethod((VmMethod)VM_Entrypoints.jnodeUnlockMethod.getJnodeMember(), os); + os.writePOP(adx); + os.writePOP(aax); + } os.writeLEA(X86Register.ESP, X86Register.EBP, 4); os.writePOP(X86Register.EBP); final int soffset = (VmArray.DATA_OFFSET * 4) + (X86JumpTable.VM_ATHROW_NOTRACE_IDX << 2); @@ -512,6 +540,21 @@ return jnodecm; } + + public final int getSharedStaticsOffset(VmSharedStaticsEntry entry, X86Assembler os) { + if (os.isCode32()) { + return (VmArray.DATA_OFFSET * 4) + + (entry.getSharedStaticsIndex() << 2); + } else { + return (VmArray.DATA_OFFSET * 8) + + (entry.getSharedStaticsIndex() << 2); + } + } + + public final void invokeJavaMethod(VmMethod method, X86Assembler os) { + final int offset = getSharedStaticsOffset(method, os); + os.writeCALL(os.isCode32() ? (GPR)X86Register.EDI : X86Register.RDI, offset); + } } Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Statics.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Statics.java 2007-01-08 08:29:18 UTC (rev 3054) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Statics.java 2007-01-08 08:39:10 UTC (rev 3055) @@ -7,40 +7,34 @@ import org.vmmagic.pragma.*; import org.vmmagic.unboxed.*; -import org.jnode.assembler.ObjectResolver; import org.jnode.vm.Vm; -import org.jnode.vm.VmArchitecture; import org.jnode.vm.scheduler.VmProcessor; -import org.jnode.vm.classmgr.VmSharedStatics; import org.jnode.vm.classmgr.VmStatics; +import org.jnode.vm.classmgr.VmStaticsBase; import com.ibm.JikesRVM.classloader.*; import java.util.HashMap; -public class VM_Statics extends VmStatics implements VM_Constants { +public class VM_Statics implements VM_Constants { //Kinds of statics that can appear in slots of the jtoc. public static final byte EMPTY = 0x00; - public static final byte CONTINUATION = MAX_TYPE + 1; - public static final byte INT_LITERAL = TYPE_INT; - public static final byte FLOAT_LITERAL = MAX_TYPE + 2; - public static final byte LONG_LITERAL = TYPE_LONG; - public static final byte DOUBLE_LITERAL = MAX_TYPE + 3; - public static final byte STRING_LITERAL = TYPE_STRING; - public static final byte REFERENCE_FIELD = TYPE_OBJECT; - public static final byte NUMERIC_FIELD = TYPE_ADDRESS; - public static final byte METHOD = TYPE_METHOD_CODE; - public static final byte CLASS_LITERAL = TYPE_CLASS; + public static final byte CONTINUATION = VmStaticsBase.MAX_TYPE + 1; + public static final byte INT_LITERAL = VmStaticsBase.TYPE_INT; + public static final byte FLOAT_LITERAL = VmStaticsBase.MAX_TYPE + 2; + public static final byte LONG_LITERAL = VmStaticsBase.TYPE_LONG; + public static final byte DOUBLE_LITERAL = VmStaticsBase.MAX_TYPE + 3; + public static final byte STRING_LITERAL = VmStaticsBase.TYPE_STRING; + public static final byte REFERENCE_FIELD = VmStaticsBase.TYPE_OBJECT; + public static final byte NUMERIC_FIELD = VmStaticsBase.TYPE_ADDRESS; + public static final byte METHOD = VmStaticsBase.TYPE_METHOD_CODE; + public static final byte CLASS_LITERAL = VmStaticsBase.TYPE_CLASS; private static VmStatics jnodeStatics; - static {jnodeStatics = (VmStatics)Vm.getVm().getSharedStatics();} + static {jnodeStatics = Vm.getVm().getSharedStatics();} - public VM_Statics(VmArchitecture arch, ObjectResolver resolver, int size) { - super(arch, resolver, size); - } - //private static int slots[] = new int[65536]; private static int slots[] = new int[0x20000]; // 128K = 131072 private static byte descriptions[] = new byte[slots.length]; @@ -158,6 +152,7 @@ String stringValue = literal.toUnicodeString(); if (VM.runningVM) stringValue = stringValue.intern(); int newOff = jnodeStatics.allocConstantStringField(stringValue); + stringLiterals.put(literal, new Integer(newOff)); return newOff; } @@ -166,7 +161,7 @@ if (off != null) return off.intValue(); if (VM.runningVM) stringValue = stringValue.intern(); int newOff = jnodeStatics.allocConstantStringField(stringValue); - classLiterals.put(literal, new Integer(newOff)); + stringLiterals.put(literal, new Integer(newOff)); return newOff; } @@ -201,4 +196,6 @@ } + + } Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Assembler.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Assembler.java 2007-01-08 08:29:18 UTC (rev 3054) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/opt/OPT_Assembler.java 2007-01-08 08:39:10 UTC (rev 3055) @@ -38,8 +38,9 @@ * @param inst the instruction to assemble */ private void doFSUB(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isQuad(inst)) { if (isAbs(MIR_BinaryAcc.getValue(inst))) { if (VM.VerifyAssertions && !isReg(MIR_BinaryAcc.getResult(inst))) VM._assert(false, inst.toString()); @@ -136,8 +137,9 @@ * @param inst the instruction to assemble */ private void doSHL(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isImm(MIR_BinaryAcc.getValue(inst))) { if (isByte(inst)) { if (isReg(MIR_BinaryAcc.getResult(inst))) { @@ -428,8 +430,9 @@ * @param inst the instruction to assemble */ private void doFSTP(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isQuad(inst)) { if (isAbs(MIR_Move.getResult(inst))) { if (VM.VerifyAssertions && !isReg(MIR_Move.getValue(inst))) VM._assert(false, inst.toString()); @@ -526,8 +529,9 @@ * @param inst the instruction to assemble */ private void doROL(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isImm(MIR_BinaryAcc.getValue(inst))) { if (isByte(inst)) { if (isReg(MIR_BinaryAcc.getResult(inst))) { @@ -818,8 +822,9 @@ * @param inst the instruction to assemble */ private void doINC(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isByte(inst)) { if (isReg(MIR_UnaryAcc.getResult(inst))) { if (VM.VerifyAssertions && !(getReg(MIR_UnaryAcc.getResult(inst)) < 4)) VM._assert(false, inst.toString()); @@ -938,8 +943,9 @@ * @param inst the instruction to assemble */ private void doFIDIVR(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isWord(inst)) { if (isAbs(MIR_BinaryAcc.getValue(inst))) { if (VM.VerifyAssertions && !isReg(MIR_BinaryAcc.getResult(inst))) VM._assert(false, inst.toString()); @@ -1028,8 +1034,9 @@ * @param inst the instruction to assemble */ private void doFDIVP(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (VM.VerifyAssertions && !isReg(MIR_BinaryAcc.getResult(inst))) VM._assert(false, inst.toString()); if (VM.VerifyAssertions && !isReg(MIR_BinaryAcc.getValue(inst))) VM._assert(false, inst.toString()); emitFDIVP_Reg_Reg( @@ -1045,8 +1052,9 @@ * @param inst the instruction to assemble */ private void doADC(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isReg(MIR_BinaryAcc.getResult(inst))) { if (isByte(inst)) { if (isImm(MIR_BinaryAcc.getValue(inst))) { @@ -1447,8 +1455,9 @@ * @param inst the instruction to assemble */ private void doBTS(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isImm(MIR_Test.getVal2(inst))) { if (isReg(MIR_Test.getVal1(inst))) { emitBTS_Reg_Imm( @@ -1547,8 +1556,9 @@ * @param inst the instruction to assemble */ private void doPUSH(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isImm(MIR_UnaryNoRes.getVal(inst))) { emitPUSH_Imm( getImm(MIR_UnaryNoRes.getVal(inst))); @@ -1598,8 +1608,9 @@ * @param inst the instruction to assemble */ private void doIDIV(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isReg(MIR_Divide.getValue(inst))) { if (VM.VerifyAssertions && !isReg(MIR_Divide.getResult2(inst))) VM._assert(false, inst.toString()); emitIDIV_Reg_Reg( @@ -1655,8 +1666,9 @@ * @param inst the instruction to assemble */ private void doFCOMIP(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (VM.VerifyAssertions && !isReg(MIR_Compare.getVal1(inst))) VM._assert(false, inst.toString()); if (VM.VerifyAssertions && !isReg(MIR_Compare.getVal2(inst))) VM._assert(false, inst.toString()); emitFCOMIP_Reg_Reg( @@ -1672,8 +1684,9 @@ * @param inst the instruction to assemble */ private void doLEA(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isAbs(MIR_Lea.getValue(inst))) { if (VM.VerifyAssertions && !isReg(MIR_Lea.getResult(inst))) VM._assert(false, inst.toString()); emitLEA_Reg_Abs( @@ -1721,8 +1734,9 @@ * @param inst the instruction to assemble */ private void doFCOMI(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (VM.VerifyAssertions && !isReg(MIR_Compare.getVal1(inst))) VM._assert(false, inst.toString()); if (VM.VerifyAssertions && !isReg(MIR_Compare.getVal2(inst))) VM._assert(false, inst.toString()); emitFCOMI_Reg_Reg( @@ -1738,8 +1752,9 @@ * @param inst the instruction to assemble */ private void doCMPXCHG(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isReg(MIR_CompareExchange.getMemAddr(inst))) { if (VM.VerifyAssertions && !isReg(MIR_CompareExchange.getNewValue(inst))) VM._assert(false, inst.toString()); emitCMPXCHG_Reg_Reg( @@ -1795,8 +1810,9 @@ * @param inst the instruction to assemble */ private void doOR(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isReg(MIR_BinaryAcc.getResult(inst))) { if (isByte(inst)) { if (isImm(MIR_BinaryAcc.getValue(inst))) { @@ -2197,8 +2213,9 @@ * @param inst the instruction to assemble */ private void doSHR(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isImm(MIR_BinaryAcc.getValue(inst))) { if (isByte(inst)) { if (isReg(MIR_BinaryAcc.getResult(inst))) { @@ -2489,8 +2506,9 @@ * @param inst the instruction to assemble */ private void doCMP(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isReg(MIR_Compare.getVal1(inst))) { if (isByte(inst)) { if (isImm(MIR_Compare.getVal2(inst))) { @@ -2891,8 +2909,9 @@ * @param inst the instruction to assemble */ private void doIMUL2(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isImm(MIR_BinaryAcc.getValue(inst))) { if (VM.VerifyAssertions && !isReg(MIR_BinaryAcc.getResult(inst))) VM._assert(false, inst.toString()); emitIMUL2_Reg_Imm( @@ -2956,8 +2975,9 @@ * @param inst the instruction to assemble */ private void doFDIVRP(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (VM.VerifyAssertions && !isReg(MIR_BinaryAcc.getResult(inst))) VM._assert(false, inst.toString()); if (VM.VerifyAssertions && !isReg(MIR_BinaryAcc.getValue(inst))) VM._assert(false, inst.toString()); emitFDIVRP_Reg_Reg( @@ -2973,8 +2993,9 @@ * @param inst the instruction to assemble */ private void doAND(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isReg(MIR_BinaryAcc.getResult(inst))) { if (isByte(inst)) { if (isImm(MIR_BinaryAcc.getValue(inst))) { @@ -3375,8 +3396,9 @@ * @param inst the instruction to assemble */ private void doSHRD(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isImm(MIR_DoubleShift.getBitsToShift(inst))) { if (isReg(MIR_DoubleShift.getResult(inst))) { if (VM.VerifyAssertions && !isReg(MIR_DoubleShift.getSource(inst))) VM._assert(false, inst.toString()); @@ -3499,8 +3521,9 @@ * @param inst the instruction to assemble */ private void doBTC(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isImm(MIR_Test.getVal2(inst))) { if (isReg(MIR_Test.getVal1(inst))) { emitBTC_Reg_Imm( @@ -3599,8 +3622,9 @@ * @param inst the instruction to assemble */ private void doFLDL2T(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (VM.VerifyAssertions && !isReg(MIR_Nullary.getResult(inst))) VM._assert(false, inst.toString()); emitFLDL2T_Reg( getReg(MIR_Nullary.getResult(inst))); @@ -3614,8 +3638,9 @@ * @param inst the instruction to assemble */ private void doFRSTOR(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isAbs(MIR_FSave.getDestination(inst))) { emitFRSTOR_Abs( getDisp(MIR_FSave.getDestination(inst))); @@ -3653,8 +3678,9 @@ * @param inst the instruction to assemble */ private void doINT(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (VM.VerifyAssertions && !isImm(MIR_Trap.getTrapCode(inst))) VM._assert(false, inst.toString()); emitINT_Imm( getImm(MIR_Trap.getTrapCode(inst))); @@ -3668,8 +3694,9 @@ * @param inst the instruction to assemble */ private void doBSWAP(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (VM.VerifyAssertions && !isReg(MIR_UnaryAcc.getResult(inst))) VM._assert(false, inst.toString()); emitBSWAP_Reg( getReg(MIR_UnaryAcc.getResult(inst))); @@ -3683,8 +3710,9 @@ * @param inst the instruction to assemble */ private void doFISTP(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isWord(inst)) { if (isAbs(MIR_Move.getResult(inst))) { if (VM.VerifyAssertions && !isReg(MIR_Move.getValue(inst))) VM._assert(false, inst.toString()); @@ -3814,8 +3842,9 @@ * @param inst the instruction to assemble */ private void doFSUBR(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isQuad(inst)) { if (isAbs(MIR_BinaryAcc.getValue(inst))) { if (VM.VerifyAssertions && !isReg(MIR_BinaryAcc.getResult(inst))) VM._assert(false, inst.toString()); @@ -3912,8 +3941,9 @@ * @param inst the instruction to assemble */ private void doSBB(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isReg(MIR_BinaryAcc.getResult(inst))) { if (isByte(inst)) { if (isImm(MIR_BinaryAcc.getValue(inst))) { @@ -4314,8 +4344,9 @@ * @param inst the instruction to assemble */ private void doFDIV(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isQuad(inst)) { if (isAbs(MIR_BinaryAcc.getValue(inst))) { if (VM.VerifyAssertions && !isReg(MIR_BinaryAcc.getResult(inst))) VM._assert(false, inst.toString()); @@ -4412,8 +4443,9 @@ * @param inst the instruction to assemble */ private void doROR(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isImm(MIR_BinaryAcc.getValue(inst))) { if (isByte(inst)) { if (isReg(MIR_BinaryAcc.getResult(inst))) { @@ -4704,8 +4736,9 @@ * @param inst the instruction to assemble */ private void doFLDLN2(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (VM.VerifyAssertions && !isReg(MIR_Nullary.getResult(inst))) VM._assert(false, inst.toString()); emitFLDLN2_Reg( getReg(MIR_Nullary.getResult(inst))); @@ -4719,8 +4752,9 @@ * @param inst the instruction to assemble */ private void doFLDLG2(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (VM.VerifyAssertions && !isReg(MIR_Nullary.getResult(inst))) VM._assert(false, inst.toString()); emitFLDLG2_Reg( getReg(MIR_Nullary.getResult(inst))); @@ -4734,8 +4768,9 @@ * @param inst the instruction to assemble */ private void doFIADD(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isWord(inst)) { if (isAbs(MIR_BinaryAcc.getValue(inst))) { if (VM.VerifyAssertions && !isReg(MIR_BinaryAcc.getResult(inst))) VM._assert(false, inst.toString()); @@ -4824,8 +4859,9 @@ * @param inst the instruction to assemble */ private void doFNSTCW(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isAbs(MIR_UnaryNoRes.getVal(inst))) { emitFNSTCW_Abs( getDisp(MIR_UnaryNoRes.getVal(inst))); @@ -4863,8 +4899,9 @@ * @param inst the instruction to assemble */ private void doFLD(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isQuad(inst)) { if (isAbs(MIR_Move.getValue(inst))) { if (VM.VerifyAssertions && !isReg(MIR_Move.getResult(inst))) VM._assert(false, inst.toString()); @@ -4961,8 +4998,9 @@ * @param inst the instruction to assemble */ private void doFISUBR(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isWord(inst)) { if (isAbs(MIR_BinaryAcc.getValue(inst))) { if (VM.VerifyAssertions && !isReg(MIR_BinaryAcc.getResult(inst))) VM._assert(false, inst.toString()); @@ -5051,8 +5089,9 @@ * @param inst the instruction to assemble */ private void doFLDPI(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (VM.VerifyAssertions && !isReg(MIR_Nullary.getResult(inst))) VM._assert(false, inst.toString()); emitFLDPI_Reg( getReg(MIR_Nullary.getResult(inst))); @@ -5066,8 +5105,9 @@ * @param inst the instruction to assemble */ private void doFDIVR(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isQuad(inst)) { if (isAbs(MIR_BinaryAcc.getValue(inst))) { if (VM.VerifyAssertions && !isReg(MIR_BinaryAcc.getResult(inst))) VM._assert(false, inst.toString()); @@ -5164,8 +5204,9 @@ * @param inst the instruction to assemble */ private void doFIDIV(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isWord(inst)) { if (isAbs(MIR_BinaryAcc.getValue(inst))) { if (VM.VerifyAssertions && !isReg(MIR_BinaryAcc.getResult(inst))) VM._assert(false, inst.toString()); @@ -5254,8 +5295,9 @@ * @param inst the instruction to assemble */ private void doPOP(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isReg(MIR_Nullary.getResult(inst))) { emitPOP_Reg( getReg(MIR_Nullary.getResult(inst))); @@ -5299,8 +5341,9 @@ * @param inst the instruction to assemble */ private void doFILD(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isWord(inst)) { if (isAbs(MIR_Move.getValue(inst))) { if (VM.VerifyAssertions && !isReg(MIR_Move.getResult(inst))) VM._assert(false, inst.toString()); @@ -5430,8 +5473,9 @@ * @param inst the instruction to assemble */ private void doMOV(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isReg(MIR_Move.getResult(inst))) { if (isByte(inst)) { if (isReg(MIR_Move.getValue(inst))) { @@ -5817,8 +5861,9 @@ * @param inst the instruction to assemble */ private void doMOVZX(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isByte(inst)) { if (isReg(MIR_Unary.getVal(inst))) { if (VM.VerifyAssertions && !isReg(MIR_Unary.getResult(inst))) VM._assert(false, inst.toString()); @@ -5929,8 +5974,9 @@ * @param inst the instruction to assemble */ private void doSAL(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isImm(MIR_BinaryAcc.getValue(inst))) { if (isByte(inst)) { if (isReg(MIR_BinaryAcc.getResult(inst))) { @@ -6221,8 +6267,9 @@ * @param inst the instruction to assemble */ private void doFLDL2E(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (VM.VerifyAssertions && !isReg(MIR_Nullary.getResult(inst))) VM._assert(false, inst.toString()); emitFLDL2E_Reg( getReg(MIR_Nullary.getResult(inst))); @@ -6236,8 +6283,9 @@ * @param inst the instruction to assemble */ private void doFUCOMIP(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (VM.VerifyAssertions && !isReg(MIR_Compare.getVal1(inst))) VM._assert(false, inst.toString()); if (VM.VerifyAssertions && !isReg(MIR_Compare.getVal2(inst))) VM._assert(false, inst.toString()); emitFUCOMIP_Reg_Reg( @@ -6253,8 +6301,9 @@ * @param inst the instruction to assemble */ private void doFSUBRP(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (VM.VerifyAssertions && !isReg(MIR_BinaryAcc.getResult(inst))) VM._assert(false, inst.toString()); if (VM.VerifyAssertions && !isReg(MIR_BinaryAcc.getValue(inst))) VM._assert(false, inst.toString()); emitFSUBRP_Reg_Reg( @@ -6270,8 +6319,9 @@ * @param inst the instruction to assemble */ private void doBT(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (isImm(MIR_Test.getVal2(inst))) { if (isReg(MIR_Test.getVal1(inst))) { emitBT_Reg_Imm( @@ -6370,8 +6420,9 @@ * @param inst the instruction to assemble */ private void doFADDP(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (VM.VerifyAssertions && !isReg(MIR_BinaryAcc.getResult(inst))) VM._assert(false, inst.toString()); if (VM.VerifyAssertions && !isReg(MIR_BinaryAcc.getValue(inst))) VM._assert(false, inst.toString()); emitFADDP_Reg_Reg( @@ -6387,8 +6438,9 @@ * @param inst the instruction to assemble */ private void doCDQ(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); emitCDQ(); } @@ -6400,8 +6452,9 @@ * @param inst the instruction to assemble */ private void doFPREM(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); emitFPREM(); } @@ -6413,8 +6466,9 @@ * @param inst the instruction to assemble */ private void doFLD1(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); if (VM.VerifyAssertions && !isReg(MIR_Nullary.getResult(inst))) VM._assert(false, inst.toString()); emitFLD1_Reg( getReg(MIR_Nullary.getResult(inst))); @@ -6428,8 +6482,9 @@ * @param inst the instruction to assemble */ private void doFNINIT(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) - emitFSSegmentOverideForNextInstruction(); + for(int i = 0; i < inst.getNumberOfOperands(); i++) + if(inst.getOperand(i) instanceof OPT_MemoryOperand && isFsSegmentOverride(inst.getOperand(i))) + emitFSSegmentOverideForNextInstruction(); emitFNINIT(); } @@ -6441,8 +6496,9 @@ * @param inst the instruction to assemble */ private void doFST(OPT_Instruction inst) { - if(isFsSegmentOverride(MIR_BinaryAcc.getValue(inst))) ... [truncated message content] |
From: <ans...@us...> - 2007-01-08 08:29:20
|
Revision: 3054 http://jnode.svn.sourceforge.net/jnode/?rev=3054&view=rev Author: ansari82 Date: 2007-01-08 00:29:18 -0800 (Mon, 08 Jan 2007) Log Message: ----------- Updated memory requirements for build Modified Paths: -------------- branches/jikesRVM/build.sh Modified: branches/jikesRVM/build.sh =================================================================== --- branches/jikesRVM/build.sh 2007-01-08 08:28:57 UTC (rev 3053) +++ branches/jikesRVM/build.sh 2007-01-08 08:29:18 UTC (rev 3054) @@ -2,6 +2,6 @@ dir=`dirname $0` -java -Xmx1450M -jar $dir/core/lib/ant-launcher.jar -lib $JAVA_HOME/lib -lib $dir/core/lib -f $dir/all/build.xml $* +java -Xmx768M -Xms512M -jar $dir/core/lib/ant-launcher.jar -lib $JAVA_HOME/lib -lib $dir/core/lib -f $dir/all/build.xml $* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ans...@us...> - 2007-01-08 08:28:58
|
Revision: 3053 http://jnode.svn.sourceforge.net/jnode/?rev=3053&view=rev Author: ansari82 Date: 2007-01-08 00:28:57 -0800 (Mon, 08 Jan 2007) Log Message: ----------- Updated methods to call correct interface, or throw error if not implemented Modified Paths: -------------- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_ObjectModel.java Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM.java 2007-01-08 08:26:13 UTC (rev 3052) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM.java 2007-01-08 08:28:57 UTC (rev 3053) @@ -97,7 +97,7 @@ static { - instance = Vm.getVm(); +// instance = Vm.getVm(); runningVM = Vm.isRunningVm(); writingBootImage = !runningVM; writingImage = !runningVM; Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_ObjectModel.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_ObjectModel.java 2007-01-08 08:26:13 UTC (rev 3052) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_ObjectModel.java 2007-01-08 08:28:57 UTC (rev 3053) @@ -19,7 +19,7 @@ public class VM_ObjectModel { public static final int slotsize = Vm.getArch().getReferenceSize(); - public static final Offset TIB_OFFSET = Offset.fromIntSignExtend(ObjectLayout.TIB_SLOT * slotsize); + public static final Offset TIB_OFFSET = Offset.fromIntZeroExtend(ObjectLayout.TIB_SLOT * slotsize); public static final Offset ARRAY_LENGTH_OFFSET = Offset.fromIntZeroExtend(VmArray.LENGTH_OFFSET * slotsize); public static final Offset ARRAY_DATA_OFFSET = Offset.fromIntZeroExtend(VmArray.DATA_OFFSET * slotsize); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ans...@us...> - 2007-01-08 08:26:14
|
Revision: 3052 http://jnode.svn.sourceforge.net/jnode/?rev=3052&view=rev Author: ansari82 Date: 2007-01-08 00:26:13 -0800 (Mon, 08 Jan 2007) Log Message: ----------- changed default memory requirement (crashes if jikesrvm happens to get compiled during boot) Modified Paths: -------------- branches/jikesRVM/all/build-x86.xml Modified: branches/jikesRVM/all/build-x86.xml =================================================================== --- branches/jikesRVM/all/build-x86.xml 2007-01-08 08:24:25 UTC (rev 3051) +++ branches/jikesRVM/all/build-x86.xml 2007-01-08 08:26:13 UTC (rev 3052) @@ -10,7 +10,7 @@ <property name="jnode.disk.pln" value="${my-build.dir}/jnodedisk${jnode.bits}.pln" /> <property name="jnode.disk.geometry" value="64/16/63" /> - <property name="jnode.virtual.memsize" value="512" /> + <property name="jnode.virtual.memsize" value="768" /> <property name="logFile" value="${build.dir}/debugger.txt" /> <property name="grub-ver" value="grub-0.97-i386-pc" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ans...@us...> - 2007-01-08 08:24:27
|
Revision: 3051 http://jnode.svn.sourceforge.net/jnode/?rev=3051&view=rev Author: ansari82 Date: 2007-01-08 00:24:25 -0800 (Mon, 08 Jan 2007) Log Message: ----------- Fixed incorrect interrupts base Modified Paths: -------------- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_TrapConstants.java Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_TrapConstants.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_TrapConstants.java 2007-01-08 08:23:21 UTC (rev 3050) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_TrapConstants.java 2007-01-08 08:24:25 UTC (rev 3051) @@ -16,6 +16,6 @@ * This base is added to the numeric trap codes in VM_Runtime.java * to yield the intel trap number that is given to INT instructions */ - public final static byte RVM_TRAP_BASE = (byte) 0x40; + public final static byte RVM_TRAP_BASE = (byte) 0x00; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ans...@us...> - 2007-01-08 08:23:24
|
Revision: 3050 http://jnode.svn.sourceforge.net/jnode/?rev=3050&view=rev Author: ansari82 Date: 2007-01-08 00:23:21 -0800 (Mon, 08 Jan 2007) Log Message: ----------- Cleaned up interfaces for easier integration with JikesRVM head, and fixed bug of incorrectly making a static field owned by an accessing class, rather than the declaring class Modified Paths: -------------- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Helper.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Array.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_BootstrapClassLoader.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Class.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_ClassLoader.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Field.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_FieldReference.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Member.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_MemberReference.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Method.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_MethodReference.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_NormalMethod.java branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Type.java Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Helper.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Helper.java 2007-01-08 08:20:23 UTC (rev 3049) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/VM_Helper.java 2007-01-08 08:23:21 UTC (rev 3050) @@ -33,8 +33,9 @@ } else { //check and return if prim primitive name - if(strName.length() == 1){ - return strName.toUpperCase().substring(0,1); + String prim = isPrimitive(strName); + if(prim!=null){ + return prim; } //This is a class, swap '.' for '/', and attach 'L' and ';' temp = temp.concat("L"); @@ -44,4 +45,29 @@ return temp; } + private static String isPrimitive(String strName) { + if(strName.contentEquals("void")) { + return "V"; + } else if(strName.contentEquals("boolean")) { + return "Z"; + } else if(strName.contentEquals("byte")) { + return "B"; + } else if(strName.contentEquals("short")) { + return "S"; + } else if(strName.contentEquals("char")) { + return "C"; + } else if(strName.contentEquals("int")) { + return "I"; + } else if(strName.contentEquals("long")) { + return "J"; + } else if(strName.contentEquals("float")) { + return "F"; + } else if(strName.contentEquals("double")) { + return "D"; + } + return null; + + + } + } Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Array.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Array.java 2007-01-08 08:20:23 UTC (rev 3049) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Array.java 2007-01-08 08:23:21 UTC (rev 3050) @@ -26,6 +26,7 @@ public static VM_Array FloatArray; public static VM_Array DoubleArray; public static VM_Array JavaLangObjectArray; + static { BooleanArray = (VM_Array)VM_TypeReference.BooleanArray.resolve(); CharArray = (VM_Array)VM_TypeReference.CharArray.resolve(); @@ -142,8 +143,9 @@ @Override public void resolve() { - jnodeType.prepare(); - jnodeType.prepareForInstantiation(); + System.out.println("WARNING: VM_Array.resolve() is not tested"); +// jnodeType.prepare(); +// jnodeType.prepareForInstantiation(); } /** Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_BootstrapClassLoader.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_BootstrapClassLoader.java 2007-01-08 08:20:23 UTC (rev 3049) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_BootstrapClassLoader.java 2007-01-08 08:23:21 UTC (rev 3050) @@ -5,31 +5,15 @@ -public class VM_BootstrapClassLoader extends ClassLoader{ +public class VM_BootstrapClassLoader { /** Keep this a static field, since it's looked at in * {@link VM_MemberReference#parse}. */ public final static String myName = "BootstrapCL"; public static VmClassLoader fromJikesCompiler; - static { fromJikesCompiler = VmType.getObjectClass().getLoader(); } - public static VmClassLoader getBootstrapClassLoader() { return fromJikesCompiler; } - /** - * Backdoor for use by VM_TypeReference.resolve when !VM.runningVM. - * As of this writing, it is not used by any other classes. - * @throws NoClassDefFoundError - */ - public Class loadVMClass(String string) { - try{ - return ClassLoader.getSystemClassLoader().loadClass(string); - } - catch(Throwable ex) { - ex.toString(); - return null; - } - } } Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Class.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Class.java 2007-01-08 08:20:23 UTC (rev 3049) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Class.java 2007-01-08 08:23:21 UTC (rev 3050) @@ -133,23 +133,23 @@ double val = ((VmConstDouble)cpEntry).doubleValue(); long raw_val = Double.doubleToLongBits(val); int idx = VM_Statics.findOrCreateDoubleLiteral(raw_val); - return Offset.fromIntSignExtend(idx); + return Offset.fromIntZeroExtend(idx); } else if(cpEntry instanceof VmConstLong) { long val = ((VmConstLong)cpEntry).longValue(); int idx = VM_Statics.findOrCreateLongLiteral(val); - return Offset.fromIntSignExtend(idx); + return Offset.fromIntZeroExtend(idx); } else if(cpEntry instanceof VmConstFloat) { float val = ((VmConstFloat)cpEntry).floatValue(); int raw_val = Float.floatToIntBits(val); int idx = VM_Statics.findOrCreateFloatLiteral(raw_val); - return Offset.fromIntSignExtend(idx); + return Offset.fromIntZeroExtend(idx); } else if(cpEntry instanceof VmConstInt) { int val = ((VmConstInt)cpEntry).intValue(); int idx = VM_Statics.findOrCreateIntLiteral(val); - return Offset.fromIntSignExtend(idx); + return Offset.fromIntZeroExtend(idx); } else if(cpEntry instanceof VmConstString) { VmSharedStatics vmStatics = jnodeType.getLoader().getSharedStatics(); @@ -158,7 +158,7 @@ VM_Atom atom = VM_Atom.findOrCreateAsciiAtom(str); try { VM_Statics.findOrCreateStringLiteral(atom, str); - return Offset.fromIntSignExtend(val*4 + VmArray.DATA_OFFSET*4); + return Offset.fromIntZeroExtend(val*4 + VmArray.DATA_OFFSET*4); } catch (Exception e) { e.printStackTrace(); @@ -174,7 +174,7 @@ } int id = jikesType.getTypeRef().getId(); int idx = VM_Statics.findOrCreateClassLiteral(id); - return Offset.fromIntSignExtend(idx); + return Offset.fromIntZeroExtend(idx); } else { throw new Error("TODO: "+cpEntry+" "+cpEntry.getClass()); @@ -191,8 +191,9 @@ } public void resolve() { - jnodeType.prepare(); - jnodeType.prepareForInstantiation(); + jnodeType.link(); +// jnodeType.prepare(); +// jnodeType.prepareForInstantiation(); } /** Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_ClassLoader.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_ClassLoader.java 2007-01-08 08:20:23 UTC (rev 3049) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_ClassLoader.java 2007-01-08 08:23:21 UTC (rev 3050) @@ -1,6 +1,6 @@ package com.ibm.JikesRVM.classloader; -import org.jnode.vm.classmgr.ClassDecoder; +import org.jnode.vm.Unsafe; import org.jnode.vm.classmgr.VmClassLoader; public class VM_ClassLoader { @@ -22,8 +22,8 @@ static VM_Atom arrayNullCheckAttributeName = VM_Atom.findOrCreateAsciiAtom("ArrayNullCheckAttribute"); public static VmClassLoader getApplicationClassLoader() { - // TODO: Stub generated method - // Used by VM_MethodReference.parse(), which isn't called from anywhere + try { throw new Exception("VM_ClassLoader: getApplicationClassLoader()");} + catch (Exception e){Unsafe.die(e.getMessage());} return null; } Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Field.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Field.java 2007-01-08 08:20:23 UTC (rev 3049) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Field.java 2007-01-08 08:23:21 UTC (rev 3050) @@ -25,19 +25,11 @@ return memRef.asFieldReference().getFieldContentsType(); } - public boolean isStatic() { - return jnodeMember.isStatic(); - } - public boolean isVolatile() { //TODO: return jnodeField.isVolatile(); //Method doesn't exist return true; // We assume always volatile, this should be safe } - public boolean isFinal() { - return jnodeMember.isFinal(); - } - public static VM_Field buildFromJnodeField(VmField jnodeField) { if(jnodeField==null) return null; VM_Class declaringClass = VM_Class.buildFromJnodeClass(jnodeField.getDeclaringClass()); @@ -50,9 +42,4 @@ return jikesField; } - public VmField getJnodeField() { - return (VmField)jnodeMember; - } - - } Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_FieldReference.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_FieldReference.java 2007-01-08 08:20:23 UTC (rev 3049) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_FieldReference.java 2007-01-08 08:23:21 UTC (rev 3050) @@ -1,5 +1,9 @@ package com.ibm.JikesRVM.classloader; +import org.jnode.vm.classmgr.VmField; +import org.jnode.vm.classmgr.VmInstanceField; +import org.jnode.vm.classmgr.VmMember; + public class VM_FieldReference extends VM_MemberReference{ /** @@ -32,7 +36,7 @@ if (resolvedMember != null) return resolvedMember; try { - throw new Exception("This shouldn't have happened"); + throw new Exception("VM_FieldReference: peekResolvedField"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -42,9 +46,11 @@ public VM_Field resolve() { if (resolvedMember != null) return resolvedMember; +// if (resolvedMember.jnodeMember instanceof VmField) +// ((VmField)resolvedMember.jnodeMember).resolve(); try { - throw new Exception("This shouldn't have happened"); + throw new Exception("VM_FieldReference: resolve"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Member.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Member.java 2007-01-08 08:20:23 UTC (rev 3049) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Member.java 2007-01-08 08:23:21 UTC (rev 3050) @@ -154,8 +154,16 @@ public boolean isShared() { return shared; } + + public final boolean isStatic() { + return jnodeMember.isStatic(); + } + + public boolean isFinal() { + return jnodeMember.isFinal(); + } + public VmMember getJnodeMember() { return jnodeMember; } - } Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_MemberReference.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_MemberReference.java 2007-01-08 08:20:23 UTC (rev 3049) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_MemberReference.java 2007-01-08 08:23:21 UTC (rev 3050) @@ -258,6 +258,17 @@ } VM_Class thisClass = resolvedThis.getDeclaringClass(); + if(VM.writingBootImage && !thisClass.getJnodeType().isAlwaysInitialized() + && resolvedThis.isStatic() + && !thisClass.getJnodeType().isSharedStatics()) { + // JNODE Isolate-specific + // This class is an isolate type, so the state of the isolated object + // needs to be checked, if a static field from it is being accessed, + // and checking only seems possible at runtime, for now. + // See OPT_ConvertToLowLevelIR.resolve_member() + return true; + } + if (thisClass == that.getDeclaringClass()) { // Intra-class references don't need to be compiled with dynamic linking // because they execute *after* class has been loaded/resolved/compiled. @@ -292,9 +303,10 @@ // This member needs size and offset to be computed, or its class's static // initializer needs to be run when the member is first "touched", so // dynamic linking code is required to access the member. -// this.resolveMember(); -// return false; - return true; + this.resolveMember(); + return false; +// System.out.println("return true!"); +// return true; } public final int hashCode() { Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Method.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Method.java 2007-01-08 08:20:23 UTC (rev 3049) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Method.java 2007-01-08 08:23:21 UTC (rev 3050) @@ -49,10 +49,6 @@ return ((VmMethod)jnodeMember).isSynchronized(); } - public final boolean isStatic() { - return jnodeMember.isStatic(); - } - public void invalidateCompiledMethod(VM_CompiledMethod cm) { if (VM.VerifyAssertions) VM._assert(declaringClass.isInstantiated()); if (currentCompiledMethod == cm) { @@ -80,10 +76,6 @@ return !((VmMethod)jnodeMember).isUninterruptible(); } - public boolean isFinal() { - return jnodeMember.isFinal(); - } - public boolean hasInlinePragma() { return ((VmMethod)jnodeMember).hasInlinePragma(); } @@ -148,10 +140,6 @@ } - public VmMethod getJnodeMethod() { - return ((VmMethod)jnodeMember); - } - public int getSelector() { return ((VmMethod)jnodeMember).getSelector(); } Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_MethodReference.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_MethodReference.java 2007-01-08 08:20:23 UTC (rev 3049) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_MethodReference.java 2007-01-08 08:23:21 UTC (rev 3050) @@ -163,10 +163,17 @@ public final VM_Method peekResolvedMethod() { if (resolvedMember != null) return resolvedMember; - // Hasn't been resolved yet. Try to do it now without triggering class loading. - VM_Class declaringClass = (VM_Class)type.peekResolvedType(); - if (declaringClass == null) return null; - return resolveInternal(declaringClass); + try { + throw new Exception("VM_MethodReference.peekResolvedMethod() not implemented!"); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + // Hasn't been resolved yet. Try to do it now without triggering class loading. +// VM_Class declaringClass = (VM_Class)type.peekResolvedType(); +// if (declaringClass == null) return null; +// return resolveInternal(declaringClass); } /** @@ -178,7 +185,7 @@ if (resolvedMember != null) return resolvedMember; else try { - throw new Exception("WARNING: VM_MethodReference.resolve() not implemented!"); + throw new Exception("VM_MethodReference.resolve() not implemented!"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_NormalMethod.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_NormalMethod.java 2007-01-08 08:20:23 UTC (rev 3049) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_NormalMethod.java 2007-01-08 08:23:21 UTC (rev 3050) @@ -636,4 +636,8 @@ } + public boolean hasLoadStaticsPragma() { + return ((VmMethod)jnodeMember).hasLoadStaticsPragma(); + } + } Modified: branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Type.java =================================================================== --- branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Type.java 2007-01-08 08:20:23 UTC (rev 3049) +++ branches/jikesRVM/core/src/core/com/ibm/JikesRVM/classloader/VM_Type.java 2007-01-08 08:23:21 UTC (rev 3050) @@ -169,7 +169,7 @@ } public final Offset getTibOffset() { - return Offset.fromIntSignExtend(tibOffset); + return Offset.fromIntZeroExtend(tibOffset); } public abstract Object[] getTypeInformationBlock(); @@ -198,7 +198,7 @@ * Is this class part of the virtual machine's boot image? */ public final boolean isInBootImage() throws UninterruptiblePragma { - return jnodeType.isInBootImage(); + return false;//return jnodeType.isInBootImage(); } public final Class getClassForType() { @@ -304,11 +304,18 @@ public VmType<?> getJnodeType() { return jnodeType; } - + + public final int getIsolatedStaticsIndex() { + return jnodeType.getIsolatedStaticsIndex(); + } @Override public String toString() { return typeRef.name.toString(); } + public boolean isSharedStatics() { + return jnodeType.isSharedStatics(); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ans...@us...> - 2007-01-08 08:20:25
|
Revision: 3049 http://jnode.svn.sourceforge.net/jnode/?rev=3049&view=rev Author: ansari82 Date: 2007-01-08 00:20:23 -0800 (Mon, 08 Jan 2007) Log Message: ----------- Moved test files to default package temporarily so manual selection is not needed at boot time Modified Paths: -------------- branches/jikesRVM/all/conf/default-plugin-list.xml branches/jikesRVM/all/conf/tests-plugin-list.xml Modified: branches/jikesRVM/all/conf/default-plugin-list.xml =================================================================== --- branches/jikesRVM/all/conf/default-plugin-list.xml 2007-01-08 08:18:43 UTC (rev 3048) +++ branches/jikesRVM/all/conf/default-plugin-list.xml 2007-01-08 08:20:23 UTC (rev 3049) @@ -153,6 +153,9 @@ <plugin id="org.jnode.system.repository"/> <plugin id="org.jnode.test.core"/> + + <plugin id="org.junit"/> + <plugin id="org.jnode.test"/> <plugin id="org.jnode.work"/> <plugin id="org.jnode.font.bdf"/> Modified: branches/jikesRVM/all/conf/tests-plugin-list.xml =================================================================== --- branches/jikesRVM/all/conf/tests-plugin-list.xml 2007-01-08 08:18:43 UTC (rev 3048) +++ branches/jikesRVM/all/conf/tests-plugin-list.xml 2007-01-08 08:20:23 UTC (rev 3049) @@ -7,7 +7,7 @@ <include file="full-plugin-list.xml"/> - <plugin id="org.junit"/> + <plugin id="gnu.mauve"/> <plugin id="gnu.mauve.core"/> <plugin id="gnu.mauve.java.util"/> @@ -19,7 +19,7 @@ <plugin id="org.jmock.cglib"/> <plugin id="org.jmock"/> - <plugin id="org.jnode.test"/> + <plugin id="org.jnode.test.fs"/> <plugin id="org.jnode.test.net"/> <plugin id="org.jnode.shell.command.test"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ans...@us...> - 2007-01-08 08:19:41
|
Revision: 3048 http://jnode.svn.sourceforge.net/jnode/?rev=3048&view=rev Author: ansari82 Date: 2007-01-08 00:18:43 -0800 (Mon, 08 Jan 2007) Log Message: ----------- Removed serial interface support in VMWare, this removes irritating dialog box at start up of updated cd-images Modified Paths: -------------- branches/jikesRVM/builder/src/builder/org/jnode/build/VMwareBuilderTask.java Modified: branches/jikesRVM/builder/src/builder/org/jnode/build/VMwareBuilderTask.java =================================================================== --- branches/jikesRVM/builder/src/builder/org/jnode/build/VMwareBuilderTask.java 2007-01-07 21:54:36 UTC (rev 3047) +++ branches/jikesRVM/builder/src/builder/org/jnode/build/VMwareBuilderTask.java 2007-01-08 08:18:43 UTC (rev 3048) @@ -111,7 +111,7 @@ if((logFile != null) && (logFile.trim().length() != 0)) { - put(w, "serial0.present", "TRUE"); + put(w, "serial0.present", "FALSE"); put(w, "serial0.fileType", "file"); put(w, "serial0.fileName", logFile); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2007-01-07 21:54:38
|
Revision: 3047 http://jnode.svn.sourceforge.net/jnode/?rev=3047&view=rev Author: lsantha Date: 2007-01-07 13:54:36 -0800 (Sun, 07 Jan 2007) Log Message: ----------- Classpath patches. Modified Paths: -------------- trunk/core/src/classpath/javax/javax/swing/colorchooser/DefaultHSBChooserPanel.java trunk/core/src/classpath/javax/javax/swing/event/EventListenerList.java trunk/core/src/classpath/javax/javax/swing/filechooser/FileSystemView.java trunk/core/src/classpath/javax/javax/swing/text/AbstractDocument.java trunk/core/src/classpath/javax/javax/swing/text/AsyncBoxView.java trunk/core/src/classpath/javax/javax/swing/text/AttributeSet.java trunk/core/src/classpath/javax/javax/swing/text/DefaultCaret.java trunk/core/src/classpath/javax/javax/swing/text/DefaultFormatter.java trunk/core/src/classpath/javax/javax/swing/text/DefaultStyledDocument.java trunk/core/src/classpath/javax/javax/swing/text/FieldView.java trunk/core/src/classpath/javax/javax/swing/text/InternationalFormatter.java trunk/core/src/classpath/javax/javax/swing/text/JTextComponent.java trunk/core/src/classpath/javax/javax/swing/text/MutableAttributeSet.java trunk/core/src/classpath/javax/javax/swing/text/SimpleAttributeSet.java trunk/core/src/classpath/javax/javax/swing/text/StyleContext.java trunk/core/src/classpath/javax/javax/swing/text/TextAction.java trunk/core/src/classpath/javax/javax/swing/text/html/HTML.java trunk/core/src/classpath/javax/javax/swing/text/html/HTMLDocument.java trunk/core/src/classpath/javax/javax/swing/text/html/StyleSheet.java trunk/core/src/classpath/javax/javax/swing/text/html/parser/AttributeList.java trunk/core/src/classpath/javax/javax/swing/text/html/parser/ContentModel.java trunk/core/src/classpath/javax/javax/swing/text/html/parser/DTD.java Modified: trunk/core/src/classpath/javax/javax/swing/colorchooser/DefaultHSBChooserPanel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/colorchooser/DefaultHSBChooserPanel.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/colorchooser/DefaultHSBChooserPanel.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -778,7 +778,6 @@ if (locked == HLOCKED) { slider.setMaximum(359); - ; slider.setValue(((Number) hSpinner.getValue()).intValue()); slider.setInverted(true); } Modified: trunk/core/src/classpath/javax/javax/swing/event/EventListenerList.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/event/EventListenerList.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/event/EventListenerList.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -37,6 +37,9 @@ package javax.swing.event; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.io.Serializable; import java.lang.reflect.Array; import java.util.EventListener; @@ -136,7 +139,7 @@ * * @throws NullPointerException if <code>t</code> is <code>null</code>. */ - public void add(Class t, EventListener listener) + public <T extends EventListener> void add(Class<T> t, T listener) { int oldLength; Object[] newList; @@ -175,7 +178,7 @@ * <code>t</code>. Thus, subclasses of <code>t</code> will not be * counted. */ - public int getListenerCount(Class t) + public int getListenerCount(Class<?> t) { int result = 0; for (int i = 0; i < listenerList.length; i += 2) @@ -224,7 +227,7 @@ * * @since 1.3 */ - public EventListener[] getListeners(Class c) + public <T extends EventListener> T[] getListeners(Class<T> c) { int count, f; EventListener[] result; @@ -236,7 +239,7 @@ if (listenerList[i] == c) result[f++] = (EventListener) listenerList[i + 1]; - return result; + return (T[]) result; } @@ -253,7 +256,7 @@ * * @throws NullPointerException if <code>t</code> is <code>null</code>. */ - public void remove(Class t, EventListener listener) + public <T extends EventListener> void remove(Class<T> t, T listener) { Object[] oldList, newList; int oldLength; @@ -304,4 +307,51 @@ } return buf.toString(); } + + /** + * Serializes an instance to an ObjectOutputStream. + * + * @param out the stream to serialize to + * + * @throws IOException if something goes wrong + */ + private void writeObject(ObjectOutputStream out) + throws IOException + { + out.defaultWriteObject(); + for (int i = 0; i < listenerList.length; i += 2) + { + Class cl = (Class) listenerList[i]; + EventListener l = (EventListener) listenerList[i + 1]; + if (l != null && l instanceof Serializable) + { + out.writeObject(cl.getName()); + out.writeObject(l); + } + } + // Write end marker. + out.writeObject(null); + } + + /** + * Deserializes an instance from an ObjectInputStream. + * + * @param in the input stream + * + * @throws ClassNotFoundException if a serialized class can't be found + * @throws IOException if something goes wrong + */ + private <T extends EventListener> void readObject(ObjectInputStream in) + throws ClassNotFoundException, IOException + { + listenerList = NO_LISTENERS; + in.defaultReadObject(); + Object type; + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + while ((type = in.readObject()) != null) + { + EventListener l = (EventListener) in.readObject(); + add(((Class<T>) Class.forName((String) type, true, cl)), (T) l); + } + } } Modified: trunk/core/src/classpath/javax/javax/swing/filechooser/FileSystemView.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/filechooser/FileSystemView.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/filechooser/FileSystemView.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -37,8 +37,6 @@ package javax.swing.filechooser; -import gnu.classpath.NotImplementedException; - import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -171,7 +169,6 @@ * @return A default {@link FileSystemView} appropriate for the platform. */ public static FileSystemView getFileSystemView() - throws NotImplementedException { if (defaultFileSystemView == null) { Modified: trunk/core/src/classpath/javax/javax/swing/text/AbstractDocument.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/AbstractDocument.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/AbstractDocument.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -1,5 +1,5 @@ /* AbstractDocument.java -- - Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -467,7 +467,7 @@ * * @return the properties of this <code>Document</code> */ - public Dictionary getDocumentProperties() + public Dictionary<Object, Object> getDocumentProperties() { // FIXME: make me thread-safe if (properties == null) @@ -518,7 +518,7 @@ * * @return all registered listeners of the specified type */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } @@ -1347,7 +1347,7 @@ * * @param p the document properties to set */ - public void setDocumentProperties(Dictionary p) + public void setDocumentProperties(Dictionary<Object, Object> p) { // FIXME: make me thread-safe properties = p; @@ -1521,7 +1521,7 @@ * @return the attributes of <code>old</code> minus the attributes in * <code>attributes</code> */ - AttributeSet removeAttributes(AttributeSet old, Enumeration names); + AttributeSet removeAttributes(AttributeSet old, Enumeration<?> names); } /** @@ -1777,7 +1777,7 @@ * * @param names the names of the attributes to be removed */ - public void removeAttributes(Enumeration names) + public void removeAttributes(Enumeration<?> names) { attributes = getAttributeContext().removeAttributes(attributes, names); } @@ -1872,7 +1872,7 @@ * * @return the names of the attributes of this element */ - public Enumeration getAttributeNames() + public Enumeration<?> getAttributeNames() { return attributes.getAttributeNames(); } @@ -2093,7 +2093,7 @@ /** * The child elements of this BranchElement. */ - private Element[] children;; + private Element[] children; /** * The number of children in the branch element. @@ -2450,8 +2450,6 @@ */ public boolean addEdit(UndoableEdit edit) { - // XXX - Fully qualify ElementChange to work around gcj bug #2499. - // Start using Hashtable when we pass a certain threshold. This // gives a good memory/performance compromise. if (changes == null && edits.size() > THRESHOLD) @@ -2461,19 +2459,17 @@ for (int i = 0; i < count; i++) { Object o = edits.elementAt(i); - if (o instanceof DocumentEvent.ElementChange) + if (o instanceof ElementChange) { - DocumentEvent.ElementChange ec = - (DocumentEvent.ElementChange) o; + ElementChange ec = (ElementChange) o; changes.put(ec.getElement(), ec); } } } - if (changes != null && edit instanceof DocumentEvent.ElementChange) + if (changes != null && edit instanceof ElementChange) { - DocumentEvent.ElementChange elEdit = - (DocumentEvent.ElementChange) edit; + ElementChange elEdit = (ElementChange) edit; changes.put(elEdit.getElement(), elEdit); } return super.addEdit(edit); @@ -2527,13 +2523,12 @@ * @return the changes for <code>elem</code> or <code>null</code> if * <code>elem</code> has not been changed */ - public DocumentEvent.ElementChange getChange(Element elem) + public ElementChange getChange(Element elem) { - // XXX - Fully qualify ElementChange to work around gcj bug #2499. - DocumentEvent.ElementChange change = null; + ElementChange change = null; if (changes != null) { - change = (DocumentEvent.ElementChange) changes.get(elem); + change = (ElementChange) changes.get(elem); } else { @@ -2541,10 +2536,9 @@ for (int i = 0; i < count && change == null; i++) { Object o = edits.get(i); - if (o instanceof DocumentEvent.ElementChange) + if (o instanceof ElementChange) { - DocumentEvent.ElementChange ec = - (DocumentEvent.ElementChange) o; + ElementChange ec = (ElementChange) o; if (elem.equals(ec.getElement())) change = ec; } Modified: trunk/core/src/classpath/javax/javax/swing/text/AsyncBoxView.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/AsyncBoxView.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/AsyncBoxView.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -307,7 +307,7 @@ private int updateChildOffsets(float targetOffset) { int n = getViewCount(); - int targetIndex = n - 1;; + int targetIndex = n - 1; int pos = lastValidOffset.getChildView().getStartOffset(); int startIndex = getViewIndexAtPosition(pos, Position.Bias.Forward); float start = lastValidOffset.getMajorOffset(); Modified: trunk/core/src/classpath/javax/javax/swing/text/AttributeSet.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/AttributeSet.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/AttributeSet.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -158,7 +158,7 @@ * @return the names of the attributes that are stored in this * <code>AttributeSet</code> */ - Enumeration getAttributeNames(); + Enumeration<?> getAttributeNames(); /** * Returns the resolving parent of this <code>AttributeSet</code>. Modified: trunk/core/src/classpath/javax/javax/swing/text/DefaultCaret.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/DefaultCaret.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/DefaultCaret.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -946,7 +946,7 @@ * * @return all registered event listeners of the specified type */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } Modified: trunk/core/src/classpath/javax/javax/swing/text/DefaultFormatter.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/DefaultFormatter.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/DefaultFormatter.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -330,7 +330,7 @@ * * @return the class that is used for values */ - public Class getValueClass() + public Class<?> getValueClass() { return valueClass; } @@ -342,7 +342,7 @@ * * @see #getValueClass() */ - public void setValueClass(Class valueClass) + public void setValueClass(Class<?> valueClass) { this.valueClass = valueClass; } Modified: trunk/core/src/classpath/javax/javax/swing/text/DefaultStyledDocument.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/DefaultStyledDocument.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/DefaultStyledDocument.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -1126,7 +1126,9 @@ int p; for (p = 0; p < data.length && data[p].getType() == ElementSpec.EndTagType; - p++); + p++) + ; + Edit edit = insertPath[insertPath.length - p - 1]; edit.index--; edit.removed.add(0, edit.e.getElement(edit.index)); @@ -2377,7 +2379,7 @@ * * @return an enumeration of all style names */ - public Enumeration getStyleNames() + public Enumeration<?> getStyleNames() { StyleContext context = (StyleContext) getAttributeContext(); return context.getStyleNames(); Modified: trunk/core/src/classpath/javax/javax/swing/text/FieldView.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/FieldView.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/FieldView.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -91,7 +91,7 @@ horizontalVisibility.addChangeListener(new ChangeListener(){ public void stateChanged(ChangeEvent event) { getContainer().repaint(); - }; + } }); // It turned out that the span calculated at this point is wrong Modified: trunk/core/src/classpath/javax/javax/swing/text/InternationalFormatter.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/InternationalFormatter.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/InternationalFormatter.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -1,5 +1,5 @@ /* InternationalFormatter.java -- -Copyright (C) 2005 Free Software Foundation, Inc. +Copyright (C) 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -329,7 +329,7 @@ * * @throws CloneNotSupportedException not thrown here, since cloning is * supported - * XXX - FIXME - Whole method disabled as workaround for gcj bug #22060. + */ public Object clone() throws CloneNotSupportedException { @@ -338,7 +338,6 @@ Object clone = super.clone(); return clone; } - */ /** * Returns the Actions that are supported by this Formatter. Modified: trunk/core/src/classpath/javax/javax/swing/text/JTextComponent.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/JTextComponent.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/JTextComponent.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -1821,7 +1821,7 @@ public boolean getScrollableTracksViewportWidth() { - boolean res = false;; + boolean res = false; Container c = getParent(); if (c instanceof JViewport) res = ((JViewport) c).getExtentSize().width > getPreferredSize().width; Modified: trunk/core/src/classpath/javax/javax/swing/text/MutableAttributeSet.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/MutableAttributeSet.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/MutableAttributeSet.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -90,7 +90,7 @@ * @throws NullPointerException if <code>names</code> is <code>null</code> * or contains any <code>null</code> values. */ - void removeAttributes(Enumeration names); + void removeAttributes(Enumeration<?> names); /** * Removes attributes from this set if they are found in the Modified: trunk/core/src/classpath/javax/javax/swing/text/SimpleAttributeSet.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/SimpleAttributeSet.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/SimpleAttributeSet.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -261,7 +261,7 @@ * * @return An enumeration of the attribute names. */ - public Enumeration getAttributeNames() + public Enumeration<?> getAttributeNames() { return tab.keys(); } @@ -375,7 +375,7 @@ * @throws NullPointerException if <code>names</code> is <code>null</code> * or contains any <code>null</code> values. */ - public void removeAttributes(Enumeration names) + public void removeAttributes(Enumeration<?> names) { while (names.hasMoreElements()) { Modified: trunk/core/src/classpath/javax/javax/swing/text/StyleContext.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/StyleContext.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/StyleContext.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -121,7 +121,7 @@ listenerList.remove(ChangeListener.class, l); } - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } @@ -183,7 +183,7 @@ return attributes.getAttributeCount(); } - public Enumeration getAttributeNames() + public Enumeration<?> getAttributeNames() { return attributes.getAttributeNames(); } @@ -210,7 +210,7 @@ fireStateChanged(); } - public void removeAttributes(Enumeration names) + public void removeAttributes(Enumeration<?> names) { attributes = StyleContext.this.removeAttributes(attributes, names); fireStateChanged(); @@ -351,7 +351,7 @@ return attrs.length / 2; } - public Enumeration getAttributeNames() + public Enumeration<?> getAttributeNames() { return new Enumeration() { @@ -539,7 +539,7 @@ * Get the names of the style. The returned enumeration always * contains at least one member, the default style. */ - public Enumeration getStyleNames() + public Enumeration<?> getStyleNames() { return styles.getAttributeNames(); } @@ -749,7 +749,7 @@ } public synchronized AttributeSet removeAttributes(AttributeSet old, - Enumeration names) + Enumeration<?> names) { AttributeSet ret; if (old.getAttributeCount() <= getCompressionThreshold()) Modified: trunk/core/src/classpath/javax/javax/swing/text/TextAction.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/TextAction.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/TextAction.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -96,7 +96,7 @@ */ public static final Action[] augmentList(Action[] list1, Action[] list2) { - HashMap actions = new HashMap(); + HashMap<Object,Action> actions = new HashMap<Object,Action>(); for (int i = 0; i < list1.length; ++i) { @@ -104,6 +104,7 @@ Object name = a.getValue(Action.NAME); actions.put(name != null ? name : "", a); } + for (int i = 0; i < list2.length; ++i) { Action a = list2[i]; @@ -113,9 +114,10 @@ Action[] augmented = new Action[actions.size()]; int i = 0; - for (Iterator it = actions.values().iterator(); it.hasNext(); i++) - augmented[i] = (Action) it.next(); + for (Iterator<Action> it = actions.values().iterator(); it.hasNext(); i++) + augmented[i] = it.next(); return augmented; + } /** Modified: trunk/core/src/classpath/javax/javax/swing/text/html/HTML.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/html/HTML.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/html/HTML.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -1129,8 +1129,8 @@ static final int BLOCK = 2; static final int PREFORMATTED = 4; static final int SYNTHETIC = 8; - private static Map tagMap; - private static Map attrMap; + private static Map<String,Tag> tagMap; + private static Map<String,Attribute> attrMap; /** * The public constructor (does nothing). It it seldom required to have @@ -1169,7 +1169,7 @@ if (attrMap == null) { // Create the map on demand. - attrMap = new TreeMap(); + attrMap = new TreeMap<String,Attribute>(); Attribute[] attrs = getAllAttributeKeys(); @@ -1179,7 +1179,7 @@ } } - return (Attribute) attrMap.get(attName.toLowerCase()); + return attrMap.get(attName.toLowerCase()); } /** @@ -1238,7 +1238,7 @@ if (tagMap == null) { // Create the mao on demand. - tagMap = new TreeMap(); + tagMap = new TreeMap<String,Tag>(); Tag[] tags = getAllTags(); @@ -1248,6 +1248,6 @@ } } - return (Tag) tagMap.get(tagName.toLowerCase()); + return tagMap.get(tagName.toLowerCase()); } } Modified: trunk/core/src/classpath/javax/javax/swing/text/html/HTMLDocument.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/html/HTMLDocument.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/html/HTMLDocument.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -649,12 +649,12 @@ */ protected MutableAttributeSet charAttr = new SimpleAttributeSet(); - protected Vector parseBuffer = new Vector(); + protected Vector<ElementSpec> parseBuffer = new Vector<ElementSpec>(); /** * The parse stack. It holds the current element tree path. */ - private Stack parseStack = new Stack(); + private Stack<HTML.Tag> parseStack = new Stack<HTML.Tag>(); /** * A stack for character attribute sets * @@ -1791,7 +1791,7 @@ boolean inParagraph = false; if (! parseStack.isEmpty()) { - HTML.Tag top = (HTML.Tag) parseStack.peek(); + HTML.Tag top = parseStack.peek(); inParagraph = top == HTML.Tag.P || top == HTML.Tag.IMPLIED; } return inParagraph; @@ -1802,7 +1802,7 @@ boolean inParagraph = false; if (! parseStack.isEmpty()) { - HTML.Tag top = (HTML.Tag) parseStack.peek(); + HTML.Tag top = parseStack.peek(); inParagraph = top == HTML.Tag.IMPLIED; } return inParagraph; Modified: trunk/core/src/classpath/javax/javax/swing/text/html/StyleSheet.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/html/StyleSheet.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/html/StyleSheet.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -870,7 +870,7 @@ * @param names - the attribute names * @return the update attribute set */ - public AttributeSet removeAttributes(AttributeSet old, Enumeration names) + public AttributeSet removeAttributes(AttributeSet old, Enumeration<?> names) { // FIXME: Not implemented. return super.removeAttributes(old, names); Modified: trunk/core/src/classpath/javax/javax/swing/text/html/parser/AttributeList.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/html/parser/AttributeList.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/html/parser/AttributeList.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -122,7 +122,7 @@ * null, if this parameter was not specified. * Values, defined in DTD, are case insensitive. */ - public Vector values; + public Vector<?> values; /** * The modifier of this attribute. This field contains one of the @@ -176,7 +176,7 @@ * Equals to null for the last attribute definition. */ public AttributeList(String a_name, int a_type, int a_modifier, - String a_default, Vector allowed_values, + String a_default, Vector<?> allowed_values, AttributeList a_next ) { @@ -251,7 +251,7 @@ /** * Get the allowed values of this attribute. */ - public Enumeration getValues() + public Enumeration<?> getValues() { return values.elements(); } Modified: trunk/core/src/classpath/javax/javax/swing/text/html/parser/ContentModel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/html/parser/ContentModel.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/html/parser/ContentModel.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -151,13 +151,15 @@ * discarded. * @param elements - a vector to add the values to. */ - public void getElements(Vector elements) + public void getElements(Vector<Element> elements) { ContentModel c = this; while (c != null) { - elements.add(c.content); + // FIXME: correct? + if (c.content instanceof Element) + elements.add((Element) c.content); c = c.next; } } Modified: trunk/core/src/classpath/javax/javax/swing/text/html/parser/DTD.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/text/html/parser/DTD.java 2007-01-07 21:49:14 UTC (rev 3046) +++ trunk/core/src/classpath/javax/javax/swing/text/html/parser/DTD.java 2007-01-07 21:54:36 UTC (rev 3047) @@ -88,7 +88,7 @@ /** * The table of existing available DTDs. */ - static Hashtable dtdHash = new Hashtable(); + static Hashtable<String,DTD> dtdHash = new Hashtable<String,DTD>(); /** * The applet element for this DTD. @@ -148,12 +148,13 @@ /** * The element for accessing all DTD elements by name. */ - public Hashtable elementHash = new Hashtable(); + public Hashtable<String,Element> elementHash = + new Hashtable<String,Element>(); /** * The entity table for accessing all DTD entities by name. */ - public Hashtable entityHash = new Hashtable(); + public Hashtable<Object, Entity> entityHash = new Hashtable<Object, Entity>(); /** * The name of this DTD. @@ -165,7 +166,7 @@ * javax.swing.text.html.parser.Element#index field of all elements * in this vector is set to the element position in this vector. */ - public Vector elements = new Vector(); + public Vector<Element> elements = new Vector<Element>(); /** Create a new DTD with the specified name. */ protected DTD(String a_name) @@ -224,7 +225,7 @@ String name = Entity.mapper.get(id); if (name != null) - return (Entity) entityHash.get(name); + return entityHash.get(name); else return null; } @@ -269,7 +270,7 @@ */ public void defineAttributes(String forElement, AttributeList attributes) { - Element e = (Element) elementHash.get(forElement.toLowerCase()); + Element e = elementHash.get(forElement.toLowerCase()); if (e == null) e = newElement(forElement); @@ -420,7 +421,7 @@ if (allowed_values != null) { StringTokenizer st = new StringTokenizer(allowed_values, " \t|"); - Vector v = new Vector(st.countTokens()); + Vector<String> v = new Vector<String>(st.countTokens()); while (st.hasMoreTokens()) v.add(st.nextToken()); @@ -571,7 +572,7 @@ */ private Element newElement(String name) { - Element e = (Element) elementHash.get(name.toLowerCase()); + Element e = elementHash.get(name.toLowerCase()); if (e == null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2007-01-07 21:49:15
|
Revision: 3046 http://jnode.svn.sourceforge.net/jnode/?rev=3046&view=rev Author: lsantha Date: 2007-01-07 13:49:14 -0800 (Sun, 07 Jan 2007) Log Message: ----------- Classpath patches. Modified Paths: -------------- trunk/core/src/classpath/javax/javax/swing/table/AbstractTableModel.java trunk/core/src/classpath/javax/javax/swing/table/DefaultTableColumnModel.java trunk/core/src/classpath/javax/javax/swing/table/DefaultTableModel.java trunk/core/src/classpath/javax/javax/swing/table/JTableHeader.java trunk/core/src/classpath/javax/javax/swing/table/TableColumnModel.java trunk/core/src/classpath/javax/javax/swing/table/TableModel.java Modified: trunk/core/src/classpath/javax/javax/swing/table/AbstractTableModel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/table/AbstractTableModel.java 2007-01-07 18:42:54 UTC (rev 3045) +++ trunk/core/src/classpath/javax/javax/swing/table/AbstractTableModel.java 2007-01-07 21:49:14 UTC (rev 3046) @@ -125,7 +125,7 @@ * * @return The class. */ - public Class getColumnClass(int columnIndex) + public Class<?> getColumnClass(int columnIndex) { return Object.class; } @@ -294,7 +294,7 @@ * * @return An array of listeners (possibly empty). */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } Modified: trunk/core/src/classpath/javax/javax/swing/table/DefaultTableColumnModel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/table/DefaultTableColumnModel.java 2007-01-07 18:42:54 UTC (rev 3045) +++ trunk/core/src/classpath/javax/javax/swing/table/DefaultTableColumnModel.java 2007-01-07 21:49:14 UTC (rev 3046) @@ -71,7 +71,7 @@ /** * Storage for the table columns. */ - protected Vector tableColumns; + protected Vector<TableColumn> tableColumns; /** * A selection model that keeps track of column selections. @@ -187,7 +187,7 @@ throw new IllegalArgumentException("Index 'i' out of range."); if (j < 0 || j >= columnCount) throw new IllegalArgumentException("Index 'j' out of range."); - Object column = tableColumns.remove(i); + TableColumn column = tableColumns.remove(i); tableColumns.add(j, column); fireColumnMoved(new TableColumnModelEvent(this, i, j)); } @@ -221,7 +221,7 @@ * * @return An enumeration of the columns in the model. */ - public Enumeration getColumns() + public Enumeration<TableColumn> getColumns() { return tableColumns.elements(); } @@ -597,7 +597,7 @@ * @return An array containing the listeners (of the specified type) that * are registered with this model. */ - public EventListener[] getListeners(Class listenerType) + public <T extends EventListener> T[] getListeners(Class<T> listenerType) { return listenerList.getListeners(listenerType); } Modified: trunk/core/src/classpath/javax/javax/swing/table/DefaultTableModel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/table/DefaultTableModel.java 2007-01-07 18:42:54 UTC (rev 3045) +++ trunk/core/src/classpath/javax/javax/swing/table/DefaultTableModel.java 2007-01-07 21:49:14 UTC (rev 3046) @@ -625,7 +625,7 @@ if (columnCount > columnIdentifiers.size()) columnIdentifiers.setSize(columnCount); - if (rowCount > dataVector.size()) + if (dataVector != null && rowCount > dataVector.size()) { int rowsToAdd = rowCount - dataVector.size(); addExtraRows(rowsToAdd, columnCount); Modified: trunk/core/src/classpath/javax/javax/swing/table/JTableHeader.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/table/JTableHeader.java 2007-01-07 18:42:54 UTC (rev 3045) +++ trunk/core/src/classpath/javax/javax/swing/table/JTableHeader.java 2007-01-07 21:49:14 UTC (rev 3046) @@ -570,7 +570,7 @@ if (comp != null) comp.setVisible(b); } - }; + } public AccessibleRole getAccessibleRole() { Modified: trunk/core/src/classpath/javax/javax/swing/table/TableColumnModel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/table/TableColumnModel.java 2007-01-07 18:42:54 UTC (rev 3045) +++ trunk/core/src/classpath/javax/javax/swing/table/TableColumnModel.java 2007-01-07 21:49:14 UTC (rev 3046) @@ -102,7 +102,7 @@ * * @return An enumeration of the columns in the model. */ - Enumeration getColumns(); + Enumeration<TableColumn> getColumns(); /** * Returns the index of the {@link TableColumn} with the given identifier. Modified: trunk/core/src/classpath/javax/javax/swing/table/TableModel.java =================================================================== --- trunk/core/src/classpath/javax/javax/swing/table/TableModel.java 2007-01-07 18:42:54 UTC (rev 3045) +++ trunk/core/src/classpath/javax/javax/swing/table/TableModel.java 2007-01-07 21:49:14 UTC (rev 3046) @@ -84,7 +84,7 @@ * * @return The class. */ - Class getColumnClass(int columnIndex); + Class<?> getColumnClass(int columnIndex); /** * Returns <code>true</code> if the cell is editable, and <code>false</code> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ls...@us...> - 2007-01-07 18:42:55
|
Revision: 3045 http://jnode.svn.sourceforge.net/jnode/?rev=3045&view=rev Author: lsantha Date: 2007-01-07 10:42:54 -0800 (Sun, 07 Jan 2007) Log Message: ----------- Classpath patches. Modified Paths: -------------- trunk/core/src/classpath/tools/gnu/classpath/tools/appletviewer/Main.java trunk/core/src/classpath/tools/gnu/classpath/tools/appletviewer/TagParser.java trunk/core/src/classpath/vm/java/lang/reflect/Constructor.java Modified: trunk/core/src/classpath/tools/gnu/classpath/tools/appletviewer/Main.java =================================================================== --- trunk/core/src/classpath/tools/gnu/classpath/tools/appletviewer/Main.java 2007-01-07 18:42:15 UTC (rev 3044) +++ trunk/core/src/classpath/tools/gnu/classpath/tools/appletviewer/Main.java 2007-01-07 18:42:54 UTC (rev 3045) @@ -266,7 +266,6 @@ else { // Warn user about missing security manager. - /* @jnode disable security warning System.err.println(Messages.getString("Main.SecurityWarning") + "\n"); System.err.println(Messages.getString("Main.ContinuationPrompt")); @@ -290,7 +289,6 @@ System.exit(0); } - */ if (code == null) { // The --code option wasn't given and there are no URL Modified: trunk/core/src/classpath/tools/gnu/classpath/tools/appletviewer/TagParser.java =================================================================== --- trunk/core/src/classpath/tools/gnu/classpath/tools/appletviewer/TagParser.java 2007-01-07 18:42:15 UTC (rev 3044) +++ trunk/core/src/classpath/tools/gnu/classpath/tools/appletviewer/TagParser.java 2007-01-07 18:42:54 UTC (rev 3045) @@ -130,7 +130,7 @@ { ArrayList allTags = new ArrayList(); if (document == null) - return null;; + return null; recurseDocument(document.getChildNodes()); Modified: trunk/core/src/classpath/vm/java/lang/reflect/Constructor.java =================================================================== --- trunk/core/src/classpath/vm/java/lang/reflect/Constructor.java 2007-01-07 18:42:15 UTC (rev 3044) +++ trunk/core/src/classpath/vm/java/lang/reflect/Constructor.java 2007-01-07 18:42:54 UTC (rev 3045) @@ -79,7 +79,12 @@ * @since 1.1 * @status updated to 1.4 */ -public final class Constructor extends AccessibleObject implements Member, AnnotatedElement, GenericDeclaration { +public final class Constructor<T> + extends AccessibleObject + implements GenericDeclaration, Member +{ + private Class<T> clazz; + private int slot; private final VmMethod vmMethod; private ArrayList<Class> parameterTypes; @@ -99,8 +104,8 @@ * Gets the class that declared this constructor. * @return the class that declared this member */ - public Class getDeclaringClass() { - return vmMethod.getDeclaringClass().asClass(); + public Class<T> getDeclaringClass() { + return (Class<T>) vmMethod.getDeclaringClass().asClass(); } /** @@ -108,9 +113,9 @@ * it was declared in). * @return the name of this constructor */ - public String getName() { - final Class<?> declClass = getDeclaringClass(); - return declClass.getName(); + public String getName() + { + return getDeclaringClass().getName(); } /** @@ -164,7 +169,7 @@ * * @return a list of the types of the constructor's parameters */ - public Class[] getParameterTypes() { + public Class<?>[] getParameterTypes() { if (parameterTypes == null) { int cnt = vmMethod.getNoArguments(); ArrayList<Class> list = new ArrayList<Class>(cnt); @@ -183,7 +188,7 @@ * * @return a list of the types in the constructor's throws clause */ - public Class[] getExceptionTypes() { + public Class<?>[] getExceptionTypes() { if (exceptionTypes == null) { final VmExceptions exceptions = vmMethod.getExceptions(); final int cnt = exceptions.getLength(); @@ -216,9 +221,9 @@ * * @return the hash code for the object */ - public int hashCode() { - final Class<?> declClass = getDeclaringClass(); - return declClass.getName().hashCode(); + public int hashCode() + { + return getDeclaringClass().getName().hashCode(); } /** @@ -233,7 +238,7 @@ */ public String toString() { // 128 is a reasonable buffer initial size for constructor - StringBuffer sb = new StringBuffer(128); + StringBuilder sb = new StringBuilder(128); Modifier.toString(getModifiers(), sb).append(' '); final Class<?> declClass = getDeclaringClass(); sb.append(declClass.getName()).append('('); @@ -285,8 +290,8 @@ * @throws ExceptionInInitializerError if construction triggered class * initialization, which then failed */ - public Object newInstance(Object args[]) throws InstantiationException, IllegalAccessException, InvocationTargetException { - return VmReflection.newInstance(vmMethod, args); + public T newInstance(Object... args) throws InstantiationException, IllegalAccessException, InvocationTargetException { + return (T) VmReflection.newInstance(vmMethod, args); } /** @@ -318,6 +323,7 @@ MethodSignatureParser p = new MethodSignatureParser(this, sig); return p.getTypeParameters(); } + /** * Returns an array of <code>Type</code> objects that represents * the exception types declared by this constructor, in declaration order. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |