>>>>> "Tom" == Tom Tromey <tromey@xxxxxxxxxx> writes: >>>>> "Stuart" == Stuart Ballard <stuart.a.ballard@xxxxxxxxx> writes: Stuart> I believe Classpath already has an unchecked NotImplementedException Stuart> so that's what I used. Any method marked as "throws Stuart> NotImplementedException" will be reported by Japi as "not implemented Stuart> in Classpath", in the same category as "missing" errors. Tom> This is a nice hack, I like it. I started implementing this. The appended patch just scratches the surface. I got a bit depressed writing this patch -- there are that many stubs. Ugh :-( I'll hold off committing this until sometime tomorrow. If someone objects to it going in, they should speak up. This is going to crush our JAPI scores. Bitter medicine is good for you :-) Ways to find stubs: * Search for 'stub'... but this gives false positives from things like corba and rmi * Use Eclipse and search for references to the Error constructors. This finds a good number but there are a couple places where we throw Error on purpose (and also this picks up the constructors of all the subclasses of Error :-) * Search for 'not implemented' (surprisingly, 'unimplemented' yields very few hits) Tom 2006-03-21 Tom Tromey <tromey@xxxxxxxxxx> * java/nio/channels/Channels.java (newWriter): Mark as stub. * java/awt/dnd/DragSourceContext.java: Marked most methods as stubs. * java/awt/dnd/DragGestureRecognizer.java (fireDragGestureRecognized): Mark as stub. (resetRecognizer): Likewise. * java/awt/datatransfer/SystemFlavorMap.java (getFlavorsForNative): Mark as stub. (getNativesForFlavor): Likewise. * javax/swing/plaf/synth/SynthStyle.java: Mark all methods as stub.s * javax/swing/plaf/synth/SynthLookAndFeel.java (updateStyles): Mark as stub. (getRegion): Likewise. (createUI): Likewise. (initialize): Likewise. (uninitialize): Likewise. (getDefaults): Likewise. (load): Likewise. (shouldUpdateStyleOnAncestorChanged): Likewise. * javax/swing/plaf/synth/SynthGraphicsUtils.java (getMinimumSize): Mark as stub. (getPreferredSize): Likewise. (getMaximumSize): Likewise. (paintText): Likewise. * java/text/RuleBasedCollator.java (getCollationElementIterator): Mark as stub. * java/text/Collator.java (getAvailableLocales): Mark as stub. Index: java/awt/datatransfer/SystemFlavorMap.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/awt/datatransfer/SystemFlavorMap.java,v retrieving revision 1.10 diff -u -r1.10 SystemFlavorMap.java --- java/awt/datatransfer/SystemFlavorMap.java 30 Nov 2005 01:46:47 -0000 1.10 +++ java/awt/datatransfer/SystemFlavorMap.java 22 Mar 2006 00:36:40 -0000 @@ -38,6 +38,8 @@ package java.awt.datatransfer; +import gnu.classpath.NotImplementedException; + import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -262,11 +264,13 @@ * version of the native. */ public List getFlavorsForNative (String nat) + throws NotImplementedException { throw new Error ("Not implemented"); } public List getNativesForFlavor (DataFlavor flav) + throws NotImplementedException { throw new Error ("Not implemented"); } Index: java/awt/dnd/DragGestureRecognizer.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/awt/dnd/DragGestureRecognizer.java,v retrieving revision 1.3 diff -u -r1.3 DragGestureRecognizer.java --- java/awt/dnd/DragGestureRecognizer.java 2 Jul 2005 20:32:26 -0000 1.3 +++ java/awt/dnd/DragGestureRecognizer.java 22 Mar 2006 00:36:40 -0000 @@ -38,6 +38,8 @@ package java.awt.dnd; +import gnu.classpath.NotImplementedException; + import java.awt.Component; import java.awt.Point; import java.awt.event.InputEvent; @@ -126,6 +128,7 @@ } public void resetRecognizer() + throws NotImplementedException { throw new Error("not implemented"); } @@ -152,6 +155,7 @@ } protected void fireDragGestureRecognized(int dragAction, Point p) + throws NotImplementedException { throw new Error("not implemented"); } Index: java/awt/dnd/DragSourceContext.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/awt/dnd/DragSourceContext.java,v retrieving revision 1.7 diff -u -r1.7 DragSourceContext.java --- java/awt/dnd/DragSourceContext.java 2 Jul 2005 20:32:26 -0000 1.7 +++ java/awt/dnd/DragSourceContext.java 22 Mar 2006 00:36:40 -0000 @@ -38,6 +38,8 @@ package java.awt.dnd; +import gnu.classpath.NotImplementedException; + import java.awt.Component; import java.awt.Cursor; import java.awt.Image; @@ -86,6 +88,7 @@ DragGestureEvent trigger, Cursor cursor, Image image, Point offset, Transferable trans, DragSourceListener dsl) + throws NotImplementedException { if (peer == null || trigger == null) @@ -130,6 +133,7 @@ } public void setCursor (Cursor cursor) + throws NotImplementedException { this.cursor = cursor; // FIXME: Check if we need to do more here @@ -162,30 +166,37 @@ } public void transferablesFlavorsChanged() + throws NotImplementedException { } public void dragEnter(DragSourceDragEvent e) + throws NotImplementedException { } public void dragOver(DragSourceDragEvent e) + throws NotImplementedException { } public void dragExit(DragSourceEvent e) + throws NotImplementedException { } public void dropActionChanged(DragSourceDragEvent e) + throws NotImplementedException { } public void dragDropEnd(DragSourceDropEvent e) + throws NotImplementedException { } public void dragMouseMoved(DragSourceDragEvent e) + throws NotImplementedException { } @@ -195,6 +206,7 @@ } protected void updateCurrentCursor(int dropOp, int targetAct, int status) + throws NotImplementedException { } } // class DragSourceContext Index: java/nio/channels/Channels.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/nio/channels/Channels.java,v retrieving revision 1.13 diff -u -r1.13 Channels.java --- java/nio/channels/Channels.java 1 Mar 2006 17:42:48 -0000 1.13 +++ java/nio/channels/Channels.java 22 Mar 2006 00:36:40 -0000 @@ -38,6 +38,7 @@ package java.nio.channels; +import gnu.classpath.NotImplementedException; import gnu.java.nio.ChannelReader; import gnu.java.nio.InputStreamChannel; import gnu.java.nio.OutputStreamChannel; @@ -125,6 +126,7 @@ */ public static Writer newWriter(WritableByteChannel ch, CharsetEncoder enc, int minBufferCap) + throws NotImplementedException { // FIXME: implement java.nio.channels.Channel.newWriter(WritableByteChannel, CharsetEncoder, int) throw new Error("not implemented"); Index: java/text/Collator.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/text/Collator.java,v retrieving revision 1.15 diff -u -r1.15 Collator.java --- java/text/Collator.java 23 Jul 2005 20:25:15 -0000 1.15 +++ java/text/Collator.java 22 Mar 2006 00:36:40 -0000 @@ -38,6 +38,8 @@ package java.text; +import gnu.classpath.NotImplementedException; + import java.util.Comparator; import java.util.Locale; import java.util.MissingResourceException; @@ -243,8 +245,8 @@ * @return The list of locales for which <code>Collator</code>'s exist. */ public static synchronized Locale[] getAvailableLocales () + throws NotImplementedException { - // FIXME Locale[] l = new Locale[1]; l[0] = Locale.US; return l; Index: java/text/RuleBasedCollator.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/text/RuleBasedCollator.java,v retrieving revision 1.31 diff -u -r1.31 RuleBasedCollator.java --- java/text/RuleBasedCollator.java 18 Sep 2005 10:01:45 -0000 1.31 +++ java/text/RuleBasedCollator.java 22 Mar 2006 00:36:40 -0000 @@ -38,6 +38,8 @@ package java.text; +import gnu.classpath.NotImplementedException; + import java.util.ArrayList; import java.util.HashMap; @@ -921,6 +923,7 @@ * @return A <code>CollationElementIterator</code> for the specified <code>String</code>. */ public CollationElementIterator getCollationElementIterator(CharacterIterator source) + throws NotImplementedException // Because decomposeCharacter does not work { StringBuffer expand = new StringBuffer(""); Index: javax/swing/plaf/synth/SynthGraphicsUtils.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/synth/SynthGraphicsUtils.java,v retrieving revision 1.1 diff -u -r1.1 SynthGraphicsUtils.java --- javax/swing/plaf/synth/SynthGraphicsUtils.java 23 Jan 2006 17:02:33 -0000 1.1 +++ javax/swing/plaf/synth/SynthGraphicsUtils.java 22 Mar 2006 00:36:41 -0000 @@ -38,6 +38,8 @@ package javax.swing.plaf.synth; +import gnu.classpath.NotImplementedException; + import java.awt.Component; import java.awt.Dimension; import java.awt.Font; @@ -159,6 +161,7 @@ Icon icon, int hAlign, int vAlign, int hTextPosition,int vTextPosition, int iconTextGap,int mnemonicIndex) + throws NotImplementedException { // FIXME: Implement this correctly. return new Dimension(0, 0); @@ -187,6 +190,7 @@ Icon icon, int hAlign, int vAlign, int hTextPosition,int vTextPosition, int iconTextGap,int mnemonicIndex) + throws NotImplementedException { // FIXME: Implement this correctly. return new Dimension(0, 0); @@ -215,6 +219,7 @@ Icon icon, int hAlign, int vAlign, int hTextPosition,int vTextPosition, int iconTextGap,int mnemonicIndex) + throws NotImplementedException { // FIXME: Implement this correctly. return new Dimension(0, 0); @@ -277,6 +282,7 @@ int hAlign, int vAlign, int hTextPosition, int vTextPosition, int iconTextGap, int mnemonicIndex, int textOffset) + throws NotImplementedException { // FIXME: Implement this correctly. } Index: javax/swing/plaf/synth/SynthLookAndFeel.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/synth/SynthLookAndFeel.java,v retrieving revision 1.2 diff -u -r1.2 SynthLookAndFeel.java --- javax/swing/plaf/synth/SynthLookAndFeel.java 6 Mar 2006 15:08:46 -0000 1.2 +++ javax/swing/plaf/synth/SynthLookAndFeel.java 22 Mar 2006 00:36:41 -0000 @@ -38,6 +38,8 @@ package javax.swing.plaf.synth; +import gnu.classpath.NotImplementedException; + import java.awt.Component; import java.io.InputStream; import java.text.ParseException; @@ -119,6 +121,7 @@ * @param c the componenent for which to update the style */ public static void updateStyles(Component c) + throws NotImplementedException { // FIXME: Implement this properly. } @@ -131,6 +134,7 @@ * @return the region for a given Swing component */ public static Region getRegion(JComponent c) + throws NotImplementedException { // FIXME: This can be implemented as soon as we have the component UI // classes in place, since this region will be matched via the UI classes. @@ -147,6 +151,7 @@ * component */ public static ComponentUI createUI(JComponent c) + throws NotImplementedException { // FIXME: This can be implemented as soon as we have the component UI // classes in place. @@ -157,6 +162,7 @@ * Initializes this look and feel. */ public void initialize() + throws NotImplementedException { super.initialize(); // TODO: Implement at least the following here: @@ -168,6 +174,7 @@ * Uninitializes the look and feel. */ public void uninitialize() + throws NotImplementedException { super.uninitialize(); // TODO: What to do here? @@ -179,6 +186,7 @@ * @return the UI defaults of this look and feel */ public UIDefaults getDefaults() + throws NotImplementedException { // FIXME: This is certainly wrong. The defaults should be fetched/merged // from the file from which the l&f is loaded. @@ -191,6 +199,7 @@ * @return FIXME */ public boolean shouldUpdateStyleOnAncestorChanged() + throws NotImplementedException { return false; } @@ -210,7 +219,7 @@ // FIXME: The signature in the JDK has a Class<?> here. Should be fixed as // soon as we switch to the generics branch. public void load(InputStream in, Class resourceBase) - throws ParseException, IllegalArgumentException + throws ParseException, IllegalArgumentException, NotImplementedException { // FIXME: Implement this correctly. } Index: javax/swing/plaf/synth/SynthStyle.java =================================================================== RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/synth/SynthStyle.java,v retrieving revision 1.1 diff -u -r1.1 SynthStyle.java --- javax/swing/plaf/synth/SynthStyle.java 23 Jan 2006 17:02:33 -0000 1.1 +++ javax/swing/plaf/synth/SynthStyle.java 22 Mar 2006 00:36:41 -0000 @@ -38,6 +38,8 @@ package javax.swing.plaf.synth; +import gnu.classpath.NotImplementedException; + import java.awt.Color; import java.awt.Font; import java.awt.Insets; @@ -58,17 +60,20 @@ * Creates a new <code>SynthStyle</code> object. */ public SynthStyle() + throws NotImplementedException { // FIXME: Implement this correctly. } public SynthGraphicsUtils getGraphicsUtils(SynthContext ctx) + throws NotImplementedException { // FIXME: Implement this correctly. return null; } public Color getColor(SynthContext ctx, ColorType type) + throws NotImplementedException { // FIXME: Implement this correctly. return null; @@ -77,6 +82,7 @@ public abstract Color getColorForState(SynthContext ctx, ColorType type); public Font getFont(SynthContext ctx) + throws NotImplementedException { // FIXME: Implement this correctly. return null; @@ -85,58 +91,68 @@ public abstract Font getFontForState(SynthContext ctx); public Insets getInsets(SynthContext ctx) + throws NotImplementedException { // FIXME: Implement this correctly. return null; } public SynthPainter getPainted(SynthContext ctx) + throws NotImplementedException { // FIXME: Implement this correctly. return null; } public boolean isOpaque(SynthContext ctx) + throws NotImplementedException { // FIXME: Implement this correctly. return true; } public Object get(SynthContext ctx, Object key) + throws NotImplementedException { // FIXME: Implement this correctly. return null; } public void installDefaults(SynthContext ctx) + throws NotImplementedException { // FIXME: Implement this correctly. } public void uninstallDefaults(SynthContext ctx) + throws NotImplementedException { // FIXME: Implement this correctly. } public int getInt(SynthContext ctx, Object key, int defaultValue) + throws NotImplementedException { // FIXME: Implement this correctly. return -1; } public boolean getBoolean(SynthContext ctx, Object key, boolean defaultValue) + throws NotImplementedException { // FIXME: Implement this correctly. return false; } public Icon getIcon(SynthContext ctx, Object key) + throws NotImplementedException { // FIXME: Implement this correctly. return null; } public String getString(SynthContext ctx, Object key, String defaultValue) + throws NotImplementedException { // FIXME: Implement this correctly. return null; Index: gnu/classpath/NotImplementedException.java =================================================================== RCS file: gnu/classpath/NotImplementedException.java diff -N gnu/classpath/NotImplementedException.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/classpath/NotImplementedException.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,61 @@ +/* NotImplementedException.java -- Marker for stub methods + 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.classpath; + +/** + * This class is used as a marker to indicate that a given method + * is merely a stub, requiring implementation. For historical + * reasons, GNU Classpath includes a number of stub methods. We + * don't wish to remove them, but we do want to make them easily + * discoverable. JAPI will notice methods declared as throwing + * this exception and mark them appropriately. + */ +public class NotImplementedException + extends RuntimeException +{ + private static final long serialVersionUID = 5112972057211125814L; + + /** + * This class is not instantiable. It should only be used + * in a method 'throws' clause -- not actually ever thrown. + */ + private NotImplementedException() + { + } +}