@@ -500,15 +500,20 @@ static class JavaMarshalValueManagerHelper
500500
501501[ RequiresDynamicCode ( "This value manager is reflection-backed and is not compatible with Native AOT." ) ]
502502[ RequiresUnreferencedCode ( "This value manager is reflection-backed and is not trimming-compatible." ) ]
503- abstract class JavaMarshalReflectionValueManagerBase : JniRuntime . ReflectionJniValueManager
503+ class CoreClrJavaMarshalValueManager : JniRuntime . ReflectionJniValueManager
504504{
505- protected const DynamicallyAccessedMemberTypes Constructors = DynamicallyAccessedMemberTypes . PublicConstructors | DynamicallyAccessedMemberTypes . NonPublicConstructors ;
505+ const DynamicallyAccessedMemberTypes Constructors = DynamicallyAccessedMemberTypes . PublicConstructors | DynamicallyAccessedMemberTypes . NonPublicConstructors ;
506+ const BindingFlags ActivationConstructorBindingFlags = BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Instance ;
507+
508+ static readonly Type ByRefJniObjectReference = typeof ( JniObjectReference ) . MakeByRefType ( ) ;
509+ static readonly Type [ ] JIConstructorSignature = new Type [ ] { ByRefJniObjectReference , typeof ( JniObjectReferenceOptions ) } ;
510+ static readonly Type [ ] XAConstructorSignature = new Type [ ] { typeof ( IntPtr ) , typeof ( JniHandleOwnership ) } ;
506511
507512 readonly JavaMarshalPeerManager peerManager ;
508513
509514 [ RequiresDynamicCode ( "This value manager is reflection-backed and is not compatible with Native AOT." ) ]
510515 [ RequiresUnreferencedCode ( "This value manager is reflection-backed and is not trimming-compatible." ) ]
511- protected JavaMarshalReflectionValueManagerBase ( )
516+ public CoreClrJavaMarshalValueManager ( )
512517 {
513518 peerManager = new JavaMarshalPeerManager ( GetType ( ) . Name ) ;
514519 }
@@ -554,33 +559,6 @@ public override List<JniSurfacedPeerInfo> GetSurfacedPeers ()
554559 return peerManager . GetSurfacedPeers ( ) ;
555560 }
556561
557- protected override bool TryUnboxPeerObject ( IJavaPeerable value , [ NotNullWhen ( true ) ] out object ? result )
558- {
559- var proxy = value as JavaProxyThrowable ;
560- if ( proxy != null ) {
561- result = proxy . InnerException ;
562- return true ;
563- }
564- return base . TryUnboxPeerObject ( value , out result ) ;
565- }
566- }
567-
568- [ RequiresDynamicCode ( "This value manager is reflection-backed and is not compatible with Native AOT." ) ]
569- [ RequiresUnreferencedCode ( "This value manager is reflection-backed and is not trimming-compatible." ) ]
570- class CoreClrJavaMarshalValueManager : JavaMarshalReflectionValueManagerBase
571- {
572- const BindingFlags ActivationConstructorBindingFlags = BindingFlags . Public | BindingFlags . NonPublic | BindingFlags . Instance ;
573-
574- static readonly Type ByRefJniObjectReference = typeof ( JniObjectReference ) . MakeByRefType ( ) ;
575- static readonly Type [ ] JIConstructorSignature = new Type [ ] { ByRefJniObjectReference , typeof ( JniObjectReferenceOptions ) } ;
576- static readonly Type [ ] XAConstructorSignature = new Type [ ] { typeof ( IntPtr ) , typeof ( JniHandleOwnership ) } ;
577-
578- [ RequiresDynamicCode ( "This value manager is reflection-backed and is not compatible with Native AOT." ) ]
579- [ RequiresUnreferencedCode ( "This value manager is reflection-backed and is not trimming-compatible." ) ]
580- public CoreClrJavaMarshalValueManager ( )
581- {
582- }
583-
584562 public override IJavaPeerable ? CreatePeer (
585563 ref JniObjectReference reference ,
586564 JniObjectReferenceOptions transfer ,
@@ -734,6 +712,16 @@ bool TryConstructPeer (
734712
735713 return false ;
736714 }
715+
716+ protected override bool TryUnboxPeerObject ( IJavaPeerable value , [ NotNullWhen ( true ) ] out object ? result )
717+ {
718+ var proxy = value as JavaProxyThrowable ;
719+ if ( proxy != null ) {
720+ result = proxy . InnerException ;
721+ return true ;
722+ }
723+ return base . TryUnboxPeerObject ( value , out result ) ;
724+ }
737725}
738726
739727class TrimmableTypeMapValueManager : JniRuntime . JniValueManager
0 commit comments