add support for the RuntimeVisibleParameterAnnotations attribute

This commit is contained in:
Joel Dice 2013-04-30 22:55:59 -06:00
parent b1840a297d
commit 529c7a17fb
3 changed files with 34 additions and 9 deletions

View File

@ -13,4 +13,5 @@ package avian;
public class MethodAddendum extends Addendum {
public Object exceptionTable;
public Object annotationDefault;
public Object parameterAnnotationTable;
}

View File

@ -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 File

@ -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,7 +2044,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);
@ -2052,6 +2052,19 @@ parseMethodTable(Thread* t, Stream& s, object class_, object pool)
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;
}