Commit Graph

954 Commits

Author SHA1 Message Date
Joel Dice
0a89683eff move Unsafe.get{Object|Int}Volatile from classpath-openjdk.cpp to builtin.cpp
This makes them available in all class libraries, not just the OpenJDK
library.  Note that I've also removed the unecessary idle statements,
per ab4adef.
2014-03-03 14:55:49 -07:00
Joshua Warner
e837502d43 Merge pull request #184 from dicej/zip-available
remove redundant decrement in ZipFile.getInputStream inner class
2014-02-26 15:55:48 -07:00
Joel Dice
094af1e794 remove redundant decrement in ZipFile.getInputStream inner class
We were decrementing the "remaining" field twice for each byte read
using the no-arg read method, which resulted in available() returning
a value that was too small.
2014-02-26 14:48:28 -07:00
Joel Dice
0c298eb513 move OpenJDK.getProtectionDomain into Classes.java
This way, apps can access the CodeSource of a class whether they're
using the OpenJDK class library or the Avian one.
2014-02-26 14:09:42 -07:00
Joshua Warner
4a436bad80 Merge pull request #170 from l1m5/master
Change ConcurrentLinkedQueue.poll(boolean remove) to private.
2014-02-11 15:30:13 -07:00
Ben Limmer
d9ce351a24 Change ConcurrentLinkedQueue.poll(boolean remove) to private.
Since it's not available in the Oracle classpath.
Closes #169.
2014-02-11 14:55:29 -07:00
Joshua Warner
02becdb5bf implement Arrays.deepEquals and Objects.deepEquals 2014-01-30 17:12:34 -07:00
Simon Ochsenreither
57d34808c3 Implement java.util.Objects 2014-01-29 02:10:22 +01:00
Joshua Warner
65ca5752da Implement single quotes in MessageFormat 2014-01-28 09:56:25 -07:00
Simon Ochsenreither
4b54b30439 Add StringIndexOutOfBoundsException and use it in String 2014-01-22 21:06:54 +01:00
Joshua Warner
d2cc630736 implement java/util/Observ* 2014-01-20 10:17:22 -07:00
Joel Dice
ce1d59aac7 stop using Gestalt on OS X
This function has been deprecated for a while and is not even part of
the latest SDK, so it's time to say goodbye.
2014-01-16 17:00:52 -07:00
Joel Dice
c3638b7d10 Merge pull request #156 from jentfoo/concurrency_classpath_extension
Adding more java.util.concurrent interfaces that were missed previously.
2014-01-10 07:58:00 -08:00
Mike Jensen
2aa9de3dfb More interfaces that were missed previously. 2014-01-09 09:50:15 -07:00
Joel Dice
d1eb8c5d11 define ENOTCONN if necessary on Windows 2014-01-08 16:08:32 -07:00
Joel Dice
1f6051bcbc Merge pull request #149 from jentfoo/concurrency_classpath_extension
Concurrency classpath extension (part of the atomic package implementation)
2014-01-03 16:06:04 -08:00
Mike Jensen
3fdf29a670 Small simplfication on this if/else statement 2014-01-03 14:23:48 -07:00
Joel Dice
d1bdf2f8ef fix dumb mistake leading to AIOOBEs in Class.getMethod 2014-01-03 13:58:37 -07:00
Mike Jensen
f7d77473a4 Merge branch 'master' of github.com:ReadyTalk/avian into concurrency_classpath_extension 2014-01-03 08:49:40 -07:00
Joel Dice
789c36a459 move Unsafe.putObjectVolatile and putOrderedObject implementations
This makes them available to all class libraries, not just OpenJDK.
2014-01-02 18:00:53 -07:00
Joel Dice
cc5b58725a implement Unsafe.putOrderedLong and putVolatileLong
The former just defers to the latter for now, since it provides
strictly weaker guarantees.  Thus it's correct to use full
volatile-style barriers, though not as efficient as it could be on
some architectures.
2014-01-02 17:49:56 -07:00
Mike Jensen
99c59cfe94 Start for a basic atomic implementation for avian. Still need to figure out how to do the Array versions of these. But I wanted to wait till we have the needed Unsafe implementation and add testing for these before we go further. 2014-01-02 13:01:13 -07:00
Mike Jensen
996e52170f Fix for spelling error joel pointed out, as well as a simple unit test around the TimeUnit conversions 2013-12-24 11:30:50 -07:00
Mike Jensen
8b7f689e1a Added the easy to add interfaces and implementations for java.util.concurrent to pave the way for future expansion of avians java.util.concurrent classpath implementation. 2013-12-23 14:19:41 -07:00
Joel Dice
fc38f596f1 fix header include order build regression 2013-12-18 11:40:23 -07:00
Joel Dice
15906ddb12 fix build regression on platforms with no native 64-bit CAS
Unsafe.compareAndSwapLong was moved from classpath-openjdk.cpp to
builtin.cpp, but the fieldForOffset helper function was not, which
only caused problems when I tried to build for ARM.  This commit moves
said helper function, along with Unsafe.getVolatileLong, which also
uses it.
2013-12-18 11:06:15 -07:00
Joel Dice
59d5bbbb1a throw UnknownHostException if host is not found in InetAddress.getByName 2013-12-18 10:43:11 -07:00
Joel Dice
5f40c1642e don't throw UnknownHostException from InetAddress.getByName("0.0.0.0")
0.0.0.0 means any local interface, which is commonly used by servers
which wish to listen on all interfaces.
2013-12-18 10:12:10 -07:00
Simon Ochsenreither
55e9923ee6 Move Unsafe.compareAndSwapLong from ...
... classpath-openjdk.cpp to builtin.cpp.
2013-12-18 05:19:45 +01:00
Joshua Warner
1dc932618f Use 0777/0666 permissions when creating dirs/files.
Just like openjdk, we now depend on the processes umask (0022, for
instance) to mask that into 0755 or 0666, for instance.

This fixes #57.
2013-12-06 22:22:16 -07:00
Joel Dice
afc3c64e37 Merge pull request #121 from joshuawarner32/master
add jdk-test target, and fix failures
2013-12-06 18:50:45 -08:00
Joel Dice
7056315c18 fix various Android test suite regressions and add more reflection tests
Most of these regressions were simply due to testing a lot more stuff,
esp. annotations and reflection, revealing holes in the Android
compatibility code.  There are still some holes, but at least the
suite is passing (except for a fragile test in Serialize.java which I
will open an issue for).

Sorry this is such a big commit; there was more to address than I
initially expected.
2013-12-06 18:48:47 -07:00
Joshua Warner
47a7732a81 add jdk-test target, and fix failures
The intent of this target is to run our test suite against the installed jre.
This should help prevent our VM from diverging in implementation from the jdk.

The remainder of this commit fixes the problems that this exposes.
2013-12-06 15:00:02 -07:00
Joel Dice
abe8bc6fda fix exception wrapping for Method.invoke and static initializers
Method.invoke should initialize its class before invoking the method,
throwing an ExceptionInInitializerError if it fails, without wrapping
said error in an InvocationTargetException.

Also, we must initialize ExceptionInInitializerError.exception when
throwing instances from the VM, since OpenJDK's
ExceptionInInitializerError.getCause uses the exception field, not the
cause field.
2013-12-05 22:28:13 -07:00
Joshua Warner
8cda2446d5 implement sun.misc.Unsafe.throwException 2013-12-05 20:28:08 -07:00
Joel Dice
2000c139ea modify TreeSet.MyIterator to support both ascending and descending iteration
This also fixes a bug such that the remove() method left the iterator
in an inconsistent state.
2013-12-04 17:52:27 -07:00
Joshua Warner
136bc0e40b Merge pull request #111 from dscho/filechannel-size
Add FileChannel#size()
2013-12-04 13:36:07 -08:00
Johannes Schindelin
b1d2f66194 Add FileChannel#size()
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-04 15:23:03 -06:00
Joshua Warner
fe9ac94629 Merge pull request #105 from dscho/regex
Support (the most common subset of) regular expressions
2013-12-04 11:57:26 -08:00
Joshua Warner
a90100ee32 Merge pull request #112 from dscho/get-generic-type
Support Field#getGenericType()
2013-12-04 11:22:49 -08:00
Johannes Schindelin
6626b477ad Replace java.util.regex.* with the new regular expression engine
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-04 12:52:03 -06:00
Johannes Schindelin
2d83622975 Implement Field#getGenericType()
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-03 16:48:40 -06:00
Johannes Schindelin
0eb2d55da2 Class#getDeclaredClasses(): exclude inner classes of inner classes
Inner classes can have inner classes, but getDeclaredClasses() is
supposed to list *only* the immediate inner classes.

Example: if class Reflection contains a class Hello that contains
a class World, Reflection.class.getDeclaredClasses() must not
include World in its result.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-03 16:48:40 -06:00
Mike Jensen
a2e1e1eec9 Merge pull request #102 from dscho/proxy-annotations
This looks good to me, good work.
2013-12-02 09:13:01 -08:00
Johannes Schindelin
e1d91f153b Fix parsing of recursive annotations
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-27 10:39:28 -06:00
Johannes Schindelin
0a179355f4 Pass the correct Method instance to the InvocationHandlers
We should pass the method of the original interface to the
InvocationHandler, not the method of the interface.

That way, proxy instances of annotations will have easy access to
the default values.

This happens to be compatible with the way Oracle Java does it, too.

To accomplish our goal, we keep a global map between proxy classes and
Method references and assign the appropriate list to a field of the
Proxy subclass. This means that we now have to call the super-class
constructor in the generated constructor (which is the correct thing to
do anyway... ;-)).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-27 10:35:48 -06:00
Johannes Schindelin
6f5bcb00b9 Use the default value in annotations' proxies
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-26 15:28:20 -06:00
Johannes Schindelin
58ec623d7a Implement Method#getDefaultValue()
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-26 15:28:13 -06:00
Johannes Schindelin
ff323d46a3 AnnotationInvocationHandler: avoid calling Method#getName too often
This is only a cosmetic change, but we should not call getName()
over and over again ;-)

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-26 15:27:48 -06:00
Johannes Schindelin
db0422dcde Proxy: make all methods public
Proxies implement interfaces whose methods *must* be public, as per the
specification of the Java language.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-11-26 15:27:31 -06:00