зеркало из https://github.com/mono/ikvm-fork.git
Expose annotations on statically compiled code as java.lang.reflect.Proxy instead of the custom attribute object, to deal with broken code that assumes annotations are always implemented with Proxy.
Fix for #3254823.
This commit is contained in:
Родитель
20c2b1c206
Коммит
4337d62994
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2005, 2006, 2007 Jeroen Frijters
|
||||
Copyright (C) 2005-2011 Jeroen Frijters
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@ -219,15 +219,13 @@ public abstract class AnnotationAttributeBase
|
|||
}
|
||||
|
||||
@ikvm.lang.Internal
|
||||
public static void freeze(Object ann)
|
||||
public Map getValues()
|
||||
{
|
||||
if(ann instanceof AnnotationAttributeBase)
|
||||
{
|
||||
((AnnotationAttributeBase)ann).freeze();
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
private synchronized void freeze()
|
||||
@ikvm.lang.Internal
|
||||
public synchronized void freeze()
|
||||
{
|
||||
if(!frozen)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2007, 2008, 2010 Jeroen Frijters
|
||||
Copyright (C) 2007-2011 Jeroen Frijters
|
||||
Copyright (C) 2009 Volker Berlin (i-net software)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
|
@ -2707,8 +2707,7 @@ namespace IKVM.NativeCode.java
|
|||
Annotation a = obj as Annotation;
|
||||
if (a != null)
|
||||
{
|
||||
global::ikvm.@internal.AnnotationAttributeBase.freeze(a);
|
||||
map.put(a.annotationType(), a);
|
||||
map.put(a.annotationType(), FreezeOrWrapAttribute(a));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2716,6 +2715,24 @@ namespace IKVM.NativeCode.java
|
|||
#endif
|
||||
}
|
||||
|
||||
#if !FIRST_PASS
|
||||
internal static Annotation FreezeOrWrapAttribute(Annotation ann)
|
||||
{
|
||||
global::ikvm.@internal.AnnotationAttributeBase attr = ann as global::ikvm.@internal.AnnotationAttributeBase;
|
||||
if (attr != null)
|
||||
{
|
||||
#if DONT_WRAP_ANNOTATION_ATTRIBUTES
|
||||
attr.freeze();
|
||||
#else
|
||||
// freeze to make sure the defaults are set
|
||||
attr.freeze();
|
||||
ann = global::sun.reflect.annotation.AnnotationParser.annotationForMap(attr.annotationType(), attr.getValues());
|
||||
#endif
|
||||
}
|
||||
return ann;
|
||||
}
|
||||
#endif
|
||||
|
||||
public static object getDeclaredAnnotationsImpl(jlClass thisClass)
|
||||
{
|
||||
#if FIRST_PASS
|
||||
|
@ -3566,8 +3583,7 @@ namespace IKVM.NativeCode.java
|
|||
Annotation a = obj as Annotation;
|
||||
if (a != null)
|
||||
{
|
||||
global::ikvm.@internal.AnnotationAttributeBase.freeze(a);
|
||||
list.Add(a);
|
||||
list.Add(Class.FreezeOrWrapAttribute(a));
|
||||
}
|
||||
}
|
||||
ann[i] = list.ToArray();
|
||||
|
|
Загрузка…
Ссылка в новой задаче