Commit Graph

3903 Commits

Author SHA1 Message Date
Joel Dice
2cb606babd Merge pull request #132 from joshuawarner32/master
fix java 1.6 compatibility, and make sure it's maintained in the future
2013-12-11 09:20:03 -08:00
Joshua Warner
ef82c4a03a Fix extra java 1.6 failures... that only happen with -source 1.6. Go figure. 2013-12-11 08:51:00 -07:00
Joshua Warner
d2c3d771d7 fix java 1.6 compatibility, and make sure it's maintained in the future 2013-12-10 20:26:29 -07:00
Joel Dice
19274ee3d6 Merge pull request #129 from joshuawarner32/openjdk-osx10.9-build-fix
Openjdk osx10.9 build fix
2013-12-07 19:42:08 -08:00
Joel Dice
8c3f3b268a Merge pull request #130 from joshuawarner32/openjdk-files-compat
fix FileInputStream for newer openjdk7 versions
2013-12-07 18:52:51 -08:00
Joshua Warner
94f5888f97 prevent openjdk-src build from trying to load the installed 'JavaRuntimeSupport' (fixes #128) 2013-12-07 18:49:23 -07:00
Joshua Warner
773417ab2b fix openjdk-src build failures on osx 10.9 2013-12-07 16:43:18 -07:00
Joshua Warner
9a899a2e4a fix FileInputStream for newer openjdk7 versions 2013-12-07 16:22:08 -07:00
Joel Dice
a7469164fe Merge pull request #126 from joshuawarner32/master
Use 0777/0666 permissions when creating dirs/files.
2013-12-07 10:55:14 -08: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
Joshua Warner
1f1d5095b8 Merge pull request #125 from dicej/master
use portable conditional expression in test.sh
2013-12-06 20:30:18 -08:00
Joel Dice
e50ee5152a use portable conditional expression in test.sh
[[ expression ]] is bash-specific, so we use [ expression ] instead.
2013-12-06 20:57:26 -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
Joshua Warner
db2a701cf5 Merge pull request #122 from dicej/master
fix various Android test suite regressions and add more reflection tests
2013-12-06 18:40:39 -08:00
Joshua Warner
0a4eff33b2 fix jdk-test failures 2013-12-06 19:30:04 -07: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
Joel Dice
2279a13f91 Merge pull request #124 from dscho/serialize-test
Do not test java.util.TreeMap's serialization in the Serialize test
2013-12-06 17:44:44 -08:00
Johannes Schindelin
ddd057c53a Do not test java.util.TreeMap's serialization in the Serialize test
In the Android class path, TreeMap is implemented differently and as a
consequence its serialization is incompatible with OpenJDK's. So let's
test a private static class' serialization instead, to make sure that
the wire protocol defined by the Java Language Specification is
implemented.

This addresses issue #123 reported by Joel Dice.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-06 19:24:41 -06: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
Joshua Warner
39e3850ed8 Merge pull request #120 from dscho/look-behind-test
Fix the look-behind test for OpenJDK
2013-12-06 12:19:43 -08:00
Johannes Schindelin
d8d980be9a Fix the look-behind test for OpenJDK
OpenJDK's regex engine can only handle look-behinds of limited sizes.
So let's just test for that, not the unbounded one we had before (that
our own regex engine handles quite fine, though).

This fixes issue #115.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-06 10:50:34 -06:00
Joshua Warner
d17bbc6d1b Merge pull request #118 from dicej/master
fix exception wrapping for Method.invoke and static initializers
2013-12-06 07:13:41 -08: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
Joel Dice
451fe159c2 Merge pull request #116 from joshuawarner32/master
implement sun.misc.Unsafe.throwException
2013-12-05 20:10:53 -08:00
Joshua Warner
8cda2446d5 implement sun.misc.Unsafe.throwException 2013-12-05 20:28:08 -07:00
Joshua Warner
f7ce0c4207 Merge pull request #114 from dicej/treeset-descending-iterator
modify TreeSet.MyIterator to support both ascending and descending itera...
2013-12-05 09:27:10 -08: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
bb18637f13 Merge pull request #110 from dscho/memory
Implement Runtime#{free,total}Memory()
2013-12-04 13:43:45 -08: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
Johannes Schindelin
18aeeae0e8 Implement Runtime#{free,total}Memory()
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-04 15:19:06 -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
e96379ee19 Regex: document the strengths and limitations
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-04 12:52:02 -06:00
Johannes Schindelin
9e7169fe34 Regex: let toString() in the Compiler reconstruct the regex
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-04 12:52:02 -06:00
Johannes Schindelin
c975e25864 Regex: implement counted quantifiers: {<n>,<m>}
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-04 12:52:02 -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
Johannes Schindelin
fb6486e276 Regex: implement ^,$,\b and \B
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-03 12:28:11 -06:00
Johannes Schindelin
fe32cce2ad Regex: support intersection/union of character classes
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-03 12:28:11 -06:00
Johannes Schindelin
b4c768b101 Regex: Test Pattern#split(String)
The particular pattern we use to test it is used in ImgLib2, based on
this answer on stackoverflow:

	http://stackoverflow.com/a/279337

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-03 12:28:11 -06:00
Johannes Schindelin
8ab10a6953 Regex: support special character classes
This adds support for character classes such as \d or \W, leaving \p{...}
style character classes as an exercise for later.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-03 12:28:11 -06:00
Johannes Schindelin
098f688cd8 Regex: implement negative look-arounds
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-03 12:28:11 -06:00
Johannes Schindelin
8b611c8075 Regex: support look-behind patterns
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-03 12:28:11 -06:00
Johannes Schindelin
62d1964779 Regex: add a method to reverse the PikeVM program
A program for the PikeVM corresponds to a regular expression pattern. The
program matches the character sequence in left-to-right order. However,
for look-behind expressions, we will want to match the character sequence
backwards.

To this end, it is nice that regular expression patterns can be reversed
in a straight-forward manner. However, it would be nice if we could avoid
multiple parsing passes and simply parse even look-behind expressions as
if they were look-ahead ones, and then simply reverse the program for that
part.

Happily, it is not difficult to reverse the program so it is equivalent to
matching the pattern backwards.

There is one catch, though. Imagine matching the sequence "a" against the
regular expression "(a?)a?". If we match forward, the group will match the
letter "a", when matching backwards, it will match the empty string. So,
while the reverse pattern is equivalent to the forward pattern in terms of
"does the pattern match that sequence", but not its sub-matches. For that
reason, Java simply ignores capturing groups in look-behind patterns (and
for consistency, the same holds for look-ahead patterns).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-03 12:28:11 -06:00
Johannes Schindelin
85af36ef90 Regex: support lookaheads
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-03 12:28:11 -06:00
Johannes Schindelin
d4a2f58eb5 Regex: implement alternatives
Now we support regular expressions like 'A|B|C'.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-03 12:28:11 -06:00
Johannes Schindelin
c3a06a600a Regex: implement non-capturing groups
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-03 12:28:11 -06:00
Johannes Schindelin
53563c4f8e Regex: add support for character classes
Now we support regular expression patterns a la '[0-9]'.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-12-03 12:28:11 -06:00