diff options
author | dnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-01-17 19:56:11 +0000 |
---|---|---|
committer | dnovillo <dnovillo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-01-17 19:56:11 +0000 |
commit | 7dfef11be32cb007bb2c804b10dd9002bc1753f6 (patch) | |
tree | 5e1505b9835c3f77ebd28e2c80236a9033bca3b9 /libjava | |
parent | faa9c366d6b082f64b2d5b94c8b84b098f742770 (diff) |
Mainline merge as of 2003-01-17.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@61454 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
109 files changed, 2768 insertions, 1410 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 2044fc49694..45a00fda736 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,373 @@ +2003-01-16 Mark Wielaard <mark@klomp.org> + + * java/net/SocketImpl.java (toString): Don't explicitly call + toString() on possible null address. + +2003-01-16 Michael Koch <konqueror@gmx.de> + + * java/net/MulticastSocket.java + (setInterface): Reindented. + +2003-01-15 Scott Gilbertson <scottg@mantatest.com> + + * gnu/gcj/xlib/natGC.cc (fillPolygon): New method. + * gnu/gcj/xlib/GC.java (fillPolygon): Declare. + * gnu/awt/xlib/XGraphics.java (fillPolygon): Added translateX and + translateY arguments. Implement. + * gnu/awt/j2d/IntegerGraphicsState.java (fillPolygon): Pass + down translation arguments. + (drawPolyline, drawPolygon): Fix incorrect tests. + * gnu/awt/j2d/DirectRasterGraphics.java (fillPolygon): Added + translateX and translateY arguments. + +2003-01-15 Scott Gilbertson <scottg@mantatest.com> + + * Makefile.in: Rebuilt. + * Makefile.am (xlib_includes): New macro. + (INCLUDES): Use it. + +2003-01-15 Scott Gilbertson <scottg@mantatest.com> + + * gnu/awt/xlib/XToolkit.java (getColorModel): Implemented. + * gnu/awt/xlib/XGraphicsConfiguration.java (getPixel): Work with + 16-bit display mode. + +2003-01-15 Scott Gilbertson <scottg@mantatest.com> + + * java/awt/CardLayout.java (show): Rewrote. + (gotoComponent): Removed `target' argument. Simplified code. + Don't pre-compute `choice' unless `what' is FIRST or LAST. + Changed all callers. + (NONE): Removed. + +2003-01-14 Michael Koch <konqueror@gmx.de> + + * java/net/InetSocketAddress.java + (serialVersionUID): New member variable. + * java/net/NetPermission.java + (NetPermission): Dont implement java.io.Serialization directly. + * java/net/SocketAddress.java: + (serialVersionUID): Documentation added. + +2003-01-14 Michael Koch <konqueror@gmx.de> + + * java/awt/Label.java + (Label): Implements javax.accessibility.Accessible; + * java/awt/List.java + (List): Implements javax.accessibility.Accessible; + * java/awt/ScrollPane.java + (ScrollPane): Implements javax.accessibility.Accessible; + * java/awt/Scrollbar.java + (Scrollbar): Implements javax.accessibility.Accessible; + * java/awt/TextComponent.java + (setCaretPosition): Throw exception, documentation added. + * java/awt/Toolkit.java: + Added some newlines in method documentations. + (createButton): Exception documentation added. + (createTextField): Exception documentation added. + (createLabel): Exception documentation added. + (createList): Exception documentation added. + (createCheckbox): Exception documentation added. + (createScrollbar): Exception documentation added. + (createScrollPane): Exception documentation added. + (createTextArea): Exception documentation added. + (createChoice): Exception documentation added. + (createFrame): Exception documentation added. + (createWindow): Exception documentation added. + (createDialog): Exception documentation added. + (createMenuBar): Exception documentation added. + (createMenu): Exception documentation added. + (createMenuItem): Exception documentation added. + (createFileDialog): Exception documentation added. + (createCheckboxMenuItem): Exception documentation added. + (loadSystemColors): Exception documentation added. + (setDynamicLayout): Exception documentation added. + (isDynamicLayoutSet): Exception documentation added. + (isDynamicLayoutActive): Exception documentation added. + (getScreenSize): Exception documentation added. + (getScreenResolution): Exception documentation added. + (getScreenInsets): Exception documentation added. + (getColorModel): Exception documentation added. + (getSystemClipboard): Exception documentation added. + (getSystemSelection): Exception documentation added. + (getMenuShortcutKeyMask): Exception documentation added. + (getSystemEventQueue): Exception documentation added. + * java/awt/Window.java: + Reindented some code. + (Window): Centralized implementation, documentation added. + (finalize): Documentation added. + (hide): Fixed typo in comment. + (getWindowListeners): Documentation added. + * java/awt/color/ColorSpace.java + (toRGB): Documentation added. + * java/awt/color/ICC_ColorSpace.java + (ICC_ColorSpace): Documentation added. + (toRGB): Throw exception, documentation added. + (fromRGB): Throw exception, documentation added. + (toCIEXYZ): Documentation added. + (fromCIEXYZ): Documentation added. + (getMinValue): Documentation added. + (getMaxValue): Documentation added. + * java/awt/geom/Dimension2D.java + (clone): Documentation added. + * java/awt/geom/GeneralPath.java + (clone): Documentation added. + * java/awt/geom/Line2D.java + (clone): Documentation added. + * java/awt/geom/QuadCurve2D.java + (clone): Documentation added. + * java/awt/image/ColorModel.java + (ColorModel): Throw exception, documentation added. + * java/awt/image/ImageFilter.java + (clone): Doesnt throw CloneNotSupportedException. + +2003-01-14 Andrew Haley <aph@redhat.com> + + * java/lang/natRuntime.cc (_load): StackTrace access needs to be + in a try block. + +2003-01-10 Andrew Haley <aph@redhat.com> + + * include/dwarf2-signal.h: Remove x86_64. + * configure.host (x86_64 DIVIDESPEC): Remove. + * include/x86_64-signal.h: New file. + * configure.in: Regenerate. + +2003-01-10 Michael Koch <konqueror@gmx.de> + + * java/net/DatagramSocket.java + (ch): Description added. + (remotePort): Initialize with -1. + (connect): Doesnt throws SocketException. + * java/net/MulticastSocket.java + (setInterface): Merge with Classpath. + * java/net/ServerSocket.java + (closed): New member variable. + (bind): Check if socket is closed. + (close): Close an associated channel too, set new value to closed. + (isBound): Reindented. + (isClosed): Implemented. + * java/net/Socket.java + (closed): New member variable. + (bind): Check if socket is closed. + (connect): Check if socket is closed. + (close): Close an associated channel too, set new value to closed. + (isClosed): Implemented. + +2003-01-10 Michael Koch <konqueror@gmx.de> + + * java/awt/DisplayMode.java + (equals): Fixed argument type and implementation. + +2003-01-07 Tom Tromey <tromey@redhat.com> + + * include/posix.h (_Jv_platform_usleep): Wrap in ifdef + JV_HASH_SYNCHRONIZATION. + * include/win32.h (_Jv_platform_usleep): Wrap in ifdef + JV_HASH_SYNCHRONIZATION. + +2003-01-07 Michael Koch <konqueror@gmx.de> + + * java/net/DatagramSocket.java: + Added classpath license info. + (DatagramSocket): Merged description with classpath. + (close): Merged description with classpath. + (getChannel): Merged description with classpath. + (getInetAddress): Merged description with classpath. + (getPort): Merged description with classpath. + (getLocalAddress): Merged description with classpath. + (getLocalPort): Merged description with classpath. + (getSoTimeout): Merged description with classpath. + (setSoTimeout): Merged description with classpath. + (getSendBufferSize): Merged description with classpath. + (setSendBufferSize): Merged description with classpath. + (getReceiveBufferSize): Merged description with classpath. + (setReceiveBufferSize): Merged description with classpath. + +2003-01-04 Tom Tromey <tromey@redhat.com> + + * java/awt/List.java: Merged with Classpath. + +2003-01-03 Mark Wielaard <mark@klomp.org> + + * java/io/FileDescriptor.java (position): New private field. + * java/io/natFileDescriptorPosix.cc (write): Up position. + (setLength): Use and set position. + (seek): Set position. + (getFilePointer): Return position. + (read): Up position. + +2003-01-03 Mark Wielaard <mark@klomp.org> + + Merge with Classpath: + * java/io/ObjectStreamClass.java (lookup): Split method and call + lookupForClassObject(). + (lookupForClassObject): New method. + (isProxyClass): New field. + (setClass): Set isProxyClass, add object to classLookupTable, set + superClass and calculateOffsets. + (ObjectStreamClass): Set isProxyClass. Only set uid when Serializable + and not a proxy class. + (setFields): Set accessible true for serialPersistentFields. + (getClassUID): Same for suid. And check if suid is of type long. + (hasClassInitializer): Don't throw NoSuchMethodError. + +2003-01-03 Mark Wielaard <mark@klomp.org> + + * java/io/FileInputStream.java (finalize): Don't explicitly + finalize FileDescriptor. + +2003-01-03 Jeff Sturm <jsturm@one-point.com> + + * configure.host (sparc*-*): Enable bytecode interpreter. + +2003-01-03 Dhek Bhun Kho <bhun@chello.nl> + + * gnu/java/rmi/server/UnicastServerRef.java (unexportObject): + Don't throw RemoteException. + * java/rmi/server/UnicastRemoteObject.java (unexportObject): Don't + throw RemoteException. + +2003-01-03 Joerg Brunsmann <joerg_brunsmann@yahoo.de> + + * gnu/gcj/protocol/http/Connection.java (proxyPort, proxyInUse, + proxyHost): New static fields. + (<clinit>): Initialize new fields. + (connect): Use proxy if necessary. + (usingProxy): Implement. + +2003-01-03 Eric Blake <ebb9@email.byu.edu> + + * java/util/TreeMap.java (fabricateTree): Fix off-by-one error. + (TreeIterator.remove): Prefer IllegalStateException over + ConcurrentModificationException, to match Sun. + +2002-12-22 Anthony Green <green@redhat.com> + + * boehm.cc (_Jv_MarkObj): Mark the protectionDomain of a class. + +2003-01-02 Mark Wielaard <mark@klomp.org> + + * java/net/HttpURLConnection.java (HTTP_NOT_IMPLEMENTED): Must be + public. + (HTTP_USE_PROXY): Add field. + (getResponseVals): Only set responseCode when not yet explicitly + set by subclass. + +2003-01-02 Artur Biesiadowski <abies@pg.gda.pl> + Mark Wielaard <mark@klomp.org> + + * java/util/zip/ZipFile.java (entries): Now HashMap. + (readLeShort(DataInput, byte[])): Read from given byte array. + (readLeInt(DataInput, byte[]): Likewise. + (readLeShort(byte[] b, int off)): New method. + (readLeInt(byte[] b, int off)): Likewise. + (readEntries): Use byte arrays to read info in bigger chunks. + (getEntries): Return HashMap. + (getEntry): Use HashMap. + (locBuf): New private field. + (checkLocalHeader): Use locBuf to read info in one chunk. + (getInputStream): Use entries HashMap, wrap PartialInputStream + in BufferedInputStream. + (ZipEntryEnumeration): Use HashMap and Interator. + +2003-01-02 Mark Wielaard <mark@klomp.org> + Jeroen Frijters <jeroen@sumatra.nl> + + * java/net/URLClassLoader.java (Resource.getCodeSource): + Fix check certs == null. + (getCanonicalFileURL): Removed method. + (JarURLLoader): Don't call removed method. + (FileURLLoader): Likewise. + (FileURLLoader.getResource): Don't canonicalize file name. + +2003-01-01 Tom Tromey <tromey@redhat.com> + + * Makefile.in: Rebuilt. + * Makefile.am (rmi_java_source_files): Added RMIClassLoaderSpi. + * java/awt/AlphaComposite.java, java/awt/BasicStroke.java, + java/awt/BufferCapabilities.java, java/awt/Button.java, + java/awt/CheckboxMenuItem.java, java/awt/Choice.java, + java/awt/Container.java, java/awt/Cursor.java, + java/awt/EventQueue.java, java/awt/FileDialog.java, + java/awt/Graphics2D.java, java/awt/Label.java, java/awt/Menu.java, + java/awt/MenuBar.java, java/awt/MenuComponent.java, + java/awt/PopupMenu.java, java/awt/ScrollPane.java, + java/awt/Scrollbar.java, java/awt/TextArea.java, + java/awt/TextField.java, java/awt/color/CMMException.java, + java/awt/color/ColorSpace.java, java/awt/color/ICC_Profile.java, + java/awt/color/ProfileDataException.java, + java/awt/datatransfer/Clipboard.java, + java/awt/datatransfer/DataFlavor.java, + java/awt/datatransfer/FlavorMap.java, + java/awt/datatransfer/SystemFlavorMap.java, + java/awt/dnd/DragGestureEvent.java, + java/awt/dnd/DragGestureRecognizer.java, + java/awt/dnd/DragSource.java, java/awt/dnd/DropTarget.java, + java/awt/event/WindowEvent.java, java/awt/geom/PathIterator.java, + java/awt/im/InputMethodHighlight.java, + java/io/PipedOutputStream.java, java/io/PipedWriter.java, + java/rmi/server/RMIClassLoader.java: Merged from Classpath. + + * gnu/awt/j2d/Graphics2DImpl.java (drawImage): Changed type of + `op' to BufferedImageOp. + +2002-12-31 Tom Tromey <tromey@redhat.com> + + Fix for PR libgcj/7416: + * javax/naming/InitialContext.java (init): Use + gnu.classpath.home.url. + * java/security/Security.java: Use new properties. + (loadProviders): Accept base url; use it. + * java/lang/System.java: Document gnu.classpath.vm.shortname, and + gnu.classpath.home.url. + (gnu.classpath.home.url): Define. + (gnu.classpath.vm.shortname): Likewise. + +2002-12-31 Tom Tromey <tromey@redhat.com> + Ranjit Mathew <rmathew@hotmail.com> + + Fix for PR libgcj/8997: + * java/lang/natObject.cc (spin): Use _Jv_platform_usleep. + Include platform.h. + * include/posix.h (_Jv_platform_usleep): New function. + * include/win32.h (_Jv_platform_usleep): New function. + +2002-12-29 Tom Tromey <tromey@redhat.com> + + * gcj/javaprims.h: Updated. + * scripts/classes.pl (scan): Removed stray semicolon. + +2002-12-30 Mark Wielaard <mark@klomp.org> + + * java/net/URLStreamHandler.java (toExternalForm): Ignore port + if zero or smaller. + +2002-12-30 Mark Wielaard <mark@klomp.org> + + * java/util/Properties (formatForOutput): Don't fall through to + default case after escaping character. + +2002-12-30 Mark Wielaard <mark@klomp.org> + + * java/lang/StringBuffer.java (getChars): Remove wrong dstOffset check + against count. + +2002-12-27 Mark Mitchell <mark@codesourcery.com> + + * boehm.cc: Remove stray semicolon. + * interpret.cc: Likewise. + * prims.cc: Likewise. + * verify.cc (_Jv_BytecodeVerifier::verify_fail): Move definition + earlier to ensure default arguments are processed. + * gcj/array.h (JArray): Add forward declaration. + (elements): Likewise. + * gcj/javaprim.h: Remove stray semicolons. + * include/bohm-gc.h: Likewise. + * include/jni.h: Likewise. + * include/jvm.h: Likewise. + * java/lang/Class.h (_Jv_GetArrayClass): Declare _Jv_NewArrayClass. + 2002-12-23 Jeff Sturm <jsturm@one-point.com> * exception.cc (PERSONALITY_FUNCTION): Clear least-significant-bit diff --git a/libjava/Makefile.am b/libjava/Makefile.am index cbacaf3f77f..afdb8253ae0 100644 --- a/libjava/Makefile.am +++ b/libjava/Makefile.am @@ -25,8 +25,11 @@ endif if XLIB_AWT cond_x_ltlibrary = libgcjx.la +## We require libstdc++-v3 to be in the same build tree. +xlib_includes = -I../libstdc++-v3/include -I../libstdc++-v3/include/$(target_alias) -I$(srcdir)/../libstdc++-v3/libsupc++ else cond_x_ltlibrary = +xlib_includes = endif toolexeclib_LTLIBRARIES = libgcj.la lib-org-xml-sax.la lib-org-w3c-dom.la $(cond_x_ltlibrary) @@ -107,10 +110,9 @@ JC1FLAGS = @LIBGCJ_JAVAFLAGS@ $(GCJFLAGS) LIBFFIINCS = @LIBFFIINCS@ INCLUDES = -I$(top_srcdir) -Iinclude -I$(top_srcdir)/include \ - $(GCINCS) $(THREADINCS) $(INCLTDL) \ + $(GCINCS) $(THREADINCS) $(INCLTDL) $(xlib_includes) \ $(GCC_UNWIND_INCLUDE) $(ZINCS) $(LIBFFIINCS) - ## ################################################################ ## @@ -1336,6 +1338,7 @@ java/rmi/server/LogStream.java \ java/rmi/server/ObjID.java \ java/rmi/server/Operation.java \ java/rmi/server/RMIClassLoader.java \ +java/rmi/server/RMIClassLoaderSpi.java \ java/rmi/server/RMIClientSocketFactory.java \ java/rmi/server/RMIFailureHandler.java \ java/rmi/server/RMIServerSocketFactory.java \ diff --git a/libjava/Makefile.in b/libjava/Makefile.in index 295fd893b4c..e771b4e5cb4 100644 --- a/libjava/Makefile.in +++ b/libjava/Makefile.in @@ -136,6 +136,8 @@ AUTOMAKE_OPTIONS = foreign @USE_LIBDIR_FALSE@toolexecdir = @USE_LIBDIR_FALSE@$(exec_prefix)/$(target_alias) @XLIB_AWT_TRUE@cond_x_ltlibrary = @XLIB_AWT_TRUE@libgcjx.la @XLIB_AWT_FALSE@cond_x_ltlibrary = +@XLIB_AWT_TRUE@xlib_includes = @XLIB_AWT_TRUE@-I../libstdc++-v3/include -I../libstdc++-v3/include/$(target_alias) -I$(srcdir)/../libstdc++-v3/libsupc++ +@XLIB_AWT_FALSE@xlib_includes = toolexeclib_LTLIBRARIES = libgcj.la lib-org-xml-sax.la lib-org-w3c-dom.la $(cond_x_ltlibrary) toolexeclib_DATA = libgcj.spec @@ -182,7 +184,7 @@ JC1FLAGS = @LIBGCJ_JAVAFLAGS@ $(GCJFLAGS) LIBFFIINCS = @LIBFFIINCS@ INCLUDES = -I$(top_srcdir) -Iinclude -I$(top_srcdir)/include \ - $(GCINCS) $(THREADINCS) $(INCLTDL) \ + $(GCINCS) $(THREADINCS) $(INCLTDL) $(xlib_includes) \ $(GCC_UNWIND_INCLUDE) $(ZINCS) $(LIBFFIINCS) @@ -1096,6 +1098,7 @@ java/rmi/server/LogStream.java \ java/rmi/server/ObjID.java \ java/rmi/server/Operation.java \ java/rmi/server/RMIClassLoader.java \ +java/rmi/server/RMIClassLoaderSpi.java \ java/rmi/server/RMIClientSocketFactory.java \ java/rmi/server/RMIFailureHandler.java \ java/rmi/server/RMIServerSocketFactory.java \ @@ -3164,6 +3167,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ .deps/java/rmi/server/LoaderHandler.P .deps/java/rmi/server/LogStream.P \ .deps/java/rmi/server/ObjID.P .deps/java/rmi/server/Operation.P \ .deps/java/rmi/server/RMIClassLoader.P \ +.deps/java/rmi/server/RMIClassLoaderSpi.P \ .deps/java/rmi/server/RMIClientSocketFactory.P \ .deps/java/rmi/server/RMIFailureHandler.P \ .deps/java/rmi/server/RMIServerSocketFactory.P \ diff --git a/libjava/boehm.cc b/libjava/boehm.cc index 90796f2ddf0..5006059dabd 100644 --- a/libjava/boehm.cc +++ b/libjava/boehm.cc @@ -203,6 +203,8 @@ _Jv_MarkObj (void *addr, void *msp, void *msl, void * /* env */) MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cBlabel); p = (ptr_t) c->arrayclass; MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cDlabel); + p = (ptr_t) c->protectionDomain; + MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cPlabel); #ifdef INTERPRETER if (_Jv_IsInterpretedClass (c)) diff --git a/libjava/configure b/libjava/configure index 0721b6ae196..353f4f2088a 100755 --- a/libjava/configure +++ b/libjava/configure @@ -1644,7 +1644,7 @@ else if { (eval echo configure:1645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in - *.$ac_ext | *.c | *.o | *.obj) ;; + *.c | *.o | *.obj) ;; *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; esac done @@ -2563,7 +2563,7 @@ if test -z "$CXXCPP"; then if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - ac_ext=C + ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' @@ -2589,15 +2589,18 @@ else fi rm -f conftest* ac_cv_prog_CXXCPP="$CXXCPP" -ac_ext=c + ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross + fi + CXXCPP="$ac_cv_prog_CXXCPP" +else + ac_cv_prog_CXXCPP=$CXXCPP fi -CXXCPP="$ac_cv_prog_CXXCPP" echo "$ac_t""$CXXCPP" 1>&6 @@ -2812,7 +2815,7 @@ INTERPRETER="$libgcj_interpreter" echo $ac_n "checking for exception model to use""... $ac_c" 1>&6 -echo "configure:2816: checking for exception model to use" >&5 +echo "configure:2819: checking for exception model to use" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -2827,7 +2830,7 @@ if test "${enable_sjlj_exceptions+set}" = set; then : else cat > conftest.$ac_ext << EOF -#line 2831 "configure" +#line 2834 "configure" struct S { ~S(); }; void bar(); void foo() @@ -2838,7 +2841,7 @@ void foo() EOF old_CXXFLAGS="$CXXFLAGS" CXXFLAGS=-S -if { (eval echo configure:2842: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2845: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then enable_sjlj_exceptions=yes elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then @@ -2946,7 +2949,30 @@ case "$TARGET_ECOS" in PLATFORM=Win32 PLATFORMOBJS=win32.lo PLATFORMH=win32.h - CHECK_FOR_BROKEN_MINGW_LD + +echo $ac_n "checking whether 'ld' is at least 2.13""... $ac_c" 1>&6 +echo "configure:2955: checking whether 'ld' is at least 2.13" >&5 +LD_PROG=`$CC --print-prog-name=ld` +LD_VERSION=`$LD_PROG --version` +LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 4` +LD_VERSION_MINOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 2` +if expr "$LD_VERSION_MAJOR" \> 2 > /dev/null; then + LD_OK="ok" +else + if expr "$LD_VERSION_MAJOR" = 2 && expr "$LD_VERSION_MINOR" \>= 13 > /dev/null; then + LD_OK="ok" + fi +fi +if test "x$LD_OK" != x; then + echo "$ac_t""yes; major=$LD_VERSION_MAJOR, minor=$LD_VERSION_MINOR" 1>&6 +else + echo "$ac_t""no; major=$LD_VERSION_MAJOR, minor=$LD_VERSION_MINOR" 1>&6 + echo "configure: warning: ld <2.13 detected; enabling JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS hack..." 1>&2 + cat >> confdefs.h <<\EOF +#define JV_LINKER_CANNOT_8BYTE_ALIGN_STATICS 1 +EOF + +fi ;; *) PLATFORM=Posix @@ -2969,7 +2995,7 @@ esac echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2973: checking how to run the C preprocessor" >&5 +echo "configure:2999: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2984,13 +3010,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 2988 "configure" +#line 3014 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2994: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3020: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -3001,13 +3027,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 3005 "configure" +#line 3031 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3011: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3037: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -3018,13 +3044,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 3022 "configure" +#line 3048 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3028: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3054: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -3049,7 +3075,7 @@ fi echo "$ac_t""$CPP" 1>&6 cat > conftest.$ac_ext <<EOF -#line 3053 "configure" +#line 3079 "configure" #include "confdefs.h" #include <stdint.h> EOF @@ -3064,7 +3090,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3068 "configure" +#line 3094 "configure" #include "confdefs.h" #include <inttypes.h> EOF @@ -3079,7 +3105,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3083 "configure" +#line 3109 "configure" #include "confdefs.h" #include <sys/types.h> EOF @@ -3094,7 +3120,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3098 "configure" +#line 3124 "configure" #include "confdefs.h" #include <sys/config.h> EOF @@ -3111,7 +3137,7 @@ rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3115 "configure" +#line 3141 "configure" #include "confdefs.h" #include <time.h> EOF @@ -3126,7 +3152,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3130 "configure" +#line 3156 "configure" #include "confdefs.h" #include <time.h> EOF @@ -3178,7 +3204,7 @@ ZLIBTESTSPEC= libsubdir=.libs echo $ac_n "checking for garbage collector to use""... $ac_c" 1>&6 -echo "configure:3182: checking for garbage collector to use" >&5 +echo "configure:3208: checking for garbage collector to use" >&5 # Check whether --enable-java-gc or --disable-java-gc was given. if test "${enable_java_gc+set}" = set; then enableval="$enable_java_gc" @@ -3231,7 +3257,7 @@ esac echo $ac_n "checking for thread model used by GCC""... $ac_c" 1>&6 -echo "configure:3235: checking for thread model used by GCC" >&5 +echo "configure:3261: checking for thread model used by GCC" >&5 THREADS=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` echo "$ac_t""$THREADS" 1>&6 @@ -3439,12 +3465,12 @@ else for ac_func in strerror ioctl select fstat open fsync sleep opendir do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3443: checking for $ac_func" >&5 +echo "configure:3469: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3448 "configure" +#line 3474 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3467,7 +3493,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3497: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3494,12 +3520,12 @@ done for ac_func in gmtime_r localtime_r readdir_r getpwuid_r getcwd do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3498: checking for $ac_func" >&5 +echo "configure:3524: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3503 "configure" +#line 3529 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3522,7 +3548,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3549,12 +3575,12 @@ done for ac_func in access stat mkdir rename rmdir unlink realpath utime chmod do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3553: checking for $ac_func" >&5 +echo "configure:3579: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3558 "configure" +#line 3584 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3577,7 +3603,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3581: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3607: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3604,12 +3630,12 @@ done for ac_func in nl_langinfo setlocale do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3608: checking for $ac_func" >&5 +echo "configure:3634: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3613 "configure" +#line 3639 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3632,7 +3658,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3659,12 +3685,12 @@ done for ac_func in inet_aton inet_addr do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3663: checking for $ac_func" >&5 +echo "configure:3689: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3668 "configure" +#line 3694 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3687,7 +3713,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3714,12 +3740,12 @@ done for ac_func in inet_pton uname inet_ntoa do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3718: checking for $ac_func" >&5 +echo "configure:3744: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3723 "configure" +#line 3749 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3742,7 +3768,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3769,12 +3795,12 @@ done for ac_func in fork execvp pipe sigaction ftruncate do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3773: checking for $ac_func" >&5 +echo "configure:3799: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3778 "configure" +#line 3804 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3797,7 +3823,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3825,17 +3851,17 @@ done do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3829: checking for $ac_hdr" >&5 +echo "configure:3855: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3834 "configure" +#line 3860 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3839: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3865: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3862,12 +3888,12 @@ fi done echo $ac_n "checking for backtrace""... $ac_c" 1>&6 -echo "configure:3866: checking for backtrace" >&5 +echo "configure:3892: checking for backtrace" >&5 if eval "test \"`echo '$''{'ac_cv_func_backtrace'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3871 "configure" +#line 3897 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char backtrace(); below. */ @@ -3890,7 +3916,7 @@ backtrace(); ; return 0; } EOF -if { (eval echo configure:3894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_backtrace=yes" else @@ -3926,7 +3952,7 @@ fi echo $ac_n "checking for dladdr in -ldl""... $ac_c" 1>&6 -echo "configure:3930: checking for dladdr in -ldl" >&5 +echo "configure:3956: checking for dladdr in -ldl" >&5 ac_lib_var=`echo dl'_'dladdr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3934,7 +3960,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3938 "configure" +#line 3964 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3945,7 +3971,7 @@ int main() { dladdr() ; return 0; } EOF -if { (eval echo configure:3949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3975,7 +4001,7 @@ do ac_safe=`echo "$ac_file" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_file""... $ac_c" 1>&6 -echo "configure:3979: checking for $ac_file" >&5 +echo "configure:4005: checking for $ac_file" >&5 if eval "test \"`echo '$''{'ac_cv_file_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4033,7 +4059,7 @@ fi echo $ac_n "checking for iconv""... $ac_c" 1>&6 -echo "configure:4037: checking for iconv" >&5 +echo "configure:4063: checking for iconv" >&5 if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4041,7 +4067,7 @@ else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat > conftest.$ac_ext <<EOF -#line 4045 "configure" +#line 4071 "configure" #include "confdefs.h" #include <stdlib.h> #include <iconv.h> @@ -4051,7 +4077,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:4055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_func_iconv=yes else @@ -4063,7 +4089,7 @@ rm -f conftest* am_save_LIBS="$LIBS" LIBS="$LIBS $am_cv_libiconv_ldpath -liconv" cat > conftest.$ac_ext <<EOF -#line 4067 "configure" +#line 4093 "configure" #include "confdefs.h" #include <stdlib.h> #include <iconv.h> @@ -4073,7 +4099,7 @@ iconv_t cd = iconv_open("",""); iconv_close(cd); ; return 0; } EOF -if { (eval echo configure:4077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4103: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_lib_iconv=yes am_cv_func_iconv=yes @@ -4094,13 +4120,13 @@ echo "$ac_t""$am_cv_func_iconv" 1>&6 EOF echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6 -echo "configure:4098: checking for iconv declaration" >&5 +echo "configure:4124: checking for iconv declaration" >&5 if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4104 "configure" +#line 4130 "configure" #include "confdefs.h" #include <stdlib.h> @@ -4119,7 +4145,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4123: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4149: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_proto_iconv_arg1="" else @@ -4148,19 +4174,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:4152: checking for LC_MESSAGES" >&5 +echo "configure:4178: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4157 "configure" +#line 4183 "configure" #include "confdefs.h" #include <locale.h> int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:4164: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -4181,12 +4207,12 @@ EOF fi fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:4185: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:4211: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4190 "configure" +#line 4216 "configure" #include "confdefs.h" #include <sys/types.h> #include <time.h> @@ -4194,7 +4220,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:4198: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -4215,12 +4241,12 @@ EOF fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:4219: checking for tm_zone in struct tm" >&5 +echo "configure:4245: checking for tm_zone in struct tm" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4224 "configure" +#line 4250 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_cv_struct_tm> @@ -4228,7 +4254,7 @@ int main() { struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:4232: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4258: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -4248,12 +4274,12 @@ EOF else echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:4252: checking for tzname" >&5 +echo "configure:4278: checking for tzname" >&5 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4257 "configure" +#line 4283 "configure" #include "confdefs.h" #include <time.h> #ifndef tzname /* For SGI. */ @@ -4263,7 +4289,7 @@ int main() { atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:4267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -4288,12 +4314,12 @@ fi for ac_func in gethostbyname_r do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4292: checking for $ac_func" >&5 +echo "configure:4318: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4297 "configure" +#line 4323 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4316,7 +4342,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4320: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4346: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4343,7 +4369,7 @@ EOF # We look for the one that returns `int'. # Hopefully this check is robust enough. cat > conftest.$ac_ext <<EOF -#line 4347 "configure" +#line 4373 "configure" #include "confdefs.h" #include <netdb.h> EOF @@ -4363,7 +4389,7 @@ rm -f conftest* *" -D_REENTRANT "*) ;; *) echo $ac_n "checking whether gethostbyname_r declaration requires -D_REENTRANT""... $ac_c" 1>&6 -echo "configure:4367: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5 +echo "configure:4393: checking whether gethostbyname_r declaration requires -D_REENTRANT" >&5 if eval "test \"`echo '$''{'libjava_cv_gethostbyname_r_needs_reentrant'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4376,14 +4402,14 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext <<EOF -#line 4380 "configure" +#line 4406 "configure" #include "confdefs.h" #include <netdb.h> int main() { gethostbyname_r("", 0, 0); ; return 0; } EOF -if { (eval echo configure:4387: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4413: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libjava_cv_gethostbyname_r_needs_reentrant=no else @@ -4393,14 +4419,14 @@ else CPPFLAGS_SAVE="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_REENTRANT" cat > conftest.$ac_ext <<EOF -#line 4397 "configure" +#line 4423 "configure" #include "confdefs.h" #include <netdb.h> int main() { gethostbyname_r("", 0, 0); ; return 0; } EOF -if { (eval echo configure:4404: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4430: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libjava_cv_gethostbyname_r_needs_reentrant=yes else @@ -4435,12 +4461,12 @@ EOF esac echo $ac_n "checking for struct hostent_data""... $ac_c" 1>&6 -echo "configure:4439: checking for struct hostent_data" >&5 +echo "configure:4465: checking for struct hostent_data" >&5 if eval "test \"`echo '$''{'libjava_cv_struct_hostent_data'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4444 "configure" +#line 4470 "configure" #include "confdefs.h" #if GETHOSTBYNAME_R_NEEDS_REENTRANT && !defined(_REENTRANT) @@ -4451,7 +4477,7 @@ int main() { struct hostent_data data; ; return 0; } EOF -if { (eval echo configure:4455: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4481: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* libjava_cv_struct_hostent_data=yes else @@ -4483,7 +4509,7 @@ done # to exist where expected. (The root issue: AC_CHECK_FUNCS assumes C # linkage check is enough, yet C++ code requires proper prototypes.) cat > conftest.$ac_ext <<EOF -#line 4487 "configure" +#line 4513 "configure" #include "confdefs.h" #include <netdb.h> EOF @@ -4494,12 +4520,12 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | for ac_func in gethostbyaddr_r do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4498: checking for $ac_func" >&5 +echo "configure:4524: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4503 "configure" +#line 4529 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4522,7 +4548,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4549,7 +4575,7 @@ EOF # We look for the one that returns `int'. # Hopefully this check is robust enough. cat > conftest.$ac_ext <<EOF -#line 4553 "configure" +#line 4579 "configure" #include "confdefs.h" #include <netdb.h> EOF @@ -4576,12 +4602,12 @@ rm -f conftest* for ac_func in gethostname do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4580: checking for $ac_func" >&5 +echo "configure:4606: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4585 "configure" +#line 4611 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4604,7 +4630,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4628,7 +4654,7 @@ EOF EOF cat > conftest.$ac_ext <<EOF -#line 4632 "configure" +#line 4658 "configure" #include "confdefs.h" #include <unistd.h> EOF @@ -4659,12 +4685,12 @@ done for ac_func in pthread_mutexattr_settype pthread_mutexattr_setkind_np do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4663: checking for $ac_func" >&5 +echo "configure:4689: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4668 "configure" +#line 4694 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4687,7 +4713,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4717,12 +4743,12 @@ done for ac_func in sched_yield do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4721: checking for $ac_func" >&5 +echo "configure:4747: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4726 "configure" +#line 4752 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4745,7 +4771,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4775: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4767,7 +4793,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6 -echo "configure:4771: checking for sched_yield in -lrt" >&5 +echo "configure:4797: checking for sched_yield in -lrt" >&5 ac_lib_var=`echo rt'_'sched_yield | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4775,7 +4801,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lrt $LIBS" cat > conftest.$ac_ext <<EOF -#line 4779 "configure" +#line 4805 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4786,7 +4812,7 @@ int main() { sched_yield() ; return 0; } EOF -if { (eval echo configure:4790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4812,7 +4838,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6 -echo "configure:4816: checking for sched_yield in -lposix4" >&5 +echo "configure:4842: checking for sched_yield in -lposix4" >&5 ac_lib_var=`echo posix4'_'sched_yield | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4820,7 +4846,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix4 $LIBS" cat > conftest.$ac_ext <<EOF -#line 4824 "configure" +#line 4850 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -4831,7 +4857,7 @@ int main() { sched_yield() ; return 0; } EOF -if { (eval echo configure:4835: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4867,7 +4893,7 @@ done # We can save a little space at runtime if the mutex has m_count # or __m_count. This is a nice hack for Linux. cat > conftest.$ac_ext <<EOF -#line 4871 "configure" +#line 4897 "configure" #include "confdefs.h" #include <pthread.h> int main() { @@ -4876,7 +4902,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4880: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4906: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define PTHREAD_MUTEX_HAVE_M_COUNT 1 @@ -4888,7 +4914,7 @@ else rm -rf conftest* cat > conftest.$ac_ext <<EOF -#line 4892 "configure" +#line 4918 "configure" #include "confdefs.h" #include <pthread.h> int main() { @@ -4897,7 +4923,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4901: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4927: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define PTHREAD_MUTEX_HAVE___M_COUNT 1 @@ -4917,12 +4943,12 @@ rm -f conftest* for ac_func in gettimeofday time ftime do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4921: checking for $ac_func" >&5 +echo "configure:4947: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4926 "configure" +#line 4952 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -4945,7 +4971,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:4949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4976,12 +5002,12 @@ done for ac_func in memmove do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4980: checking for $ac_func" >&5 +echo "configure:5006: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 4985 "configure" +#line 5011 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5004,7 +5030,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5008: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5034,12 +5060,12 @@ done for ac_func in memcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5038: checking for $ac_func" >&5 +echo "configure:5064: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5043 "configure" +#line 5069 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5062,7 +5088,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -5091,7 +5117,7 @@ done fi echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:5095: checking for dlopen in -ldl" >&5 +echo "configure:5121: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5099,7 +5125,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 5103 "configure" +#line 5129 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -5110,7 +5136,7 @@ int main() { dlopen() ; return 0; } EOF -if { (eval echo configure:5114: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5155,7 +5181,7 @@ fi #-------------------------------------------------------------------- echo $ac_n "checking for socket libraries""... $ac_c" 1>&6 -echo "configure:5159: checking for socket libraries" >&5 +echo "configure:5185: checking for socket libraries" >&5 if eval "test \"`echo '$''{'gcj_cv_lib_sockets'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5163,12 +5189,12 @@ else gcj_checkBoth=0 unset ac_cv_func_connect echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:5167: checking for connect" >&5 +echo "configure:5193: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5172 "configure" +#line 5198 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect(); below. */ @@ -5191,7 +5217,7 @@ connect(); ; return 0; } EOF -if { (eval echo configure:5195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5221: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -5214,7 +5240,7 @@ fi if test "$gcj_checkSocket" = 1; then unset ac_cv_func_connect echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6 -echo "configure:5218: checking for main in -lsocket" >&5 +echo "configure:5244: checking for main in -lsocket" >&5 ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5222,14 +5248,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <<EOF -#line 5226 "configure" +#line 5252 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:5233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5256,12 +5282,12 @@ fi LIBS="$LIBS -lsocket -lnsl" unset ac_cv_func_accept echo $ac_n "checking for accept""... $ac_c" 1>&6 -echo "configure:5260: checking for accept" >&5 +echo "configure:5286: checking for accept" >&5 if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5265 "configure" +#line 5291 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char accept(); below. */ @@ -5284,7 +5310,7 @@ accept(); ; return 0; } EOF -if { (eval echo configure:5288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_accept=yes" else @@ -5311,12 +5337,12 @@ fi gcj_oldLibs=$LIBS LIBS="$LIBS $gcj_cv_lib_sockets" echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:5315: checking for gethostbyname" >&5 +echo "configure:5341: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5320 "configure" +#line 5346 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname(); below. */ @@ -5339,7 +5365,7 @@ gethostbyname(); ; return 0; } EOF -if { (eval echo configure:5343: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -5357,7 +5383,7 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6 -echo "configure:5361: checking for main in -lnsl" >&5 +echo "configure:5387: checking for main in -lnsl" >&5 ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5365,14 +5391,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <<EOF -#line 5369 "configure" +#line 5395 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:5376: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5402: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5404,7 +5430,7 @@ echo "$ac_t""$gcj_cv_lib_sockets" 1>&6 if test "$with_system_zlib" = yes; then echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6 -echo "configure:5408: checking for deflate in -lz" >&5 +echo "configure:5434: checking for deflate in -lz" >&5 ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5412,7 +5438,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" cat > conftest.$ac_ext <<EOF -#line 5416 "configure" +#line 5442 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -5423,7 +5449,7 @@ int main() { deflate() ; return 0; } EOF -if { (eval echo configure:5427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5450,7 +5476,7 @@ fi # requires -ldl. if test "$GC" = boehm; then echo $ac_n "checking for main in -ldl""... $ac_c" 1>&6 -echo "configure:5454: checking for main in -ldl" >&5 +echo "configure:5480: checking for main in -ldl" >&5 ac_lib_var=`echo dl'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -5458,14 +5484,14 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 5462 "configure" +#line 5488 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:5469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5531,7 +5557,7 @@ fi # Extract the first word of "${ac_tool_prefix}gcj", so it can be a program name with args. set dummy ${ac_tool_prefix}gcj; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5535: checking for $ac_word" >&5 +echo "configure:5561: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCJ'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5563,7 +5589,7 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "gcj", so it can be a program name with args. set dummy gcj; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:5567: checking for $ac_word" >&5 +echo "configure:5593: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GCJ'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -5625,13 +5651,13 @@ exec 5>>./config.log CPPFLAGS=$GCJ_SAVE_CPPFLAGS echo $ac_n "checking size of void *""... $ac_c" 1>&6 -echo "configure:5629: checking size of void *" >&5 +echo "configure:5655: checking size of void *" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_void_p'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else for ac_size in 4 8 1 2 16 12 ; do # List sizes in rough order of prevalence. cat > conftest.$ac_ext <<EOF -#line 5635 "configure" +#line 5661 "configure" #include "confdefs.h" #include "confdefs.h" #include <sys/types.h> @@ -5641,7 +5667,7 @@ int main() { switch (0) case 0: case (sizeof (void *) == $ac_size):; ; return 0; } EOF -if { (eval echo configure:5645: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5671: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sizeof_void_p=$ac_size else @@ -5742,18 +5768,18 @@ EOF echo $ac_n "checking for g++ -ffloat-store bug""... $ac_c" 1>&6 -echo "configure:5746: checking for g++ -ffloat-store bug" >&5 +echo "configure:5772: checking for g++ -ffloat-store bug" >&5 save_CFLAGS="$CFLAGS" CFLAGS="-x c++ -O2 -ffloat-store" cat > conftest.$ac_ext <<EOF -#line 5750 "configure" +#line 5776 "configure" #include "confdefs.h" #include <math.h> int main() { ; return 0; } EOF -if { (eval echo configure:5757: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5783: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""no" 1>&6 else @@ -5773,17 +5799,17 @@ for ac_hdr in unistd.h bstring.h sys/time.h sys/types.h fcntl.h sys/ioctl.h sys/ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5777: checking for $ac_hdr" >&5 +echo "configure:5803: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5782 "configure" +#line 5808 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5787: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5813: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5813,17 +5839,17 @@ for ac_hdr in dirent.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5817: checking for $ac_hdr" >&5 +echo "configure:5843: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5822 "configure" +#line 5848 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5827: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5853: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5853,17 +5879,17 @@ for ac_hdr in inttypes.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5857: checking for $ac_hdr" >&5 +echo "configure:5883: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5862 "configure" +#line 5888 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5867: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5893: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5899,12 +5925,12 @@ fi done echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:5903: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:5929: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5908 "configure" +#line 5934 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/wait.h> @@ -5920,7 +5946,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:5924: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5950: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -5942,12 +5968,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:5946: checking for ANSI C header files" >&5 +echo "configure:5972: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 5951 "configure" +#line 5977 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -5955,7 +5981,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5959: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5985: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5972,7 +5998,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 5976 "configure" +#line 6002 "configure" #include "confdefs.h" #include <string.h> EOF @@ -5990,7 +6016,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 5994 "configure" +#line 6020 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -6011,7 +6037,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 6015 "configure" +#line 6041 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -6022,7 +6048,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:6026: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6052: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -6046,12 +6072,12 @@ EOF fi echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 -echo "configure:6050: checking for ssize_t" >&5 +echo "configure:6076: checking for ssize_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6055 "configure" +#line 6081 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -6080,9 +6106,9 @@ fi echo $ac_n "checking for in_addr_t""... $ac_c" 1>&6 -echo "configure:6084: checking for in_addr_t" >&5 +echo "configure:6110: checking for in_addr_t" >&5 cat > conftest.$ac_ext <<EOF -#line 6086 "configure" +#line 6112 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -6096,7 +6122,7 @@ int main() { in_addr_t foo; ; return 0; } EOF -if { (eval echo configure:6100: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6126: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_IN_ADDR_T 1 @@ -6112,16 +6138,16 @@ fi rm -f conftest* echo $ac_n "checking whether struct ip_mreq is in netinet/in.h""... $ac_c" 1>&6 -echo "configure:6116: checking whether struct ip_mreq is in netinet/in.h" >&5 +echo "configure:6142: checking whether struct ip_mreq is in netinet/in.h" >&5 cat > conftest.$ac_ext <<EOF -#line 6118 "configure" +#line 6144 "configure" #include "confdefs.h" #include <netinet/in.h> int main() { struct ip_mreq mreq; ; return 0; } EOF -if { (eval echo configure:6125: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6151: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_STRUCT_IP_MREQ 1 @@ -6137,16 +6163,16 @@ fi rm -f conftest* echo $ac_n "checking whether struct ipv6_mreq is in netinet/in.h""... $ac_c" 1>&6 -echo "configure:6141: checking whether struct ipv6_mreq is in netinet/in.h" >&5 +echo "configure:6167: checking whether struct ipv6_mreq is in netinet/in.h" >&5 cat > conftest.$ac_ext <<EOF -#line 6143 "configure" +#line 6169 "configure" #include "confdefs.h" #include <netinet/in.h> int main() { struct ipv6_mreq mreq6; ; return 0; } EOF -if { (eval echo configure:6150: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6176: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_STRUCT_IPV6_MREQ 1 @@ -6162,16 +6188,16 @@ fi rm -f conftest* echo $ac_n "checking whether struct sockaddr_in6 is in netinet/in.h""... $ac_c" 1>&6 -echo "configure:6166: checking whether struct sockaddr_in6 is in netinet/in.h" >&5 +echo "configure:6192: checking whether struct sockaddr_in6 is in netinet/in.h" >&5 cat > conftest.$ac_ext <<EOF -#line 6168 "configure" +#line 6194 "configure" #include "confdefs.h" #include <netinet/in.h> int main() { struct sockaddr_in6 addr6; ; return 0; } EOF -if { (eval echo configure:6175: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6201: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_INET6 1 @@ -6187,9 +6213,9 @@ fi rm -f conftest* echo $ac_n "checking for socklen_t in sys/socket.h""... $ac_c" 1>&6 -echo "configure:6191: checking for socklen_t in sys/socket.h" >&5 +echo "configure:6217: checking for socklen_t in sys/socket.h" >&5 cat > conftest.$ac_ext <<EOF -#line 6193 "configure" +#line 6219 "configure" #include "confdefs.h" #define _POSIX_PII_SOCKET #include <sys/types.h> @@ -6198,7 +6224,7 @@ int main() { socklen_t x = 5; ; return 0; } EOF -if { (eval echo configure:6202: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6228: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_SOCKLEN_T 1 @@ -6214,16 +6240,16 @@ fi rm -f conftest* echo $ac_n "checking for tm_gmtoff in struct tm""... $ac_c" 1>&6 -echo "configure:6218: checking for tm_gmtoff in struct tm" >&5 +echo "configure:6244: checking for tm_gmtoff in struct tm" >&5 cat > conftest.$ac_ext <<EOF -#line 6220 "configure" +#line 6246 "configure" #include "confdefs.h" #include <time.h> int main() { struct tm tim; tim.tm_gmtoff = 0; ; return 0; } EOF -if { (eval echo configure:6227: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6253: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define STRUCT_TM_HAS_GMTOFF 1 @@ -6236,16 +6262,16 @@ else rm -rf conftest* echo "$ac_t""no" 1>&6 echo $ac_n "checking for global timezone variable""... $ac_c" 1>&6 -echo "configure:6240: checking for global timezone variable" >&5 +echo "configure:6266: checking for global timezone variable" >&5 cat > conftest.$ac_ext <<EOF -#line 6242 "configure" +#line 6268 "configure" #include "confdefs.h" #include <time.h> int main() { void i(){long z2 = 2*timezone;} ; return 0; } EOF -if { (eval echo configure:6249: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6275: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_TIMEZONE 1 @@ -6258,16 +6284,16 @@ else rm -rf conftest* echo "$ac_t""no" 1>&6 echo $ac_n "checking for global _timezone variable""... $ac_c" 1>&6 -echo "configure:6262: checking for global _timezone variable" >&5 +echo "configure:6288: checking for global _timezone variable" >&5 cat > conftest.$ac_ext <<EOF -#line 6264 "configure" +#line 6290 "configure" #include "confdefs.h" #include <time.h> int main() { long z2 = _timezone; ; return 0; } EOF -if { (eval echo configure:6271: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:6297: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_UNDERSCORE_TIMEZONE 1 @@ -6289,19 +6315,19 @@ rm -f conftest* # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:6293: checking for working alloca.h" >&5 +echo "configure:6319: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6298 "configure" +#line 6324 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:6305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -6322,12 +6348,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:6326: checking for alloca" >&5 +echo "configure:6352: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6331 "configure" +#line 6357 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -6355,7 +6381,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:6359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -6387,12 +6413,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:6391: checking whether alloca needs Cray hooks" >&5 +echo "configure:6417: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6396 "configure" +#line 6422 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -6417,12 +6443,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:6421: checking for $ac_func" >&5 +echo "configure:6447: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6426 "configure" +#line 6452 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -6445,7 +6471,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:6449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -6472,7 +6498,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:6476: checking stack direction for C alloca" >&5 +echo "configure:6502: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6480,7 +6506,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 6484 "configure" +#line 6510 "configure" #include "confdefs.h" find_stack_direction () { @@ -6499,7 +6525,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:6503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -6526,7 +6552,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6530: checking for $ac_word" >&5 +echo "configure:6556: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -6583,14 +6609,11 @@ case "${host}" in SIGNAL_HANDLER=include/s390-signal.h ;; x86_64*-*-linux*) - SIGNAL_HANDLER=include/dwarf2-signal.h + SIGNAL_HANDLER=include/x86_64-signal.h ;; sparc*-*-linux*) SIGNAL_HANDLER=include/dwarf2-signal.h ;; - sh-*-linux* | sh[34]*-*-linux*) - SIGNAL_HANDLER=include/dwarf2-signal.h - ;; *mingw*) SIGNAL_HANDLER=include/win32-signal.h ;; @@ -6619,7 +6642,7 @@ fi # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:6623: checking for X" >&5 +echo "configure:6646: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -6681,12 +6704,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext <<EOF -#line 6685 "configure" +#line 6708 "configure" #include "confdefs.h" #include <$x_direct_test_include> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6690: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6713: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6755,14 +6778,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <<EOF -#line 6759 "configure" +#line 6782 "configure" #include "confdefs.h" int main() { ${x_direct_test_function}() ; return 0; } EOF -if { (eval echo configure:6766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6789: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -6868,17 +6891,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:6872: checking whether -R must be followed by a space" >&5 +echo "configure:6895: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <<EOF -#line 6875 "configure" +#line 6898 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:6882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -6894,14 +6917,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <<EOF -#line 6898 "configure" +#line 6921 "configure" #include "confdefs.h" int main() { ; return 0; } EOF -if { (eval echo configure:6905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6928: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -6933,7 +6956,7 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:6937: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:6960: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6941,7 +6964,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <<EOF -#line 6945 "configure" +#line 6968 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -6952,7 +6975,7 @@ int main() { dnet_ntoa() ; return 0; } EOF -if { (eval echo configure:6956: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6974,7 +6997,7 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:6978: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:7001: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -6982,7 +7005,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <<EOF -#line 6986 "configure" +#line 7009 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -6993,7 +7016,7 @@ int main() { dnet_ntoa() ; return 0; } EOF -if { (eval echo configure:6997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7022,12 +7045,12 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:7026: checking for gethostbyname" >&5 +echo "configure:7049: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7031 "configure" +#line 7054 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname(); below. */ @@ -7050,7 +7073,7 @@ gethostbyname(); ; return 0; } EOF -if { (eval echo configure:7054: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -7071,7 +7094,7 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:7075: checking for gethostbyname in -lnsl" >&5 +echo "configure:7098: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7079,7 +7102,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <<EOF -#line 7083 "configure" +#line 7106 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7090,7 +7113,7 @@ int main() { gethostbyname() ; return 0; } EOF -if { (eval echo configure:7094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7120,12 +7143,12 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:7124: checking for connect" >&5 +echo "configure:7147: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7129 "configure" +#line 7152 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect(); below. */ @@ -7148,7 +7171,7 @@ connect(); ; return 0; } EOF -if { (eval echo configure:7152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7175: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -7169,7 +7192,7 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:7173: checking for connect in -lsocket" >&5 +echo "configure:7196: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7177,7 +7200,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 7181 "configure" +#line 7204 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7188,7 +7211,7 @@ int main() { connect() ; return 0; } EOF -if { (eval echo configure:7192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7212,12 +7235,12 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:7216: checking for remove" >&5 +echo "configure:7239: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7221 "configure" +#line 7244 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char remove(); below. */ @@ -7240,7 +7263,7 @@ remove(); ; return 0; } EOF -if { (eval echo configure:7244: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -7261,7 +7284,7 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:7265: checking for remove in -lposix" >&5 +echo "configure:7288: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7269,7 +7292,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <<EOF -#line 7273 "configure" +#line 7296 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7280,7 +7303,7 @@ int main() { remove() ; return 0; } EOF -if { (eval echo configure:7284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7307: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7304,12 +7327,12 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:7308: checking for shmat" >&5 +echo "configure:7331: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 7313 "configure" +#line 7336 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shmat(); below. */ @@ -7332,7 +7355,7 @@ shmat(); ; return 0; } EOF -if { (eval echo configure:7336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -7353,7 +7376,7 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:7357: checking for shmat in -lipc" >&5 +echo "configure:7380: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7361,7 +7384,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <<EOF -#line 7365 "configure" +#line 7388 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7372,7 +7395,7 @@ int main() { shmat() ; return 0; } EOF -if { (eval echo configure:7376: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7405,7 +7428,7 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:7409: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:7432: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -7413,7 +7436,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <<EOF -#line 7417 "configure" +#line 7440 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -7424,7 +7447,7 @@ int main() { IceConnectionNumber() ; return 0; } EOF -if { (eval echo configure:7428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else diff --git a/libjava/configure.host b/libjava/configure.host index 8f3f3bb9ad2..40e4e38590a 100644 --- a/libjava/configure.host +++ b/libjava/configure.host @@ -101,7 +101,6 @@ case "${host}" in libgcj_interpreter=no libgcj_cxxflags="-D__NO_MATH_INLINES" libgcj_cflags="-D__NO_MATH_INLINES" - DIVIDESPEC=-fno-use-divide-subroutine enable_hash_synchronization_default=yes slow_pthread_self=yes ;; @@ -132,7 +131,8 @@ case "${host}" in libgcj_interpreter=yes enable_hash_synchronization_default=yes ;; - sparc-*) + sparc*-*) + libgcj_interpreter=yes ;; ia64-*) sysdeps_dir=ia64 diff --git a/libjava/configure.in b/libjava/configure.in index 868dc1cffde..5592400cf58 100644 --- a/libjava/configure.in +++ b/libjava/configure.in @@ -916,7 +916,7 @@ case "${host}" in SIGNAL_HANDLER=include/s390-signal.h ;; x86_64*-*-linux*) - SIGNAL_HANDLER=include/dwarf2-signal.h + SIGNAL_HANDLER=include/x86_64-signal.h ;; sparc*-*-linux*) SIGNAL_HANDLER=include/dwarf2-signal.h diff --git a/libjava/gcj/array.h b/libjava/gcj/array.h index db58ddfbdf8..33ea038df93 100644 --- a/libjava/gcj/array.h +++ b/libjava/gcj/array.h @@ -1,6 +1,6 @@ // array.h - Header file for CNI arrays. -*- c++ -*- -/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation This file is part of libgcj. @@ -30,6 +30,14 @@ public: }; template<class T> +class JArray; + +template<class T> +inline T* elements(JArray<T>& x); +template<class T> +inline T* elements(JArray<T>* x); + +template<class T> class JArray : public __JArray { T data[0]; @@ -45,7 +53,7 @@ inline T* elements(JArray<T>& x) { return x.data; } template<class T> inline T* elements(JArray<T>* x) { return x->data; } -}; // end extern "Java" +} // end extern "Java" /* These typesdefs match those in JNI. */ typedef __JArray *jarray; diff --git a/libjava/gcj/javaprims.h b/libjava/gcj/javaprims.h index 8ed649432a2..99b2fc1b153 100644 --- a/libjava/gcj/javaprims.h +++ b/libjava/gcj/javaprims.h @@ -123,7 +123,7 @@ extern "Java" class ValidatorAndPriority; class WriteAbortedException; class Writer; - }; + } namespace lang { @@ -222,7 +222,7 @@ extern "Java" class ReferenceQueue; class SoftReference; class WeakReference; - }; + } namespace reflect { @@ -230,18 +230,20 @@ extern "Java" class Array; class Constructor; class Field; - class InvocationHandler; + class InvocationHandler; class InvocationTargetException; class Member; class Method; class Modifier; - class Proxy; - class Proxy$ProxyData; - class Proxy$ProxyType; + class Proxy; + class Proxy$ClassFactory; + class Proxy$ProxyData; + class Proxy$ProxySignature; + class Proxy$ProxyType; class ReflectPermission; - class UndeclaredThrowableException; - }; - }; + class UndeclaredThrowableException; + } + } namespace util { @@ -334,7 +336,6 @@ extern "Java" class RandomAccess; class RandomAccessSubList; class ResourceBundle; - class ResourceBundle$Security; class Set; class SimpleTimeZone; class SortedMap; @@ -369,7 +370,14 @@ extern "Java" class JarInputStream; class JarOutputStream; class Manifest; - }; + } + + namespace regex + { + class Matcher; + class Pattern; + class PatternSyntaxException; + } namespace zip { @@ -393,10 +401,10 @@ extern "Java" class ZipFile$ZipEntryEnumeration; class ZipInputStream; class ZipOutputStream; - }; - }; - }; -}; + } + } + } +} typedef struct java::lang::Object* jobject; typedef class java::lang::Class* jclass; diff --git a/libjava/gnu/awt/j2d/DirectRasterGraphics.java b/libjava/gnu/awt/j2d/DirectRasterGraphics.java index 8d25b88d018..28aad9b0404 100644 --- a/libjava/gnu/awt/j2d/DirectRasterGraphics.java +++ b/libjava/gnu/awt/j2d/DirectRasterGraphics.java @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 Free Software Foundation +/* Copyright (C) 2000, 2003 Free Software Foundation This file is part of libgcj. @@ -61,7 +61,8 @@ public interface DirectRasterGraphics extends Cloneable public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints); - public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints); + public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints, + int translateX, int translateY); public void drawString(String str, int x, int y); diff --git a/libjava/gnu/awt/j2d/Graphics2DImpl.java b/libjava/gnu/awt/j2d/Graphics2DImpl.java index ef4d742c056..5af41bfc9cb 100644 --- a/libjava/gnu/awt/j2d/Graphics2DImpl.java +++ b/libjava/gnu/awt/j2d/Graphics2DImpl.java @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2002 Free Software Foundation +/* Copyright (C) 2000, 2002, 2003 Free Software Foundation This file is part of libgcj. @@ -24,6 +24,7 @@ import java.awt.Stroke; import java.awt.geom.AffineTransform; import java.awt.image.ImageObserver; import java.awt.image.BufferedImage; +import java.awt.image.BufferedImageOp; import java.awt.image.RenderedImage; import java.awt.image.renderable.RenderableImage; import java.text.AttributedCharacterIterator; @@ -459,7 +460,7 @@ public class Graphics2DImpl extends Graphics2D implements Cloneable throw new UnsupportedOperationException(msg); } - public void drawImage(BufferedImage image, BufferedImage op, int x, int y) + public void drawImage(BufferedImage image, BufferedImageOp op, int x, int y) { throw new UnsupportedOperationException("not implemented yet"); } diff --git a/libjava/gnu/awt/j2d/IntegerGraphicsState.java b/libjava/gnu/awt/j2d/IntegerGraphicsState.java index 90a1a4d2ab5..bfea6611ca5 100644 --- a/libjava/gnu/awt/j2d/IntegerGraphicsState.java +++ b/libjava/gnu/awt/j2d/IntegerGraphicsState.java @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 Free Software Foundation +/* Copyright (C) 2000, 2003 Free Software Foundation This file is part of libgcj. @@ -212,7 +212,7 @@ public class IntegerGraphicsState extends AbstractGraphicsState public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) { - if ((tx == 0) || (ty == 0)) + if ((tx == 0) && (ty == 0)) { directGfx.drawPolyline(xPoints, yPoints, nPoints); return; @@ -223,7 +223,7 @@ public class IntegerGraphicsState extends AbstractGraphicsState public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) { - if ((tx == 0) || (ty == 0)) + if ((tx == 0) && (ty == 0)) { directGfx.drawPolygon(xPoints, yPoints, nPoints); return; @@ -232,15 +232,11 @@ public class IntegerGraphicsState extends AbstractGraphicsState throw new UnsupportedOperationException("translate not implemented"); } - public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) + public void fillPolygon (int[] xPoints, int[] yPoints, int nPoints) { - if ((tx == 0) || (ty == 0)) - { - directGfx.fillPolygon(xPoints, yPoints, nPoints); - return; - } - - throw new UnsupportedOperationException("translate not implemented"); + // FIXME: remove tx & ty args once translation via AffineTransform + // is implemented. + directGfx.fillPolygon (xPoints, yPoints, nPoints, tx, ty); } public boolean drawImage(Image image, int x, int y, diff --git a/libjava/gnu/awt/xlib/XGraphics.java b/libjava/gnu/awt/xlib/XGraphics.java index 27b07a2369a..90f53880e85 100644 --- a/libjava/gnu/awt/xlib/XGraphics.java +++ b/libjava/gnu/awt/xlib/XGraphics.java @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 Free Software Foundation +/* Copyright (C) 2000, 2003 Free Software Foundation This file is part of libgcj. @@ -176,10 +176,10 @@ public class XGraphics implements Cloneable, DirectRasterGraphics throw new UnsupportedOperationException("not implemented"); } - public void fillPolygon(int[] xPoints, int[] yPoints, int - nPoints) + public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints, + int translateX, int translateY) { - throw new UnsupportedOperationException("not implemented"); + context.fillPolygon(xPoints, yPoints, nPoints, translateX, translateY); } public void drawString(String str, int x, int y) diff --git a/libjava/gnu/awt/xlib/XGraphicsConfiguration.java b/libjava/gnu/awt/xlib/XGraphicsConfiguration.java index 9ae12d6f8b9..7d7d5159fe0 100644 --- a/libjava/gnu/awt/xlib/XGraphicsConfiguration.java +++ b/libjava/gnu/awt/xlib/XGraphicsConfiguration.java @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 Free Software Foundation +/* Copyright (C) 2000, 2003 Free Software Foundation This file is part of libgcj. @@ -389,15 +389,32 @@ public class XGraphicsConfiguration extends GraphicsConfiguration int getPixel(Color color) { + /* FIXME: consider an integer technique whenever + * the ColorModel is 8 bits per color. + * The problem with using integers is that it doesn't work unless + * the colors are 8 bits each (as in the array), since ColorModel.getDataElement(int[],int) + * expects non-normalized values. For example, in a 16-bit display mode, you + * would typically have 5 bits each for red and blue, and 6 bits for green. int[] components = - { - color.getRed(), - color.getGreen(), - color.getBlue(), - 0xff - }; - - ColorModel cm = getColorModel(); - return cm.getDataElement(components, 0); + { + color.getRed (), + color.getGreen (), + color.getBlue (), + 0xff + }; + */ + + float[] normalizedComponents = + { + ((float)color.getRed ()) / 255F, + ((float)color.getGreen ()) / 255F, + ((float)color.getBlue ()) / 255F, + 1 + }; + int[] unnormalizedComponents = { 0, 0, 0, 0xff }; + ColorModel cm = getColorModel (); + cm.getUnnormalizedComponents(normalizedComponents, 0, + unnormalizedComponents, 0); + return cm.getDataElement (unnormalizedComponents, 0); } } diff --git a/libjava/gnu/awt/xlib/XToolkit.java b/libjava/gnu/awt/xlib/XToolkit.java index 0c199b2b7f7..c71b39d0f80 100644 --- a/libjava/gnu/awt/xlib/XToolkit.java +++ b/libjava/gnu/awt/xlib/XToolkit.java @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2002 Free Software Foundation +/* Copyright (C) 2000, 2002, 2003 Free Software Foundation This file is part of libgcj. @@ -173,7 +173,7 @@ public class XToolkit extends Toolkit public java.awt.image.ColorModel getColorModel() { - throw new UnsupportedOperationException("not implemented yet"); + return getDefaultXGraphicsConfiguration().getColorModel(); } public String[] getFontList() diff --git a/libjava/gnu/gcj/protocol/http/Connection.java b/libjava/gnu/gcj/protocol/http/Connection.java index caababa6823..1a6fc0105f9 100644 --- a/libjava/gnu/gcj/protocol/http/Connection.java +++ b/libjava/gnu/gcj/protocol/http/Connection.java @@ -1,6 +1,6 @@ // Connection.java - Implementation of HttpURLConnection for http protocol. -/* Copyright (C) 1999, 2000 Free Software Foundation +/* Copyright (C) 1999, 2000, 2003 Free Software Foundation This file is part of libgcj. @@ -25,10 +25,11 @@ import java.util.Enumeration; /** * Written using on-line Java Platform 1.2 API Specification, as well * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998). - * Status: Minimal subset of functionality. Proxies and Redirects - * not yet handled. FileNameMap handling needs to be considered. - * useCaches, ifModifiedSince, and allowUserInteraction need - * consideration as well as doInput and doOutput. + * Status: Minimal subset of functionality. Proxies only partially + * handled; Redirects not yet handled. FileNameMap handling needs to + * be considered. useCaches, ifModifiedSince, and + * allowUserInteraction need consideration as well as doInput and + * doOutput. */ class Connection extends HttpURLConnection @@ -40,6 +41,33 @@ class Connection extends HttpURLConnection private Vector hdrVec = new Vector(); private BufferedInputStream bufferedIn; + private static int proxyPort = 80; + private static boolean proxyInUse = false; + private static String proxyHost = null; + + static + { + // Recognize some networking properties listed at + // http://java.sun.com/j2se/1.4/docs/guide/net/properties.html. + String port = null; + proxyHost = System.getProperty("http.proxyHost"); + if (proxyHost != null) + { + proxyInUse = true; + if ((port = System.getProperty("http.proxyPort")) != null) + { + try + { + proxyPort = Integer.parseInt(port); + } + catch (Throwable t) + { + // Nothing. + } + } + } + } + public Connection(URL url) { super(url); @@ -85,12 +113,20 @@ class Connection extends HttpURLConnection // Get address and port number. int port; - InetAddress destAddr = InetAddress.getByName(url.getHost()); - if ((port = url.getPort()) == -1) - port = 80; + if (proxyInUse) + { + port = proxyPort; + sock = new Socket(proxyHost, port); + } + else + { + InetAddress destAddr = InetAddress.getByName(url.getHost()); + if ((port = url.getPort()) == -1) + port = 80; + // Open socket and output stream. + sock = new Socket(destAddr, port); + } - // Open socket and output stream. - sock = new Socket(destAddr, port); PrintWriter out = new PrintWriter(sock.getOutputStream()); // Send request including any request properties that were set. @@ -123,10 +159,9 @@ class Connection extends HttpURLConnection } } - // TODO: public boolean usingProxy() public boolean usingProxy() { - return false; + return proxyInUse; } // Override default method in URLConnection. diff --git a/libjava/gnu/gcj/xlib/GC.java b/libjava/gnu/gcj/xlib/GC.java index 6b33715cf6c..1806c2ae569 100644 --- a/libjava/gnu/gcj/xlib/GC.java +++ b/libjava/gnu/gcj/xlib/GC.java @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 Free Software Foundation +/* Copyright (C) 2000, 2003 Free Software Foundation This file is part of libgcj. @@ -84,6 +84,8 @@ public class GC implements Cloneable public native void drawRectangle(int x, int y, int w, int h); public native void fillRectangle(int x, int y, int w, int h); + public native void fillPolygon(int[] xPoints, int[] yPoints, int nPoints, + int translateX, int translateY); /** * diff --git a/libjava/gnu/gcj/xlib/natGC.cc b/libjava/gnu/gcj/xlib/natGC.cc index 66de35f868b..1a1bd586d8e 100644 --- a/libjava/gnu/gcj/xlib/natGC.cc +++ b/libjava/gnu/gcj/xlib/natGC.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 Free Software Foundation +/* Copyright (C) 2000, 2003 Free Software Foundation This file is part of libgcj. @@ -11,6 +11,7 @@ details. */ #include <X11/Xlib.h> #include <gcj/cni.h> +#include <gcj/array.h> #include <gnu/gcj/RawData.h> #include <java/lang/String.h> #include <java/awt/Rectangle.h> @@ -154,6 +155,27 @@ void gnu::gcj::xlib::GC::fillRectangle(jint x, jint y, jint w, jint h) // no fast fail } +void gnu::gcj::xlib::GC::fillPolygon(jintArray xPoints, jintArray yPoints, + jint nPoints, + jint translateX, jint translateY) +{ + Display* display = target->getDisplay(); + ::Display* dpy = (::Display*) (display->display); + ::Drawable drawableXID = target->getXID(); + ::GC gc = (::GC) structure; + typedef ::XPoint xpoint; + std::vector<xpoint> points(nPoints+1); + for (int i=0; i<nPoints; i++) + { + points[i].x = elements(xPoints)[i] + translateX; + points[i].y = elements(yPoints)[i] + translateY; + } + points[nPoints] = points[0]; + XFillPolygon(dpy, drawableXID, gc, &(points.front()), nPoints, + Complex, CoordModeOrigin); + // no fast fail +} + void gnu::gcj::xlib::GC::clearArea(jint x, jint y, jint w, jint h, jboolean exposures) { diff --git a/libjava/gnu/java/rmi/server/UnicastServerRef.java b/libjava/gnu/java/rmi/server/UnicastServerRef.java index 4f64452b124..a3a999f2e9f 100644 --- a/libjava/gnu/java/rmi/server/UnicastServerRef.java +++ b/libjava/gnu/java/rmi/server/UnicastServerRef.java @@ -1,5 +1,5 @@ /* - Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. + Copyright (c) 1996, 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -129,7 +129,7 @@ public RemoteStub getStub(){ } -public boolean unexportObject(Remote obj, boolean force) throws RemoteException { +public boolean unexportObject(Remote obj, boolean force) { // Remove all hashes of methods which may be called. buildMethodHash(obj.getClass(), false); return UnicastServer.unexportObject(this, force); diff --git a/libjava/include/boehm-gc.h b/libjava/include/boehm-gc.h index 6c60c794502..509900c737c 100644 --- a/libjava/include/boehm-gc.h +++ b/libjava/include/boehm-gc.h @@ -1,7 +1,7 @@ // -*- c++ -*- // boehm-gc.h - Defines for Boehm collector. -/* Copyright (C) 1998, 1999 Free Software Foundation +/* Copyright (C) 1998, 1999, 2002 Free Software Foundation This file is part of libgcj. @@ -19,7 +19,7 @@ extern "C" { JV_MARKOBJ_DECL; JV_MARKARRAY_DECL; -}; +} // Enough stuff to inline _Jv_AllocObj. Ugly. #include <gcj/javaprims.h> diff --git a/libjava/include/dwarf2-signal.h b/libjava/include/dwarf2-signal.h index b996732b743..7dbcd9dfd2d 100644 --- a/libjava/include/dwarf2-signal.h +++ b/libjava/include/dwarf2-signal.h @@ -209,9 +209,6 @@ do \ while (0) #endif #elif !defined(__ia64__) -#if defined(__x86_64__) -#define SYS_sigaction SYS_rt_sigaction -#endif #define INIT_SEGV \ do \ { \ diff --git a/libjava/include/jni.h b/libjava/include/jni.h index 31f57985683..cab4571b094 100644 --- a/libjava/include/jni.h +++ b/libjava/include/jni.h @@ -211,7 +211,7 @@ extern JNIIMPEXP jint JNICALL JNI_CreateJavaVM (JavaVM **, void **, void *); extern JNIIMPEXP jint JNICALL JNI_GetCreatedJavaVMs(JavaVM **, jsize, jsize *); #ifdef __cplusplus -}; +} #endif /* __cplusplus */ typedef union jvalue diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h index e02901de824..1e604980e0e 100644 --- a/libjava/include/jvm.h +++ b/libjava/include/jvm.h @@ -162,7 +162,7 @@ namespace gcj /* Set to true by _Jv_CreateJavaVM. */ extern bool runtimeInitialized; -}; +} /* Type of pointer used as finalizer. */ typedef void _Jv_FinalizerFunc (jobject); diff --git a/libjava/include/posix.h b/libjava/include/posix.h index cdcdb5d45ac..0e1220a10b3 100644 --- a/libjava/include/posix.h +++ b/libjava/include/posix.h @@ -1,6 +1,6 @@ // posix.h -- Helper functions for POSIX-flavored OSs. -/* Copyright (C) 2000, 2002 Free Software Foundation +/* Copyright (C) 2000, 2002, 2003 Free Software Foundation This file is part of libgcj. @@ -60,6 +60,14 @@ _Jv_platform_close_on_exec (jint fd) ::fcntl (fd, F_SETFD, FD_CLOEXEC); } +#ifdef JV_HASH_SYNCHRONIZATION +inline void +_Jv_platform_usleep (unsigned long usecs) +{ + usleep (usecs); +} +#endif /* JV_HASH_SYNCHRONIZATION */ + #ifndef DISABLE_JAVA_NET #ifndef HAVE_SOCKLEN_T diff --git a/libjava/include/win32.h b/libjava/include/win32.h index d4c0ab6c18d..5de8211a9a9 100644 --- a/libjava/include/win32.h +++ b/libjava/include/win32.h @@ -48,6 +48,21 @@ _Jv_platform_close_on_exec (jint) // Ignore. } +#ifdef JV_HASH_SYNCHRONIZATION +/* Suspends the execution of the current thread for the specified + number of microseconds. Tries to emulate the behaviour of usleep() + on UNIX and provides a granularity of 1 millisecond. */ +inline void +_Jv_platform_usleep (unsigned long usecs) +{ + if (usecs > 0UL) + { + unsigned long millis = ((usecs + 999UL) / 1000UL); + Sleep (millis); + } +} +#endif /* JV_HASH_SYNCHRONIZATION */ + #ifndef DISABLE_JAVA_NET static inline int diff --git a/libjava/interpret.cc b/libjava/interpret.cc index 9791b4a5cd8..15fb413e835 100644 --- a/libjava/interpret.cc +++ b/libjava/interpret.cc @@ -91,7 +91,7 @@ static inline void dupx (_Jv_word *sp, int n, int x) sp[top-(n+x)-i] = sp[top-i]; } -}; +} // Used to convert from floating types to integral types. template<typename TO, typename FROM> diff --git a/libjava/java/awt/AlphaComposite.java b/libjava/java/awt/AlphaComposite.java index 14649fc74a3..f0795a96010 100644 --- a/libjava/java/awt/AlphaComposite.java +++ b/libjava/java/awt/AlphaComposite.java @@ -64,6 +64,7 @@ public final class AlphaComposite implements Composite return size() > MAX_CACHE_SIZE; } }; + public static final int CLEAR = 1; public static final int SRC = 2; public static final int DST = 9; @@ -88,6 +89,7 @@ public final class AlphaComposite implements Composite public static final AlphaComposite SrcAtop = getInstance(SRC_ATOP); public static final AlphaComposite DstAtop = getInstance(DST_ATOP); public static final AlphaComposite Xor = getInstance(XOR); + private final int rule; private final float alpha; private AlphaComposite(int rule, float alpha) @@ -95,10 +97,32 @@ public final class AlphaComposite implements Composite this.rule = rule; this.alpha = alpha; } + + /** + * Creates an AlphaComposite object with the specified rule. + * + * @param rule The compositing rule. + * + * @exception IllegalArgumentException If rule is not one of the following: + * CLEAR, SRC, DST, SRC_OVER, DST_OVER, SRC_IN, DST_IN, SRC_OUT, DST_OUT, + * SRC_ATOP, DST_ATOP, or XOR. + */ public static AlphaComposite getInstance(int rule) { return getInstance(rule, 1); } + + /** + * Creates an AlphaComposite object with the specified rule and the constant + * alpha to multiply with the alpha of the source. The source is multiplied + * with the specified alpha before being composited with the destination. + * + * @param rule The compositing rule. + * + * @exception IllegalArgumentException If rule is not one of the following: + * CLEAR, SRC, DST, SRC_OVER, DST_OVER, SRC_IN, DST_IN, SRC_OUT, DST_OUT, + * SRC_ATOP, DST_ATOP, or XOR. + */ public static AlphaComposite getInstance(int rule, float alpha) { if (rule < CLEAR || rule > XOR || ! (alpha >= 0 && alpha <= 1)) diff --git a/libjava/java/awt/BasicStroke.java b/libjava/java/awt/BasicStroke.java index c3290336cd9..3d0a2e74506 100644 --- a/libjava/java/awt/BasicStroke.java +++ b/libjava/java/awt/BasicStroke.java @@ -1,5 +1,5 @@ /* BasicStroke.java -- - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -59,12 +59,31 @@ public class BasicStroke implements Stroke private final float[] dash; private final float phase; + /** + * Creates a basic stroke. + * + * @param width May not be negative . + * @param cap May be either CAP_BUTT, CAP_ROUND or CAP_SQUARE. + * @param join May be either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER. + * @param miterlimit the limit to trim the miter join. The miterlimit must be + * greater than or equal to 1.0f. + * @param dash The array representing the dashing pattern. + * @param dash_phase is negative and dash is not null. + * + * @exception IllegalArgumentException If one input parameter doesn't meet + * its needs. + */ public BasicStroke(float width, int cap, int join, float miterlimit, float[] dash, float dashPhase) { - if (width < 0 || miterlimit < 1 || cap < CAP_BUTT || cap > CAP_SQUARE - || join < JOIN_MITER || join > JOIN_BEVEL) + if (width < 0 || + miterlimit < 1.0f || + cap < CAP_BUTT || + cap > CAP_SQUARE || + join < JOIN_MITER || + join > JOIN_BEVEL) throw new IllegalArgumentException(); + this.width = width; this.cap = cap; this.join = join; @@ -73,21 +92,54 @@ public class BasicStroke implements Stroke phase = dashPhase; } + /** + * Creates a basic stroke. + * + * @param width The width of the BasicStroke. May not be negative . + * @param cap May be either CAP_BUTT, CAP_ROUND or CAP_SQUARE. + * @param join May be either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER. + * @param miterlimit the limit to trim the miter join. The miterlimit must be + * greater than or equal to 1.0f. + * + * @exception IllegalArgumentException If one input parameter doesn't meet + * its needs. + */ public BasicStroke(float width, int cap, int join, float miterlimit) { this(width, cap, join, miterlimit, null, 0); } + /** + * Creates a basic stroke. + * + * @param width The width of the BasicStroke. May not be nehative. + * @param cap May be either CAP_BUTT, CAP_ROUND or CAP_SQUARE. + * @param join May be either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER. + * + * @exception IllegalArgumentException If one input parameter doesn't meet + * its needs. + * @exception IllegalArgumentException FIXME + */ public BasicStroke(float width, int cap, int join) { this(width, cap, join, 10, null, 0); } + /** + * Creates a basic stroke. + * + * @param width The width of the BasicStroke. + * + * @exception IllegalArgumentException If width is negative. + */ public BasicStroke(float width) { this(width, CAP_SQUARE, JOIN_MITER, 10, null, 0); } + /** + * Creates a basic stroke. + */ public BasicStroke() { this(1, CAP_SQUARE, JOIN_MITER, 10, null, 0); diff --git a/libjava/java/awt/BufferCapabilities.java b/libjava/java/awt/BufferCapabilities.java index 389594b76b5..871529e6e93 100644 --- a/libjava/java/awt/BufferCapabilities.java +++ b/libjava/java/awt/BufferCapabilities.java @@ -67,6 +67,11 @@ public class BufferCapabilities implements Cloneable private final ImageCapabilities back; private final FlipContents flip; + /** + * Creates a buffer capabilities object. + * + * @exception IllegalArgumentException If frontCaps or backCaps are null. + */ public BufferCapabilities(ImageCapabilities front, ImageCapabilities back, FlipContents flip) { diff --git a/libjava/java/awt/Button.java b/libjava/java/awt/Button.java index ed954ddcfda..989fbc95173 100644 --- a/libjava/java/awt/Button.java +++ b/libjava/java/awt/Button.java @@ -90,6 +90,9 @@ private transient ActionListener action_listeners; /** * Initializes a new instance of <code>Button</code> with no label. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() + * returns true */ public Button() @@ -104,12 +107,18 @@ Button() * label. The action command name is also initialized to this value. * * @param label The label to display on the button. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() + * returns true */ public Button(String label) { this.label = label; actionCommand = label; + + if (GraphicsEnvironment.isHeadless ()) + throw new HeadlessException (); } /*************************************************************************/ @@ -211,6 +220,10 @@ removeActionListener(ActionListener listener) /** Returns all registered EventListers of the given listenerType. * listenerType must be a subclass of EventListener, or a * ClassClassException is thrown. + * + * @exception ClassCastException If listenerType doesn't specify a class or + * interface that implements @see java.util.EventListener. + * * @since 1.3 */ public EventListener[] getListeners(Class listenerType) diff --git a/libjava/java/awt/CardLayout.java b/libjava/java/awt/CardLayout.java index 10ffa2ec6c2..1900a6094e2 100644 --- a/libjava/java/awt/CardLayout.java +++ b/libjava/java/awt/CardLayout.java @@ -1,6 +1,6 @@ // CardLayout.java - Card-based layout engine -/* Copyright (C) 1999, 2000, 2002 Free Software Foundation +/* Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation This file is part of GNU Classpath. @@ -110,7 +110,7 @@ public class CardLayout implements LayoutManager2, Serializable */ public void first (Container parent) { - gotoComponent (parent, FIRST, null); + gotoComponent (parent, FIRST); } /** Return this layout manager's horizontal gap. */ @@ -154,7 +154,7 @@ public class CardLayout implements LayoutManager2, Serializable */ public void last (Container parent) { - gotoComponent (parent, LAST, null); + gotoComponent (parent, LAST); } /** @@ -210,7 +210,7 @@ public class CardLayout implements LayoutManager2, Serializable */ public void next (Container parent) { - gotoComponent (parent, NEXT, null); + gotoComponent (parent, NEXT); } /** Get the preferred layout size of the container. @@ -228,7 +228,7 @@ public class CardLayout implements LayoutManager2, Serializable */ public void previous (Container parent) { - gotoComponent (parent, PREV, null); + gotoComponent (parent, PREV); } /** Remove the indicated component from this layout manager. @@ -273,7 +273,21 @@ public class CardLayout implements LayoutManager2, Serializable { Object target = tab.get (name); if (target != null) - gotoComponent (parent, NONE, (Component) target); + { + int num = parent.ncomponents; + // This is more efficient than calling getComponents(). + Component[] comps = parent.component; + for (int i = 0; i < num; ++i) + { + if (comps[i].isVisible()) + { + if (target == comps[i]) + return; + comps[i].setVisible (false); + } + } + ((Component) target).setVisible (true); + } } /** @@ -286,9 +300,11 @@ public class CardLayout implements LayoutManager2, Serializable return getClass ().getName () + "[" + hgap + "," + vgap + "]"; } - // This implements first(), last(), next(), and previous(). - private void gotoComponent (Container parent, int what, - Component target) + /** This implements first(), last(), next(), and previous(). + * @param parent The parent container + * @param what The type of goto: FIRST, LAST, NEXT or PREV + */ + private void gotoComponent (Container parent, int what) { synchronized (parent.getTreeLock ()) { @@ -301,19 +317,9 @@ public class CardLayout implements LayoutManager2, Serializable choice = 0; else if (what == LAST) choice = num - 1; - else if (what >= 0) - choice = what; for (int i = 0; i < num; ++i) { - // If TARGET is set then we are looking for a specific - // component. - if (target != null) - { - if (target == comps[i]) - choice = i; - } - if (comps[i].isVisible ()) { if (what == NEXT) @@ -335,7 +341,7 @@ public class CardLayout implements LayoutManager2, Serializable return; } comps[i].setVisible (false); - + if (choice >= 0) break; } @@ -403,7 +409,6 @@ public class CardLayout implements LayoutManager2, Serializable private int LAST = 1; private int NEXT = 2; private int PREV = 3; - private int NONE = 4; // These constants are used by the private getSize method. private int MIN = 0; diff --git a/libjava/java/awt/CheckboxMenuItem.java b/libjava/java/awt/CheckboxMenuItem.java index 2f7ecd79fc5..88218397c3c 100644 --- a/libjava/java/awt/CheckboxMenuItem.java +++ b/libjava/java/awt/CheckboxMenuItem.java @@ -84,6 +84,9 @@ private transient ItemListener item_listeners; /** * Initializes a new instance of <code>CheckboxMenuItem</code> with no * label and an initial state of off. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() + * returns true. */ public CheckboxMenuItem() @@ -98,6 +101,9 @@ CheckboxMenuItem() * specified label and an initial state of off. * * @param label The label of the menu item. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() + * returns true. */ public CheckboxMenuItem(String label) @@ -114,12 +120,18 @@ CheckboxMenuItem(String label) * @param label The label of the menu item. * @param state The initial state of the menu item, where <code>true</code> * is on, and <code>false</code> is off. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() + * returns true. */ public CheckboxMenuItem(String label, boolean state) { super(label); this.state = state; + + if (GraphicsEnvironment.isHeadless()) + throw new HeadlessException (); } /*************************************************************************/ diff --git a/libjava/java/awt/Choice.java b/libjava/java/awt/Choice.java index 81a2a31c932..4c7b505535c 100644 --- a/libjava/java/awt/Choice.java +++ b/libjava/java/awt/Choice.java @@ -85,13 +85,17 @@ private ItemListener item_listeners; * Constructors */ -/** - * Initializes a new instance of <code>Choice</code>. - */ -public -Choice() -{ -} + /** + * Initializes a new instance of <code>Choice</code>. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() + * returns true + */ + public Choice() + { + if (GraphicsEnvironment.isHeadless()) + throw new HeadlessException (); + } /*************************************************************************/ @@ -146,12 +150,16 @@ getItem(int index) * Adds the specified item to this choice box. * * @param item The item to add. + * + * @exception NullPointerException If the item's value is null + * + * @since 1.1 */ public synchronized void add(String item) { if (item == null) - throw new IllegalArgumentException ("item must be non-null"); + throw new NullPointerException ("item must be non-null"); pItems.addElement(item); @@ -171,7 +179,12 @@ add(String item) /** * Adds the specified item to this choice box. * + * This method is oboslete since Java 2 platform 1.1. Please use @see add + * instead. + * * @param item The item to add. + * + * @exception NullPointerException If the item's value is equal to null */ public synchronized void addItem(String item) @@ -189,10 +202,15 @@ addItem(String item) * * @param item The item to add. * @param index The index at which the item should be inserted. + * + * @exception IllegalArgumentException If index is less than 0 */ public synchronized void insert(String item, int index) { + if (index < 0) + throw new IllegalArgumentException ("index may not be less then 0"); + if (index > getItemCount ()) index = getItemCount (); diff --git a/libjava/java/awt/Container.java b/libjava/java/awt/Container.java index dd2390d35ba..9494d8c56ac 100644 --- a/libjava/java/awt/Container.java +++ b/libjava/java/awt/Container.java @@ -59,7 +59,9 @@ import javax.accessibility.Accessible; * * @author original author unknown * @author Eric Blake <ebb9@email.byu.edu> + * * @since 1.0 + * * @status still missing 1.4 support */ public class Container extends Component @@ -78,7 +80,9 @@ public class Container extends Component Dimension maxSize; - /** @since 1.4 */ + /** + * @since 1.4 + */ boolean focusCycleRoot; int containerSerializedDataVersion; @@ -107,6 +111,7 @@ public class Container extends Component * Returns the number of components in this container. * * @return The number of components in this container. + * * @deprecated use {@link #getComponentCount()} instead */ public int countComponents() @@ -118,16 +123,19 @@ public class Container extends Component * Returns the component at the specified index. * * @param index The index of the component to retrieve. + * * @return The requested component. + * * @throws ArrayIndexOutOfBoundsException If the specified index is invalid */ public Component getComponent(int n) { synchronized (getTreeLock ()) { - if (n < 0 || n >= ncomponents) - throw new ArrayIndexOutOfBoundsException("no such component"); - return component[n]; + if (n < 0 || n >= ncomponents) + throw new ArrayIndexOutOfBoundsException("no such component"); + + return component[n]; } } @@ -140,10 +148,12 @@ public class Container extends Component { synchronized (getTreeLock ()) { - Component[] result = new Component[ncomponents]; - if (ncomponents > 0) - System.arraycopy(component, 0, result, 0, ncomponents); - return result; + Component[] result = new Component[ncomponents]; + + if (ncomponents > 0) + System.arraycopy(component, 0, result, 0, ncomponents); + + return result; } } @@ -157,6 +167,7 @@ public class Container extends Component { if (peer == null) return new Insets(0, 0, 0, 0); + return ((ContainerPeer) peer).getInsets(); } @@ -177,6 +188,7 @@ public class Container extends Component * component list. * * @param component The component to add to the container. + * * @return The same component that was added. */ public Component add(Component comp) @@ -190,7 +202,7 @@ public class Container extends Component * component list. This method should not be used. Instead, use * <code>add(Component, Object</code>. * - * @param name FIXME + * @param name The name of the component to be added. * @param component The component to be added. * * @return The same component that was added. @@ -268,69 +280,70 @@ public class Container extends Component { synchronized (getTreeLock ()) { - if (index > ncomponents - || (index < 0 && index != -1) - || comp instanceof Window - || (comp instanceof Container - && ((Container) comp).isAncestorOf(this))) - throw new IllegalArgumentException(); - - // Reparent component, and make sure component is instantiated if - // we are. - if (comp.parent != null) - comp.parent.remove(comp); - comp.parent = this; - if (peer != null) - { - comp.addNotify(); - - if (comp.isLightweight()) - enableEvents(comp.eventMask); - } + if (index > ncomponents + || (index < 0 && index != -1) + || comp instanceof Window + || (comp instanceof Container + && ((Container) comp).isAncestorOf(this))) + throw new IllegalArgumentException(); + + // Reparent component, and make sure component is instantiated if + // we are. + if (comp.parent != null) + comp.parent.remove(comp); + comp.parent = this; + if (peer != null) + { + comp.addNotify(); - invalidate(); + if (comp.isLightweight()) + enableEvents(comp.eventMask); + } - if (component == null) - component = new Component[4]; // FIXME, better initial size? + invalidate(); - // This isn't the most efficient implementation. We could do less - // copying when growing the array. It probably doesn't matter. - if (ncomponents >= component.length) - { - int nl = component.length * 2; - Component[] c = new Component[nl]; - System.arraycopy(component, 0, c, 0, ncomponents); - component = c; - } - if (index == -1) - component[ncomponents++] = comp; - else - { - System.arraycopy(component, index, component, index + 1, - ncomponents - index); - component[index] = comp; - ++ncomponents; - } + if (component == null) + component = new Component[4]; // FIXME, better initial size? - // Notify the layout manager. - if (layoutMgr != null) - { - if (layoutMgr instanceof LayoutManager2) - { - LayoutManager2 lm2 = (LayoutManager2) layoutMgr; - lm2.addLayoutComponent(comp, constraints); - } - else if (constraints instanceof String) - layoutMgr.addLayoutComponent((String) constraints, comp); - else - layoutMgr.addLayoutComponent(null, comp); - } + // This isn't the most efficient implementation. We could do less + // copying when growing the array. It probably doesn't matter. + if (ncomponents >= component.length) + { + int nl = component.length * 2; + Component[] c = new Component[nl]; + System.arraycopy(component, 0, c, 0, ncomponents); + component = c; + } + + if (index == -1) + component[ncomponents++] = comp; + else + { + System.arraycopy(component, index, component, index + 1, + ncomponents - index); + component[index] = comp; + ++ncomponents; + } - // Post event to notify of adding the container. - ContainerEvent ce = new ContainerEvent(this, - ContainerEvent.COMPONENT_ADDED, - comp); - getToolkit().getSystemEventQueue().postEvent(ce); + // Notify the layout manager. + if (layoutMgr != null) + { + if (layoutMgr instanceof LayoutManager2) + { + LayoutManager2 lm2 = (LayoutManager2) layoutMgr; + lm2.addLayoutComponent(comp, constraints); + } + else if (constraints instanceof String) + layoutMgr.addLayoutComponent((String) constraints, comp); + else + layoutMgr.addLayoutComponent(null, comp); + } + + // Post event to notify of adding the container. + ContainerEvent ce = new ContainerEvent(this, + ContainerEvent.COMPONENT_ADDED, + comp); + getToolkit().getSystemEventQueue().postEvent(ce); } } @@ -343,24 +356,24 @@ public class Container extends Component { synchronized (getTreeLock ()) { - Component r = component[index]; + Component r = component[index]; - r.removeNotify(); + r.removeNotify(); - System.arraycopy(component, index + 1, component, index, - ncomponents - index - 1); - component[--ncomponents] = null; + System.arraycopy(component, index + 1, component, index, + ncomponents - index - 1); + component[--ncomponents] = null; - invalidate(); + invalidate(); - if (layoutMgr != null) - layoutMgr.removeLayoutComponent(r); + if (layoutMgr != null) + layoutMgr.removeLayoutComponent(r); - // Post event to notify of adding the container. - ContainerEvent ce = new ContainerEvent(this, - ContainerEvent.COMPONENT_REMOVED, - r); - getToolkit().getSystemEventQueue().postEvent(ce); + // Post event to notify of adding the container. + ContainerEvent ce = new ContainerEvent(this, + ContainerEvent.COMPONENT_REMOVED, + r); + getToolkit().getSystemEventQueue().postEvent(ce); } } @@ -373,14 +386,14 @@ public class Container extends Component { synchronized (getTreeLock ()) { - for (int i = 0; i < ncomponents; ++i) - { - if (component[i] == comp) - { - remove(i); - break; - } - } + for (int i = 0; i < ncomponents; ++i) + { + if (component[i] == comp) + { + remove(i); + break; + } + } } } @@ -391,8 +404,8 @@ public class Container extends Component { synchronized (getTreeLock ()) { - while (ncomponents > 0) - remove(0); + while (ncomponents > 0) + remove(0); } } @@ -525,6 +538,7 @@ public class Container extends Component * Returns the preferred size of this container. * * @return The preferred size of this container. + * * @deprecated use {@link #getPreferredSize()} instead */ public Dimension preferredSize() @@ -549,6 +563,7 @@ public class Container extends Component * Returns the minimum size of this container. * * @return The minimum size of this container. + * * @deprecated use {@link #getMinimumSize()} instead */ public Dimension minimumSize() @@ -709,6 +724,10 @@ public class Container extends Component } /** + * Returns an array of all the objects currently registered as FooListeners + * upon this Container. FooListeners are registered using the addFooListener + * method. + * * @since 1.3 */ public EventListener[] getListeners(Class listenerType) @@ -760,6 +779,7 @@ public class Container extends Component * AWT 1.0 event processor. * * @param event The event that occurred. + * * @deprecated use {@link #dispatchEvent(AWTEvent)} instead */ public void deliverEvent(Event e) @@ -784,20 +804,20 @@ public class Container extends Component { synchronized (getTreeLock ()) { - if (! contains(x, y)) - return null; - for (int i = 0; i < ncomponents; ++i) - { - // Ignore invisible children... - if (!component[i].isVisible()) - continue; - - int x2 = x - component[i].x; - int y2 = y - component[i].y; - if (component[i].contains(x2, y2)) - return component[i]; - } - return this; + if (! contains(x, y)) + return null; + for (int i = 0; i < ncomponents; ++i) + { + // Ignore invisible children... + if (!component[i].isVisible()) + continue; + + int x2 = x - component[i].x; + int y2 = y - component[i].y; + if (component[i].contains(x2, y2)) + return component[i]; + } + return this; } } @@ -813,6 +833,7 @@ public class Container extends Component * * @return The component containing the specified point, or <code>null</code> * if there is no such point. + * * @deprecated use {@link #getComponentAt(int, int)} instead */ public Component locate(int x, int y) @@ -841,31 +862,31 @@ public class Container extends Component { synchronized (getTreeLock ()) { - if (! contains(x, y)) - return null; - - for (int i = 0; i < ncomponents; ++i) - { - // Ignore invisible children... - if (!component[i].isVisible()) - continue; - - int x2 = x - component[i].x; - int y2 = y - component[i].y; - // We don't do the contains() check right away because - // findComponentAt would redundantly do it first thing. - if (component[i] instanceof Container) - { - Container k = (Container) component[i]; - Component r = k.findComponentAt(x2, y2); - if (r != null) - return r; - } - else if (component[i].contains(x2, y2)) - return component[i]; - } + if (! contains(x, y)) + return null; - return this; + for (int i = 0; i < ncomponents; ++i) + { + // Ignore invisible children... + if (!component[i].isVisible()) + continue; + + int x2 = x - component[i].x; + int y2 = y - component[i].y; + // We don't do the contains() check right away because + // findComponentAt would redundantly do it first thing. + if (component[i] instanceof Container) + { + Container k = (Container) component[i]; + Component r = k.findComponentAt(x2, y2); + if (r != null) + return r; + } + else if (component[i].contains(x2, y2)) + return component[i]; + } + + return this; } } @@ -894,9 +915,9 @@ public class Container extends Component { synchronized (getTreeLock ()) { - for (int i = 0; i < ncomponents; ++i) - component[i].removeNotify(); - super.removeNotify(); + for (int i = 0; i < ncomponents; ++i) + component[i].removeNotify(); + super.removeNotify(); } } @@ -913,14 +934,14 @@ public class Container extends Component { synchronized (getTreeLock ()) { - while (true) - { - if (comp == null) - return false; - if (comp == this) - return true; - comp = comp.getParent(); - } + while (true) + { + if (comp == null) + return false; + if (comp == this) + return true; + comp = comp.getParent(); + } } } @@ -950,9 +971,9 @@ public class Container extends Component { synchronized (getTreeLock ()) { - super.list(out, indent); - for (int i = 0; i < ncomponents; ++i) - component[i].list(out, indent + 2); + super.list(out, indent); + for (int i = 0; i < ncomponents; ++i) + component[i].list(out, indent + 2); } } @@ -967,62 +988,93 @@ public class Container extends Component { synchronized (getTreeLock ()) { - super.list(out, indent); - for (int i = 0; i < ncomponents; ++i) - component[i].list(out, indent + 2); + super.list(out, indent); + for (int i = 0; i < ncomponents; ++i) + component[i].list(out, indent + 2); } } public void setFocusTraversalKeys(int id, Set keys) { + if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS && + id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS && + id != KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS && + id != KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS) + throw new IllegalArgumentException (); } + public Set getFocusTraversalKeys(int id) { + if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS && + id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS && + id != KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS && + id != KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS) + throw new IllegalArgumentException (); + return null; } + public boolean areFocusTraversalKeysSet(int id) { + if (id != KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS && + id != KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS && + id != KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS && + id != KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS) + throw new IllegalArgumentException (); + return false; } + public boolean isFocusCycleRoot(Container c) { return false; } + public void transferFocusBackward() { } + public void setFocusTraversalPolicy(FocusTraversalPolicy policy) { } + public FocusTraversalPolicy getFocusTraversalPolicy() { return null; } + public boolean isFocusTraversalPolicySet() { return false; } + public void setFocusCycleRoot(boolean focusCycleRoot) { } + public boolean isFocusCycleRoot() { return false; } + public void transferFocusDownCycle() { } + public void applyComponentOrientation(ComponentOrientation o) { + if (orientation == null) + throw new NullPointerException (); } + public void addPropertyChangeListener(PropertyChangeListener l) { } + public void addPropertyChangeListener(String name, PropertyChangeListener l) { } - // Hidden helper methods. /** @@ -1044,14 +1096,14 @@ public class Container extends Component { synchronized (getTreeLock ()) { - for (int i = 0; i < ncomponents; ++i) - { - Component comp = component[i]; - boolean applicable = comp.isVisible() - && (comp.isLightweight() || !lightweightOnly); - - if (applicable) - visitChild(gfx, visitor, comp); + for (int i = 0; i < ncomponents; ++i) + { + Component comp = component[i]; + boolean applicable = comp.isVisible() + && (comp.isLightweight() || !lightweightOnly); + + if (applicable) + visitChild(gfx, visitor, comp); } } } @@ -1100,50 +1152,50 @@ public class Container extends Component { synchronized (getTreeLock ()) { - int start, end; - if (child != null) - { - for (start = 0; start < ncomponents; ++start) - { - if (component[start] == child) - break; - } - end = start; - // This special case lets us be sure to terminate. - if (end == 0) - end = ncomponents; - ++start; - } - else - { - start = 0; - end = ncomponents; - } + int start, end; + if (child != null) + { + for (start = 0; start < ncomponents; ++start) + { + if (component[start] == child) + break; + } + end = start; + // This special case lets us be sure to terminate. + if (end == 0) + end = ncomponents; + ++start; + } + else + { + start = 0; + end = ncomponents; + } - for (int j = start; j != end; ++j) - { - if (j >= ncomponents) - { - // The JCL says that we should wrap here. However, that - // seems wrong. To me it seems that focus order should be - // global within in given window. So instead if we reach - // the end we try to look in our parent, if we have one. - if (parent != null) - return parent.findNextFocusComponent(this); - j -= ncomponents; - } - if (component[j] instanceof Container) - { - Component c = component[j]; - c = c.findNextFocusComponent(null); - if (c != null) - return c; - } - else if (component[j].isFocusTraversable()) - return component[j]; - } + for (int j = start; j != end; ++j) + { + if (j >= ncomponents) + { + // The JCL says that we should wrap here. However, that + // seems wrong. To me it seems that focus order should be + // global within in given window. So instead if we reach + // the end we try to look in our parent, if we have one. + if (parent != null) + return parent.findNextFocusComponent(this); + j -= ncomponents; + } + if (component[j] instanceof Container) + { + Component c = component[j]; + c = c.findNextFocusComponent(null); + if (c != null) + return c; + } + else if (component[j].isFocusTraversable()) + return component[j]; + } - return null; + return null; } } @@ -1151,16 +1203,15 @@ public class Container extends Component { synchronized (getTreeLock ()) { - for (int i = ncomponents; --i >= 0; ) - { - component[i].addNotify(); - if (component[i].isLightweight()) - enableEvents(component[i].eventMask); - } + for (int i = ncomponents; --i >= 0; ) + { + component[i].addNotify(); + if (component[i].isLightweight()) + enableEvents(component[i].eventMask); + } } } - // Nested classes. /* The following classes are used in concert with the @@ -1200,6 +1251,7 @@ public class Container extends Component * This class provides accessibility support for subclasses of container. * * @author Eric Blake <ebb9@email.byu.edu> + * * @since 1.3 */ protected class AccessibleAWTContainer extends AccessibleAWTComponent @@ -1234,14 +1286,14 @@ public class Container extends Component public int getAccessibleChildrenCount() { synchronized (getTreeLock ()) - { - int count = 0; - int i = component == null ? 0 : component.length; - while (--i >= 0) - if (component[i] instanceof Accessible) - count++; - return count; - } + { + int count = 0; + int i = component == null ? 0 : component.length; + while (--i >= 0) + if (component[i] instanceof Accessible) + count++; + return count; + } } /** @@ -1253,17 +1305,17 @@ public class Container extends Component public Accessible getAccessibleChild(int i) { synchronized (getTreeLock ()) - { - if (component == null) - return null; - int index = -1; - while (i >= 0 && ++index < component.length) - if (component[index] instanceof Accessible) - i--; - if (i < 0) - return (Accessible) component[index]; - return null; - } + { + if (component == null) + return null; + int index = -1; + while (i >= 0 && ++index < component.length) + if (component[index] instanceof Accessible) + i--; + if (i < 0) + return (Accessible) component[index]; + return null; + } } /** @@ -1271,7 +1323,9 @@ public class Container extends Component * coordinates), if one exists. * * @param p the point to look at + * * @return an accessible object at that point, or null + * * @throws NullPointerException if p is null */ public Accessible getAccessibleAt(Point p) @@ -1286,6 +1340,7 @@ public class Container extends Component * when children are added or removed from the enclosing accessible object. * * @author Eric Blake <ebb9@email.byu.edu> + * * @since 1.3 */ protected class AccessibleContainerHandler implements ContainerListener @@ -1324,7 +1379,6 @@ public class Container extends Component } // class AccessibleAWTPanel } // class Container - /** * Undocumented helper class. * STUBBED @@ -1339,39 +1393,50 @@ class LightweightDispatcher implements Serializable, AWTEventListener private transient boolean isMouseInNativeContainer; private Cursor nativeCursor; private long eventMask; + LightweightDispatcher(Container c) { } + void dispose() { } + void enableEvents(long l) { } + boolean dispatchEvent(AWTEvent e) { return true; } + boolean isMouseGrab(MouseEvent e) { return true; } + boolean processMouseEvent(MouseEvent e) { return true; } + void trackMouseEnterExit(Component c, MouseEvent e) { } + void startListeningForOtherDrags() { } + void stopListeningForOtherDrags() { } + public void eventDispatched(AWTEvent e) { } + void retargetMouseEvent(Component c, int i, MouseEvent e) { } diff --git a/libjava/java/awt/Cursor.java b/libjava/java/awt/Cursor.java index 5852b8bbf85..8652a1e5ebe 100644 --- a/libjava/java/awt/Cursor.java +++ b/libjava/java/awt/Cursor.java @@ -133,11 +133,14 @@ public class Cursor implements java.io.Serializable * type. * * @param type The cursor type. + * + * @exception IllegalArgumentException If the specified cursor type is invalid */ public Cursor(int type) { if (type < 0 || type >= PREDEFINED_COUNT) throw new IllegalArgumentException ("invalid cursor " + type); + this.type = type; // FIXME: lookup and set name? } @@ -171,9 +174,20 @@ public class Cursor implements java.io.Serializable return predefined[type]; } + /** + * Retrieves the system specific custom Cursor named Cursor names are, + * for example: "Invalid.16x16". + * + * @exception AWTException + * @exception HeadlessException If GraphicsEnvironment.isHeadless() + * returns true. + */ public static Cursor getSystemCustomCursor(String name) throws AWTException { + if (GraphicsEnvironment.isHeadless()) + throw new HeadlessException (); + // FIXME return null; } diff --git a/libjava/java/awt/DisplayMode.java b/libjava/java/awt/DisplayMode.java index b988e20be5e..533ab5ef482 100644 --- a/libjava/java/awt/DisplayMode.java +++ b/libjava/java/awt/DisplayMode.java @@ -1,5 +1,5 @@ /* DisplayMode.java -- a description of display mode configurations - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -140,16 +140,16 @@ public final class DisplayMode * Test for equality. This returns true for two modes with identical * parameters. * - * @param o the object to compare to + * @param dm The display mode to compare to + * * @return true if it is equal */ - public boolean equals(Object o) + public boolean equals (DisplayMode dm) { - if (! (o instanceof DisplayMode)) - return false; - DisplayMode m = (DisplayMode) o; - return width == m.width && height == m.height && bitDepth == m.bitDepth - && refreshRate == m.refreshRate; + return (width == dm.width + && height == dm.height + && bitDepth == dm.bitDepth + && refreshRate == dm.refreshRate); } /** diff --git a/libjava/java/awt/EventQueue.java b/libjava/java/awt/EventQueue.java index 1ce3d163181..6b64fb7ee3b 100644 --- a/libjava/java/awt/EventQueue.java +++ b/libjava/java/awt/EventQueue.java @@ -151,6 +151,8 @@ public class EventQueue * Posts a new event to the queue. * * @param event The event to post to the queue. + * + * @exception NullPointerException If event is null. */ public synchronized void postEvent(AWTEvent evt) { @@ -209,7 +211,19 @@ public class EventQueue notify(); } - /** @since JDK1.2 */ + /** + * Causes runnable to have its run method called in the dispatch thread of the + * EventQueue. This will happen after all pending events are processed. The + * call blocks until this has happened. This method will throw an Error if + * called from the event dispatcher thread. + * + * @exception InterruptedException If another thread has interrupted + * this thread. + * @exception InvocationTargetException If an exception is thrown when running + * runnable. + * + * @since 1.2 + */ public static void invokeAndWait(Runnable runnable) throws InterruptedException, InvocationTargetException { @@ -254,6 +268,8 @@ public class EventQueue * All pending events are transferred to the new queue. Calls to postEvent, * getNextEvent, and peekEvent are forwarded to the pushed queue until it * is removed with a pop(). + * + * @exception NullPointerException if newEventQueue is null. */ public synchronized void push(EventQueue newEventQueue) { @@ -271,7 +287,11 @@ public class EventQueue } /** Transfer any pending events from this queue back to the parent queue that - * was previously push()ed. Event dispatch from this queue is suspended. */ + * was previously push()ed. Event dispatch from this queue is suspended. + * + * @exception EmptyStackException If no previous push was made on this + * EventQueue. + */ protected void pop() throws EmptyStackException { if (prev == null) @@ -297,6 +317,12 @@ public class EventQueue } } + /** + * Dispatches an event. The manner in which the event is dispatched depends + * upon the type of the event and the type of the event's source object. + * + * @exception NullPointerException If event is null. + */ protected void dispatchEvent(AWTEvent evt) { if (evt instanceof ActiveEvent) diff --git a/libjava/java/awt/FileDialog.java b/libjava/java/awt/FileDialog.java index 2019572d5f6..764424c82c3 100644 --- a/libjava/java/awt/FileDialog.java +++ b/libjava/java/awt/FileDialog.java @@ -142,16 +142,15 @@ FileDialog(Frame parent, String title) * @param title The title for this dialog. * @param mode The mode of the dialog, either <code>LOAD</code> or * <code>SAVE</code>. + * + * @exception IllegalArgumentException If an illegal file dialog mode + * is supplied. */ public FileDialog(Frame parent, String title, int mode) { super(parent, title, true); - - if ((mode != LOAD) && (mode != SAVE)) - throw new IllegalArgumentException("Bad mode: " + mode); - - this.mode = mode; + setMode (mode); } /*************************************************************************/ @@ -180,6 +179,9 @@ getMode() * peer is created. * * @param mode The new mode of this file dialog. + * + * @exception IllegalArgumentException If an illegal file dialog mode + * is supplied. */ public void setMode(int mode) diff --git a/libjava/java/awt/Graphics2D.java b/libjava/java/awt/Graphics2D.java index 879fae5ad51..ed80936bfcb 100644 --- a/libjava/java/awt/Graphics2D.java +++ b/libjava/java/awt/Graphics2D.java @@ -38,6 +38,7 @@ package java.awt; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; +import java.awt.image.BufferedImageOp; import java.awt.image.RenderedImage; import java.awt.image.ImageObserver; import java.awt.image.renderable.RenderableImage; @@ -74,7 +75,7 @@ public abstract class Graphics2D extends Graphics ImageObserver obs); public abstract void drawImage(BufferedImage image, - BufferedImage op, + BufferedImageOp op, int x, int y); diff --git a/libjava/java/awt/Label.java b/libjava/java/awt/Label.java index 36ea45b944a..4f248c30bb9 100644 --- a/libjava/java/awt/Label.java +++ b/libjava/java/awt/Label.java @@ -40,6 +40,8 @@ package java.awt; import java.awt.peer.LabelPeer; import java.awt.peer.ComponentPeer; +import java.io.Serializable; +import javax.accessibility.Accessible; /** * This component is used for displaying simple text strings that cannot @@ -48,7 +50,7 @@ import java.awt.peer.ComponentPeer; * @author Aaron M. Renn (arenn@urbanophile.com) * @author Tom Tromey <tromey@cygnus.com> */ -public class Label extends Component implements java.io.Serializable +public class Label extends Component implements Serializable, Accessible { /* @@ -99,6 +101,8 @@ private String text; /** * Initializes a new instance of <code>Label</code> with no text. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public Label() @@ -113,6 +117,8 @@ Label() * text that is aligned to the left. * * @param text The text of the label. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public Label(String text) @@ -130,12 +136,17 @@ Label(String text) * @param alignment The desired alignment for the text in this label, * which must be one of <code>LEFT</code>, <code>CENTER</code>, or * <code>RIGHT</code>. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public Label(String text, int alignment) { setAlignment (alignment); setText (text); + + if (GraphicsEnvironment.isHeadless()) + throw new HeadlessException (); } /*************************************************************************/ diff --git a/libjava/java/awt/List.java b/libjava/java/awt/List.java index f2c6d078832..561a30d4dab 100644 --- a/libjava/java/awt/List.java +++ b/libjava/java/awt/List.java @@ -46,13 +46,15 @@ import java.awt.event.ItemListener; import java.awt.peer.ListPeer; import java.awt.peer.ComponentPeer; import java.util.Vector; +import javax.accessibility.Accessible; /** * Class that implements a listbox widget * * @author Aaron M. Renn (arenn@urbanophile.com) */ -public class List extends Component implements ItemSelectable, Serializable +public class List extends Component + implements ItemSelectable, Serializable, Accessible { /* @@ -113,6 +115,8 @@ private ActionListener action_listeners; /** * Initializes a new instance of <code>List</code> with no visible lines * and multi-select disabled. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public List() @@ -127,6 +131,8 @@ List() * number of visible lines and multi-select disabled. * * @param lines The number of visible lines in the list. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public List(int rows) @@ -143,12 +149,17 @@ List(int rows) * @param lines The number of visible lines in the list. * @param multipleMode <code>true</code> if multiple lines can be selected * simultaneously, <code>false</code> otherwise. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public List(int rows, boolean multipleMode) { this.rows = rows; this.multipleMode = multipleMode; + + if (GraphicsEnvironment.isHeadless()) + throw new HeadlessException (); } /*************************************************************************/ diff --git a/libjava/java/awt/Menu.java b/libjava/java/awt/Menu.java index 18d63be7490..326101b76e5 100644 --- a/libjava/java/awt/Menu.java +++ b/libjava/java/awt/Menu.java @@ -95,6 +95,8 @@ static final MenuItem separator = new MenuItem("-"); /** * Initializes a new instance of <code>Menu</code> with no label and that * is not a tearoff; + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public Menu() @@ -108,6 +110,8 @@ Menu() * that has the specified label. * * @param label The menu label. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public Menu(String label) @@ -124,6 +128,8 @@ Menu(String label) * @param label The label for this menu * @param isTearOff <code>true</code> if this menu is a tear off menu, * <code>false</code> otherwise. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public Menu(String label, boolean isTearOff) @@ -134,6 +140,9 @@ Menu(String label, boolean isTearOff) if (label.equals("Help")) isHelpMenu = true; + + if (GraphicsEnvironment.isHeadless()) + throw new HeadlessException (); } /*************************************************************************/ diff --git a/libjava/java/awt/MenuBar.java b/libjava/java/awt/MenuBar.java index 2e1a9636155..b9ddef9aa1b 100644 --- a/libjava/java/awt/MenuBar.java +++ b/libjava/java/awt/MenuBar.java @@ -86,10 +86,14 @@ private Vector menus = new Vector(); /** * Initializes a new instance of <code>MenuBar</code>. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public MenuBar() { + if (GraphicsEnvironment.isHeadless()) + throw new HeadlessException (); } /*************************************************************************/ diff --git a/libjava/java/awt/MenuComponent.java b/libjava/java/awt/MenuComponent.java index b9c6ea020f1..548aa77937a 100644 --- a/libjava/java/awt/MenuComponent.java +++ b/libjava/java/awt/MenuComponent.java @@ -92,10 +92,14 @@ private static transient Toolkit toolkit = Toolkit.getDefaultToolkit(); /** * Default constructor for subclasses. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected MenuComponent() { + if (GraphicsEnvironment.isHeadless()) + throw new HeadlessException (); } /*************************************************************************/ diff --git a/libjava/java/awt/PopupMenu.java b/libjava/java/awt/PopupMenu.java index 9553b87f10a..d0f1980472b 100644 --- a/libjava/java/awt/PopupMenu.java +++ b/libjava/java/awt/PopupMenu.java @@ -65,6 +65,9 @@ private static final long serialVersionUID = -4620452533522760060L; /** * Initializes a new instance of <code>PopupMenu</code>. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() + * returns true. */ public PopupMenu() @@ -78,11 +81,17 @@ PopupMenu() * label. * * @param label The label for this popup menu. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() + * returns true. */ public PopupMenu(String label) { super(label); + + if (GraphicsEnvironment.isHeadless()) + throw new HeadlessException (); } /*************************************************************************/ diff --git a/libjava/java/awt/ScrollPane.java b/libjava/java/awt/ScrollPane.java index e558d0bc23f..045600cddf2 100644 --- a/libjava/java/awt/ScrollPane.java +++ b/libjava/java/awt/ScrollPane.java @@ -41,6 +41,8 @@ package java.awt; import java.awt.peer.ScrollPanePeer; import java.awt.peer.ContainerPeer; import java.awt.peer.ComponentPeer; +import java.io.Serializable; +import javax.accessibility.Accessible; /** * This widget provides a scrollable region that allows a single @@ -48,7 +50,7 @@ import java.awt.peer.ComponentPeer; * * @author Aaron M. Renn (arenn@urbanophile.com) */ -public class ScrollPane extends Container implements java.io.Serializable +public class ScrollPane extends Container implements Accessible, Serializable { /* @@ -113,6 +115,8 @@ private Point scrollPosition = new Point(0, 0); /** * Initializes a new instance of <code>ScrollPane</code> with a default * scrollbar policy of <code>SCROLLBARS_AS_NEEDED</code>. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public ScrollPane() @@ -128,10 +132,15 @@ ScrollPane() * * @param scrollbarDisplayPolicy When to display scrollbars, which must * be one of the constants defined in this class. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public ScrollPane(int scrollbarDisplayPolicy) { + if (GraphicsEnvironment.isHeadless ()) + throw new HeadlessException (); + this.scrollbarDisplayPolicy = scrollbarDisplayPolicy; if (scrollbarDisplayPolicy != SCROLLBARS_ALWAYS diff --git a/libjava/java/awt/Scrollbar.java b/libjava/java/awt/Scrollbar.java index 1f1875955bf..4bdc3166ad9 100644 --- a/libjava/java/awt/Scrollbar.java +++ b/libjava/java/awt/Scrollbar.java @@ -1,5 +1,5 @@ /* Scrollbar.java -- AWT Scrollbar widget - Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,9 +40,10 @@ package java.awt; import java.awt.peer.ScrollbarPeer; import java.awt.peer.ComponentPeer; - import java.awt.event.AdjustmentListener; import java.awt.event.AdjustmentEvent; +import java.io.Serializable; +import javax.accessibility.Accessible; /** * This class implements a scrollbar widget. @@ -50,8 +51,9 @@ import java.awt.event.AdjustmentEvent; * @author Aaron M. Renn (arenn@urbanophile.com) * @author Tom Tromey <tromey@cygnus.com> */ -public class Scrollbar extends Component implements Adjustable, - java.io.Serializable +public class Scrollbar extends Component implements Accessible, + Adjustable, + Serializable { // FIXME: Serialization readObject/writeObject @@ -126,7 +128,9 @@ private AdjustmentListener adjustment_listeners; /** * Initializes a new instance of <code>Scrollbar</code> with a - * veritical orientation and default values for all other parameters. + * vertical orientation and default values for all other parameters. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true, */ public Scrollbar() @@ -145,6 +149,7 @@ Scrollbar() * * @param orientation The orientation of this scrollbar. * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true, * @exception IllegalArgumentException If the orientation value is not valid. */ public @@ -168,12 +173,16 @@ Scrollbar(int orientation) throws IllegalArgumentException * @param minimum The minimum value of the scrollbar. * @param maximum The maximum value of the scrollbar. * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true, * @exception IllegalArgumentException If the orientation value is not valid. */ public Scrollbar(int orientation, int value, int visibleAmount, int minimum, int maximum) throws IllegalArgumentException { + if (GraphicsEnvironment.isHeadless()) + throw new HeadlessException (); + if ((orientation != HORIZONTAL) && (orientation != VERTICAL)) throw new IllegalArgumentException("Bad orientation value: " + orientation); diff --git a/libjava/java/awt/TextArea.java b/libjava/java/awt/TextArea.java index 799656ec554..f164add49a1 100644 --- a/libjava/java/awt/TextArea.java +++ b/libjava/java/awt/TextArea.java @@ -109,6 +109,8 @@ private int scrollbarVisibility; * Initialize a new instance of <code>TextArea</code> that is empty * and is one row and one column. Both horizontal and vertical * scrollbars will be used. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true, */ public TextArea() @@ -124,6 +126,8 @@ TextArea() * scrollbars will be used. * * @param text The text to display in this text area. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true, */ public TextArea(String text) @@ -140,6 +144,8 @@ TextArea(String text) * * @param rows The number of rows in this text area. * @param columns The number of columns in this text area. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true, */ public TextArea(int rows, int columns) @@ -156,6 +162,8 @@ TextArea(int rows, int columns) * @param text The text to display in this text area. * @param rows The number of rows in this text area. * @param columns The number of columns in this text area. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true, */ public TextArea(String text, int rows, int columns) @@ -174,12 +182,17 @@ TextArea(String text, int rows, int columns) * @param rows The number of rows in this text area. * @param columns The number of columns in this text area. * @param scrollbarVisibility Which scrollbars to display. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true, */ public TextArea(String text, int rows, int columns, int scrollbarVisibility) { super(text); + if (GraphicsEnvironment.isHeadless()) + throw new HeadlessException (); + if ((rows < 1) || (columns < 0)) throw new IllegalArgumentException("Bad row or column value"); diff --git a/libjava/java/awt/TextComponent.java b/libjava/java/awt/TextComponent.java index 5ba80edc1da..6dc904cc8b1 100644 --- a/libjava/java/awt/TextComponent.java +++ b/libjava/java/awt/TextComponent.java @@ -291,10 +291,18 @@ getCaretPosition() * Sets the caret position to the specified value. * * @param caretPosition The new caret position. + * + * @exception IllegalArgumentException If the value supplied for position + * is less than zero. + * + * @since 1.1 */ public synchronized void setCaretPosition(int caretPosition) { + if (caretPosition < 0) + throw new IllegalArgumentException (); + TextComponentPeer tcp = (TextComponentPeer)getPeer(); if (tcp != null) tcp.setCaretPosition(caretPosition); diff --git a/libjava/java/awt/TextField.java b/libjava/java/awt/TextField.java index 28d444ce95f..0106d77e3ad 100644 --- a/libjava/java/awt/TextField.java +++ b/libjava/java/awt/TextField.java @@ -84,9 +84,11 @@ private ActionListener action_listeners; * Constructors */ -/* +/** * Initializes a new instance of <code>TextField</code> that is empty * and has one column. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true, */ public TextField() @@ -102,6 +104,8 @@ TextField() * length of the text string. * * @param text The text to display in the field. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true, */ public TextField(String text) @@ -116,6 +120,8 @@ TextField(String text) * and has the specified number of columns. * * @param columns The number of columns in the text field. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true, */ public TextField(int columns) @@ -131,12 +137,17 @@ TextField(int columns) * * @param text The text to display in the field. * @param columns The number of columns in the field. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true, */ public TextField(String text, int columns) { super(text); this.columns = columns; + + if (GraphicsEnvironment.isHeadless()) + throw new HeadlessException (); } /*************************************************************************/ diff --git a/libjava/java/awt/Toolkit.java b/libjava/java/awt/Toolkit.java index fb5e020a29e..da9bc0e4e4b 100644 --- a/libjava/java/awt/Toolkit.java +++ b/libjava/java/awt/Toolkit.java @@ -123,7 +123,10 @@ public abstract class Toolkit * Creates a peer object for the specified <code>Button</code>. * * @param target The <code>Button</code> to create the peer for. + * * @return The peer for the specified <code>Button</code> object. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract ButtonPeer createButton(Button target); @@ -132,6 +135,8 @@ public abstract class Toolkit * * @param target The <code>TextField</code> to create the peer for. * @return The peer for the specified <code>TextField</code> object. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract TextFieldPeer createTextField(TextField target); @@ -140,6 +145,8 @@ public abstract class Toolkit * * @param target The <code>Label</code> to create the peer for. * @return The peer for the specified <code>Label</code> object. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract LabelPeer createLabel(Label target); @@ -148,6 +155,8 @@ public abstract class Toolkit * * @param target The <code>List</code> to create the peer for. * @return The peer for the specified <code>List</code> object. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract ListPeer createList(List target); @@ -156,6 +165,8 @@ public abstract class Toolkit * * @param target The <code>Checkbox</code> to create the peer for. * @return The peer for the specified <code>Checkbox</code> object. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract CheckboxPeer createCheckbox(Checkbox target); @@ -164,6 +175,8 @@ public abstract class Toolkit * * @param target The <code>Scrollbar</code> to create the peer for. * @return The peer for the specified <code>Scrollbar</code> object. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract ScrollbarPeer createScrollbar(Scrollbar target); @@ -172,6 +185,8 @@ public abstract class Toolkit * * @param target The <code>ScrollPane</code> to create the peer for. * @return The peer for the specified <code>ScrollPane</code> object. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract ScrollPanePeer createScrollPane(ScrollPane target); @@ -180,6 +195,8 @@ public abstract class Toolkit * * @param target The <code>TextArea</code> to create the peer for. * @return The peer for the specified <code>TextArea</code> object. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract TextAreaPeer createTextArea(TextArea target); @@ -188,6 +205,8 @@ public abstract class Toolkit * * @param target The <code>Choice</code> to create the peer for. * @return The peer for the specified <code>Choice</code> object. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract ChoicePeer createChoice(Choice target); @@ -196,6 +215,8 @@ public abstract class Toolkit * * @param target The <code>Frame</code> to create the peer for. * @return The peer for the specified <code>Frame</code> object. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract FramePeer createFrame(Frame target); @@ -220,6 +241,8 @@ public abstract class Toolkit * * @param target The <code>Window</code> to create the peer for. * @return The peer for the specified <code>Window</code> object. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract WindowPeer createWindow(Window target); @@ -228,6 +251,8 @@ public abstract class Toolkit * * @param target The dialog to create the peer for * @return The peer for the specified font name. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract DialogPeer createDialog(Dialog target); @@ -236,6 +261,8 @@ public abstract class Toolkit * * @param target The <code>MenuBar</code> to create the peer for. * @return The peer for the specified <code>MenuBar</code> object. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract MenuBarPeer createMenuBar(MenuBar target); @@ -244,6 +271,8 @@ public abstract class Toolkit * * @param target The <code>Menu</code> to create the peer for. * @return The peer for the specified <code>Menu</code> object. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract MenuPeer createMenu(Menu target); @@ -252,6 +281,8 @@ public abstract class Toolkit * * @param target The <code>PopupMenu</code> to create the peer for. * @return The peer for the specified <code>PopupMenu</code> object. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract PopupMenuPeer createPopupMenu(PopupMenu target); @@ -260,6 +291,8 @@ public abstract class Toolkit * * @param target The <code>MenuItem</code> to create the peer for. * @return The peer for the specified <code>MenuItem</code> object. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract MenuItemPeer createMenuItem(MenuItem target); @@ -268,6 +301,8 @@ public abstract class Toolkit * * @param target The <code>FileDialog</code> to create the peer for. * @return The peer for the specified <code>FileDialog</code> object. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract FileDialogPeer createFileDialog(FileDialog target); @@ -276,6 +311,8 @@ public abstract class Toolkit * * @param target The <code>CheckboxMenuItem</code> to create the peer for. * @return The peer for the specified <code>CheckboxMenuItem</code> object. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected abstract CheckboxMenuItemPeer createCheckboxMenuItem(CheckboxMenuItem target); @@ -310,6 +347,8 @@ public abstract class Toolkit * the interface used by the <code>SystemColors</code> class. * * @param colors The array to copy the system colors into. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected void loadSystemColors(int systemColors[]) { @@ -318,6 +357,8 @@ public abstract class Toolkit /** * @since 1.4 + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public void setDynamicLayout(boolean dynamic) { @@ -325,6 +366,8 @@ public abstract class Toolkit /** * @since 1.4 + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ protected boolean isDynamicLayoutSet() { @@ -333,6 +376,8 @@ public abstract class Toolkit /** * @since 1.4 + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public boolean isDynamicLayoutActive() { @@ -343,6 +388,8 @@ public abstract class Toolkit * Returns the dimensions of the screen in pixels. * * @return The dimensions of the screen in pixels. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public abstract Dimension getScreenSize(); @@ -350,10 +397,14 @@ public abstract class Toolkit * Returns the screen resolution in dots per square inch. * * @return The screen resolution in dots per square inch. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public abstract int getScreenResolution(); /** + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. + * * @since 1.4 */ public Insets getScreenInsets(GraphicsConfiguration gc) @@ -396,6 +447,7 @@ public abstract class Toolkit * if the property is not set. * * @return An instance of the system default toolkit. + * * @throws AWTError If the toolkit cannot be loaded. */ public static Toolkit getDefaultToolkit() @@ -450,6 +502,7 @@ public abstract class Toolkit * @param height The height of the image. * @param observer The observer to receive events about the preparation * process. + * * @return <code>true</code> if the image is already prepared for rendering, * <code>false</code> otherwise. */ @@ -465,6 +518,7 @@ public abstract class Toolkit * @param height The height of the image. * @param observer The observer to receive events about the preparation * process. + * * @return A union of the bitmasks from * <code>java.awt.image.ImageObserver</code> that indicates the current * state of the imaging readying process. @@ -476,6 +530,7 @@ public abstract class Toolkit * Creates an image using the specified <code>ImageProducer</code> * * @param producer The <code>ImageProducer</code> to create the image from. + * * @return The created image. */ public abstract Image createImage(ImageProducer producer); @@ -485,6 +540,7 @@ public abstract class Toolkit * a recognized format. Supported formats vary from toolkit to toolkit. * * @param data The raw image data. + * * @return The created image. */ public Image createImage(byte[] data) @@ -500,6 +556,7 @@ public abstract class Toolkit * @param data The raw image data. * @param offset The offset into the data where the image data starts. * @param len The length of the image data. + * * @return The created image. */ public abstract Image createImage(byte[] data, int offset, int len); @@ -511,6 +568,7 @@ public abstract class Toolkit * @param frame The window initiating the print job. * @param title The print job title. * @param props The print job properties. + * * @return The requested print job, or <code>null</code> if the job * was cancelled. */ @@ -536,10 +594,14 @@ public abstract class Toolkit * Returns the system clipboard. * * @return THe system clipboard. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public abstract Clipboard getSystemClipboard(); /** + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. + * * @since 1.4 */ public Clipboard getSystemSelection() @@ -553,6 +615,8 @@ public abstract class Toolkit * to change the default. * * @return The key mask for the menu accelerator key. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. */ public int getMenuShortcutKeyMask() { diff --git a/libjava/java/awt/Window.java b/libjava/java/awt/Window.java index b8befaf0507..31e6b573f53 100644 --- a/libjava/java/awt/Window.java +++ b/libjava/java/awt/Window.java @@ -86,32 +86,56 @@ public class Window extends Container * parent. The window will initially be invisible. * * @param parent The owning <code>Frame</code> of this window. + * + * @exception IllegalArgumentException If the owner's GraphicsConfiguration + * is not from a screen device, or if owner is null; this exception is always + * thrown when GraphicsEnvironment.isHeadless returns true. */ public Window(Frame owner) { - this((Window) owner); + this (owner, owner.getGraphicsConfiguration ()); } - /** @since 1.2 */ + /** + * Initializes a new instance of <code>Window</code> with the specified + * parent. The window will initially be invisible. + * + * @exception IllegalArgumentException If the owner's GraphicsConfiguration + * is not from a screen device, or if owner is null; this exception is always + * thrown when GraphicsEnvironment.isHeadless returns true. + * + * @since 1.2 + */ public Window(Window owner) { - this(); - if (owner == null) - throw new IllegalArgumentException("owner must not be null"); - - this.parent = owner; - - // FIXME: add to owner's "owned window" list - //owner.owned.add(this); // this should be a weak reference + this (owner, owner.getGraphicsConfiguration ()); } - /** @since 1.3 */ + /** + * Initializes a new instance of <code>Window</code> with the specified + * parent. The window will initially be invisible. + * + * @exception IllegalArgumentException If owner is null or if gc is not from a + * screen device; this exception is always thrown when + * GraphicsEnvironment.isHeadless returns true. + * + * @since 1.3 + */ public Window(Window owner, GraphicsConfiguration gc) { - this(owner); + this (); + + if (owner == null) + throw new IllegalArgumentException ("owner must not be null"); + this.parent = owner; + + // FIXME: add to owner's "owned window" list + //owner.owned.add(this); // this should be a weak reference + /* FIXME: Security check SecurityManager.checkTopLevelWindow(...) + */ if (gc != null && gc.getDevice().getType() != GraphicsDevice.TYPE_RASTER_SCREEN) @@ -119,11 +143,10 @@ public class Window extends Container if (gc == null) graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment() - .getDefaultScreenDevice() - .getDefaultConfiguration(); + .getDefaultScreenDevice() + .getDefaultConfiguration(); else - */ - graphicsConfiguration = gc; + graphicsConfiguration = gc; } GraphicsConfiguration getGraphicsConfigurationImpl() @@ -134,6 +157,12 @@ public class Window extends Container return super.getGraphicsConfigurationImpl(); } + /** + * Disposes of the input methods and context, and removes the WeakReference + * which formerly pointed to this Window from the parent's owned Window list. + * + * @exception Throwable The Exception raised by this method. + */ protected void finalize() throws Throwable { // FIXME: remove from owner's "owned window" list (Weak References) @@ -185,7 +214,7 @@ public class Window extends Container public void hide() { - // FIXME: call hide() on amy "owned" children here. + // FIXME: call hide() on any "owned" children here. super.hide(); } @@ -233,8 +262,8 @@ public class Window extends Container { if (peer != null) { - WindowPeer wp = (WindowPeer) peer; - wp.toFront(); + WindowPeer wp = (WindowPeer) peer; + wp.toFront(); } } @@ -265,12 +294,12 @@ public class Window extends Container if (!secure) { if (warningString != null) - return warningString; - else - { - String warning = System.getProperty("awt.appletWarning"); - return warning; - } + return warningString; + else + { + String warning = System.getProperty("awt.appletWarning"); + return warning; + } } return null; } @@ -338,6 +367,11 @@ public class Window extends Container windowListener = AWTEventMulticaster.remove(windowListener, listener); } + /** + * Returns an array of all the window listeners registered on this window. + * + * @since 1.4 + */ public synchronized WindowListener[] getWindowListeners() { return (WindowListener[]) @@ -345,7 +379,16 @@ public class Window extends Container WindowListener.class); } - /** @since 1.3 */ + /** + * Returns an array of all the objects currently registered as FooListeners + * upon this Window. FooListeners are registered using the addFooListener + * method. + * + * @exception ClassCastException If listenerType doesn't specify a class or + * interface that implements java.util.EventListener. + * + * @since 1.3 + */ public EventListener[] getListeners(Class listenerType) { if (listenerType == WindowListener.class) diff --git a/libjava/java/awt/color/CMMException.java b/libjava/java/awt/color/CMMException.java index 0d146e6c6eb..a0948ef27eb 100644 --- a/libjava/java/awt/color/CMMException.java +++ b/libjava/java/awt/color/CMMException.java @@ -44,7 +44,7 @@ package java.awt.color; * @author Eric Blake <ebb9@email.byu.edu> * @status updated to 1.4 */ -public class CMMException extends Exception +public class CMMException extends RuntimeException { /** * Compatible with JDK 1.2+. diff --git a/libjava/java/awt/color/ColorSpace.java b/libjava/java/awt/color/ColorSpace.java index 4f68fabcb7b..8bf0a8196c0 100644 --- a/libjava/java/awt/color/ColorSpace.java +++ b/libjava/java/awt/color/ColorSpace.java @@ -46,7 +46,7 @@ import java.io.Serializable; * @author Rolf W. Rasmussen <rolfwr@ii.uib.no> * @since 1.2 */ -public abstract class ColorSpace +public abstract class ColorSpace implements Serializable { /** * Compatible with JDK 1.2+. @@ -131,6 +131,13 @@ public abstract class ColorSpace return false; } + /** + * Transforms a color value assumed to be in this ColorSpace into a value in + * the default CS_sRGB color space. + * + * @exception ArrayIndexOutOfBoundsException If array length is not at least + * the number of components in this ColorSpace. + */ public abstract float[] toRGB(float[] colorvalue); public abstract float[] fromRGB(float[] rgbvalue); diff --git a/libjava/java/awt/color/ICC_ColorSpace.java b/libjava/java/awt/color/ICC_ColorSpace.java index 1a144dbfbd2..2b7016742c9 100644 --- a/libjava/java/awt/color/ICC_ColorSpace.java +++ b/libjava/java/awt/color/ICC_ColorSpace.java @@ -81,6 +81,12 @@ public class ICC_ColorSpace extends ColorSpace */ private boolean needScaleInit; + /** + * Constructs a new ICC_ColorSpace from an ICC_Profile object. + * + * @exception IllegalArgumentException If profile is inappropriate for + * representing a ColorSpace. + */ public ICC_ColorSpace(ICC_Profile profile) { super(CS_sRGB, profile.getNumComponents()); @@ -92,18 +98,45 @@ public class ICC_ColorSpace extends ColorSpace return thisProfile; } + /** + * Transforms a color value assumed to be in this ColorSpace into a value in + * the default CS_sRGB color space. + * + * @exception ArrayIndexOutOfBoundsException If array length is not at least + * the number of components in this ColorSpace. + */ public float[] toRGB(float[] colorvalue) { + if (colorvalue.length < numComponents) + throw new IllegalArgumentException (); + // FIXME: Always assumes sRGB: return colorvalue; } + /** + * Transforms a color value assumed to be in the default CS_sRGB color space + * into this ColorSpace. + * + * @exception ArrayIndexOutOfBoundsException If array length is not at + * least 3. + */ public float[] fromRGB(float[] rgbvalue) { + if (rgbvalue.length < 3) + throw new IllegalArgumentException (); + // FIXME: Always assumes sRGB: return rgbvalue; } + /** + * Transforms a color value assumed to be in this ColorSpace into the + * CS_CIEXYZ conversion color space. + * + * @exception ArrayIndexOutOfBoundsException If array length is not at + * least the number of components in this ColorSpace. + */ public float[] toCIEXYZ(float[] colorvalue) { // FIXME: Not implemented diff --git a/libjava/java/awt/color/ICC_Profile.java b/libjava/java/awt/color/ICC_Profile.java index 7adaac06472..eb534ebffca 100644 --- a/libjava/java/awt/color/ICC_Profile.java +++ b/libjava/java/awt/color/ICC_Profile.java @@ -245,7 +245,7 @@ public class ICC_Profile implements Serializable write(new FileOutputStream(filename)); } - public void write(OutputStream out) + public void write(OutputStream out) throws IOException { throw new Error("not implemented"); } diff --git a/libjava/java/awt/color/ProfileDataException.java b/libjava/java/awt/color/ProfileDataException.java index 130781faf9b..89f47a207e1 100644 --- a/libjava/java/awt/color/ProfileDataException.java +++ b/libjava/java/awt/color/ProfileDataException.java @@ -45,7 +45,7 @@ package java.awt.color; * @author Eric Blake <ebb9@email.byu.edu> * @status updated to 1.4 */ -public class ProfileDataException extends Exception +public class ProfileDataException extends RuntimeException { /** * Compatible with JDK 1.2+. diff --git a/libjava/java/awt/datatransfer/Clipboard.java b/libjava/java/awt/datatransfer/Clipboard.java index 6ef9e70b6aa..93bba7c1a3d 100644 --- a/libjava/java/awt/datatransfer/Clipboard.java +++ b/libjava/java/awt/datatransfer/Clipboard.java @@ -103,6 +103,8 @@ getName() * Returns the contents of the clipboard. * * @param requestor The object requesting the contents. + * + * @exception IllegalStateException If the clipboard is currently unavailable */ public synchronized Transferable getContents(Object requestor) @@ -120,6 +122,8 @@ getContents(Object requestor) * * @param contents The new clipboard contents. * @param owner The new clipboard owner + * + * @exception IllegalStateException If the clipboard is currently unavailable */ public synchronized void setContents(Transferable contents, ClipboardOwner owner) diff --git a/libjava/java/awt/datatransfer/DataFlavor.java b/libjava/java/awt/datatransfer/DataFlavor.java index 85f6ae5d455..e1500a7926c 100644 --- a/libjava/java/awt/datatransfer/DataFlavor.java +++ b/libjava/java/awt/datatransfer/DataFlavor.java @@ -281,6 +281,7 @@ DataFlavor(Class representationClass, String humanPresentableName) * * @exception IllegalArgumentException If the representation class * specified cannot be loaded. + * @exception ClassNotFoundException If the class is not loaded. */ public DataFlavor(String mimeType, String humanPresentableName, @@ -504,6 +505,8 @@ setHumanPresentableName(String humanPresentableName) * * @return <code>true</code> if the MIME type is equal to this object's * MIME type, <code>false</code> otherwise. + * + * @exception NullPointerException If mimeType is null. */ public final boolean isMimeTypeEqual(String mimeType) @@ -652,6 +655,10 @@ isFlavorJavaFileListType() * Returns a copy of this object. * * @return A copy of this object. + * + * @exception CloneNotSupportedException If the object's class does not support + * the Cloneable interface. Subclasses that override the clone method can also + * throw this exception to indicate that an instance cannot be cloned. */ public Object clone() @@ -813,6 +820,8 @@ normalizeMimeType(String type) * Serialize this class. * * @param stream The <code>ObjectOutput</code> stream to serialize to. + * + * @exception IOException If an error occurs. */ public void writeExternal(ObjectOutput stream) throws IOException @@ -826,6 +835,10 @@ writeExternal(ObjectOutput stream) throws IOException * De-serialize this class. * * @param stream The <code>ObjectInput</code> stream to deserialize from. + * + * @exception IOException If an error ocurs. + * @exception ClassNotFoundException If the class for an object being restored + * cannot be found. */ public void readExternal(ObjectInput stream) throws IOException, ClassNotFoundException @@ -950,6 +963,10 @@ selectBestTextFlavor(DataFlavor[] availableFlavors) * * @param transferable The <code>Transferable</code> for which a text * <code>Reader</code> is requested. + * + * @exception IllegalArgumentException If the representation class is not one + * of the seven listed above or the Transferable has null data. + * @exception NullPointerException If the Transferable is null. * @exception UnsupportedFlavorException when the transferable doesn't * support this <code>DataFlavor</code>. Or if the representable class * isn't a (subclass of) <code>Reader</code>, <code>String</code>, diff --git a/libjava/java/awt/datatransfer/FlavorMap.java b/libjava/java/awt/datatransfer/FlavorMap.java index 96b160842d9..a3926150631 100644 --- a/libjava/java/awt/datatransfer/FlavorMap.java +++ b/libjava/java/awt/datatransfer/FlavorMap.java @@ -41,42 +41,35 @@ package java.awt.datatransfer; import java.util.Map; /** - * This interface maps between native platform type names and DataFlavors. - * - * @author Aaron M. Renn (arenn@urbanophile.com) - */ + * This interface maps between native platform type names and DataFlavors. + * + * @author Aaron M. Renn (arenn@urbanophile.com) + */ public interface FlavorMap { + /** + * Maps the specified <code>DataFlavor</code> objects to the native + * data type name. The returned <code>Map</code> has keys that are + * the data flavors and values that are strings. The returned map + * may be modified. This can be useful for implementing nested mappings. + * + * @param flavors An array of data flavors to map + * or null for all data flavors. + * + * @return A <code>Map</code> of native data types. + */ + public abstract Map getNativesForFlavors (DataFlavor[] flavors); -/** - * Maps the specified <code>DataFlavor</code> objects to the native - * data type name. The returned <code>Map</code> has keys that are - * the data flavors and values that are strings. The returned map - * may be modified. This can be useful for implementing nested mappings. - * - * @param flavors An array of data flavors to map - * or null for all data flavors. - * - * @return A <code>Map</code> of native data types. - */ -public abstract Map -getNativesForFlavors(DataFlavor[] flavors); - -/*************************************************************************/ - -/** - * Maps the specified native type names to <code>DataFlavor</code>'s. - * The returned <code>Map</code> has keys that are strings and values - * that are <code>DataFlavor</code>'s. The returned map may be - * modified. This can be useful for implementing nested mappings. - * - * @param natives An array of native types to map - * or null for all native types. - * - * @return A <code>Map</code> of data flavors. - */ -public abstract Map -getFlavorsForNatives(String[] natives); - -} // interface FlavorMap - + /** + * Maps the specified native type names to <code>DataFlavor</code>'s. + * The returned <code>Map</code> has keys that are strings and values + * that are <code>DataFlavor</code>'s. The returned map may be + * modified. This can be useful for implementing nested mappings. + * + * @param natives An array of native types to map + * or null for all native types. + * + * @return A <code>Map</code> of data flavors. + */ + public abstract Map getFlavorsForNatives (String[] natives); +} diff --git a/libjava/java/awt/datatransfer/SystemFlavorMap.java b/libjava/java/awt/datatransfer/SystemFlavorMap.java index 50064db4c92..7d914120e8f 100644 --- a/libjava/java/awt/datatransfer/SystemFlavorMap.java +++ b/libjava/java/awt/datatransfer/SystemFlavorMap.java @@ -40,6 +40,7 @@ package java.awt.datatransfer; import java.util.HashMap; import java.util.Map; +import java.util.List; /** * This class maps between native platform type names and DataFlavors. @@ -47,134 +48,122 @@ import java.util.Map; * XXX - The current implementation does no mapping at all. * * @author Mark Wielaard (mark@klomp.org) - */ -public final class SystemFlavorMap implements FlavorMap -{ - -/** - * The default (instance) flavor map. - */ -private static FlavorMap defaultFlavorMap; - -/** - * Private constructor. - */ -private SystemFlavorMap() -{ -} - -/*************************************************************************/ - -/** - * Maps the specified <code>DataFlavor</code> objects to the native - * data type name. The returned <code>Map</code> has keys that are - * the data flavors and values that are strings. The returned map - * may be modified. This can be useful for implementing nested mappings. - * - * @param flavors An array of data flavors to map - * or null for all data flavors. * - * @return A <code>Map</code> of native data types to data flavors. - */ -public Map -getNativesForFlavors(DataFlavor[] flavors) -{ - return(new HashMap()); -} - -/*************************************************************************/ - -/** - * Maps the specified native type names to <code>DataFlavor</code>'s. - * The returned <code>Map</code> has keys that are strings and values - * that are <code>DataFlavor</code>'s. The returned map may be - * modified. This can be useful for implementing nested mappings. - * - * @param natives An array of native types to map - * or null for all native types. - * - * @return A <code>Map</code> of data flavors to native type names. - */ -public Map -getFlavorsForNatives(String[] natives) -{ - return(new HashMap()); -} - -/*************************************************************************/ - -/** - * Returns the default (instance) (System)FlavorMap. - */ -public static FlavorMap -getDefaultFlavorMap() -{ - if (defaultFlavorMap == null) - defaultFlavorMap = new SystemFlavorMap(); - - return(defaultFlavorMap); -} - -/*************************************************************************/ - -/** - * Returns the native type name for the given java mime type. - */ -public static String -encodeJavaMIMEType(String mime) -{ - return null; -} - -/*************************************************************************/ - -/** - * Returns the native type name for the given data flavor. - */ -public static String -encodeDataFlavor(DataFlavor df) -{ - return null; -} - -/*************************************************************************/ - -/** - * Returns true if the native type name can be represented as - * a java mime type. - */ -public static boolean -isJavaMIMEType(String name) -{ - return(false); -} - -/*************************************************************************/ - -/** - * Returns the java mime type for the given the native type name. + * @since 1.2 */ -public static String -decodeJavaMIMEType(String name) +public final class SystemFlavorMap implements FlavorMap, FlavorTable { - return null; -} - -/*************************************************************************/ - -/** - * Returns the data flavor given the native type name - * or null when no such data flavor exists. - */ -public static DataFlavor -decodeDataFlavor(String name) throws ClassNotFoundException -{ - String javaMIMEType = decodeJavaMIMEType(name); - if (javaMIMEType != null) - return(new DataFlavor(javaMIMEType)); - else - return(null); -} + /** + * The default (instance) flavor map. + */ + private static FlavorMap defaultFlavorMap; + + /** + * Private constructor. + */ + private SystemFlavorMap () + { + } + + /** + * Maps the specified <code>DataFlavor</code> objects to the native + * data type name. The returned <code>Map</code> has keys that are + * the data flavors and values that are strings. The returned map + * may be modified. This can be useful for implementing nested mappings. + * + * @param flavors An array of data flavors to map + * or null for all data flavors. + * + * @return A <code>Map</code> of native data types to data flavors. + */ + public Map getNativesForFlavors (DataFlavor[] flavors) + { + return new HashMap(); + } + + /** + * Maps the specified native type names to <code>DataFlavor</code>'s. + * The returned <code>Map</code> has keys that are strings and values + * that are <code>DataFlavor</code>'s. The returned map may be + * modified. This can be useful for implementing nested mappings. + * + * @param natives An array of native types to map + * or null for all native types. + * + * @return A <code>Map</code> of data flavors to native type names. + */ + public Map getFlavorsForNatives (String[] natives) + { + return new HashMap(); + } + + /** + * Returns the default (instance) (System)FlavorMap. + */ + public static FlavorMap getDefaultFlavorMap () + { + if (defaultFlavorMap == null) + defaultFlavorMap = new SystemFlavorMap (); + + return defaultFlavorMap; + } + + /** + * Returns the native type name for the given java mime type. + */ + public static String encodeJavaMIMEType (String mime) + { + return null; + } + + /** + * Returns the native type name for the given data flavor. + */ + public static String encodeDataFlavor (DataFlavor df) + { + return null; + } + + /** + * Returns true if the native type name can be represented as + * a java mime type. + */ + public static boolean isJavaMIMEType (String name) + { + return false; + } + + /** + * Returns the java mime type for the given the native type name. + */ + public static String decodeJavaMIMEType (String name) + { + return null; + } + + /** + * Returns the data flavor given the native type name + * or null when no such data flavor exists. + */ + public static DataFlavor decodeDataFlavor (String name) + throws ClassNotFoundException + { + String javaMIMEType = decodeJavaMIMEType (name); + + if (javaMIMEType != null) + return new DataFlavor (javaMIMEType); + else + return null; + } + + public List getFlavorsForNative (String nat) + { + throw new Error ("Not implemented"); + } + + public List getNativesForFlavor (DataFlavor flav) + { + throw new Error ("Not implemented"); + } } // class SystemFlavorMap - diff --git a/libjava/java/awt/dnd/DragGestureEvent.java b/libjava/java/awt/dnd/DragGestureEvent.java index 84fa1cbb901..3d268820ba7 100644 --- a/libjava/java/awt/dnd/DragGestureEvent.java +++ b/libjava/java/awt/dnd/DragGestureEvent.java @@ -113,15 +113,42 @@ public class DragGestureEvent extends EventObject { return null; } + + /** + * Starts the drag given the initial Cursor to display, the Transferable + * object, and the DragSourceListener to use. + * + * @exception InvalidDnDOperationException If the Drag and Drop system is + * unable to initiate a drag operation, or if the user attempts to start + * a drag while an existing drag operation is still executing. + */ public void startDrag(Cursor dragCursor, Transferable trans) { startDrag(dragCursor, null, null, trans, null); } + + /** + * Starts the drag given the initial Cursor to display, the Transferable + * object, and the DragSourceListener to use. + * + * @exception InvalidDnDOperationException If the Drag and Drop system is + * unable to initiate a drag operation, or if the user attempts to start + * a drag while an existing drag operation is still executing. + */ public void startDrag(Cursor dragCursor, Transferable trans, DragSourceListener l) { startDrag(dragCursor, null, null, trans, l); } + + /** + * Starts the drag given the initial Cursor to display, the Transferable + * object, and the DragSourceListener to use. + * + * @exception InvalidDnDOperationException If the Drag and Drop system is + * unable to initiate a drag operation, or if the user attempts to start + * a drag while an existing drag operation is still executing. + */ public void startDrag(Cursor dragCursor, Image dragImage, Point imageOffset, Transferable trans, DragSourceListener l) { diff --git a/libjava/java/awt/dnd/DragGestureRecognizer.java b/libjava/java/awt/dnd/DragGestureRecognizer.java index 674e26e8a3b..cd204b6fe93 100644 --- a/libjava/java/awt/dnd/DragGestureRecognizer.java +++ b/libjava/java/awt/dnd/DragGestureRecognizer.java @@ -130,6 +130,12 @@ public abstract class DragGestureRecognizer implements Serializable throw new Error("not implemented"); } + /** + * Register a new DragGestureListener. + * + * @exception TooManyListenersException If a DragGestureListener has already + * been added. + */ public void addDragGestureListener(DragGestureListener dgl) throws TooManyListenersException { diff --git a/libjava/java/awt/dnd/DragSource.java b/libjava/java/awt/dnd/DragSource.java index 01cae00a3cf..740235ac83c 100644 --- a/libjava/java/awt/dnd/DragSource.java +++ b/libjava/java/awt/dnd/DragSource.java @@ -40,6 +40,8 @@ package java.awt.dnd; import java.awt.Component; import java.awt.Cursor; +import java.awt.GraphicsEnvironment; +import java.awt.HeadlessException; import java.awt.Image; import java.awt.Point; import java.awt.datatransfer.FlavorMap; @@ -62,10 +64,20 @@ public class DragSource implements Serializable public static final Cursor DefaultMoveNoDrop = null; public static final Cursor DefaultLinkNoDrop = null; + /** + * Initializes the drag source. + * + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. + */ public DragSource() { + if (GraphicsEnvironment.isHeadless()) + throw new HeadlessException (); } + /** + * @exception HeadlessException If GraphicsEnvironment.isHeadless() is true. + */ public static DragSource getDefaultDragSource() { return null; @@ -76,6 +88,13 @@ public class DragSource implements Serializable return false; } + /** + * Start a drag, given the DragGestureEvent that initiated the drag. + * + * @exception InvalidDnDOperationException If the Drag and Drop system is + * unable to initiate a drag operation, or if the user attempts to start + * a drag while an existing drag operation is still executing. + */ public void startDrag(DragGestureEvent trigger, Cursor dragCursor, Image dragImage, Point imageOffset, Transferable trans, DragSourceListener dsl, @@ -83,6 +102,13 @@ public class DragSource implements Serializable { } + /** + * Start a drag, given the DragGestureEvent that initiated the drag. + * + * @exception InvalidDnDOperationException If the Drag and Drop system is + * unable to initiate a drag operation, or if the user attempts to start + * a drag while an existing drag operation is still executing. + */ public void startDrag(DragGestureEvent trigger, Cursor dragCursor, Transferable trans, DragSourceListener dsl, FlavorMap map) @@ -90,6 +116,13 @@ public class DragSource implements Serializable startDrag(trigger, dragCursor, null, null, trans, dsl, map); } + /** + * Start a drag, given the DragGestureEvent that initiated the drag. + * + * @exception InvalidDnDOperationException If the Drag and Drop system is + * unable to initiate a drag operation, or if the user attempts to start + * a drag while an existing drag operation is still executing. + */ public void startDrag(DragGestureEvent trigger, Cursor dragCursor, Image dragImage, Point imageOffset, Transferable trans, DragSourceListener dsl) @@ -97,12 +130,25 @@ public class DragSource implements Serializable startDrag(trigger, dragCursor, dragImage, imageOffset, trans, dsl, null); } + /** + * Start a drag, given the DragGestureEvent that initiated the drag. + * + * @exception InvalidDnDOperationException If the Drag and Drop system is + * unable to initiate a drag operation, or if the user attempts to start + * a drag while an existing drag operation is still executing. + */ public void startDrag(DragGestureEvent trigger, Cursor dragCursor, Transferable trans, DragSourceListener dsl) { startDrag(trigger, dragCursor, null, null, trans, dsl, null); } + /** + * Creates the DragSourceContext to handle this drag. + * + * @exception IllegalArgumentException FIXME + * @exception NullPointerException If dscp, dgl, dragImage or t is null. + */ protected DragSourceContext createDragSourceContext(DragSourceContextPeer peer, DragGestureEvent dge, Cursor cursor, Image image, Point offset, diff --git a/libjava/java/awt/dnd/DropTarget.java b/libjava/java/awt/dnd/DropTarget.java index c469605b8b4..53c09178d32 100644 --- a/libjava/java/awt/dnd/DropTarget.java +++ b/libjava/java/awt/dnd/DropTarget.java @@ -42,10 +42,13 @@ import java.awt.Component; import java.awt.datatransfer.FlavorMap; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.io.Serializable; +import java.util.EventListener; import java.util.TooManyListenersException; /** STUB CLASS ONLY */ public class DropTarget + implements DropTargetListener, EventListener, Serializable { protected static class DropTargetAutoScroller implements ActionListener @@ -67,6 +70,9 @@ public class DropTarget } } + // FIXME: check the correctness of default value. + private boolean isActive = false; + /** * FIXME * @@ -133,11 +139,12 @@ public class DropTarget public void setActive(boolean isActive) { + this.isActive = isActive; } public boolean isActive() { - return false; + return this.isActive; } /** diff --git a/libjava/java/awt/event/WindowEvent.java b/libjava/java/awt/event/WindowEvent.java index ca51ba545b4..6e40d5165b8 100644 --- a/libjava/java/awt/event/WindowEvent.java +++ b/libjava/java/awt/event/WindowEvent.java @@ -109,7 +109,7 @@ public class WindowEvent extends ComponentEvent public static final int WINDOW_STATE_CHANGED = 209; /** This is the last id in the range of event ids used by this class. */ - public static final int WINDOW_LAST = 207; + public static final int WINDOW_LAST = 209; /** * The other Window involved in a focus or activation change. For diff --git a/libjava/java/awt/geom/Dimension2D.java b/libjava/java/awt/geom/Dimension2D.java index e111e5434cf..dbbdf6b25b3 100644 --- a/libjava/java/awt/geom/Dimension2D.java +++ b/libjava/java/awt/geom/Dimension2D.java @@ -86,6 +86,7 @@ public abstract class Dimension2D implements Cloneable * may occur. * * @param d the dimension containing the new values + * * @throws NullPointerException if d is null */ public void setSize(Dimension2D d) @@ -98,6 +99,10 @@ public abstract class Dimension2D implements Cloneable * as this one. * * @return the clone + * + * @exception OutOfMemoryError If there is not enough memory available. + * + * @since 1.2 */ public Object clone() { diff --git a/libjava/java/awt/geom/GeneralPath.java b/libjava/java/awt/geom/GeneralPath.java index 267db6ca0e3..6c1b578fc19 100644 --- a/libjava/java/awt/geom/GeneralPath.java +++ b/libjava/java/awt/geom/GeneralPath.java @@ -338,6 +338,10 @@ public final class GeneralPath implements Shape, Cloneable * this one. * * @return the clone + * + * @exception OutOfMemoryError If there is not enough memory available. + * + * @since 1.2 */ public Object clone() { diff --git a/libjava/java/awt/geom/Line2D.java b/libjava/java/awt/geom/Line2D.java index 9e551103332..d2dd65c4341 100644 --- a/libjava/java/awt/geom/Line2D.java +++ b/libjava/java/awt/geom/Line2D.java @@ -752,6 +752,10 @@ public abstract class Line2D implements Shape, Cloneable * this one. * * @return the clone + * + * @exception OutOfMemoryError If there is not enough memory available. + * + * @since 1.2 */ public Object clone() { diff --git a/libjava/java/awt/geom/PathIterator.java b/libjava/java/awt/geom/PathIterator.java index 6cf77d74df2..c23eb351306 100644 --- a/libjava/java/awt/geom/PathIterator.java +++ b/libjava/java/awt/geom/PathIterator.java @@ -84,7 +84,7 @@ public interface PathIterator * (P1), and final interpolated control point (P2): * <pre> * P(t) = B(2,0)*CP + B(2,1)*P1 + B(2,2)*P2 - * 0 <= t <= 1 + * 0 <= t <= 1 * B(n,m) = mth coefficient of nth degree Bernstein polynomial * = C(n,m) * t^(m) * (1 - t)^(n-m) * C(n,m) = Combinations of n things, taken m at a time @@ -100,7 +100,7 @@ public interface PathIterator * (P2), and final interpolated control point (P3): * <pre> * P(t) = B(3,0)*CP + B(3,1)*P1 + B(3,2)*P2 + B(3,3)*P3 - * 0 <= t <= 1 + * 0 <= t <= 1 * B(n,m) = mth coefficient of nth degree Bernstein polynomial * = C(n,m) * t^(m) * (1 - t)^(n-m) * C(n,m) = Combinations of n things, taken m at a time diff --git a/libjava/java/awt/geom/QuadCurve2D.java b/libjava/java/awt/geom/QuadCurve2D.java index 2f1aafad21b..05748fc979d 100644 --- a/libjava/java/awt/geom/QuadCurve2D.java +++ b/libjava/java/awt/geom/QuadCurve2D.java @@ -289,6 +289,10 @@ public abstract class QuadCurve2D implements Shape, Cloneable * this one. * * @return the clone + * + * @exception OutOfMemoryError If there is not enough memory available. + * + * @since 1.2 */ public Object clone() { diff --git a/libjava/java/awt/im/InputMethodHighlight.java b/libjava/java/awt/im/InputMethodHighlight.java index 5398fc5de77..2946d259b91 100644 --- a/libjava/java/awt/im/InputMethodHighlight.java +++ b/libjava/java/awt/im/InputMethodHighlight.java @@ -178,7 +178,7 @@ public class InputMethodHighlight * @return the style map * @since 1.3 */ - public Map getSytle() + public Map getStyle() { return style; } diff --git a/libjava/java/awt/image/ColorModel.java b/libjava/java/awt/image/ColorModel.java index 14a1b2e73b9..fab51667edb 100644 --- a/libjava/java/awt/image/ColorModel.java +++ b/libjava/java/awt/image/ColorModel.java @@ -120,10 +120,32 @@ public abstract class ColorModel implements Transparency Buffers.smallestAppropriateTransferType(bits * 4)); } + /** + * Constructs a ColorModel that translates pixel values to + * color/alpha components. + * + * @exception IllegalArgumentException If the length of the bit array is less + * than the number of color or alpha components in this ColorModel, or if the + * transparency is not a valid value, or if the sum of the number of bits in + * bits is less than 1 or if any of the elements in bits is less than 0. + */ protected ColorModel(int pixel_bits, int[] bits, ColorSpace cspace, boolean hasAlpha, boolean isAlphaPremultiplied, int transparency, int transferType) { + int bits_sum = 0; + for (int i = 0; i < bits.length; i++) + { + if (bits [i] < 0) + throw new IllegalArgumentException (); + + bits_sum |= bits [i]; + } + + if ((bits.length < cspace.numComponents) + || (bits_sum < 1)) + throw new IllegalArgumentException (); + this.pixel_bits = pixel_bits; this.bits = bits; this.cspace = cspace; diff --git a/libjava/java/awt/image/ImageFilter.java b/libjava/java/awt/image/ImageFilter.java index b34bb7d9cd3..86bc0210a4b 100644 --- a/libjava/java/awt/image/ImageFilter.java +++ b/libjava/java/awt/image/ImageFilter.java @@ -81,9 +81,18 @@ public class ImageFilter implements ImageConsumer, Cloneable * * @see java.lang.Object#clone () */ - public Object clone() throws CloneNotSupportedException + public Object clone() { - return (super.clone()); + try + { + return super.clone(); + } + catch (CloneNotSupportedException e) + { + // This should never happen as this class implements the + // Cloneable interface. + throw new InternalError (); + } } /** diff --git a/libjava/java/io/FileDescriptor.java b/libjava/java/io/FileDescriptor.java index 08f8edfaa0d..f105c6f8ab0 100644 --- a/libjava/java/io/FileDescriptor.java +++ b/libjava/java/io/FileDescriptor.java @@ -1,6 +1,6 @@ // FileDescriptor.java - Open file or device -/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation This file is part of libgcj. @@ -101,4 +101,6 @@ public final class FileDescriptor // we want to make sure this has the value -1. This is the most // efficient way to accomplish that. private int fd = -1; + + private long position = 0; } diff --git a/libjava/java/io/FileInputStream.java b/libjava/java/io/FileInputStream.java index d7efc26db87..85d7bbe0879 100644 --- a/libjava/java/io/FileInputStream.java +++ b/libjava/java/io/FileInputStream.java @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation +/* Copyright (C) 1998, 1999, 2001, 2002, 2003 Free Software Foundation This file is part of libgcj. @@ -61,8 +61,8 @@ public class FileInputStream extends InputStream protected void finalize() throws IOException { - if (fd != null) - fd.finalize(); + // We don't actually need this, but we include it because it is + // mentioned in the JCL. } public final FileDescriptor getFD() throws IOException diff --git a/libjava/java/io/ObjectStreamClass.java b/libjava/java/io/ObjectStreamClass.java index ecdd91d00c6..5d4c102f220 100644 --- a/libjava/java/io/ObjectStreamClass.java +++ b/libjava/java/io/ObjectStreamClass.java @@ -1,6 +1,6 @@ /* ObjectStreamClass.java -- Class used to write class information about serialized objects. - Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -44,6 +44,7 @@ import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.lang.reflect.Proxy; import java.security.DigestOutputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -76,6 +77,19 @@ public class ObjectStreamClass implements Serializable if (! (Serializable.class).isAssignableFrom (cl)) return null; + return lookupForClassObject (cl); + } + + /** + * This lookup for internal use by ObjectOutputStream. Suppose + * we have a java.lang.Class object C for class A, though A is not + * serializable, but it's okay to serialize C. + */ + static ObjectStreamClass lookupForClassObject (Class cl) + { + if (cl == null) + return null; + ObjectStreamClass osc = (ObjectStreamClass)classLookupTable.get (cl); if (osc != null) @@ -260,22 +274,29 @@ public class ObjectStreamClass implements Serializable void setClass (Class cl) throws InvalidClassException { this.clazz = cl; + long class_uid = getClassUID (cl); if (uid == 0) + uid = class_uid; + else { - uid = class_uid; - return; - } - - // Check that the actual UID of the resolved class matches the UID from - // the stream. - if (uid != class_uid) - { - String msg = cl + - ": Local class not compatible: stream serialVersionUID=" - + uid + ", local serialVersionUID=" + class_uid; - throw new InvalidClassException (msg); + // Check that the actual UID of the resolved class matches the UID from + // the stream. + if (uid != class_uid) + { + String msg = cl + + ": Local class not compatible: stream serialVersionUID=" + + uid + ", local serialVersionUID=" + class_uid; + throw new InvalidClassException (msg); + } } + + isProxyClass = clazz != null && Proxy.isProxyClass (clazz); + ObjectStreamClass osc = (ObjectStreamClass)classLookupTable.get (clazz); + if (osc == null) + classLookupTable.put (clazz, this); + superClass = lookupForClassObject (clazz.getSuperclass ()); + calculateOffsets (); } void setSuperclass (ObjectStreamClass osc) @@ -328,12 +349,15 @@ public class ObjectStreamClass implements Serializable { uid = 0; flags = 0; + isProxyClass = Proxy.isProxyClass (cl); clazz = cl; name = cl.getName (); setFlags (cl); setFields (cl); - uid = getClassUID (cl); + // to those class nonserializable, its uid field is 0 + if ( (Serializable.class).isAssignableFrom (cl) && !isProxyClass) + uid = getClassUID (cl); superClass = lookup (cl.getSuperclass ()); } @@ -377,6 +401,7 @@ public class ObjectStreamClass implements Serializable { Field serialPersistentFields = cl.getDeclaredField ("serialPersistentFields"); + serialPersistentFields.setAccessible(true); int modifiers = serialPersistentFields.getModifiers (); if (Modifier.isStatic (modifiers) @@ -427,26 +452,27 @@ public class ObjectStreamClass implements Serializable { try { + // Use getDeclaredField rather than getField, since serialVersionUID + // may not be public AND we only want the serialVersionUID of this + // class, not a superclass or interface. Field suid = cl.getDeclaredField ("serialVersionUID"); + suid.setAccessible(true); int modifiers = suid.getModifiers (); - if (Modifier.isStatic (modifiers) && Modifier.isFinal (modifiers)) - return suid.getLong (null); + if (Modifier.isStatic (modifiers) + && Modifier.isFinal (modifiers) + && suid.getType() == Long.TYPE) + return suid.getLong (null); } catch (NoSuchFieldException ignore) - { - } + {} catch (IllegalAccessException ignore) - { - } + {} // cl didn't define serialVersionUID, so we have to compute it try { - MessageDigest md = null; - DigestOutputStream digest_out = null; - DataOutputStream data_out = null; - + MessageDigest md; try { md = MessageDigest.getInstance ("SHA"); @@ -459,8 +485,10 @@ public class ObjectStreamClass implements Serializable md = MessageDigest.getInstance ("SHA"); } - digest_out = new DigestOutputStream (nullOutputStream, md); - data_out = new DataOutputStream (digest_out); + DigestOutputStream digest_out = + new DigestOutputStream (nullOutputStream, md); + DataOutputStream data_out = new DataOutputStream (digest_out); + data_out.writeUTF (cl.getName ()); int modifiers = cl.getModifiers (); @@ -497,17 +525,7 @@ public class ObjectStreamClass implements Serializable } // write class initializer method if present - boolean has_init; - try - { - has_init = hasClassInitializer (cl); - } - catch (NoSuchMethodError e) - { - has_init = false; - } - - if (has_init) + if (hasClassInitializer (cl)) { data_out.writeUTF ("<clinit>"); data_out.writeInt (Modifier.STATIC); @@ -564,11 +582,11 @@ public class ObjectStreamClass implements Serializable catch (NoSuchAlgorithmException e) { throw new RuntimeException ("The SHA algorithm was not found to use in computing the Serial Version UID for class " - + cl.getName ()); + + cl.getName (), e); } catch (IOException ioe) { - throw new RuntimeException (ioe.getMessage ()); + throw new RuntimeException (ioe); } } @@ -582,6 +600,7 @@ public class ObjectStreamClass implements Serializable // Use getDeclaredField rather than getField for the same reason // as above in getDefinedSUID. Field f = clazz.getDeclaredField ("getSerialPersistentFields"); + f.setAccessible(true); o = (ObjectStreamField[])f.get (null); } catch (java.lang.NoSuchFieldException e) @@ -597,21 +616,23 @@ public class ObjectStreamClass implements Serializable // Returns true if CLAZZ has a static class initializer // (a.k.a. <clinit>). - // - // A NoSuchMethodError is raised if CLAZZ has no such method. private static boolean hasClassInitializer (Class clazz) - throws java.lang.NoSuchMethodError { Method m = null; try { + /* + * There exists a problem here, according to the spec + * clazz.getDeclaredMethod ("<clinit>", classArgs); + * will always throw NoSuchMethodException, even if the static + * intializer does exist. + */ Class classArgs[] = {}; m = clazz.getDeclaredMethod ("<clinit>", classArgs); } catch (java.lang.NoSuchMethodException e) { - throw new java.lang.NoSuchMethodError (); } return m != null; @@ -640,9 +661,12 @@ public class ObjectStreamClass implements Serializable int primFieldSize = -1; // -1 if not yet calculated int objectFieldCount; + boolean isProxyClass = false; + // This is probably not necessary because this class is special cased already // but it will avoid showing up as a discrepancy when comparing SUIDs. private static final long serialVersionUID = -6120832682080437368L; + } diff --git a/libjava/java/io/PipedOutputStream.java b/libjava/java/io/PipedOutputStream.java index b819f309c2a..68b656b1925 100644 --- a/libjava/java/io/PipedOutputStream.java +++ b/libjava/java/io/PipedOutputStream.java @@ -97,7 +97,7 @@ public class PipedOutputStream extends OutputStream */ public void connect(PipedInputStream sink) throws IOException { - if (sink != null) + if (this.sink != null || sink.source != null) throw new IOException ("Already connected"); sink.connect(this); } diff --git a/libjava/java/io/PipedWriter.java b/libjava/java/io/PipedWriter.java index a8844d746f2..0ab3c0b8e12 100644 --- a/libjava/java/io/PipedWriter.java +++ b/libjava/java/io/PipedWriter.java @@ -100,7 +100,7 @@ public class PipedWriter extends Writer */ public void connect(PipedReader sink) throws IOException { - if (sink != null) + if (this.sink != null || sink.source != null) throw new IOException ("Already connected"); sink.connect(this); } diff --git a/libjava/java/io/natFileDescriptorPosix.cc b/libjava/java/io/natFileDescriptorPosix.cc index 80e6bad97ae..e8ec9a7e733 100644 --- a/libjava/java/io/natFileDescriptorPosix.cc +++ b/libjava/java/io/natFileDescriptorPosix.cc @@ -1,6 +1,6 @@ // natFileDescriptor.cc - Native part of FileDescriptor class. -/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation This file is part of libgcj. @@ -147,6 +147,7 @@ java::io::FileDescriptor::write (jint b) throw new IOException (JvNewStringLatin1 (strerror (errno))); } } + position++; } void @@ -177,6 +178,7 @@ java::io::FileDescriptor::write (jbyteArray b, jint offset, jint len) written += r; len -= r; bytes += r; + position += r; } } @@ -193,7 +195,6 @@ void java::io::FileDescriptor::setLength (jlong pos) { struct stat sb; - off_t orig; #ifdef HAVE_FTRUNCATE if (::fstat (fd, &sb)) @@ -202,10 +203,6 @@ java::io::FileDescriptor::setLength (jlong pos) if ((jlong) sb.st_size == pos) return; - orig = ::lseek (fd, (off_t) 0, SEEK_CUR); - if (orig == -1) - throw new IOException (JvNewStringLatin1 (strerror (errno))); - // If the file is too short, we extend it. We can't rely on // ftruncate() extending the file. So we lseek() to 1 byte less // than we want, and then we write a single byte at the end. @@ -215,11 +212,15 @@ java::io::FileDescriptor::setLength (jlong pos) throw new IOException (JvNewStringLatin1 (strerror (errno))); char out = '\0'; int r = ::write (fd, &out, 1); - if (r <= 0 || ::lseek (fd, orig, SEEK_SET) == -1) + if (r <= 0 || ::lseek (fd, position, SEEK_SET) == -1) throw new IOException (JvNewStringLatin1 (strerror (errno))); } - else if (::ftruncate (fd, (off_t) pos)) - throw new IOException (JvNewStringLatin1 (strerror (errno))); + else + { + if (::ftruncate (fd, (off_t) pos)) + throw new IOException (JvNewStringLatin1 (strerror (errno))); + position = pos; + } #else /* HAVE_FTRUNCATE */ throw new IOException (JvNewStringLatin1 ("FileDescriptor.setLength not implemented")); #endif /* HAVE_FTRUNCATE */ @@ -230,19 +231,29 @@ java::io::FileDescriptor::seek (jlong pos, jint whence, jboolean eof_trunc) { JvAssert (whence == SET || whence == CUR); - jlong len = length (); - jlong here = getFilePointer (); - - if (eof_trunc - && ((whence == SET && pos > len) || (whence == CUR && here + pos > len))) + if (eof_trunc) { - whence = SET; - pos = len; + jlong len = length (); + if (whence == SET) + { + if (pos > len) + pos = len; + } + else + { + jlong here = getFilePointer (); + if (here + pos > len) + { + pos = len; + whence = SET; + } + } } off_t r = ::lseek (fd, (off_t) pos, whence == SET ? SEEK_SET : SEEK_CUR); if (r == -1) throw new IOException (JvNewStringLatin1 (strerror (errno))); + position = r; return r; } @@ -258,10 +269,7 @@ java::io::FileDescriptor::length (void) jlong java::io::FileDescriptor::getFilePointer (void) { - off_t r = ::lseek (fd, 0, SEEK_CUR); - if (r == -1) - throw new IOException (JvNewStringLatin1 (strerror (errno))); - return r; + return position; } jint @@ -282,6 +290,7 @@ java::io::FileDescriptor::read (void) } throw new IOException (JvNewStringLatin1 (strerror (errno))); } + position++; return b & 0xFF; } @@ -313,6 +322,7 @@ java::io::FileDescriptor::read (jbyteArray buffer, jint offset, jint count) } throw new IOException (JvNewStringLatin1 (strerror (errno))); } + position += r; return r; } diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h index d59899a8182..5a56fd35c3b 100644 --- a/libjava/java/lang/Class.h +++ b/libjava/java/lang/Class.h @@ -333,6 +333,9 @@ private: inline friend jclass _Jv_GetArrayClass (jclass klass, java::lang::ClassLoader *loader) { + extern void _Jv_NewArrayClass (jclass element, + java::lang::ClassLoader *loader, + _Jv_VTable *array_vtable = 0); if (__builtin_expect (!klass->arrayclass, false)) _Jv_NewArrayClass (klass, loader); return klass->arrayclass; diff --git a/libjava/java/lang/StringBuffer.java b/libjava/java/lang/StringBuffer.java index bfaaaf92f23..922d6bb6d24 100644 --- a/libjava/java/lang/StringBuffer.java +++ b/libjava/java/lang/StringBuffer.java @@ -308,26 +308,27 @@ public final class StringBuffer implements Serializable, CharSequence } } - /** Get the specified array of characters. - * The characters will be copied into the array you pass in. - * @param srcOffset the index to start copying from in the - * <code>StringBuffer</code>. - * @param srcEnd the number of characters to copy. - * @param dst the array to copy into. - * @param dstOffset the index to start copying into <code>dst</code>. - * @exception NullPointerException if dst is null. - * @exception IndexOutOfBoundsException if any source or target - * indices are out of range. - * @see java.lang.System#arraycopy(java.lang.Object,int,java.lang.Object,int,int) - */ - public synchronized void getChars (int srcOffset, int srcEnd, - char[] dst, int dstOffset) - { - if (srcOffset < 0 || srcOffset > srcEnd) - throw new StringIndexOutOfBoundsException (srcOffset); + /** + * Get the specified array of characters. <code>srcOffset - srcEnd</code> + * characters will be copied into the array you pass in. + * + * @param srcOffset the index to start copying from (inclusive) + * @param srcEnd the index to stop copying from (exclusive) + * @param dst the array to copy into + * @param dstOffset the index to start copying into + * @throws NullPointerException if dst is null + * @throws IndexOutOfBoundsException if any source or target indices are + * out of range (while unspecified, source problems cause a + * StringIndexOutOfBoundsException, and dest problems cause an + * ArrayIndexOutOfBoundsException) + * @see System#arraycopy(Object, int, Object, int, int) + */ + public synchronized void getChars(int srcOffset, int srcEnd, + char[] dst, int dstOffset) + { int todo = srcEnd - srcOffset; - if (srcEnd > count || dstOffset + todo > count) - throw new StringIndexOutOfBoundsException (srcEnd); + if (srcOffset < 0 || srcEnd > count || todo < 0) + throw new StringIndexOutOfBoundsException(); System.arraycopy(value, srcOffset, dst, dstOffset, todo); } diff --git a/libjava/java/lang/System.java b/libjava/java/lang/System.java index edc818fb181..ab584250749 100644 --- a/libjava/java/lang/System.java +++ b/libjava/java/lang/System.java @@ -73,15 +73,32 @@ public final class System loadLibrary("javalang"); Properties defaultProperties = Runtime.defaultProperties; - defaultProperties.put("gnu.cpu.endian", - isWordsBigEndian() ? "big" : "little"); + // Set base URL if not already set. + if (defaultProperties.get("gnu.classpath.home.url") == null) + defaultProperties.put("gnu.classpath.home.url", + "file://" + + defaultProperties.get("gnu.classpath.home") + + "/lib"); + + // Set short name if not already set. + if (defaultProperties.get("gnu.classpath.vm.shortname") == null) + { + String value = defaultProperties.getProperty("java.vm.name"); + int index = value.lastIndexOf(' '); + if (index != -1) + value = value.substring(index + 1); + defaultProperties.put("gnu.classpath.vm.shortname", value); + } + + defaultProperties.put("gnu.cpu.endian", + isWordsBigEndian() ? "big" : "little"); // XXX FIXME - Temp hack for old systems that set the wrong property if (defaultProperties.get("java.io.tmpdir") == null) defaultProperties.put("java.io.tmpdir", defaultProperties.get("java.tmpdir")); } - + /** * Stores the current system properties. This can be modified by * {@link #setProperties(Properties)}, but will never be null, because @@ -101,7 +118,7 @@ public final class System * however. */ public static final InputStream in - = new BufferedInputStream (new FileInputStream(FileDescriptor.in)); + = new BufferedInputStream(new FileInputStream(FileDescriptor.in)); /** * The standard output PrintStream. This is assigned at startup and * starts its life perfectly valid. Although it is marked final, you can @@ -113,7 +130,7 @@ public final class System * you, however. */ public static final PrintStream out - = new PrintStream(new BufferedOutputStream (new FileOutputStream(FileDescriptor.out)), true); + = new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.out)), true); /** * The standard output PrintStream. This is assigned at startup and * starts its life perfectly valid. Although it is marked final, you can @@ -125,7 +142,7 @@ public final class System * you, however. */ public static final PrintStream err - = new PrintStream(new BufferedOutputStream (new FileOutputStream(FileDescriptor.err)), true); + = new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.err)), true); /** * This class is uninstantiable. @@ -312,6 +329,10 @@ public final class System * In addition, gnu defines several other properties, where ? stands for * each character in '0' through '9': * <dl> + * <dl> gnu.classpath.vm.shortname <dd> Succinct version of the VM name; + * used for finding property files in file system + * <dl> gnu.classpath.home.url <dd> Base URL; used for finding + * property files in file system * <dt> gnu.cpu.endian <dd>big or little * <dt> gnu.java.io.encoding_scheme_alias.ISO-8859-? <dd>8859_? * <dt> gnu.java.io.encoding_scheme_alias.iso-8859-? <dd>8859_? diff --git a/libjava/java/lang/natObject.cc b/libjava/java/lang/natObject.cc index 4c2fd6cab03..a050baa3f66 100644 --- a/libjava/java/lang/natObject.cc +++ b/libjava/java/lang/natObject.cc @@ -1,6 +1,6 @@ // natObject.cc - Implementation of the Object class. -/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation This file is part of libgcj. @@ -28,6 +28,8 @@ details. */ #include <java/lang/Cloneable.h> #include <java/lang/Thread.h> +#include "platform.h" + #ifdef LOCK_DEBUG # include <stdio.h> #endif @@ -532,7 +534,7 @@ spin(unsigned n) unsigned duration = MIN_SLEEP_USECS << (n - yield_limit); if (n >= 15 + yield_limit || duration > MAX_SLEEP_USECS) duration = MAX_SLEEP_USECS; - java::lang::Thread::sleep(0, duration); + _Jv_platform_usleep(duration); } } diff --git a/libjava/java/lang/natRuntime.cc b/libjava/java/lang/natRuntime.cc index f5177b0aa35..f74a1e76bcf 100644 --- a/libjava/java/lang/natRuntime.cc +++ b/libjava/java/lang/natRuntime.cc @@ -29,6 +29,7 @@ details. */ #include <java/lang/ConcreteProcess.h> #include <java/lang/ClassLoader.h> #include <gnu/gcj/runtime/StackTrace.h> +#include <java/lang/ArrayIndexOutOfBoundsException.h> #include <jni.h> @@ -181,19 +182,26 @@ java::lang::Runtime::_load (jstring path, jboolean do_search) ClassLoader *sys = ClassLoader::getSystemClassLoader(); ClassLoader *look = NULL; gnu::gcj::runtime::StackTrace *t = new gnu::gcj::runtime::StackTrace(10); - for (int i = 0; i < 10; ++i) - { - jclass klass = t->classAt(i); - if (klass != NULL) + try + { + for (int i = 0; i < 10; ++i) { - ClassLoader *loader = klass->getClassLoaderInternal(); - if (loader != NULL && loader != sys) + jclass klass = t->classAt(i); + if (klass != NULL) { - look = loader; - break; + ClassLoader *loader = klass->getClassLoaderInternal(); + if (loader != NULL && loader != sys) + { + look = loader; + break; + } } } } + catch (::java::lang::ArrayIndexOutOfBoundsException *e) + { + } + if (look != NULL) { // Don't include solib prefix in string passed to diff --git a/libjava/java/net/DatagramSocket.java b/libjava/java/net/DatagramSocket.java index b2f2ca11ce3..c286d650b73 100644 --- a/libjava/java/net/DatagramSocket.java +++ b/libjava/java/net/DatagramSocket.java @@ -1,12 +1,39 @@ -// DatagramSocket.java - -/* Copyright (C) 1999, 2000, 2002 Free Software Foundation - - This file is part of libgcj. - -This software is copyrighted work licensed under the terms of the -Libgcj License. Please consult the file "LIBGCJ_LICENSE" for -details. */ +/* DatagramSocket.java -- A class to model UDP sockets + Copyright (C) 1998, 1999, 2000, 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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 java.net; @@ -15,16 +42,23 @@ import java.nio.channels.DatagramChannel; import java.nio.channels.IllegalBlockingModeException; /** - * @author Warren Levy <warrenl@cygnus.com> - * @date May 3, 1999. - */ - -/** * Written using on-line Java Platform 1.2 API Specification, as well * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998). * Status: Believed complete and correct. */ +/** + * This class models a connectionless datagram socket that sends + * individual packets of data across the network. In the TCP/IP world, + * this means UDP. Datagram packets do not have guaranteed delivery, + * or any guarantee about the order the data will be received on the + * remote host. + * + * @author Aaron M. Renn (arenn@urbanophile.com) + * @author Warren Levy (warrenl@cygnus.com) + * @date May 3, 1999. + */ + public class DatagramSocket { /** @@ -33,24 +67,26 @@ public class DatagramSocket */ static DatagramSocketImplFactory factory; + /** + * This is the implementation object used by this socket. + */ DatagramSocketImpl impl; + /** + * The unique DatagramChannel object associated with this datagram socket, + * or null. + */ DatagramChannel ch; + /** + * This is the address we are "connected" to + */ private InetAddress remoteAddress; - private int remotePort; /** - * Creates a DatagramSocket - * - * @exception SocketException If an error occurs - * @exception SecurityException If a security manager exists and - * its checkListen method doesn't allow the operation + * This is the port we are "connected" to */ - public DatagramSocket() throws SocketException - { - this(0, null); - } + private int remotePort = -1; /** * Creates a DatagramSocket from a specified DatagramSocketImpl instance @@ -67,31 +103,27 @@ public class DatagramSocket } /** - * Creates a datagram socket that is bound to a given socket address - * - * @param bindaddr The socket address to bind to + * Initializes a new instance of <code>DatagramSocket</code> that binds to + * a random port and every address on the local machine. * - * @exception SocketException If an error occurs + * @exception SocketException If an error occurs. * @exception SecurityException If a security manager exists and - * its checkListen method doesn't allow the operation - * - * @since 1.4 + * its checkListen method doesn't allow the operation. */ - public DatagramSocket (SocketAddress bindaddr) - throws SocketException + public DatagramSocket() throws SocketException { - this (((InetSocketAddress) bindaddr).getPort (), - ((InetSocketAddress) bindaddr).getAddress ()); + this(0, null); } /** - * Creates a datagram socket that is bound to a specific port + * Initializes a new instance of <code>DatagramSocket</code> that binds to + * the specified port and every address on the local machine. * - * @param port The port number to bind to + * @param port The local port number to bind to. * - * @exception SocketException If an error occurs - * @exception SecurityException If a security manager exists and - * its checkListen method doesn't allow the operation + * @exception SecurityException If a security manager exists and its + * checkListen method doesn't allow the operation. + * @exception SocketException If an error occurs. */ public DatagramSocket(int port) throws SocketException { @@ -99,14 +131,15 @@ public class DatagramSocket } /** - * Creates a datagram socket that is bound to a specific port/inet address + * Initializes a new instance of <code>DatagramSocket</code> that binds to + * the specified local port and address. * - * @param port The port number to bind to - * @param laddr The local address to bind to + * @param port The local port number to bind to. + * @param laddr The local address to bind to. * - * @exception SocketException If an error occurs - * @exception SecurityException If a security manager exists and - * its checkListen method doesn't allow the operation + * @exception SecurityException If a security manager exists and its + * checkListen method doesn't allow the operation. + * @exception SocketException If an error occurs. */ public DatagramSocket(int port, InetAddress laddr) throws SocketException { @@ -123,8 +156,8 @@ public class DatagramSocket else try { - impl = (DatagramSocketImpl) Class.forName("java.net." + propVal + - "DatagramSocketImpl").newInstance(); + impl = (DatagramSocketImpl) Class.forName + ("java.net." + propVal + "DatagramSocketImpl").newInstance(); } catch (Exception e) { @@ -145,34 +178,26 @@ public class DatagramSocket } /** - * Binds the socket to the given socket addres + * Initializes a new instance of <code>DatagramSocket</code> that binds to + * the specified local port and address. * - * @param address The socket address to bind to + * @param port The local port number to bind to. + * @param laddr The local address to bind to. * - * @exception SocketException If an error occurs - * @exception SecurityException If a security manager exists and - * its checkListen method doesn't allow the operation - * @exception IllegalArgumentException If address type is not supported + * @exception SecurityException If a security manager exists and its + * checkListen method doesn't allow the operation. + * @exception SocketException If an error occurs. * * @since 1.4 */ - public void bind (SocketAddress address) - throws SocketException + public DatagramSocket (SocketAddress address) throws SocketException { - if (! (address instanceof InetSocketAddress)) - throw new IllegalArgumentException (); - - InetSocketAddress tmp = (InetSocketAddress) address; - - SecurityManager s = System.getSecurityManager (); - if (s != null) - s.checkListen(tmp.getPort ()); - - impl.bind (tmp.getPort (), tmp.getAddress ()); + this (((InetSocketAddress) address).getPort (), + ((InetSocketAddress) address).getAddress ()); } /** - * Closes the datagram socket + * Closes this datagram socket. */ public void close() { @@ -182,27 +207,41 @@ public class DatagramSocket } /** - * Checks if the datagram socket is closed + * This method returns the remote address to which this socket is + * connected. If this socket is not connected, then this method will + * return <code>null</code>. * - * @since 1.4 + * @return The remote address. + * + * @since 1.2 */ - public boolean isClosed() + public InetAddress getInetAddress() { - return !impl.getFileDescriptor().valid(); + if (!isConnected ()) + return null; + + return remoteAddress; } /** - * Gets a datagram channel assoziated with the socket + * This method returns the remote port to which this socket is + * connected. If this socket is not connected, then this method will + * return -1. * - * @since 1.4 + * @return The remote port. + * + * @since 1.2 */ - public DatagramChannel getChannel() + public int getPort() { - return ch; + if (!isConnected ()) + return -1; + + return remotePort; } /** - * Returns the local address of the datagram socket + * Returns the local address this datagram socket is bound to. * * @since 1.1 */ @@ -244,9 +283,9 @@ public class DatagramSocket } /** - * Returns the local port this socket uses + * Returns the local port this socket is bound to. * - * @return The local port number + * @return The local port number. */ public int getLocalPort() { @@ -257,11 +296,12 @@ public class DatagramSocket } /** - * Gets the SO_TIMEOUT value + * Returns the value of the socket's SO_TIMEOUT setting. If this method + * returns 0 then SO_TIMEOUT is disabled. * - * @return The current timeout in milliseconds + * @return The current timeout in milliseconds. * - * @exception SocketException If an error occurs + * @exception SocketException If an error occurs. * * @since 1.1 */ @@ -271,6 +311,7 @@ public class DatagramSocket throw new SocketException ("Cannot initialize Socket implementation"); Object timeout = impl.getOption(SocketOptions.SO_TIMEOUT); + if (timeout instanceof Integer) return ((Integer)timeout).intValue(); else @@ -278,20 +319,177 @@ public class DatagramSocket } /** - * Receive a datagram packet + * Sets the value of the socket's SO_TIMEOUT value. A value of 0 will + * disable SO_TIMEOUT. Any other value is the number of milliseconds + * a socket read/write will block before timing out. + * + * @param timeout The new SO_TIMEOUT value in milliseconds. + * + * @exception SocketException If an error occurs. + * + * @since 1.1 + */ + public synchronized void setSoTimeout(int timeout) throws SocketException + { + if (timeout < 0) + throw new IllegalArgumentException("Invalid timeout: " + timeout); + + impl.setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout)); + } + + /** + * This method returns the value of the system level socket option + * SO_SNDBUF, which is used by the operating system to tune buffer + * sizes for data transfers. + * + * @return The send buffer size. + * + * @exception SocketException If an error occurs. + * + * @since 1.2 + */ + public int getSendBufferSize() throws SocketException + { + if (impl == null) + throw new SocketException ("Cannot initialize Socket implementation"); + + Object obj = impl.getOption(SocketOptions.SO_SNDBUF); + + if (obj instanceof Integer) + return(((Integer)obj).intValue()); + else + throw new SocketException("Unexpected type"); + } + + /** + * This method sets the value for the system level socket option + * SO_SNDBUF to the specified value. Note that valid values for this + * option are specific to a given operating system. + * + * @param size The new send buffer size. + * + * @exception SocketException If an error occurs. + * @exception IllegalArgumentException If size is 0 or negative. + * + * @since 1.2 + */ + public void setSendBufferSize(int size) throws SocketException + { + if (size < 0) + throw new IllegalArgumentException("Buffer size is less than 0"); + + impl.setOption(SocketOptions.SO_SNDBUF, new Integer(size)); + } + + /** + * This method returns the value of the system level socket option + * SO_RCVBUF, which is used by the operating system to tune buffer + * sizes for data transfers. + * + * @return The receive buffer size. + * + * @exception SocketException If an error occurs. + * + * @since 1.2 + */ + public int getReceiveBufferSize() throws SocketException + { + if (impl == null) + throw new SocketException ("Cannot initialize Socket implementation"); + + Object obj = impl.getOption(SocketOptions.SO_RCVBUF); + + if (obj instanceof Integer) + return(((Integer)obj).intValue()); + else + throw new SocketException("Unexpected type"); + } + + /** + * This method sets the value for the system level socket option + * SO_RCVBUF to the specified value. Note that valid values for this + * option are specific to a given operating system. + * + * @param size The new receive buffer size. * - * @param p The datagram packet to put the incoming data into + * @exception SocketException If an error occurs. + * @exception IllegalArgumentException If size is 0 or negative. * - * @exception IOException If an error occurs + * @since 1.2 + */ + public void setReceiveBufferSize(int size) throws SocketException + { + if (impl == null) + throw new SocketException ("Cannot initialize Socket implementation"); + + if (size < 0) + throw new IllegalArgumentException("Buffer size is less than 0"); + + impl.setOption(SocketOptions.SO_RCVBUF, new Integer(size)); + } + + /** + * Connects the datagram socket to a specified address/port. + * + * @param address The address to connect to. + * @param port The port to connect to. + * + * @exception SocketException If an error occurs. + * @exception IllegalArgumentException If address is null + * or the port number is illegal. + * @exception SecurityException If the caller is not allowed to send + * datagrams to and receive datagrams from the address and port. + * + * @since 1.2 + */ + public void connect(InetAddress address, int port) + { + if (address == null) + throw new IllegalArgumentException ("Address may not be null"); + + if ((port < 1) || (port > 65535)) + throw new IllegalArgumentException ("Port number is illegal"); + + SecurityManager sm = System.getSecurityManager(); + if (sm != null) + sm.checkAccept(address.getHostName (), port); + + try + { + impl.connect (address, port); + remoteAddress = address; + remotePort = port; + } + catch (SocketException e) + { + } + } + + /** + * Disconnects the datagram socket. + * + * @since 1.2 + */ + public void disconnect() + { + impl.disconnect(); + } + + /** + * Receive a datagram packet. + * + * @param p The datagram packet to put the incoming data into. + * + * @exception IOException If an error occurs. * @exception SocketTimeoutException If setSoTimeout was previously called - * and the timeout has expired + * and the timeout has expired. * @exception PortUnreachableException If the socket is connected to a * currently unreachable destination. Note, there is no guarantee that the - * exception will be thrown + * exception will be thrown. * @exception IllegalBlockingModeException If this socket has an associated - * channel, and the channel is in non-blocking mode + * channel, and the channel is in non-blocking mode. * @exception SecurityException If a security manager exists and its - * checkAccept ethod doesn't allow the receive + * checkAccept ethod doesn't allow the receive. */ public synchronized void receive(DatagramPacket p) throws IOException { @@ -313,18 +511,18 @@ public class DatagramSocket } /** - * Sends a datagram packet + * Sends a datagram packet. * - * @param p The datagram packet to send + * @param p The datagram packet to send. * - * @exception IOException If an error occurs + * @exception IOException If an error occurs. * @exception SecurityException If a security manager exists and its - * checkMulticast or checkConnect method doesn't allow the send + * checkMulticast or checkConnect method doesn't allow the send. * @exception PortUnreachableException If the socket is connected to a * currently unreachable destination. Note, there is no guarantee that the - * exception will be thrown + * exception will be thrown. * @exception IllegalBlockingModeException If this socket has an associated - * channel, and the channel is in non-blocking mode + * channel, and the channel is in non-blocking mode. */ public void send(DatagramPacket p) throws IOException { @@ -357,62 +555,59 @@ public class DatagramSocket } /** - * Sets a new value for SO_TIMEOUT + * Binds the socket to the given socket address. * - * @param timeout The timeout in milliseconds + * @param address The socket address to bind to. * - * @exception SocketException If an error occurs + * @exception SocketException If an error occurs. + * @exception SecurityException If a security manager exists and + * its checkListen method doesn't allow the operation. + * @exception IllegalArgumentException If address type is not supported. * - * @since 1.1 + * @since 1.4 */ - public synchronized void setSoTimeout(int timeout) throws SocketException + public void bind (SocketAddress address) + throws SocketException { - if (timeout < 0) - throw new IllegalArgumentException("Invalid timeout: " + timeout); + if (! (address instanceof InetSocketAddress)) + throw new IllegalArgumentException (); - impl.setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout)); + InetSocketAddress tmp = (InetSocketAddress) address; + + SecurityManager s = System.getSecurityManager (); + if (s != null) + s.checkListen(tmp.getPort ()); + + impl.bind (tmp.getPort (), tmp.getAddress ()); } /** - * Connects the datagrem socket to a specified address/port + * Checks if the datagram socket is closed. * - * @param address The address to connect to - * @param port The port to connect to - * - * @exception SocketException If an error occurs - * @exception IllegalArgumentException If address is null - * or the port number is illegal - * @exception SecurityException If the caller is not allowed to send - * datagrams to and receive datagrams from the address and port - * - * @since 1.2 + * @since 1.4 */ - public void connect(InetAddress address, int port) - throws SocketException + public boolean isClosed() { - if (address == null) - throw new IllegalArgumentException ("Address may not be null"); - - if (port < 1 || port > 65535) - throw new IllegalArgumentException ("Port number is illegal"); - - SecurityManager s = System.getSecurityManager(); - if (s != null) - s.checkAccept(address.getHostName (), port); - - impl.connect (address, port); + return !impl.getFileDescriptor().valid(); + } - remoteAddress = address; - remotePort = port; + /** + * Returns the datagram channel assoziated with this datagram socket. + * + * @since 1.4 + */ + public DatagramChannel getChannel() + { + return ch; } /** * Connects the datagram socket to a specified socket address. * - * @param address The socket address to connect to + * @param address The socket address to connect to. * - * @exception SocketException If an error occurs - * @exception IllegalArgumentException If address type is not supported + * @exception SocketException If an error occurs. + * @exception IllegalArgumentException If address type is not supported. * * @since 1.4 */ @@ -427,17 +622,7 @@ public class DatagramSocket } /** - * Disconnects the datagram socket - * - * @since 1.2 - */ - public void disconnect() - { - impl.disconnect(); - } - - /** - * Returns the binding state of the socket + * Returns the binding state of the socket. * * @since 1.4 */ @@ -456,7 +641,7 @@ public class DatagramSocket } /** - * Returns the connection state of the socket + * Returns the connection state of the socket. * * @since 1.4 */ @@ -466,35 +651,8 @@ public class DatagramSocket } /** - * Returns the InetAddress the socket is connected to - * or null if the socket is not connected - * - * @since 1.2 - */ - public InetAddress getInetAddress() - { - if (!isConnected ()) - return null; - - return remoteAddress; - } - - /** - * Returns the port number the socket is connected to or -1 if not connected - * - * @since 1.2 - */ - public int getPort() - { - if (!isConnected ()) - return -1; - - return remotePort; - } - - /** * Returns the SocketAddress of the host this socket is conneted to - * or null if this socket is not connected + * or null if this socket is not connected. * * @since 1.4 */ @@ -508,7 +666,7 @@ public class DatagramSocket /** * Returns the local SocketAddress this socket is bound to - * or null if it is not bound + * or null if it is not bound. * * @since 1.4 */ @@ -529,36 +687,12 @@ public class DatagramSocket } /** - * This method returns the value of the system level socket option - * SO_RCVBUF, which is used by the operating system to tune buffer - * sizes for data transfers. + * Enables/Disables SO_REUSEADDR. * - * @return The receive buffer size. + * @param on Whether or not to have SO_REUSEADDR turned on. * * @exception SocketException If an error occurs. * - * @since 1.2 - */ - public int getReceiveBufferSize() throws SocketException - { - if (impl == null) - throw new SocketException ("Cannot initialize Socket implementation"); - - Object obj = impl.getOption(SocketOptions.SO_RCVBUF); - - if (obj instanceof Integer) - return(((Integer)obj).intValue()); - else - throw new SocketException("Unexpected type"); - } - - /** - * Enables/Disables SO_REUSEADDR - * - * @param on Whether or not to have SO_REUSEADDR turned on - * - * @exception SocketException If an error occurs - * * @since 1.4 */ public void setReuseAddress(boolean on) throws SocketException @@ -570,9 +704,9 @@ public class DatagramSocket } /** - * Checks if SO_REUSEADDR is enabled + * Checks if SO_REUSEADDR is enabled. * - * @exception SocketException If an error occurs + * @exception SocketException If an error occurs. * * @since 1.4 */ @@ -673,73 +807,6 @@ public class DatagramSocket } /** - * This method returns the value of the system level socket option - * SO_SNDBUF, which is used by the operating system to tune buffer - * sizes for data transfers. - * - * @return The send buffer size. - * - * @exception SocketException If an error occurs. - * - * @since 1.2 - */ - public int getSendBufferSize() throws SocketException - { - if (impl == null) - throw new SocketException ("Cannot initialize Socket implementation"); - - Object obj = impl.getOption(SocketOptions.SO_SNDBUF); - - if (obj instanceof Integer) - return(((Integer)obj).intValue()); - else - throw new SocketException("Unexpected type"); - } - - /** - * This method sets the value for the system level socket option - * SO_RCVBUF to the specified value. Note that valid values for this - * option are specific to a given operating system. - * - * @param size The new receive buffer size. - * - * @exception SocketException If an error occurs. - * @exception IllegalArgumentException If size is 0 or negative - * - * @since 1.2 - */ - public void setReceiveBufferSize(int size) throws SocketException - { - if (impl == null) - throw new SocketException ("Cannot initialize Socket implementation"); - - if (size < 0) - throw new IllegalArgumentException("Buffer size is less than 0"); - - impl.setOption(SocketOptions.SO_RCVBUF, new Integer(size)); - } - - /** - * This method sets the value for the system level socket option - * SO_SNDBUF to the specified value. Note that valid values for this - * option are specific to a given operating system. - * - * @param size The new send buffer size. - * - * @exception SocketException If an error occurs. - * @exception IllegalArgumentException If size is 0 or negative - * - * @since 1.2 - */ - public void setSendBufferSize(int size) throws SocketException - { - if (size < 0) - throw new IllegalArgumentException("Buffer size is less than 0"); - - impl.setOption(SocketOptions.SO_SNDBUF, new Integer(size)); - } - - /** * Sets the datagram socket implementation factory for the application * * @param fac The factory to set diff --git a/libjava/java/net/HttpURLConnection.java b/libjava/java/net/HttpURLConnection.java index e914b190203..ebc0f8175f4 100644 --- a/libjava/java/net/HttpURLConnection.java +++ b/libjava/java/net/HttpURLConnection.java @@ -142,6 +142,11 @@ public abstract class HttpURLConnection extends URLConnection * a conditional GET. */ public static final int HTTP_NOT_MODIFIED = 304; + + /** + * The requested resource needs to be accessed through a proxy. + */ + public static final int HTTP_USE_PROXY = 305; /* HTTP Client Error Response Codes */ @@ -250,7 +255,7 @@ public abstract class HttpURLConnection extends URLConnection * The server does not support the requested functionality. * @since 1.3 */ - static final int HTTP_NOT_IMPLEMENTED = 501; + public static final int HTTP_NOT_IMPLEMENTED = 501; /** * The proxy encountered a bad response from the server it was proxy-ing for @@ -459,31 +464,36 @@ public abstract class HttpURLConnection extends URLConnection connect(); gotResponseVals = true; - // Response is the first header received from the connection. - String respField = getHeaderField(0); - - if (respField == null || ! respField.startsWith("HTTP/")) - { - // Set to default values on failure. - responseCode = -1; - responseMessage = null; - return; - } - int firstSpc, nextSpc; - firstSpc = respField.indexOf(' '); - nextSpc = respField.indexOf(' ', firstSpc + 1); - responseMessage = respField.substring(nextSpc + 1); - String codeStr = respField.substring(firstSpc + 1, nextSpc); - try + // If responseCode not yet explicitly set by subclass + if (responseCode == -1) { - responseCode = Integer.parseInt(codeStr); - } - catch (NumberFormatException e) - { - // Set to default values on failure. - responseCode = -1; - responseMessage = null; + // Response is the first header received from the connection. + String respField = getHeaderField(0); + + if (respField == null || ! respField.startsWith("HTTP/")) + { + // Set to default values on failure. + responseCode = -1; + responseMessage = null; + return; + } + + int firstSpc, nextSpc; + firstSpc = respField.indexOf(' '); + nextSpc = respField.indexOf(' ', firstSpc + 1); + responseMessage = respField.substring(nextSpc + 1); + String codeStr = respField.substring(firstSpc + 1, nextSpc); + try + { + responseCode = Integer.parseInt(codeStr); + } + catch (NumberFormatException e) + { + // Set to default values on failure. + responseCode = -1; + responseMessage = null; + } } } diff --git a/libjava/java/net/InetSocketAddress.java b/libjava/java/net/InetSocketAddress.java index 1b740dcc507..3c54b51a0f0 100644 --- a/libjava/java/net/InetSocketAddress.java +++ b/libjava/java/net/InetSocketAddress.java @@ -47,6 +47,11 @@ package java.net; public class InetSocketAddress extends SocketAddress { + /** + * Compatible with JDK 1.4+ + */ + private static final long serialVersionUID = 5076001401234631237L; + String hostname; InetAddress addr; int port; diff --git a/libjava/java/net/MulticastSocket.java b/libjava/java/net/MulticastSocket.java index 2700ebee511..dca1a85678b 100644 --- a/libjava/java/net/MulticastSocket.java +++ b/libjava/java/net/MulticastSocket.java @@ -1,5 +1,6 @@ /* MulticastSocket.java -- Class for using multicast sockets - Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 + Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -160,16 +161,18 @@ public class MulticastSocket extends DatagramSocket return impl.getTimeToLive(); } - /** - * Sets the interface to use for sending multicast packets. - * - * @param inf The new interface to use - * - * @exception SocketException If an error occurs - */ - public void setInterface(InetAddress inf) throws SocketException + /** + * Sets the interface to use for sending multicast packets. + * + * @param addr The new interface to use. + * + * @exception SocketException If an error occurs. + * + * @since 1.4 + */ + public void setInterface(InetAddress addr) throws SocketException { - impl.setOption(SocketOptions.IP_MULTICAST_IF, inf); + impl.setOption(SocketOptions.IP_MULTICAST_IF, addr); } /** diff --git a/libjava/java/net/NetPermission.java b/libjava/java/net/NetPermission.java index f5b625a0d6f..5b9502b7abe 100644 --- a/libjava/java/net/NetPermission.java +++ b/libjava/java/net/NetPermission.java @@ -48,7 +48,6 @@ import java.security.BasicPermission; * @author Aaron M. Renn (arenn@urbanophile.com) */ public final class NetPermission extends BasicPermission - implements java.io.Serializable { static final long serialVersionUID = -8343910153355041693L; diff --git a/libjava/java/net/ServerSocket.java b/libjava/java/net/ServerSocket.java index 62917b6a8a5..e2f8e637d09 100644 --- a/libjava/java/net/ServerSocket.java +++ b/libjava/java/net/ServerSocket.java @@ -77,6 +77,8 @@ public class ServerSocket */ private ServerSocketChannel ch; + private boolean closed = false; + /** * Constructor that simply sets the implementation. * @@ -200,6 +202,9 @@ public class ServerSocket */ public void bind (SocketAddress endpoint, int backlog) throws IOException { + if (closed) + throw new SocketException ("ServerSocket is closed"); + if (impl == null) throw new IOException ("Cannot initialize Socket implementation"); @@ -315,7 +320,13 @@ public class ServerSocket */ public void close () throws IOException { - impl.close(); + if (impl != null) + impl.close (); + + if (ch != null) + ch.close (); + + closed = true; } /** @@ -358,8 +369,7 @@ public class ServerSocket */ public boolean isClosed() { - // FIXME: implement this - return false; + return closed; } /** diff --git a/libjava/java/net/Socket.java b/libjava/java/net/Socket.java index 592f39a3dd3..e57c1ed5381 100644 --- a/libjava/java/net/Socket.java +++ b/libjava/java/net/Socket.java @@ -85,6 +85,8 @@ public class Socket SocketChannel ch; // this field must have been set if created by SocketChannel + private boolean closed = false; + // Constructors /** @@ -308,6 +310,9 @@ public class Socket */ public void bind (SocketAddress bindpoint) throws IOException { + if (closed) + throw new SocketException ("Socket is closed"); + if ( !(bindpoint instanceof InetSocketAddress)) throw new IllegalArgumentException (); @@ -330,6 +335,9 @@ public class Socket public void connect (SocketAddress endpoint) throws IOException { + if (closed) + throw new SocketException ("Socket is closed"); + if (! (endpoint instanceof InetSocketAddress)) throw new IllegalArgumentException ("Address type not supported"); @@ -357,6 +365,9 @@ public class Socket public void connect (SocketAddress endpoint, int timeout) throws IOException { + if (closed) + throw new SocketException ("Socket is closed"); + if (! (endpoint instanceof InetSocketAddress)) throw new IllegalArgumentException ("Address type not supported"); @@ -853,6 +864,11 @@ public class Socket { if (impl != null) impl.close(); + + if (ch != null) + ch.close(); + + closed = true; } /** @@ -1035,8 +1051,7 @@ public class Socket */ public boolean isClosed () { - // FIXME: implement this. - return false; + return closed; } /** diff --git a/libjava/java/net/SocketAddress.java b/libjava/java/net/SocketAddress.java index 370049d6fdc..f3e67d84cc0 100644 --- a/libjava/java/net/SocketAddress.java +++ b/libjava/java/net/SocketAddress.java @@ -48,6 +48,9 @@ import java.io.Serializable; */ public abstract class SocketAddress implements Serializable { + /** + * Compatible with JDK 1.4+ + */ static final long serialVersionUID = 5215720748342549866L; /** diff --git a/libjava/java/net/SocketImpl.java b/libjava/java/net/SocketImpl.java index 795e7139bee..f0f1a3c87bc 100644 --- a/libjava/java/net/SocketImpl.java +++ b/libjava/java/net/SocketImpl.java @@ -271,8 +271,9 @@ public abstract class SocketImpl implements SocketOptions */ public String toString() { - return "[addr=" + address.toString() + ",port=" + Integer.toString(port) - + ",localport=" + Integer.toString(localport) + "]"; + return "[addr=" + address + + ",port=" + port + + ",localport=" + localport + "]"; } /** diff --git a/libjava/java/net/URLClassLoader.java b/libjava/java/net/URLClassLoader.java index c6dc4b1d44d..d7fc77f8ab4 100644 --- a/libjava/java/net/URLClassLoader.java +++ b/libjava/java/net/URLClassLoader.java @@ -238,7 +238,7 @@ public class URLClassLoader extends SecureClassLoader CodeSource getCodeSource() { Certificate[] certs = getCertificates(); - if (certs != null) + if (certs == null) return loader.noCertCodeSource; else return new CodeSource(loader.baseURL, certs); @@ -271,34 +271,18 @@ public class URLClassLoader extends SecureClassLoader abstract InputStream getInputStream() throws IOException; } - static URL getCanonicalFileURL(URL url) - { - if ("file".equals(url.getProtocol())) - { - try - { - File f = new File(url.getFile()).getCanonicalFile(); - url = new URL("file", "", f.toString()); - } - catch (IOException ignore) - { - } - } - return url; - } - /** * A <code>JarURLLoader</code> is a type of <code>URLLoader</code> * only loading from jar url. */ final static class JarURLLoader extends URLLoader { - final JarFile jarfile; // The canonical jar file for this url + final JarFile jarfile; // The jar file for this url final URL baseJarURL; // Base jar: url for all resources loaded from jar public JarURLLoader(URLClassLoader classloader, URL baseURL) { - super(classloader, getCanonicalFileURL(baseURL)); + super(classloader, baseURL); // cache url prefix for all resources in this jar url String external = baseURL.toExternalForm(); @@ -481,11 +465,11 @@ public class URLClassLoader extends SecureClassLoader */ final static class FileURLLoader extends URLLoader { - File dir; //the canonical file for this file url + File dir; //the file for this file url FileURLLoader(URLClassLoader classloader, URL url) { - super(classloader, getCanonicalFileURL(url)); + super(classloader, url); dir = new File(baseURL.getFile()); } @@ -493,13 +477,6 @@ public class URLClassLoader extends SecureClassLoader Resource getResource(String name) { File file = new File(dir, name); - try - { - file = file.getCanonicalFile(); - } - catch (IOException ignore) - { - } if (file.exists() && !file.isDirectory()) return new FileResource(this, name, file); return null; diff --git a/libjava/java/net/URLStreamHandler.java b/libjava/java/net/URLStreamHandler.java index 128a0d2d3da..7f866440f2f 100644 --- a/libjava/java/net/URLStreamHandler.java +++ b/libjava/java/net/URLStreamHandler.java @@ -436,7 +436,7 @@ public abstract class URLStreamHandler // ignores a non-default port if host is null or "". That is inconsistent // with the spec since the result of this method is spec'ed so it can be // used to construct a new URL that is equivalent to the original. - boolean port_needed = port >= 0 && port != getDefaultPort(); + boolean port_needed = port > 0 && port != getDefaultPort(); if (port_needed) sb.append(':').append(port); diff --git a/libjava/java/rmi/server/RMIClassLoader.java b/libjava/java/rmi/server/RMIClassLoader.java index 1b00970e441..057ca0fd402 100644 --- a/libjava/java/rmi/server/RMIClassLoader.java +++ b/libjava/java/rmi/server/RMIClassLoader.java @@ -172,7 +172,7 @@ public class RMIClassLoader } } - return loader != null ? loader.loadClass(name) : Class.forName(name); + return loader.loadClass(name); } public static String getClassAnnotation(Class cl) diff --git a/libjava/java/rmi/server/UnicastRemoteObject.java b/libjava/java/rmi/server/UnicastRemoteObject.java index aefe9701ecd..4e2f06ae64b 100644 --- a/libjava/java/rmi/server/UnicastRemoteObject.java +++ b/libjava/java/rmi/server/UnicastRemoteObject.java @@ -1,5 +1,5 @@ /* - Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. + Copyright (c) 1996, 1997, 1998, 1999, 2002, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -113,7 +113,7 @@ public static RemoteStub exportObject(Remote obj) throws RemoteException { } public static boolean unexportObject(Remote obj, boolean force) - throws RemoteException, NoSuchObjectException + throws NoSuchObjectException { if (obj instanceof RemoteObject) { diff --git a/libjava/java/security/Security.java b/libjava/java/security/Security.java index bf7a993ad47..39d75eef00c 100644 --- a/libjava/java/security/Security.java +++ b/libjava/java/security/Security.java @@ -37,9 +37,10 @@ exception statement from your version. */ package java.security; import java.io.File; -import java.io.FileInputStream; +import java.io.InputStream; import java.io.IOException; import java.io.FileNotFoundException; +import java.net.URL; import java.security.Provider; import java.util.Vector; import java.util.Enumeration; @@ -59,9 +60,9 @@ public final class Security extends Object static { - loadProviders(System.getProperty("java.home"), - System.getProperty("java.vm.name")); - loadProviders(System.getProperty("gnu.classpath.home"), "classpath"); + String base = System.getProperty("gnu.classpath.home.url"); + loadProviders(base, System.getProperty("gnu.classpath.vm.shortname")); + loadProviders(base, "classpath"); } // This class can't be instantiated. @@ -69,20 +70,16 @@ public final class Security extends Object { } - private static void loadProviders(String dir, String vendor) + private static void loadProviders(String baseUrl, String vendor) { - if (dir == null || vendor == null) + if (baseUrl == null || vendor == null) return; - String separator = System.getProperty("file.separator"); - String secfilestr = (dir + - separator + "lib" + - separator + "security" + - separator + vendor + ".security"); + String secfilestr = baseUrl + "/security/" + vendor + ".security"; try { - FileInputStream fin = new FileInputStream(secfilestr); + InputStream fin = new URL(secfilestr).openStream(); secprops = new Properties(); secprops.load(fin); diff --git a/libjava/java/util/Properties.java b/libjava/java/util/Properties.java index adad25055ac..cb77661a397 100644 --- a/libjava/java/util/Properties.java +++ b/libjava/java/util/Properties.java @@ -540,6 +540,7 @@ label = Name:\\u0020</pre> case '=': case ':': buffer.append('\\').append(c); + break; default: if (c < ' ' || c > '~') { diff --git a/libjava/java/util/TreeMap.java b/libjava/java/util/TreeMap.java index dfa9bc63881..e0cff28e02c 100644 --- a/libjava/java/util/TreeMap.java +++ b/libjava/java/util/TreeMap.java @@ -865,7 +865,7 @@ public class TreeMap extends AbstractMap int rowsize; // Fill each row that is completely full of nodes. - for (rowsize = 2; rowsize + rowsize < count; rowsize <<= 1) + for (rowsize = 2; rowsize + rowsize <= count; rowsize <<= 1) { Node parent = row; Node last = null; @@ -1468,10 +1468,10 @@ public class TreeMap extends AbstractMap */ public void remove() { - if (knownMod != modCount) - throw new ConcurrentModificationException(); if (last == null) throw new IllegalStateException(); + if (knownMod != modCount) + throw new ConcurrentModificationException(); removeNode(last); last = null; diff --git a/libjava/java/util/zip/ZipFile.java b/libjava/java/util/zip/ZipFile.java index eb79d03e594..4b027b088a9 100644 --- a/libjava/java/util/zip/ZipFile.java +++ b/libjava/java/util/zip/ZipFile.java @@ -1,5 +1,5 @@ /* java.util.zip.ZipFile - Copyright (C) 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,6 +37,7 @@ exception statement from your version. */ package java.util.zip; +import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.DataInput; import java.io.DataInputStream; @@ -46,7 +47,8 @@ import java.io.IOException; import java.io.EOFException; import java.io.RandomAccessFile; import java.util.Enumeration; -import java.util.Hashtable; +import java.util.HashMap; +import java.util.Iterator; import java.util.NoSuchElementException; /** @@ -58,6 +60,7 @@ import java.util.NoSuchElementException; * entries in different threads. * * @author Jochen Hoenicke + * @author Artur Biesiadowski */ public class ZipFile implements ZipConstants { @@ -79,7 +82,7 @@ public class ZipFile implements ZipConstants private final RandomAccessFile raf; // The entries of this zip file when initialized and not yet closed. - private Hashtable entries; + private HashMap entries; private boolean closed = false; @@ -137,33 +140,74 @@ public class ZipFile implements ZipConstants } /** - * Read an unsigned short in little endian byte order. + * Read an unsigned short in little endian byte order from the given + * DataInput stream using the given byte buffer. + * + * @param di DataInput stream to read from. + * @param b the byte buffer to read in (must be at least 2 bytes long). + * @return The value read. + * * @exception IOException if a i/o error occured. * @exception EOFException if the file ends prematurely */ - private final int readLeShort(DataInput di) throws IOException + private final int readLeShort(DataInput di, byte[] b) throws IOException { - byte[] b = new byte[2]; - di.readFully(b); + di.readFully(b, 0, 2); return (b[0] & 0xff) | (b[1] & 0xff) << 8; } /** - * Read an int in little endian byte order. + * Read an int in little endian byte order from the given + * DataInput stream using the given byte buffer. + * + * @param di DataInput stream to read from. + * @param b the byte buffer to read in (must be at least 4 bytes long). + * @return The value read. + * * @exception IOException if a i/o error occured. * @exception EOFException if the file ends prematurely */ - private final int readLeInt(DataInput di) throws IOException + private final int readLeInt(DataInput di, byte[] b) throws IOException { - byte[] b = new byte[4]; - di.readFully(b); + di.readFully(b, 0, 4); return ((b[0] & 0xff) | (b[1] & 0xff) << 8) | ((b[2] & 0xff) | (b[3] & 0xff) << 8) << 16; } + + /** + * Read an unsigned short in little endian byte order from the given + * byte buffer at the given offset. + * + * @param b the byte array to read from. + * @param off the offset to read from. + * @return The value read. + */ + private final int readLeShort(byte[] b, int off) + { + return (b[off] & 0xff) | (b[off+1] & 0xff) << 8; + } + + /** + * Read an int in little endian byte order from the given + * byte buffer at the given offset. + * + * @param b the byte array to read from. + * @param off the offset to read from. + * @return The value read. + */ + private final int readLeInt(byte[] b, int off) + { + return ((b[off] & 0xff) | (b[off+1] & 0xff) << 8) + | ((b[off+2] & 0xff) | (b[off+3] & 0xff) << 8) << 16; + } + + /** * Read the central directory of a zip file and fill the entries - * array. This is called exactly once when first needed. + * array. This is called exactly once when first needed. It is called + * while holding the lock on <code>raf</code>. + * * @exception IOException if a i/o error occured. * @exception ZipException if the central directory is malformed */ @@ -175,6 +219,8 @@ public class ZipFile implements ZipConstants * file isn't a zip file. */ long pos = raf.length() - ENDHDR; + byte[] ebs = new byte[CENHDR]; + do { if (pos < 0) @@ -182,45 +228,42 @@ public class ZipFile implements ZipConstants ("central directory not found, probably not a zip file: " + name); raf.seek(pos--); } - while (readLeInt(raf) != ENDSIG); + while (readLeInt(raf, ebs) != ENDSIG); + if (raf.skipBytes(ENDTOT - ENDNRD) != ENDTOT - ENDNRD) throw new EOFException(name); - int count = readLeShort(raf); + int count = readLeShort(raf, ebs); if (raf.skipBytes(ENDOFF - ENDSIZ) != ENDOFF - ENDSIZ) throw new EOFException(name); - int centralOffset = readLeInt(raf); + int centralOffset = readLeInt(raf, ebs); - entries = new Hashtable(count); + entries = new HashMap(count+count/2); raf.seek(centralOffset); - byte[] ebs = new byte[24]; - ByteArrayInputStream ebais = new ByteArrayInputStream(ebs); - DataInputStream edip = new DataInputStream(ebais); + + byte[] buffer = new byte[16]; for (int i = 0; i < count; i++) { - if (readLeInt(raf) != CENSIG) + raf.readFully(ebs); + if (readLeInt(ebs, 0) != CENSIG) throw new ZipException("Wrong Central Directory signature: " + name); - if (raf.skipBytes(CENHOW - CENVEM) != CENHOW - CENVEM) - throw new EOFException(name); - - raf.readFully(ebs); - ebais.reset(); - int method = readLeShort(edip); - int dostime = readLeInt(edip); - int crc = readLeInt(edip); - int csize = readLeInt(edip); - int size = readLeInt(edip); - int nameLen = readLeShort(edip); - int extraLen = readLeShort(edip); - int commentLen = readLeShort(edip); - - if (raf.skipBytes(CENOFF - CENDSK) != CENOFF - CENDSK) - throw new EOFException(name); - int offset = readLeInt(raf); - - byte[] buffer = new byte[Math.max(nameLen, commentLen)]; + + int method = readLeShort(ebs, CENHOW); + int dostime = readLeInt(ebs, CENTIM); + int crc = readLeInt(ebs, CENCRC); + int csize = readLeInt(ebs, CENSIZ); + int size = readLeInt(ebs, CENLEN); + int nameLen = readLeShort(ebs, CENNAM); + int extraLen = readLeShort(ebs, CENEXT); + int commentLen = readLeShort(ebs, CENCOM); + + int offset = readLeInt(ebs, CENOFF); + + int needBuffer = Math.max(nameLen, commentLen); + if (buffer.length < needBuffer) + buffer = new byte[needBuffer]; raf.readFully(buffer, 0, nameLen); - String name = new String(buffer, 0, nameLen); + String name = new String(buffer, 0, 0, nameLen); ZipEntry entry = new ZipEntry(name); entry.setMethod(method); @@ -248,6 +291,7 @@ public class ZipFile implements ZipConstants * Closes the ZipFile. This also closes all input streams given by * this class. After this is called, no further method should be * called. + * * @exception IOException if a i/o error occured. */ public void close() throws IOException @@ -267,7 +311,7 @@ public class ZipFile implements ZipConstants { try { - return new ZipEntryEnumeration(getEntries().elements()); + return new ZipEntryEnumeration(getEntries().values().iterator()); } catch (IOException ioe) { @@ -281,7 +325,7 @@ public class ZipFile implements ZipConstants * @exception IllegalStateException when the ZipFile has already been closed. * @exception IOEexception when the entries could not be read. */ - private Hashtable getEntries() throws IOException + private HashMap getEntries() throws IOException { synchronized(raf) { @@ -297,15 +341,16 @@ public class ZipFile implements ZipConstants /** * Searches for a zip entry in this archive with the given name. + * * @param the name. May contain directory components separated by * slashes ('/'). * @return the zip entry, or null if no entry with that name exists. - * @see #entries */ + */ public ZipEntry getEntry(String name) { try { - Hashtable entries = getEntries(); + HashMap entries = getEntries(); ZipEntry entry = (ZipEntry) entries.get(name); return entry != null ? (ZipEntry) entry.clone() : null; } @@ -315,10 +360,17 @@ public class ZipFile implements ZipConstants } } + + //access should be protected by synchronized(raf) + private byte[] locBuf = new byte[LOCHDR]; + /** * Checks, if the local header of the entry at index i matches the * central directory, and returns the offset to the data. + * + * @param entry to check. * @return the start offset of the (compressed) data. + * * @exception IOException if a i/o error occured. * @exception ZipException if the local header doesn't match the * central directory header @@ -328,24 +380,18 @@ public class ZipFile implements ZipConstants synchronized (raf) { raf.seek(entry.offset); - if (readLeInt(raf) != LOCSIG) + raf.readFully(locBuf); + + if (readLeInt(locBuf, 0) != LOCSIG) throw new ZipException("Wrong Local header signature: " + name); - /* skip version and flags */ - if (raf.skipBytes(LOCHOW - LOCVER) != LOCHOW - LOCVER) - throw new EOFException(name); - - if (entry.getMethod() != readLeShort(raf)) + if (entry.getMethod() != readLeShort(locBuf, LOCHOW)) throw new ZipException("Compression method mismatch: " + name); - /* Skip time, crc, size and csize */ - if (raf.skipBytes(LOCNAM - LOCTIM) != LOCNAM - LOCTIM) - throw new EOFException(name); - - if (entry.getName().length() != readLeShort(raf)) + if (entry.getName().length() != readLeShort(locBuf, LOCNAM)) throw new ZipException("file name length mismatch: " + name); - int extraLen = entry.getName().length() + readLeShort(raf); + int extraLen = entry.getName().length() + readLeShort(locBuf, LOCEXT); return entry.offset + LOCHDR + extraLen; } } @@ -354,13 +400,16 @@ public class ZipFile implements ZipConstants * Creates an input stream reading the given zip entry as * uncompressed data. Normally zip entry should be an entry * returned by getEntry() or entries(). + * + * @param entry the entry to create an InputStream for. * @return the input stream. + * * @exception IOException if a i/o error occured. * @exception ZipException if the Zip archive is malformed. */ public InputStream getInputStream(ZipEntry entry) throws IOException { - Hashtable entries = getEntries(); + HashMap entries = getEntries(); String name = entry.getName(); ZipEntry zipEntry = (ZipEntry) entries.get(name); if (zipEntry == null) @@ -368,8 +417,8 @@ public class ZipFile implements ZipConstants long start = checkLocalHeader(zipEntry); int method = zipEntry.getMethod(); - InputStream is = new PartialInputStream - (raf, start, zipEntry.getCompressedSize()); + InputStream is = new BufferedInputStream(new PartialInputStream + (raf, start, zipEntry.getCompressedSize())); switch (method) { case ZipOutputStream.STORED: @@ -406,16 +455,16 @@ public class ZipFile implements ZipConstants private static class ZipEntryEnumeration implements Enumeration { - private final Enumeration elements; + private final Iterator elements; - public ZipEntryEnumeration(Enumeration elements) + public ZipEntryEnumeration(Iterator elements) { this.elements = elements; } public boolean hasMoreElements() { - return elements.hasMoreElements(); + return elements.hasNext(); } public Object nextElement() @@ -423,13 +472,13 @@ public class ZipFile implements ZipConstants /* We return a clone, just to be safe that the user doesn't * change the entry. */ - return ((ZipEntry)elements.nextElement()).clone(); + return ((ZipEntry)elements.next()).clone(); } } private static class PartialInputStream extends InputStream { - RandomAccessFile raf; + private final RandomAccessFile raf; long filepos, end; public PartialInputStream(RandomAccessFile raf, long start, long len) diff --git a/libjava/javax/naming/InitialContext.java b/libjava/javax/naming/InitialContext.java index 99ae426e9ab..705e24ad1eb 100644 --- a/libjava/javax/naming/InitialContext.java +++ b/libjava/javax/naming/InitialContext.java @@ -1,5 +1,5 @@ /* InitialContext.java -- - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -126,18 +126,22 @@ public class InitialContext implements Context } catch (IOException e) {} - String home = System.getProperty("java.home"); + String home = System.getProperty("gnu.classpath.home.url"); if (home != null) { - String fileName = home + File.separator - + "lib" + File.separator + "jndi.properties"; + String url = home + "/jndi.properties"; Properties p = new Properties (); - try { - InputStream is = new FileInputStream (fileName); - p.load (is); - is.close (); - } catch (IOException e) {} + try + { + InputStream is = new URL(url).openStream(); + p.load (is); + is.close (); + } + catch (IOException e) + { + // Ignore. + } merge (myProps, p); } diff --git a/libjava/prims.cc b/libjava/prims.cc index 2195db161e1..61c66540831 100644 --- a/libjava/prims.cc +++ b/libjava/prims.cc @@ -592,15 +592,15 @@ _Jv_NewMultiArray (jclass array_type, jint dimensions, ...) _Jv_ArrayVTable _Jv_##NAME##VTable; \ java::lang::Class _Jv_##NAME##Class __attribute__ ((aligned (8))); -DECLARE_PRIM_TYPE(byte); -DECLARE_PRIM_TYPE(short); -DECLARE_PRIM_TYPE(int); -DECLARE_PRIM_TYPE(long); -DECLARE_PRIM_TYPE(boolean); -DECLARE_PRIM_TYPE(char); -DECLARE_PRIM_TYPE(float); -DECLARE_PRIM_TYPE(double); -DECLARE_PRIM_TYPE(void); +DECLARE_PRIM_TYPE(byte) +DECLARE_PRIM_TYPE(short) +DECLARE_PRIM_TYPE(int) +DECLARE_PRIM_TYPE(long) +DECLARE_PRIM_TYPE(boolean) +DECLARE_PRIM_TYPE(char) +DECLARE_PRIM_TYPE(float) +DECLARE_PRIM_TYPE(double) +DECLARE_PRIM_TYPE(void) void _Jv_InitPrimClass (jclass cl, char *cname, char sig, int len, diff --git a/libjava/scripts/classes.pl b/libjava/scripts/classes.pl index cc5ef786668..7e77c59227e 100644 --- a/libjava/scripts/classes.pl +++ b/libjava/scripts/classes.pl @@ -1,7 +1,7 @@ # classes.pl - A perl program to generate most of the contents of # javaprims.h automatically. -# Copyright (C) 1998, 1999, 2000 Red Hat, Inc. +# Copyright (C) 1998, 1999, 2000, 2002 Red Hat, Inc. # # This file is part of libjava. # @@ -119,5 +119,5 @@ sub scan &scan ("$dir/$_", $indent + 2); } - print $spaces, "};\n"; + print $spaces, "}\n"; } diff --git a/libjava/testsuite/ChangeLog b/libjava/testsuite/ChangeLog index d77e3145f63..3dcc30e5045 100644 --- a/libjava/testsuite/ChangeLog +++ b/libjava/testsuite/ChangeLog @@ -1,3 +1,18 @@ +2003-01-12 Tom Tromey <tromey@redhat.com> + + Fix for PR libgcj/9139: + * lib/libjava.exp (find_javac): Put value of libgcj_jar into + return value when gcj is used. + * libjava.mauve/mauve.exp (test_mauve): Use libgcj_jar global. + +2003-01-03 Tom Tromey <tromey@redhat.com> + + * libjava.compile/pr8712.java: New file, for PR java/8712. + +2003-01-01 Tom Tromey <tromey@redhat.com> + + * libjava.compile/pr8955.java: New test, for PR java/8955. + 2002-12-19 Tom Tromey <tromey@redhat.com> * libjava.jacks/jacks.xfail: Updated. diff --git a/libjava/testsuite/lib/libjava.exp b/libjava/testsuite/lib/libjava.exp index a807c4c8d60..9c8e664e67b 100644 --- a/libjava/testsuite/lib/libjava.exp +++ b/libjava/testsuite/lib/libjava.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation +# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation load_lib "libgloss.exp" @@ -74,7 +74,7 @@ proc find_gcjh {} { } proc find_javac {} { - global SUN_JAVAC GCJ_UNDER_TEST env + global SUN_JAVAC GCJ_UNDER_TEST env libgcj_jar # If JDK doesn't run on your platform but some other # JDK-compatible javac does, you may set SUN_JAVAC to point to it. # One of the most important properties of a SUN_JAVAC is that it @@ -87,7 +87,7 @@ proc find_javac {} { if {[info exists env(SUN_JAVAC)]} { set SUN_JAVAC $env(SUN_JAVAC) } else { - set SUN_JAVAC "$GCJ_UNDER_TEST -C" + set SUN_JAVAC "$GCJ_UNDER_TEST -C -I$libgcj_jar" } } return $SUN_JAVAC diff --git a/libjava/testsuite/libjava.mauve/mauve.exp b/libjava/testsuite/libjava.mauve/mauve.exp index 1ca2884249c..ce4b0cee9cb 100644 --- a/libjava/testsuite/libjava.mauve/mauve.exp +++ b/libjava/testsuite/libjava.mauve/mauve.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation. +# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation. # Written by Tom Tromey <tromey@cygnus.com>. # Incorporate Mauve into libjava's DejaGNU test suite framework. @@ -86,25 +86,25 @@ proc test_mauve {} { set full_srcdir [pwd] cd $here/mauve-build - global env - global GCJ_UNDER_TEST - global TOOL_EXECUTABLE + global env libgcj_jar + global GCJ_UNDER_TEST + global TOOL_EXECUTABLE - if ![info exists GCJ_UNDER_TEST] { - if [info exists TOOL_EXECUTABLE] { - set GCJ_UNDER_TEST $TOOL_EXECUTABLE; - } else { - if [info exists env(GCJ)] { - set GCJ_UNDER_TEST env(GCJ) - } else { - set GCJ_UNDER_TEST "[find_gcj]" - } - } + if ![info exists GCJ_UNDER_TEST] { + if [info exists TOOL_EXECUTABLE] { + set GCJ_UNDER_TEST $TOOL_EXECUTABLE; + } else { + if [info exists env(GCJ)] { + set GCJ_UNDER_TEST env(GCJ) + } else { + set GCJ_UNDER_TEST "[find_gcj]" + } } + } - # Append -B and -I so that libgcj.spec and libgcj.zip are found - # before they're installed. - set env(GCJ) "$GCJ_UNDER_TEST -B$objdir/../ -I$objdir/../libgcj.jar" + # Append -B and -I so that libgcj.spec and libgcj.jar are found + # before they're installed. + set env(GCJ) "$GCJ_UNDER_TEST -B$objdir/../ -I$libgcj_jar" if {[catch { system "$env(MAUVEDIR)/configure --with-gcj 2>&1" diff --git a/libjava/verify.cc b/libjava/verify.cc index dbf80d4bf03..238a3e926f1 100644 --- a/libjava/verify.cc +++ b/libjava/verify.cc @@ -128,6 +128,34 @@ private: return r; } + __attribute__ ((__noreturn__)) void verify_fail (char *s, jint pc = -1) + { + using namespace java::lang; + StringBuffer *buf = new StringBuffer (); + + buf->append (JvNewStringLatin1 ("verification failed")); + if (pc == -1) + pc = start_PC; + if (pc != -1) + { + buf->append (JvNewStringLatin1 (" at PC ")); + buf->append (pc); + } + + _Jv_InterpMethod *method = current_method; + buf->append (JvNewStringLatin1 (" in ")); + buf->append (current_class->getName()); + buf->append ((jchar) ':'); + buf->append (JvNewStringUTF (method->get_method()->name->data)); + buf->append ((jchar) '('); + buf->append (JvNewStringUTF (method->get_method()->signature->data)); + buf->append ((jchar) ')'); + + buf->append (JvNewStringLatin1 (": ")); + buf->append (JvNewStringLatin1 (s)); + throw new java::lang::VerifyError (buf->toString ()); + } + // This enum holds a list of tags for all the different types we // need to handle. Reference types are treated specially by the // type class. @@ -3064,34 +3092,6 @@ private: } } - __attribute__ ((__noreturn__)) void verify_fail (char *s, jint pc = -1) - { - using namespace java::lang; - StringBuffer *buf = new StringBuffer (); - - buf->append (JvNewStringLatin1 ("verification failed")); - if (pc == -1) - pc = start_PC; - if (pc != -1) - { - buf->append (JvNewStringLatin1 (" at PC ")); - buf->append (pc); - } - - _Jv_InterpMethod *method = current_method; - buf->append (JvNewStringLatin1 (" in ")); - buf->append (current_class->getName()); - buf->append ((jchar) ':'); - buf->append (JvNewStringUTF (method->get_method()->name->data)); - buf->append ((jchar) '('); - buf->append (JvNewStringUTF (method->get_method()->signature->data)); - buf->append ((jchar) ')'); - - buf->append (JvNewStringLatin1 (": ")); - buf->append (JvNewStringLatin1 (s)); - throw new java::lang::VerifyError (buf->toString ()); - } - public: void verify_instructions () |