Permalink
Browse files

add support for the RuntimeVisibleParameterAnnotations attribute

  • Loading branch information...
1 parent b1840a2 commit 529c7a17fb6b612643667522be368d03710cdae7 @dicej dicej committed May 1, 2013
Showing with 34 additions and 9 deletions.
  1. +1 −0 classpath/avian/MethodAddendum.java
  2. +16 −4 src/classpath-openjdk.cpp
  3. +17 −5 src/machine.cpp
@@ -13,4 +13,5 @@
public class MethodAddendum extends Addendum {
public Object exceptionTable;
public Object annotationDefault;
+ public Object parameterAnnotationTable;
}
View
@@ -2261,6 +2261,7 @@ makeJmethod(Thread* t, object vmMethod, int index)
object signature;
object annotationTable;
+ object parameterAnnotationTable;
object annotationDefault;
object addendum = methodAddendum(t, vmMethod);
if (addendum) {
@@ -2274,18 +2275,23 @@ makeJmethod(Thread* t, object vmMethod, int index)
annotationTable = addendumAnnotationTable(t, addendum);
+ parameterAnnotationTable = methodAddendumParameterAnnotationTable
+ (t, addendum);
+
annotationDefault = methodAddendumAnnotationDefault(t, addendum);
} else {
signature = 0;
annotationTable = 0;
+ parameterAnnotationTable = 0;
annotationDefault = 0;
}
PROTECT(t, signature);
PROTECT(t, annotationTable);
+ PROTECT(t, parameterAnnotationTable);
PROTECT(t, annotationDefault);
- if (annotationTable or annotationDefault) {
+ if (annotationTable or parameterAnnotationTable or annotationDefault) {
object runtimeData = getClassRuntimeData(t, methodClass(t, vmMethod));
set(t, runtimeData, ClassRuntimeDataPool,
@@ -2309,7 +2315,7 @@ makeJmethod(Thread* t, object vmMethod, int index)
return makeJmethod
(t, true, 0, jclass, index, name, returnType, parameterTypes,
exceptionTypes, methodFlags(t, vmMethod), signature, 0, annotationTable,
- 0, annotationDefault, 0, 0, 0);
+ parameterAnnotationTable, annotationDefault, 0, 0, 0);
}
object
@@ -2331,6 +2337,7 @@ makeJconstructor(Thread* t, object vmMethod, int index)
object signature;
object annotationTable;
+ object parameterAnnotationTable;
object addendum = methodAddendum(t, vmMethod);
if (addendum) {
signature = addendumSignature(t, addendum);
@@ -2342,15 +2349,19 @@ makeJconstructor(Thread* t, object vmMethod, int index)
}
annotationTable = addendumAnnotationTable(t, addendum);
+ parameterAnnotationTable = methodAddendumParameterAnnotationTable
+ (t, addendum);
} else {
signature = 0;
annotationTable = 0;
+ parameterAnnotationTable = 0;
}
PROTECT(t, signature);
PROTECT(t, annotationTable);
+ PROTECT(t, parameterAnnotationTable);
- if (annotationTable) {
+ if (annotationTable or parameterAnnotationTable) {
object runtimeData = getClassRuntimeData(t, methodClass(t, vmMethod));
set(t, runtimeData, ClassRuntimeDataPool,
@@ -2373,7 +2384,8 @@ makeJconstructor(Thread* t, object vmMethod, int index)
return makeJconstructor
(t, true, 0, jclass, index, parameterTypes, exceptionTypes, methodFlags
- (t, vmMethod), signature, 0, annotationTable, 0, 0, 0, 0);
+ (t, vmMethod), signature, 0, annotationTable, parameterAnnotationTable,
+ 0, 0, 0);
}
object
View
@@ -2009,7 +2009,7 @@ parseMethodTable(Thread* t, Stream& s, object class_, object pool)
&byteArrayBody(t, attributeName, 0)) == 0)
{
if (addendum == 0) {
- addendum = makeMethodAddendum(t, pool, 0, 0, 0, 0);
+ addendum = makeMethodAddendum(t, pool, 0, 0, 0, 0, 0);
}
unsigned exceptionCount = s.read2();
object body = makeShortArray(t, exceptionCount);
@@ -2022,7 +2022,7 @@ parseMethodTable(Thread* t, Stream& s, object class_, object pool)
&byteArrayBody(t, attributeName, 0)) == 0)
{
if (addendum == 0) {
- addendum = makeMethodAddendum(t, pool, 0, 0, 0, 0);
+ addendum = makeMethodAddendum(t, pool, 0, 0, 0, 0, 0);
}
object body = makeByteArray(t, length);
@@ -2034,7 +2034,7 @@ parseMethodTable(Thread* t, Stream& s, object class_, object pool)
&byteArrayBody(t, attributeName, 0)) == 0)
{
if (addendum == 0) {
- addendum = makeMethodAddendum(t, pool, 0, 0, 0, 0);
+ addendum = makeMethodAddendum(t, pool, 0, 0, 0, 0, 0);
}
set(t, addendum, AddendumSignature,
@@ -2044,14 +2044,27 @@ parseMethodTable(Thread* t, Stream& s, object class_, object pool)
&byteArrayBody(t, attributeName, 0)) == 0)
{
if (addendum == 0) {
- addendum = makeMethodAddendum(t, pool, 0, 0, 0, 0);
+ addendum = makeMethodAddendum(t, pool, 0, 0, 0, 0, 0);
}
object body = makeByteArray(t, length);
s.read(reinterpret_cast<uint8_t*>(&byteArrayBody(t, body, 0)),
length);
set(t, addendum, AddendumAnnotationTable, body);
+ } else if (vm::strcmp(reinterpret_cast<const int8_t*>
+ ("RuntimeVisibleParameterAnnotations"),
+ &byteArrayBody(t, attributeName, 0)) == 0)
+ {
+ if (addendum == 0) {
+ addendum = makeMethodAddendum(t, pool, 0, 0, 0, 0, 0);
+ }
+
+ object body = makeByteArray(t, length);
+ s.read(reinterpret_cast<uint8_t*>(&byteArrayBody(t, body, 0)),
+ length);
+
+ set(t, addendum, MethodAddendumParameterAnnotationTable, body);
} else {
s.skip(length);
}
@@ -5243,7 +5256,6 @@ threadIsInterrupted(Thread* t, object thread, bool clear)
threadInterrupted(t, thread) = false;
}
monitorRelease(t, interruptLock(t, thread));
-
return v;
}

0 comments on commit 529c7a1

Please sign in to comment.