Commit Graph

989 Commits

Author SHA1 Message Date
Johannes Schindelin
884d0979a9 ObjectInputStream: handle super class descriptors correctly
We punted previously on any serializable super class' descriptor and
simply expected the super class not to be serializable (and consequently,
we expected the respective descriptor to be null). However, for quite
common classes, e.g. OpenJDK's Double class, this is not true.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:10:51 -06:00
Johannes Schindelin
ff45f452da ObjectInputStream: handle TC_REFERENCE
There are serialized objects out in the wild which make heavy use of
TC_REFERENCE: for example when an object has a reference to itself.

Therefore we need to support that, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:10:51 -06:00
Johannes Schindelin
b6d3caf458 ObjectInputStream: refactor class desc parsing
We punted previously on any serializable super class' descriptor and
simply expected the super class not to be serializable (and consequently,
we expected the respective descriptor to be null).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:10:51 -06:00
Johannes Schindelin
25ed2965e7 ObjectInputStream: use private readObject() methods
The specification of the Java deserialization demands that a private
readObject(ObjectOutputStream) method is used -- if it exists. In
that case, ObjectInputStream must not initialize the contents of the
fields (called 'classdata[]' in the documentation) but offer that
functionality via the defaultReadObject() method.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:10:51 -06:00
Johannes Schindelin
931617a787 ObjectOutputStream: use private writeObject() methods
The specification of the Java serialization demands that a private
writeObject(ObjectOutputStream) method is used -- if it exists. In that
case, ObjectOutputStream must not write the contents of the fields
(called 'classdata[]' in the documentation) but offer that via the
defaultWriteObject() method.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:10:51 -06:00
Johannes Schindelin
f3189bc79d ObjectOutputStream: optimize String serialization
The serialization protocol specifies a quick method to serialize
a String (because that is so common an operation): TC_STRING +
(short)length + bytes. Let's use that, also to make it easier to test
the upcoming changes to TreeMap harmonizing that Avian's serialization
of said class with OpenJDK's.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:10:51 -06:00
Johannes Schindelin
bba0d25ba5 ObjectInputStream: handle fields of type String
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:10:51 -06:00
Johannes Schindelin
c78923d717 ObjectInputStream: add rudimentary support for objects
This is by no means a complete support for the deserialization compliant
to the Java Language Specification, but it is better to add the support
incrementally, for better readability of the commits.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:10:51 -06:00
Johannes Schindelin
4b8285e597 Implement a rudimentary Java-compatible ObjectInputStream
The Java Language Specification documents the serialization protocol
implemented by this change set:

http://docs.oracle.com/javase/7/docs/platform/serialization/spec/protocol.html#10258

This change is intended to make it easier to use Avian VM as a drop-in
replacement for the Oracle JVM when serializing objects.

The previous serialization code is still available as
avian.LegacyObjectInputStream.

This commit only implements the non-object parts of the deserialization
specification.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:10:51 -06:00
Johannes Schindelin
35ecf5025c Make ObjectOutputStream's constants available to java.io
We will reuse the constants in the upcoming deserialization counterpart.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:10:50 -06:00
Johannes Schindelin
3dccd68fe7 Implement the Field#set<PrimitiveType> method family
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:10:50 -06:00
Johannes Schindelin
c2a6f4a726 Implement a Java-compatible ObjectOutputStream
The Java Language Specification documents the serialization protocol
implemented by this change set:

http://docs.oracle.com/javase/7/docs/platform/serialization/spec/protocol.html#10258

This change is intended to make it easier to use Avian VM as a drop-in
replacement for the Oracle JVM when serializing objects.

The previous serialization code is still available as
avian.LegacyObjectOutputStream.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:10:50 -06:00
Johannes Schindelin
f2dd4add26 Implement FilterReader
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:10:50 -06:00
Johannes Schindelin
2904dd738e Fix java.lang.reflect.Field.getLong()
The bug was that the long was cast to an int, cutting off the most
significant bytes.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:10:50 -06:00
Johannes Schindelin
6a7c03aef9 Implement the Math#signum method
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:07:58 -06:00
Johannes Schindelin
f8028c9864 Add a dummy implementation of EmptyStackException
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:07:58 -06:00
Johannes Schindelin
6159f5cd3c Support Logger#log(Level,String,Object)
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:07:58 -06:00
Johannes Schindelin
874bf4ef4c Initialize Logger instances to the 'INFO' level by default
... otherwise, logging would throw an exception when trying to
determine whether the current level allows the message to be logged.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:07:58 -06:00
Johannes Schindelin
dba8d39e63 Implement Class#getDeclaredClasses
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-06 09:07:58 -06:00
Simon Ochsenreither
5827c450c9 Adds separatorChar and pathSeparatorChar fields to File ...
... and fixes a bug which caused path.separator to always return null.
2013-11-06 14:05:25 +01:00
Johannes Schindelin
26c90170a6 Add a minimal FilterInputStream
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-05 14:36:16 -06:00
Joshua Warner
da69b735f4 Merge branch 'addzip' of git://github.com/CUBoulderBoy/avian into CUBoulderBoy-addzip 2013-11-04 17:38:27 -07:00
Joshua Warner
d128838617 Merge pull request #92 from dscho/collections
Various improvements regarding Collections
2013-11-04 16:33:06 -08:00
Joshua Warner
ac32e0de39 Merge pull request #91 from dscho/intro-sort
Replace Arrays.sort() with an efficient sort algorithm
2013-11-04 16:31:08 -08:00
Johannes Schindelin
002b0db43a Do not report jar: URLs as jar://file:...
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-04 16:55:07 -06:00
Johannes Schindelin
167688eabd Teach SystemClassLoader#getResources to not stop at the first match
The getResources method can be used to find all matches in the class
path for a given path, e.g. to seek out all the META-INF/MANIFEST.MF
files contained in all of the .jar files in the class path.

We just taught the findResources() method to return all matches (rather
than only the first), so let's use that method to get all the matches
from the current class loader's class path elements.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-04 16:49:34 -06:00
Johannes Schindelin
0602d4a447 Consider all class path elements in SystemClassLoader#findResources
The findResources method is supposed to enumerate all the class path
elements' matching paths' URLs, but we used to stop at the first one.

While this is good enough when the system class path contains only a
single .jar file, since b88438d2(sketch of JAR support in Finder)
supports more than a single .jar file in the class path.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-04 16:49:31 -06:00
Johannes Schindelin
7fe3979280 Implement LinkedHashSet
This implementation is intentionally simple. If and when the need arises,
we can always implement a more performant version.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-04 15:11:19 -06:00
Johannes Schindelin
58ea1442fd Implement LinkedHashMap
This implementation is intentionally simple. If and when the need arises,
we can always implement a more performant version.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-04 15:11:19 -06:00
Johannes Schindelin
c023bd8654 Implement TreeSet#descendingIterator
If need be, this functionality can be sped up by implementing a
descending iterator on the tree without copying it into an ArrayList.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-04 15:11:19 -06:00
Johannes Schindelin
1ed90c38ab Implement rest of the Arrays#fill family
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-04 15:11:19 -06:00
Johannes Schindelin
6a81623690 Implement the Arrays#copyOf family
... as introduced in Java 6.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-04 15:11:00 -06:00
Johannes Schindelin
46a55bd024 Implement ArrayList#ensureCapacity
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-04 14:33:25 -06:00
Johannes Schindelin
eab3b8e448 Implement Collections#reverse
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-04 14:33:25 -06:00
Johannes Schindelin
a61bcf824f Implement Collections#binarySearch
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-04 14:33:25 -06:00
Johannes Schindelin
d37b5ada37 Implement Collections#sort
This is really a verbatim translation of Arrays#sort.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-04 12:08:22 -06:00
Johannes Schindelin
605701e40a Replace Arrays.sort() with an efficient sort algorithm
This change reuses the existing insertion sort (which was previously what
Arrays.sort() executed) in a full intro sort pipeline.

The implementation is based on the Musser paper on intro sort (Musser,
David R. "Introspective sorting and selection algorithms." Softw., Pract.
Exper. 27.8 (1997): 983-993.) and Wikipedia's current description of the
heap sort: http://en.wikipedia.org/wiki/Heapsort.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-04 00:27:04 -06:00
Johannes Schindelin
6c46fe3f1a Make Vector a Cloneable
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-25 15:32:33 -05:00
Johannes Schindelin
056c65947e Add Collections#singletonList
This is a very dumb implementation that wastes space and time by
constructing a full-blown ArrayList as backend. However, it is
better to have a dumb implementation than none at all, and we can
always do something about the performance when, and if, that should
become necessary.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-25 15:32:33 -05:00
Johannes Schindelin
86c735e649 Add Collections#synchronizedSet
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-25 15:32:33 -05:00
Johannes Schindelin
526dd574d9 Add the Method#isVarArgs method
Required by bleeding-edge Beanshell...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-25 15:32:33 -05:00
Johannes Schindelin
0e3e719dd6 Add the Boolean#getBoolean method
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-25 15:32:33 -05:00
Johannes Schindelin
d04cda30ca Add the Integer#decode method
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-25 15:32:33 -05:00
Johannes Schindelin
2ff0178da4 Adjust fromIndex in String#lastIndexOf if necessary
If fromIndex 'is greater than or equal to the length of this string,
it has the same effect as if it were equal to one less than the length
of the string':

http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#lastIndexOf%28int,%20int%29

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-25 15:32:33 -05:00
Joshua Warner
187d5dfde9 fix darwin build 2013-10-24 14:07:53 -06:00
Joshua Warner
b20dcd268c Merge pull request #85 from dscho/simple-regex
Simple regex
2013-10-21 13:30:57 -07:00
Johannes Schindelin
728473e9ad Support escaped octal and hexadecimal characters in regular expressions
In the previous commit, we did not support characters in regular
expressions specified via \0..., \x... or \u... yet. This is a bit more
involved, therefore support for them is added in its own commit.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-21 13:34:33 -05:00
Johannes Schindelin
f55ac46602 Support trivial regular expressions with special escaped characters
When a regular expression contains escaped characters such as the
backslash, it is actually still a literal string. So let's support the
trivially-escaped characters, too, that are documented in

	http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-21 12:00:17 -05:00
Joshua Warner
02e433ce61 Merge pull request #84 from dscho/random-access-file
Write support for the RandomAccessFile
2013-10-21 09:38:44 -07:00
Joshua Warner
e485a468f0 Merge pull request #82 from dscho/dates
Implement date parsing / formatting
2013-10-21 09:36:46 -07:00
Johannes Schindelin
3681ae508e Implement a rudimentary RandomAccessFile#getChannel
This implementation is by no means intended to be complete, just enough to
support running http://http://loci.wisc.edu/software/bio-formats's
loci.formats.tools.ImageConverter tool.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-21 10:59:59 -05:00
Johannes Schindelin
3a67f81b50 Add the FileChannel class
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-21 10:59:59 -05:00
Johannes Schindelin
caec6eba67 Add the BufferUnderflowException
Pre-compiled code might expect the class to exist...

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-21 10:59:59 -05:00
Johannes Schindelin
4f83f8dd98 ByteBuffer: add missing order() methods
Avian's ByteBuffer implementation is actually fixed to big endian. So
let's throw an exception if the user tries to change that.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-21 10:59:59 -05:00
Johannes Schindelin
320fc511dc Fix potential memory leak in RandomAccessFile#readBytes
This was noticed when copy-editing writeBytes.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-21 10:59:59 -05:00
Johannes Schindelin
8084cb6398 Fix indentation in java-io.cpp
This was noticed when copy-editing readBytes into writeBytes.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-21 10:59:59 -05:00
Johannes Schindelin
2c0a1c726d Add write support for RandomAccessFile
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-21 10:59:59 -05:00
Johannes Schindelin
905ddfe613 Add the RandomAccessFile(File file, String mode) constructor
As per the Java API.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-21 10:59:58 -05:00
Johannes Schindelin
18f6f7881a RandomAccessFile: support opening for read/write
So far, we only allowed opening in read-only mode. Now, we also support
read/write mode in addition.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-21 10:55:26 -05:00
Johannes Schindelin
4f8b3f8865 Implement a minimal SimpleDateFormat
For the moment, this class can only handle dates of the form
"yyyy-MM-dd'T'HH:mm:ss".

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-21 10:41:40 -05:00
Johannes Schindelin
c46baa3524 Add a minimal implementation of DataOutputStream
This implements all the methods required by the DataOutput interface; to
run Bio-Formats' bfconvert tool, actually only the write() and writeByte()
methods would be required.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-18 15:10:05 -05:00
Johannes Schindelin
2f87be954c Add the DataInput / DataOutput interfaces
These are part of the standard Java class library API.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-18 15:10:05 -05:00
Johannes Schindelin
6f9a9fd15d Add java.lang.Double#doubleToLongBits
It is different than #doubleToRawLongBits only when the input value
is not a number.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-18 15:01:36 -05:00
Johannes Schindelin
a9ecf1eaed Complete the java.util.Arrays#toString family of methods
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-18 15:01:36 -05:00
Johannes Schindelin
396c0822cd Add java.lang.Character#isISOControl(char)
... as per the public JavaDoc at

http://docs.oracle.com/javase/6/docs/api/java/lang/Character.html#isISOControl%28char%29

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-18 15:01:36 -05:00
Johannes Schindelin
7aca1b1307 Add java.lang.Boolean#parse(String)
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-18 15:01:36 -05:00
Johannes Schindelin
7476603e1c Add minimal implementations of ParseException / ParsePosition
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-18 14:58:44 -05:00
Johannes Schindelin
dcfcd193be Implement Calendar#getTime
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-18 14:58:44 -05:00
Johannes Schindelin
466a7fc0c0 Be more verbose when complaining about a non-trivial regex
In particular when constructing regular expressions before compiling them,
it is a good idea to state which exact expression is non-trivial when
complaining about it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-18 14:56:05 -05:00
Joshua Warner
b3d4f33522 fix memory leak in Java_java_io_File_lastModified (exposed in debug mode) 2013-10-17 13:54:59 -06:00
Johannes Schindelin
ba10a58e3b Support java.io.File#lastModified not only on Windows
There was already non-Windows support, but it was put into the
Windows-specific part. Move it outside.

While at it, change the left-over 'st' to 'fileStat' to fix the
compilation.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-10-17 14:22:59 -05:00
Joshua Warner
314f18644f make getChars and releaseChars static, to prevent them being confused with implementations in other objects if they're not inlined (debug mode) 2013-09-06 08:47:46 -06:00
Joshua Warner
3136c9d156 fix ios sim=true build 2013-09-03 21:22:34 -06:00
Joshua Warner
b6c7cfef73 Merge pull request #77 from joshuawarner32/win-cmd-excape
add proper argument escaping in Runtime.exec for windows
2013-08-30 13:04:57 -07:00
Joshua Warner
4572c02bf0 fix typo 2013-08-30 11:32:17 -06:00
Joshua Warner
3d361619a3 add proper argument escaping in Runtime.exec for windows 2013-08-29 14:37:14 -06:00
Dan Cunningham
0db1a2c414 The unlink/_wunlink call will not delete directories, use remove/_wremove instead 2013-08-28 15:27:31 -06:00
Mike Jensen
bfe7b9110a Removed exception message based on Josh's recommendation 2013-07-17 11:52:48 -06:00
Mike Jensen
7da59277e5 This solves a class cast exception from a call to .values() from an UnmodifiableMap. It also solves an issue where you can modify an unmodifiable collection through the Iterator or ListIterator (depending on the structure type). 2013-07-15 08:54:44 -06:00
Joel Dice
ccebdb2107 Merge remote-tracking branch 'jet/master' 2013-07-09 10:04:50 -06:00
JET
1b6d8e1085 Added native Math.exp() implementation. 2013-07-09 08:31:48 -06:00
Chris Jordan
8eec1a0339 fixing problems! 2013-07-08 16:30:17 -06:00
Aaron Davis
54484bc2eb add zipOutputStream and change DeflaterOutputStream 2013-07-08 14:13:08 -06:00
Chris Jordan
6970bb26ae updating zipentry 2013-07-08 13:55:00 -06:00
Chris Jordan
055f820cac adding zipentry and zipoutputstream classes 2013-07-05 14:39:30 -06:00
Joel Dice
87b02eb949 update copyright years
Previously, I used a shell script to extract modification date ranges
from the Git history, but that was complicated and unreliable, so now
every file just gets the same year range in its copyright header.  If
someone needs to know when a specific file was modified and by whom,
they can look at the Git history themselves; no need to include it
redundantly in the header.
2013-07-02 20:52:38 -06:00
JET
b66d8b9fbf Expanded DatagramChannel and corrected blocking configuration in connect(). 2013-07-02 10:10:05 -06:00
Joshua Warner
cb11e21f95 force unicode support in java-io.cpp when including windows.h 2013-06-04 11:52:18 -06:00
Joshua Warner
8df12d5003 Use native windows APIs for File.exists()
On windows, there are obscure cases where _wstat can return non-zero for a path that
actually exists, but the native GetFileAttributes returns valid attributes.  This is
the case in particular when the user or process doesn't have permissions to access
the directory (for instance, anything outside of %temp%\Low, when running as a
low-integrity process).

This was causing problems with .mkdirs() - which first tries to check if the parent
exists, and creates it if it doesn't. In our particular case, the exists() was
returning false for the parent, even though it exists, and .mkdir() works fine,
mkdirs() fails for the same directory.
2013-05-31 11:17:21 -06:00
Joel Dice
6b3a352b38 Merge remote-tracking branch 'origin/master' 2013-04-30 23:08:18 -06:00
Joel Dice
529c7a17fb add support for the RuntimeVisibleParameterAnnotations attribute 2013-04-30 22:55:59 -06:00
Mike Jensen
bd2ebfce07 Merge branch 'master' of https://github.com/ReadyTalk/avian 2013-04-29 11:45:32 -06:00
Mike Jensen
a41f8c0103 Added more to the avian classpath for the collection interface as well as the list interface
Added to collection:
public boolean containsAll(Collection<?> c);
public boolean removeAll(Collection<?> c);

Added to list:
public boolean addAll(int startIndex, Collection<? extends T> c);

Also where possible for inner classes I made them extend the abstract version instead of just implement the interface.  This helps reduce code duplication where possible.

These changes were necessary to support protobuf 2.5.0
2013-04-29 11:32:56 -06:00
Joel Dice
4e12847858 code rearrangment to improve state of Android libcore tests
This mainly moves several sun.misc.Unsafe method implementations from
classpath-openjdk.cpp to builtin.cpp so that the Avian and Android
builds can use them.

It also replaces FinalizerReference.finalizeAllEnqueued with a no-op,
since the real implementations assumes too much about how the VM
handles (or delegates) finalization.
2013-04-23 13:47:15 -06:00
Joel Dice
b4c3eea0f1 set InvocationTargetException target
When using the OpenJDK classpath, the target exception and the
Throwable cause are two different fields; we must set them both.
2013-04-18 11:23:59 -06:00
Joel Dice
81d7786716 fix Class.getModifiers for inner classes and implement JVM_GetDeclaringClass and JVM_GetEnclosingMethodInfo properly
This fixes a couple of tests in the Scala test suite
(run/reflection-modulemirror-toplevel-badpath.scala and
run/reflection-constructormirror-nested-good.scala).
2013-04-17 15:12:58 -06:00
Joel Dice
d873f096a1 set SO_NOSIGPIPE socket option when available
This ensures we avoid SIGPIPE on socket disconnect on Darwin.
2013-03-18 11:43:00 -06:00
Joel Dice
ff19ab6c13 add avian.trace.port property
Setting this property (e.g. -Davian.trace.port=5555) will cause the VM
to start an extra daemon thread which listens on the specified TCP
port for incoming connections and dumps stack traces for all running
threads to that socket.  You can retrieve that dump using e.g. netcat:

  nc localhost 5555
2013-03-08 14:47:27 -07:00
Joel Dice
b3978c0a0a fix msvc build 2013-03-04 11:09:59 -07:00
Joel Dice
5e2d00010b move headers from src to src/avian
This is necessary to avoid name conflicts on various platforms.  For
example, iOS has its own util.h, and Windows has a process.h.  By
including our version as e.g. "avian/util.h", we avoid confusion with
the system version.
2013-02-27 13:33:29 -07:00
Joel Dice
9060a31348 Merge remote-tracking branch 'github/master' into dicej
Conflicts:
	src/classpath-openjdk.cpp
2013-02-22 14:43:20 -07:00
Joel Dice
8546ca5670 fix Avian classpath build 2013-02-22 11:55:01 -07:00
Joel Dice
42d39b1af1 more Android class library work 2013-02-21 15:37:17 -07:00
Joel Dice
d414fd4c7b more progress on Android class library port
Hello.java works.  Yay.
2013-02-20 10:22:40 -07:00
Joshua Warner
b9e281612b move runtime-array to include 2013-02-19 22:56:05 -07:00
Joshua Warner
3589d5c205 Merge branch 'master' of git://github.com/ReadyTalk/avian
Conflicts:
	src/codegen/arm/assembler.cpp
	src/common.h
	src/machine.cpp
2013-02-12 17:37:19 -07:00
Joshua Warner
964d054117 move RUNTIME_ARRAY into it's own header 2013-02-10 18:07:11 -07:00
Joel Dice
b38eecbefa specify O_BINARY when opening files on Windows 2013-02-07 11:35:48 -07:00
Alexey Pelykh
f2d2c9af29 Fix for windows ::open 2013-02-07 11:43:39 +02:00
Alexey Pelykh
023af5102e Remove empty lines
Conflicts:

	classpath/java-lang.cpp
2013-02-07 11:39:24 +02:00
Alexey Pelykh
0ff703d1c0 Culture fixes ; Path extensions 2013-02-07 11:39:22 +02:00
Alexey Pelykh
2362235b4c getErrorStr() for Windows platforms 2013-02-07 11:39:21 +02:00
Alexey Pelykh
41c7269896 Support new WinRT interop 2013-02-07 11:39:20 +02:00
Alexey Pelykh
34179f3332 Added comments regarding java.io.File.toAbsolute() and WinRT/WP8 2013-02-07 11:39:19 +02:00
Alexey Pelykh
c33c148b6b Add notifications about improvements possible 2013-02-07 11:39:18 +02:00
Alexey Pelykh
cb46cb0ba8 WP8/WinRT : Proper absolute path
WP8/WinRT : Last modified time
2013-02-07 11:39:17 +02:00
Alexey Pelykh
ebf6277660 java.io.RandomAccessFile for WinPhone8 / WinRT 2013-02-07 11:39:16 +02:00
Alexey Pelykh
3f22c6d8e3 Remove debug code 2013-02-07 11:39:15 +02:00
Alexey Pelykh
a03fda0c1d Instead of throwing exception, just return initial file name 2013-02-07 11:39:15 +02:00
Alexey Pelykh
4840f4a019 Fixes to WP8/WinRT support 2013-02-07 11:39:03 +02:00
Victor Shcherb
ce1f76a3e9 Add last modified to file 2013-02-07 11:39:01 +02:00
Alexey Pelykh
a78959a480 Replaced TODO comments with messages ; More correct AVIAN_AOT_ONLY usage 2013-02-07 11:38:59 +02:00
Alexey Pelykh
0cbaad6495 Windows Phone 8 / Windows RT initial support
Conflicts:

	makefile
2013-02-07 11:38:57 +02:00
Victor Shcherb
ba80761128 Add android redirect to logcat 2013-02-07 11:38:55 +02:00
Victor Shcherb
4cd8ab5910 Add android platform 2013-02-07 11:38:52 +02:00
Victor Shcherb
eea079ea70 Fix RAF 2013-02-07 11:38:51 +02:00
Alexey Pelykh
57f4463c4c RandomAccessFile 2013-02-07 11:38:50 +02:00
Victor Shcherb
7699c12597 Add java lang math methods 2013-02-07 11:38:49 +02:00
Alexey Pelykh
13848cb520 java.lang.Math.log() and java.lang.Math.tan() 2013-02-07 11:38:48 +02:00
Simon Ochsenreither
57a67fb312 Fix field names, add getters to j.l.Package 2013-02-04 14:14:45 +01:00
Simon Ochsenreither
1db67e463f Add Class#isEnum and improve error handling in Enum.valueOf 2013-02-03 16:03:15 +01:00
Simon Ochsenreither
b1eb4b9718 Adds code to get the Scala REPL working 2013-01-30 04:31:38 +01:00
Mike Keesey
5061d7fe4d Making Thread's isInterrupted() non-static and make it use the current instance's interrupted variable. 2012-12-25 18:12:03 -07:00
Pierre Carrier
74b070f9cc classpath: java.nio.ByteOrder
Used by jruby.
(Not saying I'm gonna implement String.format :)
2012-11-11 06:06:18 +01:00
Pierre Carrier
f8ea506021 classpath: j.l.{Integer,Long}.to{Octal,Binary}String
Offer support for toOctalString and toBinaryString in Integer and Long.
2012-11-05 00:10:02 +01:00
Pierre Carrier
be952acbcb classpath: Closeable & Flushable 2012-11-04 02:14:17 +01:00
Joshua Warner
33fed1b710 Merge branch 'master' of github.com:ReadyTalk/avian 2012-10-30 14:00:16 -06:00
Joshua Warner
4c20465294 add basic URLClassLoader implementation 2012-10-30 09:34:16 -06:00
Joel Dice
3e0ab35ba1 fix PersistentSet.remove side-effect bug
The whole point of PersistentSet is to provide non-destructive write
operations, which means the add and remove methods should have no
effect on previous revisions.  However, a bug in remove caused shared
tree nodes to be modified, corrupting any revisions with which they
were shared.
2012-10-13 09:39:14 -06:00
Joel Dice
a3c4b60f43 rename package avian.avian_vm_resource to avian.avianvmresource
This package name must match the URL protocol we use for loading
embedded resources, but OpenJDK's URL class won't tolerate underscores
in a protocol name.  Also, I had not updated the names of the native
methods in avian.avianvmresource.Handler, leading to
UnsatisfiedLinkErrors when they were called.
2012-10-06 15:33:24 -06:00
Joel Dice
2d9bbec214 fix a couple of ByteBuffer regressions
The compact() and put(ByteBuffer) methods regressed as of the recent
refactoring to support direct byte buffers.
2012-09-14 11:40:26 -06:00
Mike Jensen
3372210f45 Added .get() implementation 2012-08-16 16:13:51 -06:00
Joel Dice
2687333a37 Merge remote-tracking branch 'github/master' 2012-08-12 15:03:40 -06:00
Joel Dice
b98abe3f94 fix float to integer conversion
Java requires that NaNs be converted to zero and that numbers at or
beyond the limits of integer representation be clamped to the largest
or smallest value that can be represented, respectively.
2012-08-12 14:31:58 -06:00
Joel Dice
47503854d5 Thread.sleep(0) should not sleep indefinitely
Our implementation uses Object.wait(long) to implement Thread.sleep,
which had the side effect of interpreting zero as infinity.  However,
for Thread.sleep, zero just means zero.  I assume that doesn't mean
"don't sleep at all", though, or else the app wouldn't have called
Thread.sleep in the first place, so this patch sleeps for one
millisecond when zero is passed -- just enough to yield the processor
for a bit.  Thread.yield might be a better choice in this case, but I
assume the app would have called that directly if that's what it
wanted.
2012-08-12 11:17:59 -06:00
Joel Dice
b325221579 rename "resource" URL protocol to "avian_vm_resource"
This fixes a problem with JOSM, which attaches its own meaning to the
"resource" protocol.  The new name is less likely to cause such
conflicts.
2012-08-11 19:01:32 -06:00
Joel Dice
e2ff771baa handle basic argument substitution in MessageFormat.format
Thanks to Remi for an initial version of this patch.
2012-08-11 08:58:40 -06:00
Joel Dice
e2416ddb85 strip trailing separators when normalizing java.io.File.path
This addresses the case of e.g. new File("c:/foo/").exists() returning
false when the specified directory really does exist.
2012-08-11 08:21:14 -06:00
Joel Dice
01be4b23bb implement JNI methods needed by AWT
These include PushLocalFrame, PopLocalFrame, NewDirectByteBuffer,
GetDirectBufferAddress, and GetDirectBufferCapacity.
2012-08-11 06:56:19 -06:00
Joel Dice
6aba7bef5a add java.lang.Deprecated 2012-08-06 16:55:49 -06:00