mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
Merge branch 'master' of oss.readytalk.com:/var/local/git/avian into oss-ext
This commit is contained in:
commit
587ae00d80
@ -24,4 +24,8 @@ public class VMMethod {
|
||||
public MethodAddendum addendum;
|
||||
public VMClass class_;
|
||||
public Object code;
|
||||
|
||||
public boolean hasAnnotations() {
|
||||
return addendum != null && addendum.annotationTable != null;
|
||||
}
|
||||
}
|
||||
|
22
classpath/java/lang/annotation/ElementType.java
Normal file
22
classpath/java/lang/annotation/ElementType.java
Normal file
@ -0,0 +1,22 @@
|
||||
/* Copyright (c) 2012, Avian Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software
|
||||
for any purpose with or without fee is hereby granted, provided
|
||||
that the above copyright notice and this permission notice appear
|
||||
in all copies.
|
||||
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
package java.lang.annotation;
|
||||
|
||||
public enum ElementType {
|
||||
ANNOTATION_TYPE,
|
||||
CONSTRUCTOR,
|
||||
FIELD,
|
||||
LOCAL_VARIABLE,
|
||||
METHOD,
|
||||
PACKAGE,
|
||||
PARAMETER,
|
||||
TYPE
|
||||
}
|
17
classpath/java/lang/annotation/Target.java
Normal file
17
classpath/java/lang/annotation/Target.java
Normal file
@ -0,0 +1,17 @@
|
||||
/* Copyright (c) 2012, Avian Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software
|
||||
for any purpose with or without fee is hereby granted, provided
|
||||
that the above copyright notice and this permission notice appear
|
||||
in all copies.
|
||||
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
package java.lang.annotation;
|
||||
|
||||
@Retention(value=RetentionPolicy.RUNTIME)
|
||||
@Target(value=ElementType.ANNOTATION_TYPE)
|
||||
public @interface Target {
|
||||
public ElementType[] value();
|
||||
}
|
@ -170,7 +170,7 @@ public class Method<T> extends AccessibleObject implements Member {
|
||||
}
|
||||
|
||||
public <T extends Annotation> T getAnnotation(Class<T> class_) {
|
||||
if (vmMethod.addendum.annotationTable != null) {
|
||||
if (vmMethod.hasAnnotations()) {
|
||||
Object[] table = (Object[]) vmMethod.addendum.annotationTable;
|
||||
for (int i = 0; i < table.length; ++i) {
|
||||
Object[] a = (Object[]) table[i];
|
||||
@ -183,7 +183,7 @@ public class Method<T> extends AccessibleObject implements Member {
|
||||
}
|
||||
|
||||
public Annotation[] getAnnotations() {
|
||||
if (vmMethod.addendum.annotationTable != null) {
|
||||
if (vmMethod.hasAnnotations()) {
|
||||
Object[] table = (Object[]) vmMethod.addendum.annotationTable;
|
||||
Annotation[] array = new Annotation[table.length];
|
||||
for (int i = 0; i < table.length; ++i) {
|
||||
|
@ -358,7 +358,7 @@ public class Proxy {
|
||||
int[] interfaceIndexes = new int[interfaces.length];
|
||||
for (int i = 0; i < interfaces.length; ++i) {
|
||||
interfaceIndexes[i] = ConstantPool.addClass
|
||||
(pool, interfaces[i].getName());
|
||||
(pool, interfaces[i].getName().replace('.', '/'));
|
||||
}
|
||||
|
||||
Map<String,avian.VMMethod> virtualMap = new HashMap();
|
||||
|
60
classpath/java/util/AbstractQueue.java
Normal file
60
classpath/java/util/AbstractQueue.java
Normal file
@ -0,0 +1,60 @@
|
||||
/* Copyright (c) 2012, Avian Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software
|
||||
for any purpose with or without fee is hereby granted, provided
|
||||
that the above copyright notice and this permission notice appear
|
||||
in all copies.
|
||||
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
package java.util;
|
||||
|
||||
public abstract class AbstractQueue<T> extends AbstractCollection<T> implements Queue<T> {
|
||||
|
||||
protected AbstractQueue() {
|
||||
super();
|
||||
}
|
||||
|
||||
public boolean add(T element) {
|
||||
if (offer(element)) {
|
||||
return true;
|
||||
} else {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean addAll(Collection <? extends T> collection) {
|
||||
if (collection == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
for (T element : collection) {
|
||||
add(element);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
while (size() > 0) {
|
||||
poll();
|
||||
}
|
||||
}
|
||||
|
||||
public T element() {
|
||||
emptyCheck();
|
||||
return peek();
|
||||
}
|
||||
|
||||
public T remove() {
|
||||
emptyCheck();
|
||||
return poll();
|
||||
}
|
||||
|
||||
private void emptyCheck() {
|
||||
if (size() == 0) {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
}
|
||||
}
|
20
classpath/java/util/Queue.java
Normal file
20
classpath/java/util/Queue.java
Normal file
@ -0,0 +1,20 @@
|
||||
/* Copyright (c) 2012, Avian Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software
|
||||
for any purpose with or without fee is hereby granted, provided
|
||||
that the above copyright notice and this permission notice appear
|
||||
in all copies.
|
||||
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
package java.util;
|
||||
|
||||
public interface Queue<T> extends Collection<T>, Iterable<T> {
|
||||
public boolean add(T element);
|
||||
public T element();
|
||||
public boolean offer(T element);
|
||||
public T peek();
|
||||
public T poll();
|
||||
public T remove();
|
||||
}
|
20
classpath/java/util/SortedSet.java
Normal file
20
classpath/java/util/SortedSet.java
Normal file
@ -0,0 +1,20 @@
|
||||
/* Copyright (c) 2012, Avian Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software
|
||||
for any purpose with or without fee is hereby granted, provided
|
||||
that the above copyright notice and this permission notice appear
|
||||
in all copies.
|
||||
|
||||
There is NO WARRANTY for this software. See license.txt for
|
||||
details. */
|
||||
|
||||
package java.util;
|
||||
|
||||
public interface SortedSet<T> extends Collection<T>, Iterable<T>, Set<T> {
|
||||
public Comparator<? super T> comparator();
|
||||
public T first();
|
||||
public SortedSet<T> headSet(T toElement);
|
||||
public T last();
|
||||
public SortedSet<T> subSet(T fromElement, T toElement);
|
||||
public SortedSet<T> tailSet(T fromElement);
|
||||
}
|
5
makefile
5
makefile
@ -685,7 +685,10 @@ vm-classes = \
|
||||
avian/*.class \
|
||||
avian/resource/*.class
|
||||
|
||||
test-support-sources = $(shell find $(test)/avian/ -name '*.java')
|
||||
test-sources = $(wildcard $(test)/*.java)
|
||||
test-sources += $(test-support-sources)
|
||||
test-support-classes = $(call java-classes, $(test-support-sources),$(test),$(test-build))
|
||||
test-classes = $(call java-classes,$(test-sources),$(test),$(test-build))
|
||||
test-dep = $(test-build).dep
|
||||
|
||||
@ -765,7 +768,7 @@ vg: build
|
||||
test: build
|
||||
$(library-path) /bin/sh $(test)/test.sh 2>/dev/null \
|
||||
$(test-executable) $(mode) "$(test-flags)" \
|
||||
$(call class-names,$(test-build),$(test-classes)) \
|
||||
$(call class-names,$(test-build),$(filter-out $(test-support-classes), $(test-classes))) \
|
||||
$(continuation-tests) $(tail-tests)
|
||||
|
||||
.PHONY: tarball
|
||||
|
18
openjdk.pro
18
openjdk.pro
@ -223,3 +223,21 @@
|
||||
-keep class sun.util.resources.TimeZoneNames
|
||||
-keep class sun.text.resources.FormatData
|
||||
|
||||
# loaded via reflection from DefaultFileSystemProvider:
|
||||
-keep class sun.nio.fs.LinuxFileSystemProvider
|
||||
-keep class sun.nio.fs.BsdFileSystemProvider
|
||||
|
||||
# loaded via JNI in UnixNativeDispatcher.c:
|
||||
-keep class sun.nio.fs.UnixFileAttributes {
|
||||
<fields>;
|
||||
}
|
||||
-keep class sun.nio.fs.UnixFileStoreAttributes {
|
||||
<fields>;
|
||||
}
|
||||
-keep class sun.nio.fs.UnixMountEntry {
|
||||
<fields>;
|
||||
}
|
||||
|
||||
-keep class sun.nio.fs.UnixException {
|
||||
UnixException(int);
|
||||
}
|
||||
|
@ -1,7 +1,10 @@
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import avian.testing.annotations.Color;
|
||||
import avian.testing.annotations.Test;
|
||||
import avian.testing.annotations.TestEnum;
|
||||
import avian.testing.annotations.TestInteger;
|
||||
|
||||
public class Annotations {
|
||||
private static void expect(boolean v) {
|
||||
if (! v) throw new RuntimeException();
|
||||
@ -18,6 +21,12 @@ public class Annotations {
|
||||
.equals(Color.Red));
|
||||
|
||||
expect(((TestInteger) m.getAnnotation(TestInteger.class)).value() == 42);
|
||||
|
||||
expect(m.getAnnotations().length == 3);
|
||||
|
||||
Method noAnno = Annotations.class.getMethod("noAnnotation");
|
||||
expect(noAnno.getAnnotation(Test.class) == null);
|
||||
expect(noAnno.getAnnotations().length == 0);
|
||||
}
|
||||
|
||||
@Test("couscous")
|
||||
@ -26,24 +35,8 @@ public class Annotations {
|
||||
public static void foo() {
|
||||
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
private @interface Test {
|
||||
public String value();
|
||||
|
||||
public static void noAnnotation() {
|
||||
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
private @interface TestEnum {
|
||||
public Color value();
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
private @interface TestInteger {
|
||||
public int value();
|
||||
}
|
||||
|
||||
private static enum Color {
|
||||
Red, Yellow, Blue
|
||||
}
|
||||
|
||||
}
|
||||
|
5
test/avian/testing/annotations/Color.java
Normal file
5
test/avian/testing/annotations/Color.java
Normal file
@ -0,0 +1,5 @@
|
||||
package avian.testing.annotations;
|
||||
|
||||
public enum Color {
|
||||
Red, Yellow, Blue
|
||||
}
|
9
test/avian/testing/annotations/Test.java
Normal file
9
test/avian/testing/annotations/Test.java
Normal file
@ -0,0 +1,9 @@
|
||||
package avian.testing.annotations;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Test {
|
||||
public String value();
|
||||
}
|
8
test/avian/testing/annotations/TestEnum.java
Normal file
8
test/avian/testing/annotations/TestEnum.java
Normal file
@ -0,0 +1,8 @@
|
||||
package avian.testing.annotations;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface TestEnum {
|
||||
public Color value();
|
||||
}
|
8
test/avian/testing/annotations/TestInteger.java
Normal file
8
test/avian/testing/annotations/TestInteger.java
Normal file
@ -0,0 +1,8 @@
|
||||
package avian.testing.annotations;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface TestInteger {
|
||||
public int value();
|
||||
}
|
Loading…
Reference in New Issue
Block a user