From 3555cdfe72cff7fdb8128c3bdc5eae0326ae6b74 Mon Sep 17 00:00:00 2001 From: Jonathan Pobst Date: Wed, 20 Nov 2019 16:24:35 -0600 Subject: [PATCH] [Java.Interop] Replace Gendarme with Roslyn FxCop Analyzers. --- Makefile | 14 - build-tools/automation/azure-pipelines.yaml | 4 - gendarme-ignore.txt | 704 ------------------ src/Java.Interop/.editorconfig | 158 ++++ src/Java.Interop/GlobalSuppressions.cs | 85 +++ src/Java.Interop/Java.Interop.csproj | 4 + .../Java.Interop/JavaObjectArray.cs | 6 +- .../Java.Interop/JavaProxyObject.cs | 2 +- .../Java.Interop/JavaProxyThrowable.cs | 2 +- .../Java.Interop/JniArgumentValue.cs | 4 +- .../Java.Interop/JniEnvironment.Types.cs | 2 +- .../Java.Interop/JniObjectReference.cs | 10 +- .../JniPeerMembers.JniInstanceMethods.cs | 2 +- .../Java.Interop/JniPeerMembers.cs | 14 +- .../JniRuntime.JniMarshalMemberBuilder.cs | 1 + .../JniRuntime.JniObjectReferenceManager.cs | 4 - .../Java.Interop/JniRuntime.JniTypeManager.cs | 14 +- .../JniRuntime.JniValueManager.cs | 6 +- src/Java.Interop/Java.Interop/JniRuntime.cs | 6 +- src/Java.Interop/Java.Interop/JniType.cs | 6 +- .../Java.Interop/JniTypeSignature.cs | 12 +- .../Java.Interop/JniTypeSignatureAttribute.cs | 2 +- .../Java.Interop/JniValueMarshaler.cs | 10 +- src/Java.Interop/Java.Interop/ManagedPeer.cs | 2 +- 24 files changed, 298 insertions(+), 776 deletions(-) delete mode 100644 gendarme-ignore.txt create mode 100644 src/Java.Interop/.editorconfig create mode 100644 src/Java.Interop/GlobalSuppressions.cs diff --git a/Makefile b/Makefile index 91c26107b..e4369801e 100644 --- a/Makefile +++ b/Makefile @@ -12,8 +12,6 @@ NATIVE_EXT = .so DLLMAP_OS_NAME = linux endif -GENDARME_URL = https://github.com/downloads/spouliot/gendarme/gendarme-2.10-bin.zip - PACKAGES = \ packages/NUnit.3.11.0/NUnit.3.11.0.nupkg \ packages/NUnit.Console.3.9.0/NUnit.Console.3.9.0.nupkg @@ -95,15 +93,6 @@ src/Java.Runtime.Environment/Java.Runtime.Environment.dll.config: src/Java.Runti bin/Build$(CONFIGURATION)/JdkInfo.props sed -e 's#@JI_JVM_PATH@#$(JI_JVM_PATH)#g' -e 's#@OS_NAME@#$(DLLMAP_OS_NAME)#g' -e $(JAVA_RUNTIME_ENVIRONMENT_DLLMAP_OVERRIDE_CMD) < $< > $@ -fxcop: lib/gendarme-2.10/gendarme.exe bin/GendarmeDebug/netstandard2.0/Java.Interop.dll - cp src/Java.Interop/obj/Gendarme/netstandard2.0/Java.Interop.dll.mdb bin/GendarmeDebug/netstandard2.0 - $(RUNTIME) $< --html gendarme.html $(if @(GENDARME_XML),--xml gendarme.xml) --ignore gendarme-ignore.txt bin/GendarmeDebug/netstandard2.0/Java.Interop.dll - -lib/gendarme-2.10/gendarme.exe: - -mkdir -p `dirname "$@"` - curl -L -o lib/gendarme-2.10/gendarme-2.10-bin.zip $(GENDARME_URL) - (cd lib/gendarme-2.10 ; unzip gendarme-2.10-bin.zip) - JAVA_INTEROP_LIB = libjava-interop$(NATIVE_EXT) NATIVE_TIMING_LIB = libNativeTiming$(NATIVE_EXT) @@ -134,9 +123,6 @@ bin/Test$(CONFIGURATION)/Android.Interop-Tests.dll: $(wildcard src/Android.Inter bin/$(CONFIGURATION)/Java.Interop.dll: $(wildcard src/Java.Interop/*/*.cs) src/Java.Interop/Java.Interop.csproj $(MSBUILD) $(if $(V),/v:diag,) /p:Configuration=$(CONFIGURATION) $(if $(SNK),"/p:AssemblyOriginatorKeyFile=$(SNK)",) -bin/GendarmeDebug/netstandard2.0/Java.Interop.dll: $(wildcard src/Java.Interop/*/*.cs) src/Java.Interop/Java.Interop.csproj - $(MSBUILD) $(if $(V),/v:diag,) /p:Configuration="Gendarme" $(if $(SNK),"/p:AssemblyOriginatorKeyFile=$(SNK)",) /p:CscToolExe=`which mcs` /p:LangVersion=Default /p:DiscoverEditorConfigFiles=False src/Java.Interop/Java.Interop.csproj - CSHARP_REFS = \ bin/$(CONFIGURATION)/Java.Interop.dll \ bin/$(CONFIGURATION)/Java.Interop.Export.dll \ diff --git a/build-tools/automation/azure-pipelines.yaml b/build-tools/automation/azure-pipelines.yaml index 063292462..654692318 100644 --- a/build-tools/automation/azure-pipelines.yaml +++ b/build-tools/automation/azure-pipelines.yaml @@ -80,9 +80,6 @@ jobs: - script: make all CONFIGURATION=$(Build.Configuration) displayName: make all - - script: make fxcop - displayName: Run Gendarme - - script: | r=0 make run-all-tests CONFIGURATION=$(Build.Configuration) || r=$? @@ -103,7 +100,6 @@ jobs: inputs: SourceFolder: $(System.DefaultWorkingDirectory) Contents: | - gendarme.* xatb.jar bin.zip TargetFolder: $(Build.ArtifactStagingDirectory) diff --git a/gendarme-ignore.txt b/gendarme-ignore.txt deleted file mode 100644 index 7bb3f7d60..000000000 --- a/gendarme-ignore.txt +++ /dev/null @@ -1,704 +0,0 @@ -R: Gendarme.Rules.BadPractice.ConstructorShouldNotCallVirtualMethodsRule -# We're attempting to establish a pattern/protocol around JavaObject + JniPeerMembers, and I hereby deem it acceptable -- in this instance -- to invoke the virtual `JniPeerMembers` property from constructors -M: System.Void Java.Interop.JavaException::.ctor() -M: System.Void Java.Interop.JavaException::.ctor(System.String) -M: System.Void Java.Interop.JavaException::.ctor(System.String,System.Exception) -M: System.Void Java.Interop.JavaObject::.ctor() - -R: Gendarme.Rules.BadPractice.OnlyUseDisposeForIDisposableTypesRule -# We need *a* "cleanup" method, and I can't think of a better name than "Dispose" -# (Close? Destroy?), and for these types I don't want them to have Dispose() -# *instance* methods to avoid accidental bugs. -# See: 25de1f38, 8f7d3390 -T: Java.Interop.JniPeerMembers -T: Java.Interop.JniPeerMembers/JniInstanceMethods -T: Java.Interop.JniPeerMembers/JniStaticMethods -T: Java.Interop.JniPeerMembers/JniInstanceFields -T: Java.Interop.JniPeerMembers/JniStaticFields -T: Java.Interop.JniObjectReference - - -R: Gendarme.Rules.BadPractice.PreferSafeHandleRule -# We don't want to use the SafeHandle here to improve the performance; see tests/invocation-overhead/README.md -# We *can't* use SafeHandles here because the GC bridge needs to be able to write into JavaException & JavaObject. -T: Java.Interop.JavaException -T: Java.Interop.JavaObject -# No, we don't want/need a SafeHandle for JniRuntime.InvocationPointer! -T: Java.Interop.JniEnvironmentInfo -T: Java.Interop.JniRuntime -# We don't want/need a SafeHandle for JNIEnv::GetArrayElements() -T: Java.Interop.JniArrayElements - -R: Gendarme.Rules.Correctness.AvoidFloatingPointEqualityRule -# This is in from generated code. We could plausibly fix the generated code, but I'm not at all sure what to change it *to*. -M: System.Int32 Java.Interop.JavaSingleArray::IndexOf(System.Single) -M: System.Int32 Java.Interop.JavaDoubleArray::IndexOf(System.Double) - -R: Gendarme.Rules.Correctness.CheckParametersNullityInVisibleMethodsRule -# These methods are protected, and thus we control the (public) callers, -# and we *do* check that valid values are passed. -# No check should be needed. -M: System.Boolean Java.Interop.JniPeerMembers::UsesVirtualDispatch(Java.Interop.IJavaPeerable,System.Type) -M: Java.Interop.JniPeerMembers Java.Interop.JniPeerMembers::GetPeerMembers(Java.Interop.IJavaPeerable) - -# I suspect a gendarme bug; I don't see what it's talking about -M: System.Void Java.Interop.JniArgumentValue::.ctor(Java.Interop.IJavaPeerable) - -R: Gendarme.Rules.Correctness.EnsureLocalDisposalRule -# We don't *want* to dispose the value! -M: Java.Interop.JniType Java.Interop.JniBoolean::get_TypeRef() -M: Java.Interop.JniType Java.Interop.JniByte::get_TypeRef() -M: Java.Interop.JniType Java.Interop.JniCharacter::get_TypeRef() -M: Java.Interop.JniType Java.Interop.JniDouble::get_TypeRef() -M: System.Void Java.Interop.JniEnvironment/Exceptions::Throw(System.Exception) -M: System.Void Java.Interop.JniEnvironmentInfo::set_EnvironmentPointer(System.IntPtr) -M: Java.Interop.JniType Java.Interop.JniFloat::get_TypeRef() -M: Java.Interop.JniType Java.Interop.JniInteger::get_TypeRef() -M: Java.Interop.JniType Java.Interop.JniLong::get_TypeRef() -M: Java.Interop.JniType Java.Interop.JniPeerMembers::get_JniPeerType() -M: Java.Interop.JniRuntime Java.Interop.JniRuntime::get_CurrentRuntime() -M: System.Void Java.Interop.JniRuntime::RaisePendingException(System.Exception) -M: System.Void Java.Interop.JniRuntime/JniValueManager::DisposePeerUnlessReferenced(Java.Interop.IJavaPeerable) -M: System.Object Java.Interop.JniRuntime/JniValueManager::PeekValue(Java.Interop.JniObjectReference) -M: System.Object Java.Interop.JniRuntime/JniValueManager::PeekBoxedObject(Java.Interop.JniObjectReference) -M: Java.Interop.JniType Java.Interop.JniShort::get_TypeRef() -M: Java.Interop.JniType Java.Interop.JniSystem::get_TypeRef() -M: System.Void Java.Interop.ManagedPeer::Construct(System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Void Java.Interop.ManagedPeer::RegisterNativeMembers(System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Object Java.Interop.ProxyValueMarshaler::CreateGenericValue(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions,System.Type) -M: Java.Interop.JniValueMarshalerState Java.Interop.ProxyValueMarshaler::CreateGenericObjectReferenceArgumentState(System.Object,System.Reflection.ParameterAttributes) - -# These look like gendarme bugs wrt C#2 `yield return` methods. -M: System.Collections.IEnumerator Java.Interop.JniRuntime/JniTypeManager/c__Iterator0::System.Collections.IEnumerable.GetEnumerator() -M: System.Collections.IEnumerator Java.Interop.JniRuntime/JniTypeManager/c__Iterator1::System.Collections.IEnumerable.GetEnumerator() -M: System.Collections.IEnumerator Java.Interop.JniRuntime/JniTypeManager/c__Iterator2::System.Collections.IEnumerable.GetEnumerator() - - -R: Gendarme.Rules.Correctness.ReviewInconsistentIdentityRule -# It's consistent; GetHashCode()'s use of QualifiedReference pulls in everything Equals() compares. -T: Java.Interop.JniTypeSignature -# It's consistent; everything is delegated to Java! -T: Java.Interop.JavaException -T: Java.Interop.JavaObject - - -R: Gendarme.Rules.Design.AvoidRefAndOutParametersRule -# JniEnvironment.References mirros native API -M: System.Void Java.Interop.JniEnvironment/References::GetJavaVM(System.IntPtr&) - -# Use of `int&` is to avoid making JniEnvironmentInfo public; see a314ad82 -M: Java.Interop.JniObjectReference Java.Interop.JniRuntime/JniObjectReferenceManager::CreateLocalReference(Java.Interop.JniObjectReference,System.Int32&) -M: System.Void Java.Interop.JniRuntime/JniObjectReferenceManager::DeleteLocalReference(Java.Interop.JniObjectReference&,System.Int32&) -M: System.Void Java.Interop.JniRuntime/JniObjectReferenceManager::CreatedLocalReference(Java.Interop.JniObjectReference,System.Int32&) -M: System.IntPtr Java.Interop.JniRuntime/JniObjectReferenceManager::ReleaseLocalReference(Java.Interop.JniObjectReference&,System.Int32&) - -# See 25de1f38 for rationale for `ref JniObjectReference` -M: System.Void Java.Interop.JavaBooleanArray::.ctor(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions) -M: System.Void Java.Interop.JavaCharArray::.ctor(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions) -M: System.Void Java.Interop.JavaDoubleArray::.ctor(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions) -M: System.Void Java.Interop.JavaException::.ctor(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions) -M: System.Void Java.Interop.JavaInt16Array::.ctor(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions) -M: System.Void Java.Interop.JavaInt32Array::.ctor(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions) -M: System.Void Java.Interop.JavaInt64Array::.ctor(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions) -M: System.Void Java.Interop.JavaObject::.ctor(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions) -M: System.Void Java.Interop.JavaObjectArray`1::.ctor(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions) -M: System.Void Java.Interop.JavaSByteArray::.ctor(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions) -M: System.Void Java.Interop.JavaSingleArray::.ctor(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions) -M: System.String Java.Interop.JniEnvironment/Strings::ToString(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions) -M: System.Void Java.Interop.JniObjectReference::Dispose(Java.Interop.JniObjectReference&) -M: System.Void Java.Interop.JniObjectReference::Dispose(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions) -M: System.Exception Java.Interop.JniRuntime::GetExceptionForThrowable(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions) -M: System.Void Java.Interop.JniRuntime/JniObjectReferenceManager::DeleteGlobalReference(Java.Interop.JniObjectReference&) -M: System.Void Java.Interop.JniRuntime/JniObjectReferenceManager::DeleteWeakGlobalReference(Java.Interop.JniObjectReference&) -M: System.Void Java.Interop.JniRuntime/JniValueManager::ConstructPeer(Java.Interop.IJavaPeerable,Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions) -M: Java.Interop.IJavaPeerable Java.Interop.JniRuntime/JniValueManager::CreatePeer(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions,System.Type) -M: System.Object Java.Interop.JniRuntime/JniValueManager::CreateValue(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions,System.Type) -M: T Java.Interop.JniRuntime/JniValueManager::CreateValue(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions,System.Type) -M: System.Object Java.Interop.JniRuntime/JniValueManager::GetValue(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions,System.Type) -M: T Java.Interop.JniRuntime/JniValueManager::GetValue(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions,System.Type) -M: System.Void Java.Interop.JniType::.ctor(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions) -M: System.Object Java.Interop.JniValueMarshaler::CreateValue(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions,System.Type) -M: T Java.Interop.JniValueMarshaler`1::CreateGenericValue(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions,System.Type) -M: System.Object Java.Interop.JniValueMarshaler`1::CreateValue(Java.Interop.JniObjectReference&,Java.Interop.JniObjectReferenceOptions,System.Type) - -# Use of ref JniValueMarshalerState, added by design in 77a6bf86 -M: System.Void Java.Interop.JniValueMarshaler::DestroyArgumentState(System.Object,Java.Interop.JniValueMarshalerState&,System.Reflection.ParameterAttributes) -M: System.Void Java.Interop.JniValueMarshaler`1::DestroyArgumentState(System.Object,Java.Interop.JniValueMarshalerState&,System.Reflection.ParameterAttributes) -M: System.Void Java.Interop.JniValueMarshaler`1::DestroyGenericArgumentState(T,Java.Interop.JniValueMarshalerState&,System.Reflection.ParameterAttributes) - -# These are thread-safe wrappers for getting-and-updating a `static` variable. -M: Java.Interop.JniType Java.Interop.JniType::GetCachedJniType(Java.Interop.JniType&,System.String) -M: Java.Interop.JniMethodInfo Java.Interop.JniType::GetCachedConstructor(Java.Interop.JniMethodInfo&,System.String) -M: Java.Interop.JniFieldInfo Java.Interop.JniType::GetCachedInstanceField(Java.Interop.JniFieldInfo&,System.String,System.String) -M: Java.Interop.JniFieldInfo Java.Interop.JniType::GetCachedStaticField(Java.Interop.JniFieldInfo&,System.String,System.String) -M: Java.Interop.JniMethodInfo Java.Interop.JniType::GetCachedInstanceMethod(Java.Interop.JniMethodInfo&,System.String,System.String) -M: Java.Interop.JniMethodInfo Java.Interop.JniType::GetCachedStaticMethod(Java.Interop.JniMethodInfo&,System.String,System.String) - - -R: Gendarme.Rules.Design.AvoidVisibleFieldsRule -# This type is passed to native code, and should use fields, not properties. -T: Java.Interop.JniNativeMethodRegistration - - -R: Gendarme.Rules.Design.AvoidVisibleNestedTypesRule -# Deliberate choice to "hide" these types from code completion for `Java.Interop.`. -# See: 045b8af7, 6a42bb89, f60906cf, e10f7cb0, etc. -T: Java.Interop.JniEnvironment/References -T: Java.Interop.JniEnvironment/Arrays -T: Java.Interop.JniEnvironment/Exceptions -T: Java.Interop.JniEnvironment/InstanceFields -T: Java.Interop.JniEnvironment/InstanceMethods -T: Java.Interop.JniEnvironment/IO -T: Java.Interop.JniEnvironment/Monitors -T: Java.Interop.JniEnvironment/Object -T: Java.Interop.JniEnvironment/StaticFields -T: Java.Interop.JniEnvironment/StaticMethods -T: Java.Interop.JniEnvironment/Strings -T: Java.Interop.JniEnvironment/Types -T: Java.Interop.JniPeerMembers/JniInstanceMethods -T: Java.Interop.JniPeerMembers/JniStaticMethods -T: Java.Interop.JniPeerMembers/JniInstanceFields -T: Java.Interop.JniPeerMembers/JniStaticFields -T: Java.Interop.JniRuntime/CreationOptions -T: Java.Interop.JniRuntime/JniMarshalMemberBuilder -T: Java.Interop.JniRuntime/JniObjectReferenceManager -T: Java.Interop.JniRuntime/JniTypeManager -T: Java.Interop.JniRuntime/JniValueManager - - -R: Gendarme.Rules.Design.DisposableTypesShouldHaveFinalizerRule -# No, not all IDisposable types should have finalizers. -T: Java.Interop.JniArrayElements -T: Java.Interop.JniEnvironmentInfo - - -R: Gendarme.Rules.Design.UseCorrectDisposeSignaturesRule -# we don't need virtual Dispose(bool) method here. we also fully control the type, as it has only internal constructor -T: Java.Interop.JniArrayElements - - -R: Gendarme.Rules.Design.EnumsShouldUseInt32Rule -# It's a `uint` because I'm using bitwise operators and want to keep things sane. -T: Java.Interop.JniObjectReferenceFlags - - -R: Gendarme.Rules.Design.FlagsShouldNotDefineAZeroValueRule -# Here, the 0 value is "None", and thus I think is acceptable; -# https://msdn.microsoft.com/en-us/library/ms229058(v=vs.110).aspx -# > **AVOID** using flag enum values of zero unless the value represents "all flags are cleared" and is named appropriately, as prescribed by the next guideline -# "Invalid" implies "all flags are cleared" to *me*... -# > **DO** name the zero value of flag enums None. For a flag enum, the value must always mean "all flags are cleared." -T: Java.Interop.JniManagedPeerStates -T: Java.Interop.JniObjectReferenceOptions - - -R: Gendarme.Rules.Design.MarkAssemblyWithCLSCompliantRule -# CLSCompliantAttribute isn't in the PCL profile we're targeting, so we can't apply it. -A: Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065 - - -R: Gendarme.Rules.Design.MarkAssemblyWithComVisibleRule -# Ditto; ComVisibleAttribute isn't in our PCL profile. -A: Java.Interop, Version=0.1.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065 - - -R: Gendarme.Rules.Design.PreferEventsOverMethodsRule -# This isn't "raising" an event; it's "raising" a pending exception within the JVM. -M: System.Void Java.Interop.JniRuntime::RaisePendingException(System.Exception) - - -R: Gendarme.Rules.Design.TypesWithDisposableFieldsShouldBeDisposableRule -# JniEnvironmentInfo.Runtime is IDisposable, but JniRuntime will dispose JniEnvironmentInfo. -T: Java.Interop.JniEnvironmentInfo -# As per elsewhere, we don't want JniPeerMembers to be easily disposed by users. -# We should check/ensure that it is disposed by JniRuntime when JniRuntime is Dispose()d... -T: Java.Interop.JniPeerMembers -T: Java.Interop.JniPeerMembers/JniInstanceMethods -# It wouldn't make any sense to Dispose() CreationOptions... -T: Java.Interop.JniRuntime/CreationOptions -# JniTypeManager.Runtime is the "enclosing" runtime; it shouldn't Dispose() -T: Java.Interop.JniRuntime/JniTypeManager - - -R: Gendarme.Rules.Design.TypesWithNativeFieldsShouldBeDisposableRule -T: Java.Interop.JniEnvironmentInfo -T: Java.Interop.JniFieldInfo -T: Java.Interop.JniMethodInfo -T: Java.Interop.JniRuntime/CreationOptions - - -R: Gendarme.Rules.Design.Generic.AvoidDeclaringCustomDelegatesRule -# These are delegate types passed via P/Invoke, and thus *can't* be Func/Action -T: Java.Interop.DestroyJavaVMDelegate -T: Java.Interop.DetachCurrentThreadDelegate - -R: Gendarme.Rules.Design.Generic.DoNotExposeNestedGenericSignaturesRule -M: System.Linq.Expressions.Expression`1> Java.Interop.JniRuntime/JniMarshalMemberBuilder::CreateConstructActivationPeerExpression(System.Reflection.ConstructorInfo) - -R: Gendarme.Rules.Exceptions.DoNotSwallowErrorsCatchingNonSpecificExceptionsRule -# the *.Export assemblies are optional, so we don't care when they cannot be loaded (they are presumably missing) -M: System.Void Java.Interop.JniRuntime::SetMarshalMemberBuilder(Java.Interop.JniRuntime/CreationOptions) -M: System.Reflection.Assembly Java.Interop.JniRuntime/JniTypeManager::TryLoadAssembly(System.Reflection.AssemblyName) -# The exception is transitioned to Jni -M:System.Void Java.Interop.ManagedPeer::Construct(System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr) - -R: Gendarme.Rules.Exceptions.ExceptionShouldBeVisibleRule -T: Java.Interop.JniLocationException - -R: Gendarme.Rules.Exceptions.MissingExceptionConstructorsRule -# System.Runtime.Serialization.SerializationInfo doesn't exist in our targeted PCL profile, so we can't provide the (SerializationInfo, StreamingContext) constructor. -T: Java.Interop.JavaException -T: Java.Interop.JavaProxyThrowable -T: Java.Interop.JniLocationException - -R: Gendarme.Rules.Exceptions.UseObjectDisposedExceptionRule -# I don't want ~any overhead around reference tracking -M: System.Void Java.Interop.JniRuntime/JniObjectReferenceManager::CreatedLocalReference(Java.Interop.JniObjectReference,System.Int32&) -M: Java.Interop.JniObjectReference Java.Interop.JniRuntime/JniObjectReferenceManager::CreateGlobalReference(Java.Interop.JniObjectReference) -M: Java.Interop.JniObjectReference Java.Interop.JniRuntime/JniObjectReferenceManager::CreateLocalReference(Java.Interop.JniObjectReference,System.Int32&) -M: Java.Interop.JniObjectReference Java.Interop.JniRuntime/JniObjectReferenceManager::CreateWeakGlobalReference(Java.Interop.JniObjectReference) -M: System.Void Java.Interop.JniRuntime/JniObjectReferenceManager::DeleteGlobalReference(Java.Interop.JniObjectReference&) -M: System.Void Java.Interop.JniRuntime/JniObjectReferenceManager::DeleteLocalReference(Java.Interop.JniObjectReference&,System.Int32&) -M: System.Void Java.Interop.JniRuntime/JniObjectReferenceManager::DeleteWeakGlobalReference(Java.Interop.JniObjectReference&) -M: System.Void Java.Interop.JniRuntime/JniObjectReferenceManager::OnSetRuntime(Java.Interop.JniRuntime) -M: System.IntPtr Java.Interop.JniRuntime/JniObjectReferenceManager::ReleaseLocalReference(Java.Interop.JniObjectReference&,System.Int32&) - -# These *do* validate, they just validate via AssertValid() helper method -M: System.Void Java.Interop.JniRuntime::AttachCurrentThread(System.String,Java.Interop.JniObjectReference) -M: System.Void Java.Interop.JniRuntime::DestroyRuntime() -M: System.Void Java.Interop.JniRuntime/JniTypeManager::OnSetRuntime(Java.Interop.JniRuntime) -M: Java.Interop.JniTypeSignature Java.Interop.JniRuntime/JniTypeManager::GetTypeSignature(System.Type) -M: System.Collections.Generic.IEnumerable`1 Java.Interop.JniRuntime/JniTypeManager::GetTypeSignatures(System.Type) -M: System.Type Java.Interop.JniRuntime/JniTypeManager::GetType(Java.Interop.JniTypeSignature) -M: System.Collections.Generic.IEnumerable`1 Java.Interop.JniRuntime/JniTypeManager::GetTypes(Java.Interop.JniTypeSignature) -M: System.Void Java.Interop.JniRuntime/JniTypeManager::RegisterNativeMembers(Java.Interop.JniType,System.Type,System.String) -M: Java.Interop.JniType Java.Interop.JniType::GetSuperclass() -M: System.Boolean Java.Interop.JniType::IsAssignableFrom(Java.Interop.JniType) -M: System.Boolean Java.Interop.JniType::IsInstanceOfType(Java.Interop.JniObjectReference) -M: System.Void Java.Interop.JniType::RegisterNativeMethods(Java.Interop.JniNativeMethodRegistration[]) -M: System.Void Java.Interop.JniType::RegisterWithRuntime() -M: System.Void Java.Interop.JniType::UnregisterNativeMethods() -M: Java.Interop.JniMethodInfo Java.Interop.JniType::GetConstructor(System.String) -M: Java.Interop.JniMethodInfo Java.Interop.JniType::GetCachedConstructor(Java.Interop.JniMethodInfo&,System.String) -M: Java.Interop.JniObjectReference Java.Interop.JniType::AllocObject() -M: Java.Interop.JniObjectReference Java.Interop.JniType::NewObject(Java.Interop.JniMethodInfo,Java.Interop.JniArgumentValue*) -M: Java.Interop.JniFieldInfo Java.Interop.JniType::GetInstanceField(System.String,System.String) -M: Java.Interop.JniFieldInfo Java.Interop.JniType::GetCachedInstanceField(Java.Interop.JniFieldInfo&,System.String,System.String) -M: Java.Interop.JniFieldInfo Java.Interop.JniType::GetStaticField(System.String,System.String) -M: Java.Interop.JniFieldInfo Java.Interop.JniType::GetCachedStaticField(Java.Interop.JniFieldInfo&,System.String,System.String) -M: Java.Interop.JniMethodInfo Java.Interop.JniType::GetInstanceMethod(System.String,System.String) -M: Java.Interop.JniMethodInfo Java.Interop.JniType::GetCachedInstanceMethod(Java.Interop.JniMethodInfo&,System.String,System.String) -M: Java.Interop.JniMethodInfo Java.Interop.JniType::GetStaticMethod(System.String,System.String) -M: Java.Interop.JniMethodInfo Java.Interop.JniType::GetCachedStaticMethod(Java.Interop.JniMethodInfo&,System.String,System.String) - -# do not check here to improve performance -M: System.Void Java.Interop.JniArrayElements::CopyToJava() -M: System.Int32 Java.Interop.JavaObjectArray`1::IndexOf(T) -M: Java.Interop.JniArrayElements Java.Interop.JavaPrimitiveArray`1::GetElements() - -# it doesn't make sense to check the disposed state here, as the JavaObject::Dispose(bool) doesn't do anything and neither the JavaArray nor JavaObjectArray override it -M: System.Void Java.Interop.JavaObjectArray`1::set_Item(System.Int32,T) - -R: Gendarme.Rules.Interoperability.MarshalBooleansInPInvokeDeclarationsRule -# These aren't `bool`, they're `bool*`, which is a *huge* difference! -M: System.Char* Java.Interop.NativeMethods::java_interop_jnienv_get_string_chars(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.Boolean* Java.Interop.NativeMethods::java_interop_jnienv_get_boolean_array_elements(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.SByte* Java.Interop.NativeMethods::java_interop_jnienv_get_byte_array_elements(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.Char* Java.Interop.NativeMethods::java_interop_jnienv_get_char_array_elements(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.Int16* Java.Interop.NativeMethods::java_interop_jnienv_get_short_array_elements(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.Int32* Java.Interop.NativeMethods::java_interop_jnienv_get_int_array_elements(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.Int64* Java.Interop.NativeMethods::java_interop_jnienv_get_long_array_elements(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.Single* Java.Interop.NativeMethods::java_interop_jnienv_get_float_array_elements(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.Double* Java.Interop.NativeMethods::java_interop_jnienv_get_double_array_elements(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_release_boolean_array_elements(System.IntPtr,System.IntPtr,System.Boolean*,System.Int32) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_get_boolean_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.Boolean*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_boolean_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.Boolean*) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_get_primitive_array_critical(System.IntPtr,System.IntPtr,System.Boolean*) - -R: Gendarme.Rules.Maintainability.AvoidAlwaysNullFieldRule -# I suspect that this is a Roslyn bug; mcs output doesn't produce this. -T: Java.Interop.JniRuntime/JniTypeManager/d__15 -T: Java.Interop.JniRuntime/JniTypeManager/d__19 - - -R: Gendarme.Rules.Maintainability.AvoidLackOfCohesionOfMethodsRule -# I'm not sure I understand "lack of cohesion" in this context, and the docs -# provide no examples. :-/ -T: Java.Interop.JniArgumentValue -T: Java.Interop.JniEnvironmentInfo -T: Java.Interop.JniPeerMembers -T: Java.Interop.JniPeerMembers/JniInstanceMethods -T: Java.Interop.JniRuntime -T: Java.Interop.JniRuntime/JniObjectReferenceManager - - -R: Gendarme.Rules.Maintainability.VariableNamesShouldNotMatchFieldNamesRule -# This is (1) a stupid rule, and (2) is counter to FxDG about parameter -# names matching property names in constructors -# https://msdn.microsoft.com/en-us/library/ms229060(v=vs.100).aspx -# > Do use the same name for constructor parameters and a property, if the -# > constructor parameters are used to simply set the property. The only -# > difference between such parameters and the properties should be casing. -T: Java.Interop.JavaException -T: Java.Interop.JniArrayElements -T: Java.Interop.JniBooleanArrayElements -T: Java.Interop.JniCharArrayElements -T: Java.Interop.JniDoubleArrayElements -T: Java.Interop.JniEnvironmentInfo -T: Java.Interop.JniFieldInfo -T: Java.Interop.JniInt16ArrayElements -T: Java.Interop.JniInt32ArrayElements -T: Java.Interop.JniInt64ArrayElements -T: Java.Interop.JniLocationException -T: Java.Interop.JniMethodInfo -T: Java.Interop.JniPeerMembers -T: Java.Interop.JniSByteArrayElements -T: Java.Interop.JniSingleArrayElements -T: Java.Interop.JniType - - -R: Gendarme.Rules.Naming.AvoidNonAlphanumericIdentifierRule -# I have no ideas for how to better name the enum members here. :-( -T: Java.Interop.JniVersion - - -R: Gendarme.Rules.Naming.UseCorrectCasingRule -# These are `internal`. Don't care. -M: Java.Interop.JniObjectReference Java.Interop.JniEnvironment/Types::_FindClass(System.String) -M: System.IntPtr Java.Interop.JniRuntime::_AttachCurrentThread(System.String,Java.Interop.JniObjectReference) -M: System.Int32 Java.Interop.JniEnvironment/References::_PushLocalFrame(System.Int32) -M: System.Int32 Java.Interop.JniEnvironment/References::_EnsureLocalCapacity(System.Int32) -M: System.Int32 Java.Interop.JniEnvironment/References::_GetJavaVM(System.IntPtr&) -M: System.Int32 Java.Interop.JniEnvironment/Exceptions::_Throw(Java.Interop.JniObjectReference) -M: System.Int32 Java.Interop.JniEnvironment/Exceptions::_ThrowNew(Java.Interop.JniObjectReference,System.String) -M: System.Int32 Java.Interop.JniEnvironment/Monitors::_MonitorEnter(Java.Interop.JniObjectReference) -M: System.Int32 Java.Interop.JniEnvironment/Monitors::_MonitorExit(Java.Interop.JniObjectReference) -M: Java.Interop.JniObjectReference Java.Interop.JniEnvironment/Object::_NewObject(Java.Interop.JniObjectReference,Java.Interop.JniMethodInfo) -M: Java.Interop.JniObjectReference Java.Interop.JniEnvironment/Object::_NewObject(Java.Interop.JniObjectReference,Java.Interop.JniMethodInfo,Java.Interop.JniArgumentValue*) -M: System.Int32 Java.Interop.JniEnvironment/Types::_RegisterNatives(Java.Interop.JniObjectReference,Java.Interop.JniNativeMethodRegistration[],System.Int32) -M: System.Int32 Java.Interop.JniEnvironment/Types::_UnregisterNatives(Java.Interop.JniObjectReference) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_get_version(System.IntPtr) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_define_class(System.IntPtr,System.IntPtr&,System.String,System.IntPtr,System.IntPtr,System.Int32) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_find_class(System.IntPtr,System.IntPtr&,System.String) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_to_reflected_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.Byte) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_get_superclass(System.IntPtr,System.IntPtr) -M: System.Byte Java.Interop.NativeMethods::java_interop_jnienv_is_assignable_from(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_to_reflected_field(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.Byte) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_throw(System.IntPtr,System.IntPtr) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_throw_new(System.IntPtr,System.IntPtr,System.String) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_exception_occurred(System.IntPtr) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_exception_describe(System.IntPtr) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_exception_clear(System.IntPtr) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_fatal_error(System.IntPtr,System.String) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_push_local_frame(System.IntPtr,System.Int32) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_pop_local_frame(System.IntPtr,System.IntPtr) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_new_global_ref(System.IntPtr,System.IntPtr) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_delete_global_ref(System.IntPtr,System.IntPtr) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_delete_local_ref(System.IntPtr,System.IntPtr) -M: System.Byte Java.Interop.NativeMethods::java_interop_jnienv_is_same_object(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_new_local_ref(System.IntPtr,System.IntPtr) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_ensure_local_capacity(System.IntPtr,System.Int32) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_alloc_object(System.IntPtr,System.IntPtr&,System.IntPtr) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_new_object(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_new_object_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_get_object_class(System.IntPtr,System.IntPtr) -M: System.Byte Java.Interop.NativeMethods::java_interop_jnienv_is_instance_of(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_get_method_id(System.IntPtr,System.IntPtr&,System.IntPtr,System.String,System.String) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_call_object_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_call_object_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Byte Java.Interop.NativeMethods::java_interop_jnienv_call_boolean_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.Byte Java.Interop.NativeMethods::java_interop_jnienv_call_boolean_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.SByte Java.Interop.NativeMethods::java_interop_jnienv_call_byte_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.SByte Java.Interop.NativeMethods::java_interop_jnienv_call_byte_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Char Java.Interop.NativeMethods::java_interop_jnienv_call_char_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.Char Java.Interop.NativeMethods::java_interop_jnienv_call_char_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Int16 Java.Interop.NativeMethods::java_interop_jnienv_call_short_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.Int16 Java.Interop.NativeMethods::java_interop_jnienv_call_short_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_call_int_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_call_int_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Int64 Java.Interop.NativeMethods::java_interop_jnienv_call_long_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.Int64 Java.Interop.NativeMethods::java_interop_jnienv_call_long_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Single Java.Interop.NativeMethods::java_interop_jnienv_call_float_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.Single Java.Interop.NativeMethods::java_interop_jnienv_call_float_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Double Java.Interop.NativeMethods::java_interop_jnienv_call_double_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.Double Java.Interop.NativeMethods::java_interop_jnienv_call_double_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_call_void_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_call_void_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_object_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_object_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Byte Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_boolean_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Byte Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_boolean_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.SByte Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_byte_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.SByte Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_byte_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Char Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_char_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Char Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_char_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Int16 Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_short_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Int16 Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_short_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_int_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_int_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Int64 Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_long_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Int64 Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_long_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Single Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_float_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Single Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_float_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Double Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_double_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Double Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_double_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_void_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_call_nonvirtual_void_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_get_field_id(System.IntPtr,System.IntPtr&,System.IntPtr,System.String,System.String) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_get_object_field(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Byte Java.Interop.NativeMethods::java_interop_jnienv_get_boolean_field(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.SByte Java.Interop.NativeMethods::java_interop_jnienv_get_byte_field(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Char Java.Interop.NativeMethods::java_interop_jnienv_get_char_field(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Int16 Java.Interop.NativeMethods::java_interop_jnienv_get_short_field(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_get_int_field(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Int64 Java.Interop.NativeMethods::java_interop_jnienv_get_long_field(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Single Java.Interop.NativeMethods::java_interop_jnienv_get_float_field(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Double Java.Interop.NativeMethods::java_interop_jnienv_get_double_field(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_object_field(System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_boolean_field(System.IntPtr,System.IntPtr,System.IntPtr,System.Byte) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_byte_field(System.IntPtr,System.IntPtr,System.IntPtr,System.SByte) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_char_field(System.IntPtr,System.IntPtr,System.IntPtr,System.Char) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_short_field(System.IntPtr,System.IntPtr,System.IntPtr,System.Int16) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_int_field(System.IntPtr,System.IntPtr,System.IntPtr,System.Int32) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_long_field(System.IntPtr,System.IntPtr,System.IntPtr,System.Int64) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_float_field(System.IntPtr,System.IntPtr,System.IntPtr,System.Single) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_double_field(System.IntPtr,System.IntPtr,System.IntPtr,System.Double) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_get_static_method_id(System.IntPtr,System.IntPtr&,System.IntPtr,System.String,System.String) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_call_static_object_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_call_static_object_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Byte Java.Interop.NativeMethods::java_interop_jnienv_call_static_boolean_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.Byte Java.Interop.NativeMethods::java_interop_jnienv_call_static_boolean_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.SByte Java.Interop.NativeMethods::java_interop_jnienv_call_static_byte_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.SByte Java.Interop.NativeMethods::java_interop_jnienv_call_static_byte_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Char Java.Interop.NativeMethods::java_interop_jnienv_call_static_char_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.Char Java.Interop.NativeMethods::java_interop_jnienv_call_static_char_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Int16 Java.Interop.NativeMethods::java_interop_jnienv_call_static_short_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.Int16 Java.Interop.NativeMethods::java_interop_jnienv_call_static_short_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_call_static_int_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_call_static_int_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Int64 Java.Interop.NativeMethods::java_interop_jnienv_call_static_long_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.Int64 Java.Interop.NativeMethods::java_interop_jnienv_call_static_long_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Single Java.Interop.NativeMethods::java_interop_jnienv_call_static_float_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.Single Java.Interop.NativeMethods::java_interop_jnienv_call_static_float_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Double Java.Interop.NativeMethods::java_interop_jnienv_call_static_double_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.Double Java.Interop.NativeMethods::java_interop_jnienv_call_static_double_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_call_static_void_method(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_call_static_void_method_a(System.IntPtr,System.IntPtr&,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_get_static_field_id(System.IntPtr,System.IntPtr&,System.IntPtr,System.String,System.String) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_get_static_object_field(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Byte Java.Interop.NativeMethods::java_interop_jnienv_get_static_boolean_field(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.SByte Java.Interop.NativeMethods::java_interop_jnienv_get_static_byte_field(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Char Java.Interop.NativeMethods::java_interop_jnienv_get_static_char_field(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Int16 Java.Interop.NativeMethods::java_interop_jnienv_get_static_short_field(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_get_static_int_field(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Int64 Java.Interop.NativeMethods::java_interop_jnienv_get_static_long_field(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Single Java.Interop.NativeMethods::java_interop_jnienv_get_static_float_field(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Double Java.Interop.NativeMethods::java_interop_jnienv_get_static_double_field(System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_static_object_field(System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_static_boolean_field(System.IntPtr,System.IntPtr,System.IntPtr,System.Byte) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_static_byte_field(System.IntPtr,System.IntPtr,System.IntPtr,System.SByte) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_static_char_field(System.IntPtr,System.IntPtr,System.IntPtr,System.Char) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_static_short_field(System.IntPtr,System.IntPtr,System.IntPtr,System.Int16) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_static_int_field(System.IntPtr,System.IntPtr,System.IntPtr,System.Int32) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_static_long_field(System.IntPtr,System.IntPtr,System.IntPtr,System.Int64) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_static_float_field(System.IntPtr,System.IntPtr,System.IntPtr,System.Single) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_static_double_field(System.IntPtr,System.IntPtr,System.IntPtr,System.Double) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_new_string(System.IntPtr,System.IntPtr&,System.Char*,System.Int32) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_get_string_length(System.IntPtr,System.IntPtr) -M: System.Char* Java.Interop.NativeMethods::java_interop_jnienv_get_string_chars(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_release_string_chars(System.IntPtr,System.IntPtr,System.Char*) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_get_array_length(System.IntPtr,System.IntPtr) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_new_object_array(System.IntPtr,System.IntPtr&,System.Int32,System.IntPtr,System.IntPtr) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_get_object_array_element(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_object_array_element(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.IntPtr) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_new_boolean_array(System.IntPtr,System.Int32) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_new_byte_array(System.IntPtr,System.Int32) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_new_char_array(System.IntPtr,System.Int32) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_new_short_array(System.IntPtr,System.Int32) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_new_int_array(System.IntPtr,System.Int32) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_new_long_array(System.IntPtr,System.Int32) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_new_float_array(System.IntPtr,System.Int32) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_new_double_array(System.IntPtr,System.Int32) -M: System.Boolean* Java.Interop.NativeMethods::java_interop_jnienv_get_boolean_array_elements(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.SByte* Java.Interop.NativeMethods::java_interop_jnienv_get_byte_array_elements(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.Char* Java.Interop.NativeMethods::java_interop_jnienv_get_char_array_elements(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.Int16* Java.Interop.NativeMethods::java_interop_jnienv_get_short_array_elements(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.Int32* Java.Interop.NativeMethods::java_interop_jnienv_get_int_array_elements(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.Int64* Java.Interop.NativeMethods::java_interop_jnienv_get_long_array_elements(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.Single* Java.Interop.NativeMethods::java_interop_jnienv_get_float_array_elements(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.Double* Java.Interop.NativeMethods::java_interop_jnienv_get_double_array_elements(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_release_boolean_array_elements(System.IntPtr,System.IntPtr,System.Boolean*,System.Int32) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_release_byte_array_elements(System.IntPtr,System.IntPtr,System.SByte*,System.Int32) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_release_char_array_elements(System.IntPtr,System.IntPtr,System.Char*,System.Int32) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_release_short_array_elements(System.IntPtr,System.IntPtr,System.Int16*,System.Int32) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_release_int_array_elements(System.IntPtr,System.IntPtr,System.Int32*,System.Int32) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_release_long_array_elements(System.IntPtr,System.IntPtr,System.Int64*,System.Int32) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_release_float_array_elements(System.IntPtr,System.IntPtr,System.Single*,System.Int32) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_release_double_array_elements(System.IntPtr,System.IntPtr,System.Double*,System.Int32) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_get_boolean_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.Boolean*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_get_byte_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.SByte*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_get_char_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.Char*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_get_short_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.Int16*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_get_int_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.Int32*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_get_long_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.Int64*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_get_float_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.Single*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_get_double_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.Double*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_boolean_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.Boolean*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_byte_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.SByte*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_char_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.Char*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_short_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.Int16*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_int_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.Int32*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_long_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.Int64*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_float_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.Single*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_set_double_array_region(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int32,System.Int32,System.Double*) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_register_natives(System.IntPtr,System.IntPtr&,System.IntPtr,Java.Interop.JniNativeMethodRegistration[],System.Int32) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_unregister_natives(System.IntPtr,System.IntPtr) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_monitor_enter(System.IntPtr,System.IntPtr) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_monitor_exit(System.IntPtr,System.IntPtr) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jnienv_get_java_vm(System.IntPtr,System.IntPtr&) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_get_primitive_array_critical(System.IntPtr,System.IntPtr,System.Boolean*) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_release_primitive_array_critical(System.IntPtr,System.IntPtr,System.IntPtr,System.Int32) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_new_weak_global_ref(System.IntPtr,System.IntPtr) -M: System.Void Java.Interop.NativeMethods::java_interop_jnienv_delete_weak_global_ref(System.IntPtr,System.IntPtr) -M: System.Byte Java.Interop.NativeMethods::java_interop_jnienv_exception_check(System.IntPtr) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_new_direct_byte_buffer(System.IntPtr,System.IntPtr&,System.IntPtr,System.Int64) -M: System.IntPtr Java.Interop.NativeMethods::java_interop_jnienv_get_direct_buffer_address(System.IntPtr,System.IntPtr) -M: System.Int64 Java.Interop.NativeMethods::java_interop_jnienv_get_direct_buffer_capacity(System.IntPtr,System.IntPtr) -M: Java.Interop.JniObjectReferenceType Java.Interop.NativeMethods::java_interop_jnienv_get_object_ref_type(System.IntPtr,System.IntPtr) -M: System.Int32 Java.Interop.NativeMethods::java_interop_jvm_list(System.IntPtr[],System.Int32,System.Int32&) - - -R: Gendarme.Rules.Naming.UseCorrectSuffixRule -T: Java.Interop.AttachCurrentThreadAsDaemonDelegate -T: Java.Interop.AttachCurrentThreadDelegate -T: Java.Interop.DestroyJavaVMDelegate -T: Java.Interop.DetachCurrentThreadDelegate -T: Java.Interop.Expressions.VariableCollection -T: Java.Interop.GetEnvDelegate -T: Java.Interop.JavaArray`1 -T: Java.Interop.JavaProxyThrowable -T: Java.Interop.JniObjectReferenceFlags - - -R: Gendarme.Rules.Performance.AvoidLargeStructureRule -# This is a *union*; it's size is sizeof(double). The rule check is buggy, -# and thinks that it's 36 bytes. Nope! -T: Java.Interop.JniArgumentValue -# This we can't make smaller; it *must* match the corresponding native struct! -T: Java.Interop.JniNativeInterfaceStruct -# I think we cannot make this one smaller. Also the reported size is wrong as it contains Java.Interop.JniArgumentValue, which is a union (see above) -T: Java.Interop.JniValueMarshalerState - - -R: Gendarme.Rules.Performance.AvoidRepetitiveCastsRule -# The "repetitive" cast is in a Debug.Assert() call, which should be "stand-alone" -M: Java.Interop.JniObjectReference Java.Interop.JniEnvironment/Strings::NewString(System.Object) - -R: Gendarme.Rules.Performance.AvoidUncalledPrivateCodeRule -# These are `public` for "completeness" reasons. -M: Java.Interop.JniObjectReferenceType Java.Interop.JniEnvironment/References::GetObjectRefType(Java.Interop.JniObjectReference) -M: Java.Interop.JniObjectReference Java.Interop.JniEnvironment/Reflection::ToReflectedMethod(Java.Interop.JniObjectReference,Java.Interop.JniMethodInfo,System.Boolean) -M: Java.Interop.JniObjectReference Java.Interop.JniEnvironment/Reflection::ToReflectedField(Java.Interop.JniObjectReference,Java.Interop.JniFieldInfo,System.Boolean) -M: Java.Interop.JniObjectReferenceFlags Java.Interop.JniObjectReference::get_Flags() -# This method is used in Java.Interop.GenericMarshaler.dll, the internals are visible to this assembly. Looks like gendarme doesn't know InternalsVisibleTo attribute. -M: Java.Interop.JniObjectReference Java.Interop.JniPeerMembers/JniInstanceMethods::AllocObject(System.Type) - -# I think Gendarme is buggy here; `JavaArray.CheckLength(IList)` *is* used. -M: System.Int32 Java.Interop.JavaArray`1::CheckLength(System.Collections.Generic.IList`1) - -# `RegisterNativeMembers()` is invoked via Reflection from JniRuntime/JniTypeManager::TryRegisterNativeMembers -M: System.Void Java.Interop.JavaProxyObject::RegisterNativeMembers(Java.Interop.JniNativeMethodRegistrationArguments) - -# We need JNIEnv::FindClass() to be *bound* so that the JavaInterop_FindClass() wrapper is emitted. -# We don't want to actually *use* it, so it's `internal` and unused. Ignore -M: Java.Interop.JniObjectReference Java.Interop.JniEnvironment/Types::_FindClass(System.String) - -# This is used via Reflection by Java.Interop.Dynamic. -M: Java.Interop.JniPeerMembers Java.Interop.JniPeerMembers::CreatePeerMembers(System.String,System.Type) - - -R: Gendarme.Rules.Performance.AvoidUnusedParametersRule -# This method is virtual; *overrides* need the parameter, not the default implementation. -M: System.Collections.Generic.IEnumerable`1 Java.Interop.JniRuntime/JniTypeManager::CreateGetTypesForSimpleReferenceEnumerator(System.String) - -R: Gendarme.Rules.Performance.UseTypeEmptyTypesRule -# The PCL profile we're using doesn't *have* Type.EmptyTypes! -M: System.Void Java.Interop.JniRuntime/JniTypeManager::.cctor() -M: System.Type[] Java.Interop.ManagedPeer::GetParameterTypes(System.String) - -R: Gendarme.Rules.BadPractice.CheckNewExceptionWithoutThrowingRule -# This method constructs JavaException and calls ToString () on it. We only care about Java stack trace here, so we don't need to throw the exception to get managed StackTrace. -M: System.Exception Java.Interop.ManagedPeer::CreateJniLocationException() -# This method uses a JavaException and passes its PeerReference property along. We don't want to throw that property. -M: System.Void Java.Interop.JniEnvironment/Exceptions::Throw(System.Exception) - -R: Gendarme.Rules.Correctness.DisposableFieldsShouldBeDisposedRule -# We call Dispose on marshalMemberBuilder field in the JniRuntime::Dispose method. Looks like gendarme bug, it doesn't handle well the `?.` operator. -T: Java.Interop.JniRuntime - -R: Gendarme.Rules.Performance.AvoidUnusedPrivateFieldsRule -# The weak_handle and refs_added fields are used from C code, in java-interop-gc-bridge-mono.c, and thus invisible to Gendarme -T: Java.Interop.JavaException -T: Java.Interop.JavaObject - -R: Gendarme.Rules.Design.Generic.DoNotExposeGenericListsRule -# We don't care here as we don't hold the list and create it on request. So to avoid performace penalty, we keep the list as return type -M: System.Collections.Generic.List`1 Java.Interop.JniRuntime/JniValueManager::GetSurfacedPeers() - -R: Gendarme.Rules.Design.ListsAreStronglyTypedRule -# Add, Insert and Remove methods are not supported by design and thus lack strongly typed versions of these methods -T: Java.Interop.JavaBooleanArray -T: Java.Interop.JavaCharArray -T: Java.Interop.JavaDoubleArray -T: Java.Interop.JavaInt16Array -T: Java.Interop.JavaInt32Array -T: Java.Interop.JavaInt64Array -T: Java.Interop.JavaObjectArray`1 -T: Java.Interop.JavaSByteArray -T: Java.Interop.JavaSingleArray - -R: Gendarme.Rules.Concurrency.DoNotUseLockedRegionOutsideMethodRule -# Looks like Gendarme issue, as there are both Monitor.TryEnter and Monitor.Exit used in this method -M: System.Boolean Java.Interop.JniRuntime/JniTypeManager::TryRegisterNativeMembers(Java.Interop.JniType,System.Type,System.String,System.Reflection.MethodInfo) - -R: Gendarme.Rules.Performance.AvoidUnsealedConcreteAttributesRule -# We would like users to be able to derive from this attribute -T: Java.Interop.JniValueMarshalerAttribute - -R: Gendarme.Rules.Design.Generic.AvoidMethodWithUnusedGenericTypeRule -# looks like Gendarme bug, the TArray is used in the cast -M: System.Void Java.Interop.JavaArray`1::DestroyArgumentState(System.Collections.Generic.IList`1,Java.Interop.JniValueMarshalerState&,System.Reflection.ParameterAttributes) - - -R: Gendarme.Rules.Performance.ImplementEqualsTypeRule -# it doesn't make sense to implement IEquality on unsealed classes -T: Java.Interop.JavaException -T: Java.Interop.JavaObject - - -R: Gendarme.Rules.Performance.PreferLiteralOverInitOnlyFieldsRule -# Warning is about e.g. JavaObject.InvalidJniObjectReference -# InvalidJniObjectReference *must* be a field, not a literal, so that we can use `ref *InvalidJniObjectReference`. -T: Java.Interop.JavaException -T: Java.Interop.JavaObject - -R: Gendarme.Rules.Performance.UseStringEmptyRule -# these are compiler generated -M: System.String <>__AnonType0`2::ToString() -M: System.String <>__AnonType1`2::ToString() - -R: Gendarme.Rules.Exceptions.DoNotThrowInUnexpectedLocationRule -# throwing ArgumentOutOfRangeException is OK according to the documentation https://msdn.microsoft.com/library/system.collections.ilist.item(v=vs.110).aspx -M: T Java.Interop.JavaObjectArray`1::get_Item(System.Int32) -# we want these to check for disposed state, throwing ObjectDisposedException is better and not much different than suggested InvalidOperationException -M: System.Boolean& Java.Interop.JniBooleanArrayElements::get_Item(System.Int32) -M: System.SByte& Java.Interop.JniSByteArrayElements::get_Item(System.Int32) -M: System.Char& Java.Interop.JniCharArrayElements::get_Item(System.Int32) -M: System.Int16& Java.Interop.JniInt16ArrayElements::get_Item(System.Int32) -M: System.Int32& Java.Interop.JniInt32ArrayElements::get_Item(System.Int32) -M: System.Int64& Java.Interop.JniInt64ArrayElements::get_Item(System.Int32) -M: System.Single& Java.Interop.JniSingleArrayElements::get_Item(System.Int32) -M: System.Double& Java.Interop.JniDoubleArrayElements::get_Item(System.Int32) -# we want to check for disposed state here -M: System.IntPtr Java.Interop.JniArrayElements::get_Elements() -M: System.Int32 Java.Interop.JniArrayElements::get_Size() diff --git a/src/Java.Interop/.editorconfig b/src/Java.Interop/.editorconfig new file mode 100644 index 000000000..9b1e7d8fe --- /dev/null +++ b/src/Java.Interop/.editorconfig @@ -0,0 +1,158 @@ +# This files sets all rules from Gendarme as Code Analysis errors +# via: https://github.com/spouliot/gendarme/wiki/GendarmeToFxCop(git) + +[*.cs] +dotnet_diagnostic.CA2001.severity = error +dotnet_diagnostic.CA2214.severity = error +dotnet_diagnostic.CA2222.severity = error +dotnet_diagnostic.CA1065.severity = error +dotnet_diagnostic.CA1041.severity = error +dotnet_diagnostic.CA2230.severity = error +dotnet_diagnostic.CA2006.severity = error +dotnet_diagnostic.CA2002.severity = error +dotnet_diagnostic.CA2211.severity = error +dotnet_diagnostic.CA2243.severity = error +dotnet_diagnostic.CA1053.severity = error +# dotnet_diagnostic.CA1062.severity = error CheckParametersNullityInVisibleMethodsRule - We'll use NRT instead +dotnet_diagnostic.CA2213.severity = error +dotnet_diagnostic.CA2242.severity = error +dotnet_diagnostic.CA2000.severity = error +dotnet_diagnostic.CA2220.severity = error +dotnet_diagnostic.CA1822.severity = error +dotnet_diagnostic.CA2241.severity = error +dotnet_diagnostic.CA1012.severity = error +dotnet_diagnostic.CA1019.severity = error +dotnet_diagnostic.CA1040.severity = error +dotnet_diagnostic.CA1023.severity = error +dotnet_diagnostic.CA1044.severity = error +dotnet_diagnostic.CA1021.severity = error +dotnet_diagnostic.CA1045.severity = error +dotnet_diagnostic.CA1020.severity = error +dotnet_diagnostic.CA1051.severity = error +dotnet_diagnostic.CA1034.severity = error +dotnet_diagnostic.CA1024.severity = error +dotnet_diagnostic.CA1052.severity = error +dotnet_diagnostic.CA1009.severity = error +dotnet_diagnostic.CA2216.severity = error +dotnet_diagnostic.CA1047.severity = error +dotnet_diagnostic.CA2227.severity = error +dotnet_diagnostic.CA1048.severity = error +dotnet_diagnostic.CA2226.severity = error +dotnet_diagnostic.CA1038.severity = error +dotnet_diagnostic.CA1008.severity = error +dotnet_diagnostic.CA1028.severity = error +dotnet_diagnostic.CA2221.severity = error +dotnet_diagnostic.CA2218.severity = error +dotnet_diagnostic.CA1036.severity = error +dotnet_diagnostic.CA1039.severity = error +dotnet_diagnostic.CA1016.severity = error +dotnet_diagnostic.CA1014.severity = error +dotnet_diagnostic.CA1017.severity = error +dotnet_diagnostic.CA1018.severity = error +dotnet_diagnostic.CA1013.severity = error +dotnet_diagnostic.CA2231.severity = error +dotnet_diagnostic.CA2224.severity = error +dotnet_diagnostic.CA1030.severity = error +dotnet_diagnostic.CA1043.severity = error +dotnet_diagnostic.CA1054.severity = error +dotnet_diagnostic.CA1055.severity = error +dotnet_diagnostic.CA1056.severity = error +dotnet_diagnostic.CA1059.severity = error +dotnet_diagnostic.CA2225.severity = error +dotnet_diagnostic.CA1035.severity = error +dotnet_diagnostic.CA1050.severity = error +dotnet_diagnostic.CA1001.severity = error +dotnet_diagnostic.CA1049.severity = error +dotnet_diagnostic.CA1027.severity = error +dotnet_diagnostic.CA1005.severity = error +dotnet_diagnostic.CA1004.severity = error +dotnet_diagnostic.CA1000.severity = error +dotnet_diagnostic.CA1002.severity = error +dotnet_diagnostic.CA1006.severity = error +dotnet_diagnostic.CA1010.severity = error +dotnet_diagnostic.CA1007.severity = error +dotnet_diagnostic.CA1003.severity = error +dotnet_diagnostic.CA2201.severity = error +dotnet_diagnostic.CA2200.severity = error +dotnet_diagnostic.CA1031.severity = error +dotnet_diagnostic.CA2219.severity = error +dotnet_diagnostic.CA1065.severity = error +dotnet_diagnostic.CA2201.severity = error +dotnet_diagnostic.CA1064.severity = error +dotnet_diagnostic.CA2208.severity = error +dotnet_diagnostic.CA1032.severity = error +dotnet_diagnostic.CA1060.severity = error +dotnet_diagnostic.CA1404.severity = error +dotnet_diagnostic.CA1414.severity = error +dotnet_diagnostic.CA2101.severity = error +dotnet_diagnostic.CA1401.severity = error +dotnet_diagnostic.CA2205.severity = error +dotnet_diagnostic.CA1403.severity = error +dotnet_diagnostic.CA1406.severity = error +dotnet_diagnostic.CA1413.severity = error +dotnet_diagnostic.CA1402.severity = error +dotnet_diagnostic.CA1407.severity = error +dotnet_diagnostic.CA1405.severity = error +dotnet_diagnostic.CA1409.severity = error +dotnet_diagnostic.CA1408.severity = error +dotnet_diagnostic.CA1412.severity = error +dotnet_diagnostic.CA1410.severity = error +dotnet_diagnostic.CA1411.severity = error +dotnet_diagnostic.CA1502.severity = error +dotnet_diagnostic.CA1501.severity = error +dotnet_diagnostic.CA1011.severity = error +dotnet_diagnostic.CA1504.severity = error +dotnet_diagnostic.CA1500.severity = error +dotnet_diagnostic.CA1707.severity = error +dotnet_diagnostic.CA1724.severity = error +dotnet_diagnostic.CA1713.severity = error +dotnet_diagnostic.CA1712.severity = error +dotnet_diagnostic.CA1700.severity = error +dotnet_diagnostic.CA1725.severity = error +dotnet_diagnostic.CA1709.severity = error +dotnet_diagnostic.CA1715.severity = error +dotnet_diagnostic.CA1722.severity = error +dotnet_diagnostic.CA1710.severity = error +dotnet_diagnostic.CA1711.severity = error +dotnet_diagnostic.CA1714.severity = error +dotnet_diagnostic.CA1726.severity = error +dotnet_diagnostic.CA1809.severity = error +dotnet_diagnostic.CA1800.severity = error +dotnet_diagnostic.CA1819.severity = error +dotnet_diagnostic.CA1811.severity = error +dotnet_diagnostic.CA1812.severity = error +dotnet_diagnostic.CA1805.severity = error +dotnet_diagnostic.CA1813.severity = error +dotnet_diagnostic.CA1801.severity = error +dotnet_diagnostic.CA1823.severity = error +dotnet_diagnostic.CA1820.severity = error +dotnet_diagnostic.CA1806.severity = error +dotnet_diagnostic.CA1815.severity = error +dotnet_diagnostic.CA1802.severity = error +dotnet_diagnostic.CA1821.severity = error +dotnet_diagnostic.CA1804.severity = error +dotnet_diagnostic.CA2105.severity = error +dotnet_diagnostic.CA2111.severity = error +dotnet_diagnostic.CA2121.severity = error +dotnet_diagnostic.CA2126.severity = error +dotnet_diagnostic.CA2112.severity = error +dotnet_diagnostic.CA2122.severity = error +dotnet_diagnostic.CA2114.severity = error +dotnet_diagnostic.CA2118.severity = error +dotnet_diagnostic.CA2236.severity = error +dotnet_diagnostic.CA2239.severity = error +dotnet_diagnostic.CA2240.severity = error +dotnet_diagnostic.CA2235.severity = error +dotnet_diagnostic.CA2237.severity = error +dotnet_diagnostic.CA2229.severity = error +dotnet_diagnostic.CA2238.severity = error +dotnet_diagnostic.CA2232.severity = error + +# Disable some default Code Analysis warnings we aren't interested in +dotnet_diagnostic.CA1033.severity = none # Interface methods should be callable by child types +dotnet_diagnostic.CA1062.severity = none # Validate arguments of public methods (we'll use nullable reference types instead) +dotnet_diagnostic.CA1063.severity = none # Implement IDisposable correctly +dotnet_diagnostic.CA1303.severity = none # Do not pass literals as localized parameters +dotnet_diagnostic.CA1305.severity = none # Specify IFormatProvider +dotnet_diagnostic.CA1810.severity = none # Initialize reference type static fields inline +dotnet_diagnostic.CA1816.severity = none # Call GC.SuppressFinalize correctly diff --git a/src/Java.Interop/GlobalSuppressions.cs b/src/Java.Interop/GlobalSuppressions.cs new file mode 100644 index 000000000..2d9b410c6 --- /dev/null +++ b/src/Java.Interop/GlobalSuppressions.cs @@ -0,0 +1,85 @@ +using System.Diagnostics.CodeAnalysis; + +// This file is used by Code Analysis to maintain SuppressMessage +// attributes that are applied to this project. +// Project-level suppressions either have no target or are given +// a specific target and scoped to a namespace, type, member, etc. +[assembly: SuppressMessage ("Design", "CA1001:Types that own disposable fields should be disposable", Justification = "JniEnvironmentInfo.Runtime is IDisposable, but JniRuntime will dispose JniEnvironmentInfo.", Scope = "type", Target = "~T:Java.Interop.JniPeerMembers.JniInstanceMethods")] + +[assembly: SuppressMessage ("Design", "CA1008:Enums should have zero value", Justification = "No thanks", Scope = "type", Target = "~T:Java.Interop.JniVersion")] + +[assembly: SuppressMessage ("Design", "CA1030:Use events where appropriate", Justification = "This isn't 'raising' an event; it's 'raising' a pending exception within the JVM.", Scope = "member", Target = "~M:Java.Interop.JniRuntime.RaisePendingException(System.Exception)")] + +[assembly: SuppressMessage ("Design", "CA1024:Use properties where appropriate", Justification = "", Scope = "member", Target = "~M:Java.Interop.JniRuntime.GetRegisteredRuntimes()")] + +[assembly: SuppressMessage ("Design", "CA1032:Implement standard exception constructors", Justification = "System.Runtime.Serialization.SerializationInfo doesn't exist in our targeted PCL profile, so we can't provide the (SerializationInfo, StreamingContext) constructor.", Scope = "type", Target = "~T:Java.Interop.JavaProxyThrowable")] +[assembly: SuppressMessage ("Design", "CA1032:Implement standard exception constructors", Justification = "System.Runtime.Serialization.SerializationInfo doesn't exist in our targeted PCL profile, so we can't provide the (SerializationInfo, StreamingContext) constructor.", Scope = "type", Target = "~T:Java.Interop.JniLocationException")] + +// See: 045b8af7, 6a42bb89, f60906cf, e10f7cb0, etc. +[assembly: SuppressMessage ("Design", "CA1034:Nested types should not be visible", Justification = "Deliberate choice to 'hide' these types from code completion for `Java.Interop.`.", Scope = "type", Target = "~T:Java.Interop.JniEnvironment.Exceptions")] +[assembly: SuppressMessage ("Design", "CA1034:Nested types should not be visible", Justification = "Deliberate choice to 'hide' these types from code completion for `Java.Interop.`.", Scope = "type", Target = "~T:Java.Interop.JniPeerMembers.JniStaticMethods")] +[assembly: SuppressMessage ("Design", "CA1034:Nested types should not be visible", Justification = "Deliberate choice to 'hide' these types from code completion for `Java.Interop.`.", Scope = "type", Target = "~T:Java.Interop.JniRuntime.JniMarshalMemberBuilder")] +[assembly: SuppressMessage ("Design", "CA1034:Nested types should not be visible", Justification = "Deliberate choice to 'hide' these types from code completion for `Java.Interop.`.", Scope = "type", Target = "~T:Java.Interop.JniPeerMembers.JniStaticFields")] +[assembly: SuppressMessage ("Design", "CA1034:Nested types should not be visible", Justification = "Deliberate choice to 'hide' these types from code completion for `Java.Interop.`.", Scope = "type", Target = "~T:Java.Interop.JniRuntime.JniValueManager")] +[assembly: SuppressMessage ("Design", "CA1034:Nested types should not be visible", Justification = "Deliberate choice to 'hide' these types from code completion for `Java.Interop.`.", Scope = "type", Target = "~T:Java.Interop.JniEnvironment.References")] +[assembly: SuppressMessage ("Design", "CA1034:Nested types should not be visible", Justification = "Deliberate choice to 'hide' these types from code completion for `Java.Interop.`.", Scope = "type", Target = "~T:Java.Interop.JniRuntime.JniTypeManager")] +[assembly: SuppressMessage ("Design", "CA1034:Nested types should not be visible", Justification = "Deliberate choice to 'hide' these types from code completion for `Java.Interop.`.", Scope = "type", Target = "~T:Java.Interop.JniPeerMembers.JniInstanceMethods")] +[assembly: SuppressMessage ("Design", "CA1034:Nested types should not be visible", Justification = "Deliberate choice to 'hide' these types from code completion for `Java.Interop.`.", Scope = "type", Target = "~T:Java.Interop.JniPeerMembers.JniInstanceFields")] +[assembly: SuppressMessage ("Design", "CA1034:Nested types should not be visible", Justification = "Deliberate choice to 'hide' these types from code completion for `Java.Interop.`.", Scope = "type", Target = "~T:Java.Interop.JniRuntime.CreationOptions")] +[assembly: SuppressMessage ("Design", "CA1034:Nested types should not be visible", Justification = "Deliberate choice to 'hide' these types from code completion for `Java.Interop.`.", Scope = "type", Target = "~T:Java.Interop.JniRuntime.JniObjectReferenceManager")] +[assembly: SuppressMessage ("Design", "CA1034:Nested types should not be visible", Justification = "Deliberate choice to 'hide' these types from code completion for `Java.Interop.`.", Scope = "type", Target = "~T:Java.Interop.JniEnvironment.Monitors")] +[assembly: SuppressMessage ("Design", "CA1034:Nested types should not be visible", Justification = "Deliberate choice to 'hide' these types from code completion for `Java.Interop.`.", Scope = "type", Target = "~T:Java.Interop.JniEnvironment.Object")] +[assembly: SuppressMessage ("Design", "CA1034:Nested types should not be visible", Justification = "Deliberate choice to 'hide' these types from code completion for `Java.Interop.`.", Scope = "type", Target = "~T:Java.Interop.JniEnvironment.Strings")] +[assembly: SuppressMessage ("Design", "CA1034:Nested types should not be visible", Justification = "Deliberate choice to 'hide' these types from code completion for `Java.Interop.`.", Scope = "type", Target = "~T:Java.Interop.JniEnvironment.Types")] + +[assembly: SuppressMessage ("Design", "CA1051:Do not declare visible instance fields", Justification = "This type is passed to native code, and should use fields, not properties.", Scope = "member", Target = "~F:Java.Interop.JniNativeMethodRegistration.Name")] +[assembly: SuppressMessage ("Design", "CA1051:Do not declare visible instance fields", Justification = "This type is passed to native code, and should use fields, not properties.", Scope = "member", Target = "~F:Java.Interop.JniNativeMethodRegistration.Signature")] +[assembly: SuppressMessage ("Design", "CA1051:Do not declare visible instance fields", Justification = "This type is passed to native code, and should use fields, not properties.", Scope = "member", Target = "~F:Java.Interop.JniNativeMethodRegistration.Marshaler")] + +[assembly: SuppressMessage ("Design", "CA1064:Exceptions should be public", Justification = "", Scope = "type", Target = "~T:Java.Interop.JniLocationException")] + +[assembly: SuppressMessage ("Naming", "CA1707:Identifiers should not contain underscores", Justification = "", Scope = "type", Target = "~T:Java.Interop.JniVersion")] +[assembly: SuppressMessage ("Naming", "CA1707:Identifiers should not contain underscores", Justification = "", Scope = "member", Target = "~P:Java.Interop.JniRuntime.CreationOptions.ClassLoader_LoadClass_id")] + +[assembly: SuppressMessage ("Naming", "CA1710:Identifiers should have correct suffix", Justification = "These represent Java arrays, not collections", Scope = "type", Target = "~T:Java.Interop.JavaObjectArray`1")] +[assembly: SuppressMessage ("Naming", "CA1710:Identifiers should have correct suffix", Justification = "These represent Java arrays, not collections", Scope = "type", Target = "~T:Java.Interop.JavaArray`1")] +[assembly: SuppressMessage ("Naming", "CA1710:Identifiers should have correct suffix", Justification = "These represent Java arrays, not collections", Scope = "type", Target = "~T:Java.Interop.JavaPrimitiveArray`1")] +[assembly: SuppressMessage ("Naming", "CA1710:Identifiers should have correct suffix", Justification = "These represent Java arrays, not collections", Scope = "type", Target = "~T:Java.Interop.JavaBooleanArray")] +[assembly: SuppressMessage ("Naming", "CA1710:Identifiers should have correct suffix", Justification = "These represent Java arrays, not collections", Scope = "type", Target = "~T:Java.Interop.JavaSByteArray")] +[assembly: SuppressMessage ("Naming", "CA1710:Identifiers should have correct suffix", Justification = "These represent Java arrays, not collections", Scope = "type", Target = "~T:Java.Interop.JavaCharArray")] +[assembly: SuppressMessage ("Naming", "CA1710:Identifiers should have correct suffix", Justification = "These represent Java arrays, not collections", Scope = "type", Target = "~T:Java.Interop.JavaInt16Array")] +[assembly: SuppressMessage ("Naming", "CA1710:Identifiers should have correct suffix", Justification = "These represent Java arrays, not collections", Scope = "type", Target = "~T:Java.Interop.JavaInt32Array")] +[assembly: SuppressMessage ("Naming", "CA1710:Identifiers should have correct suffix", Justification = "These represent Java arrays, not collections", Scope = "type", Target = "~T:Java.Interop.JavaInt64Array")] +[assembly: SuppressMessage ("Naming", "CA1710:Identifiers should have correct suffix", Justification = "These represent Java arrays, not collections", Scope = "type", Target = "~T:Java.Interop.JavaSingleArray")] +[assembly: SuppressMessage ("Naming", "CA1710:Identifiers should have correct suffix", Justification = "These represent Java arrays, not collections", Scope = "type", Target = "~T:Java.Interop.JavaDoubleArray")] + +[assembly: SuppressMessage ("Naming", "CA1711:Identifiers should not have incorrect suffix", Justification = "Can't break API", Scope = "member", Target = "~M:Java.Interop.JniEnvironment.Exceptions.ThrowNew(Java.Interop.JniObjectReference,System.String)")] + +[assembly: SuppressMessage ("Naming", "CA1716:Identifiers should not match keywords", Justification = "'Object' is needed for 'Java.Lang.Object'", Scope = "type", Target = "~T:Java.Interop.JniEnvironment.Object")] + +[assembly: SuppressMessage ("Naming", "CA1720:Identifiers should not contain type names", Justification = "'Object' is needed for 'Java.Lang.Object'", Scope = "type", Target = "~T:Java.Interop.JniEnvironment.Object")] + +[assembly: SuppressMessage ("Usage", "CA1801:Review unused parameters", Justification = "Used in DEBUG configuration", Scope = "member", Target = "~M:Java.Interop.JniMethodInfo.#ctor(System.String,System.String,System.IntPtr,System.Boolean)")] +[assembly: SuppressMessage ("Usage", "CA1801:Review unused parameters", Justification = "Used in DEBUG configuration", Scope = "member", Target = "~M:Java.Interop.JniFieldInfo.#ctor(System.String,System.String,System.IntPtr,System.Boolean)")] + +[assembly: SuppressMessage ("Performance", "CA1813:Avoid unsealed attributes", Justification = "Can't break public API", Scope = "type", Target = "~T:Java.Interop.JniValueMarshalerAttribute")] + +[assembly: SuppressMessage ("Performance", "CA1815:Override equals and operator equals on value types", Justification = "", Scope = "type", Target = "~T:Java.Interop.JniNativeMethodRegistration")] +[assembly: SuppressMessage ("Performance", "CA1815:Override equals and operator equals on value types", Justification = "", Scope = "type", Target = "~T:Java.Interop.JniNativeMethodRegistrationArguments")] +[assembly: SuppressMessage ("Performance", "CA1815:Override equals and operator equals on value types", Justification = "", Scope = "type", Target = "~T:Java.Interop.JniTransition")] + +[assembly: SuppressMessage ("Performance", "CA1822:Mark members as static", Justification = "", Scope = "member", Target = "~M:Java.Interop.JniRuntime.JniMarshalMemberBuilder.IsDirectMethod(System.Reflection.ParameterInfo[])~System.Boolean")] +[assembly: SuppressMessage ("Performance", "CA1822:Mark members as static", Justification = "", Scope = "member", Target = "~M:Java.Interop.JniRuntime.JniValueManager.GetJniIdentityHashCode(Java.Interop.JniObjectReference)~System.Int32")] + +[assembly: SuppressMessage ("Performance", "CA1823:Avoid unused private fields", Justification = "Used for native interop", Scope = "type", Target = "~T:Java.Interop.JavaException")] +[assembly: SuppressMessage ("Performance", "CA1823:Avoid unused private fields", Justification = "Used for native interop", Scope = "type", Target = "~T:Java.Interop.JavaObject")] +[assembly: SuppressMessage ("Performance", "CA1823:Avoid unused private fields", Justification = "Used for native interop", Scope = "type", Target = "~T:Java.Interop.JniRuntime")] + +[assembly: SuppressMessage ("Reliability", "CA2000:Dispose objects before losing scope", Justification = "We don't *want* to dispose the value!", Scope = "member", Target = "~M:Java.Interop.JniEnvironment.Exceptions.Throw(System.Exception)")] +[assembly: SuppressMessage ("Reliability", "CA2000:Dispose objects before losing scope", Justification = "We don't *want* to dispose the value!", Scope = "member", Target = "~M:Java.Interop.JniRuntime.UnTrack(System.IntPtr)")] +[assembly: SuppressMessage ("Reliability", "CA2000:Dispose objects before losing scope", Justification = "We don't *want* to dispose the value!", Scope = "member", Target = "~M:Java.Interop.ProxyValueMarshaler.CreateGenericObjectReferenceArgumentState(System.Object,System.Reflection.ParameterAttributes)~Java.Interop.JniValueMarshalerState")] +[assembly: SuppressMessage ("Reliability", "CA2000:Dispose objects before losing scope", Justification = "We don't *want* to dispose the value!", Scope = "member", Target = "~M:Java.Interop.ManagedPeer.RegisterNativeMembers(System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr)")] +[assembly: SuppressMessage ("Reliability", "CA2000:Dispose objects before losing scope", Justification = "We don't *want* to dispose the value!", Scope = "member", Target = "~M:Java.Interop.JniRuntime.#ctor(Java.Interop.JniRuntime.CreationOptions)")] + +[assembly: SuppressMessage ("Usage", "CA2208:Instantiate argument exceptions correctly", Justification = "", Scope = "member", Target = "~M:Java.Interop.JniEnvironment.Exceptions.Throw(Java.Interop.JniObjectReference)")] +[assembly: SuppressMessage ("Usage", "CA2208:Instantiate argument exceptions correctly", Justification = "", Scope = "member", Target = "~M:Java.Interop.JniEnvironment.Exceptions.ThrowNew(Java.Interop.JniObjectReference,System.String)")] diff --git a/src/Java.Interop/Java.Interop.csproj b/src/Java.Interop/Java.Interop.csproj index 749e31bf5..f9a1771b4 100644 --- a/src/Java.Interop/Java.Interop.csproj +++ b/src/Java.Interop/Java.Interop.csproj @@ -60,6 +60,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + {6410DA0F-5E14-4FC0-9AEE-F4C542C96C7A} jnienv-gen diff --git a/src/Java.Interop/Java.Interop/JavaObjectArray.cs b/src/Java.Interop/Java.Interop/JavaObjectArray.cs index 65ff8646d..c0f2fffad 100644 --- a/src/Java.Interop/Java.Interop/JavaObjectArray.cs +++ b/src/Java.Interop/Java.Interop/JavaObjectArray.cs @@ -46,12 +46,12 @@ public JavaObjectArray (IEnumerable value) public override T this [int index] { get { if (index < 0 || index >= Length) - throw new ArgumentOutOfRangeException ("index", "index < 0 || index >= Length"); + throw new ArgumentOutOfRangeException (nameof (index), "index < 0 || index >= Length"); return GetElementAt (index); } set { if (index < 0 || index >= Length) - throw new ArgumentOutOfRangeException ("index", "index < 0 || index >= Length"); + throw new ArgumentOutOfRangeException (nameof (index), "index < 0 || index >= Length"); SetElementAt (index, value); } } @@ -109,7 +109,7 @@ public override int IndexOf (T item) public override void CopyTo (T[] array, int arrayIndex) { if (array == null) - throw new ArgumentNullException ("array"); + throw new ArgumentNullException (nameof (array)); CheckArrayCopy (0, Length, arrayIndex, array.Length, Length); CopyToList (array, arrayIndex); } diff --git a/src/Java.Interop/Java.Interop/JavaProxyObject.cs b/src/Java.Interop/Java.Interop/JavaProxyObject.cs index 0e3dcf72d..68cfbe6a5 100644 --- a/src/Java.Interop/Java.Interop/JavaProxyObject.cs +++ b/src/Java.Interop/Java.Interop/JavaProxyObject.cs @@ -28,7 +28,7 @@ public override JniPeerMembers JniPeerMembers { JavaProxyObject (object value) { if (value == null) - throw new ArgumentNullException ("value"); + throw new ArgumentNullException (nameof (value)); Value = value; } diff --git a/src/Java.Interop/Java.Interop/JavaProxyThrowable.cs b/src/Java.Interop/Java.Interop/JavaProxyThrowable.cs index b66113526..1680adb6a 100644 --- a/src/Java.Interop/Java.Interop/JavaProxyThrowable.cs +++ b/src/Java.Interop/Java.Interop/JavaProxyThrowable.cs @@ -18,7 +18,7 @@ public JavaProxyThrowable (Exception exception) static string GetMessage (Exception exception) { if (exception == null) - throw new ArgumentNullException ("exception"); + throw new ArgumentNullException (nameof (exception)); return exception.ToString (); } } diff --git a/src/Java.Interop/Java.Interop/JniArgumentValue.cs b/src/Java.Interop/Java.Interop/JniArgumentValue.cs index 6f6ee2fb5..86248e312 100644 --- a/src/Java.Interop/Java.Interop/JniArgumentValue.cs +++ b/src/Java.Interop/Java.Interop/JniArgumentValue.cs @@ -104,9 +104,9 @@ public override bool Equals (object obj) return Equals (o.Value); } - public bool Equals (JniArgumentValue value) + public bool Equals (JniArgumentValue other) { - return j == value.j; + return j == other.j; } public static bool operator==(JniArgumentValue lhs, JniArgumentValue rhs) diff --git a/src/Java.Interop/Java.Interop/JniEnvironment.Types.cs b/src/Java.Interop/Java.Interop/JniEnvironment.Types.cs index 40dfd3de1..292079054 100644 --- a/src/Java.Interop/Java.Interop/JniEnvironment.Types.cs +++ b/src/Java.Interop/Java.Interop/JniEnvironment.Types.cs @@ -31,7 +31,7 @@ static Types () public static unsafe JniObjectReference FindClass (string classname) { if (classname == null) - throw new ArgumentNullException ("classname"); + throw new ArgumentNullException (nameof (classname)); if (classname.Length == 0) throw new ArgumentException ("'classname' cannot be a zero-length string.", nameof (classname)); diff --git a/src/Java.Interop/Java.Interop/JniObjectReference.cs b/src/Java.Interop/Java.Interop/JniObjectReference.cs index 1a165924b..faf7fccd6 100644 --- a/src/Java.Interop/Java.Interop/JniObjectReference.cs +++ b/src/Java.Interop/Java.Interop/JniObjectReference.cs @@ -97,21 +97,21 @@ public override int GetHashCode () return Handle.GetHashCode (); } - public override bool Equals (object value) + public override bool Equals (object obj) { - var o = value as JniObjectReference?; + var o = obj as JniObjectReference?; if (o.HasValue) return Equals (o.Value); return false; } - public bool Equals (JniObjectReference value) + public bool Equals (JniObjectReference other) { #if FEATURE_JNIOBJECTREFERENCE_SAFEHANDLES - return object.ReferenceEquals (SafeHandle, value.SafeHandle); + return object.ReferenceEquals (SafeHandle, other.SafeHandle); #endif // FEATURE_JNIOBJECTREFERENCE_SAFEHANDLES #if FEATURE_JNIOBJECTREFERENCE_INTPTRS - return Handle == value.Handle; + return Handle == other.Handle; #endif // FEATURE_JNIOBJECTREFERENCE_INTPTRS } diff --git a/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods.cs b/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods.cs index 63b028ef1..c48204987 100644 --- a/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods.cs +++ b/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods.cs @@ -58,7 +58,7 @@ internal void Dispose () public JniMethodInfo GetConstructor (string signature) { if (signature == null) - throw new ArgumentNullException ("signature"); + throw new ArgumentNullException (nameof (signature)); lock (InstanceMethods) { JniMethodInfo m; if (!InstanceMethods.TryGetValue (signature, out m)) { diff --git a/src/Java.Interop/Java.Interop/JniPeerMembers.cs b/src/Java.Interop/Java.Interop/JniPeerMembers.cs index 50cf4dcf1..63cc330d9 100644 --- a/src/Java.Interop/Java.Interop/JniPeerMembers.cs +++ b/src/Java.Interop/Java.Interop/JniPeerMembers.cs @@ -18,9 +18,9 @@ public JniPeerMembers (string jniPeerTypeName, Type managedPeerType) : this (jniPeerTypeName, managedPeerType, checkManagedPeerType: true, isInterface: false) { if (managedPeerType == null) - throw new ArgumentNullException ("managedPeerType"); + throw new ArgumentNullException (nameof (managedPeerType)); if (!typeof (IJavaPeerable).GetTypeInfo ().IsAssignableFrom (managedPeerType.GetTypeInfo ())) - throw new ArgumentException ("'managedPeerType' must implement the IJavaPeerable interface.", "managedPeerType"); + throw new ArgumentException ("'managedPeerType' must implement the IJavaPeerable interface.", nameof (managedPeerType)); #if !XA_INTEGRATION Debug.Assert ( @@ -43,7 +43,7 @@ public JniPeerMembers (string jniPeerTypeName, Type managedPeerType) if (managedPeerType == null) throw new ArgumentNullException (nameof (managedPeerType)); if (!typeof (IJavaPeerable).GetTypeInfo ().IsAssignableFrom (managedPeerType.GetTypeInfo ())) - throw new ArgumentException ("'managedPeerType' must implement the IJavaPeerable interface.", "managedPeerType"); + throw new ArgumentException ("'managedPeerType' must implement the IJavaPeerable interface.", nameof (managedPeerType)); #if !XA_INTEGRATION Debug.Assert ( @@ -155,7 +155,7 @@ protected virtual JniPeerMembers GetPeerMembers (IJavaPeerable value) internal static void AssertSelf (IJavaPeerable self) { if (self == null) - throw new ArgumentNullException ("self"); + throw new ArgumentNullException (nameof (self)); var peer = self.PeerReference; if (!peer.IsValid) @@ -177,16 +177,16 @@ internal static void AssertSelf (IJavaPeerable self) internal static int GetSignatureSeparatorIndex (string encodedMember) { if (encodedMember == null) - throw new ArgumentNullException ("encodedMember"); + throw new ArgumentNullException (nameof (encodedMember)); int n = encodedMember.IndexOf ('.'); if (n < 0) throw new ArgumentException ( "Invalid encoding; 'encodedMember' should be encoded as \".\".", - "encodedMember"); + nameof (encodedMember)); if (encodedMember.Length <= (n+1)) throw new ArgumentException ( "Invalid encoding; 'encodedMember' is missing a JNI signature, and should be in the format \".\".", - "encodedMember"); + nameof (encodedMember)); return n; } diff --git a/src/Java.Interop/Java.Interop/JniRuntime.JniMarshalMemberBuilder.cs b/src/Java.Interop/Java.Interop/JniRuntime.JniMarshalMemberBuilder.cs index 95d72cc8c..cbd9eb6cc 100644 --- a/src/Java.Interop/Java.Interop/JniRuntime.JniMarshalMemberBuilder.cs +++ b/src/Java.Interop/Java.Interop/JniRuntime.JniMarshalMemberBuilder.cs @@ -23,6 +23,7 @@ public JniMarshalMemberBuilder MarshalMemberBuilder { } } + [System.Diagnostics.CodeAnalysis.SuppressMessage ("Design", "CA1031:Do not catch general exception types", Justification = "the *.Export assemblies are optional, so we don't care when they cannot be loaded (they are presumably missing)")] partial void SetMarshalMemberBuilder (CreationOptions options) { if (!options.UseMarshalMemberBuilder) { diff --git a/src/Java.Interop/Java.Interop/JniRuntime.JniObjectReferenceManager.cs b/src/Java.Interop/Java.Interop/JniRuntime.JniObjectReferenceManager.cs index 5679f993a..f3fa06b43 100644 --- a/src/Java.Interop/Java.Interop/JniRuntime.JniObjectReferenceManager.cs +++ b/src/Java.Interop/Java.Interop/JniRuntime.JniObjectReferenceManager.cs @@ -14,10 +14,6 @@ partial class JniRuntime { public abstract class JniObjectReferenceManager : IDisposable, ISetRuntime { - public JniObjectReferenceManager () - { - } - public JniRuntime Runtime { get; private set; } public virtual void OnSetRuntime (JniRuntime runtime) diff --git a/src/Java.Interop/Java.Interop/JniRuntime.JniTypeManager.cs b/src/Java.Interop/Java.Interop/JniRuntime.JniTypeManager.cs index 5017861ec..406bca9a7 100644 --- a/src/Java.Interop/Java.Interop/JniRuntime.JniTypeManager.cs +++ b/src/Java.Interop/Java.Interop/JniRuntime.JniTypeManager.cs @@ -51,9 +51,9 @@ public IEnumerable GetTypeSignatures (Type type) AssertValid (); if (type == null) - throw new ArgumentNullException ("type"); + throw new ArgumentNullException (nameof (type)); if (type.GetTypeInfo ().ContainsGenericParameters) - throw new ArgumentException ("Generic type definitions are not supported.", "type"); + throw new ArgumentException ("Generic type definitions are not supported.", nameof (type)); return CreateGetTypeSignaturesEnumerator (type); } @@ -64,7 +64,7 @@ IEnumerable CreateGetTypeSignaturesEnumerator (Type type) int rank = 0; while (type.IsArray) { if (type.IsArray && type.GetArrayRank () > 1) - throw new ArgumentException ("Multidimensional array '" + originalType.FullName + "' is not supported.", "type"); + throw new ArgumentException ("Multidimensional array '" + originalType.FullName + "' is not supported.", nameof (type)); rank++; type = type.GetElementType (); } @@ -125,14 +125,14 @@ protected virtual IEnumerable GetSimpleReferences (Type type) AssertValid (); if (type == null) - throw new ArgumentNullException ("type"); + throw new ArgumentNullException (nameof (type)); if (type.IsArray) - throw new ArgumentException ("Array type '" + type.FullName + "' is not supported.", "type"); + throw new ArgumentException ("Array type '" + type.FullName + "' is not supported.", nameof (type)); return EmptyStringArray; } - static readonly string[] EmptyStringArray = new string [0]; - static readonly Type[] EmptyTypeArray = new Type [0]; + static readonly string[] EmptyStringArray = Array.Empty (); + static readonly Type[] EmptyTypeArray = Array.Empty (); public Type GetType (JniTypeSignature typeSignature) diff --git a/src/Java.Interop/Java.Interop/JniRuntime.JniValueManager.cs b/src/Java.Interop/Java.Interop/JniRuntime.JniValueManager.cs index 70b2d2c84..0359ab3cf 100644 --- a/src/Java.Interop/Java.Interop/JniRuntime.JniValueManager.cs +++ b/src/Java.Interop/Java.Interop/JniRuntime.JniValueManager.cs @@ -261,7 +261,7 @@ public virtual IJavaPeerable CreatePeer (ref JniObjectReference reference, JniOb targetType = GetPeerType (targetType); if (!typeof (IJavaPeerable).GetTypeInfo ().IsAssignableFrom (targetType.GetTypeInfo ())) - throw new ArgumentException ($"targetType `{targetType.AssemblyQualifiedName}` must implement IJavaPeerable!", "targetType"); + throw new ArgumentException ($"targetType `{targetType.AssemblyQualifiedName}` must implement IJavaPeerable!", nameof (targetType)); var ctor = GetPeerConstructor (reference, targetType); if (ctor == null) @@ -485,10 +485,10 @@ public JniValueMarshaler GetValueMarshaler (Type type) throw new ObjectDisposedException (GetType ().Name); if (type == null) - throw new ArgumentNullException ("type"); + throw new ArgumentNullException (nameof (type)); var info = type.GetTypeInfo (); if (info.ContainsGenericParameters) - throw new ArgumentException ("Generic type definitions are not supported.", "type"); + throw new ArgumentException ("Generic type definitions are not supported.", nameof (type)); var marshalerAttr = info.GetCustomAttribute (); if (marshalerAttr != null) diff --git a/src/Java.Interop/Java.Interop/JniRuntime.cs b/src/Java.Interop/Java.Interop/JniRuntime.cs index fb903e07d..5d42c3ff4 100644 --- a/src/Java.Interop/Java.Interop/JniRuntime.cs +++ b/src/Java.Interop/Java.Interop/JniRuntime.cs @@ -155,7 +155,7 @@ public static JniRuntime CurrentRuntime { public static void SetCurrent (JniRuntime newCurrent) { if (newCurrent == null) - throw new ArgumentNullException ("newCurrent"); + throw new ArgumentNullException (nameof (newCurrent)); Runtimes.TryAdd (newCurrent.InvocationPointer, newCurrent); current = newCurrent; } @@ -178,9 +178,9 @@ public static void SetCurrent (JniRuntime newCurrent) protected JniRuntime (CreationOptions options) { if (options == null) - throw new ArgumentNullException ("options"); + throw new ArgumentNullException (nameof (options)); if (options.InvocationPointer == IntPtr.Zero) - throw new ArgumentException ("options.InvocationPointer is null", "options"); + throw new ArgumentException ("options.InvocationPointer is null", nameof (options)); TrackIDs = options.TrackIDs; DestroyRuntimeOnDispose = options.DestroyRuntimeOnDispose; diff --git a/src/Java.Interop/Java.Interop/JniType.cs b/src/Java.Interop/Java.Interop/JniType.cs index 35aa384fe..0ebcf7a76 100644 --- a/src/Java.Interop/Java.Interop/JniType.cs +++ b/src/Java.Interop/Java.Interop/JniType.cs @@ -116,9 +116,9 @@ public bool IsAssignableFrom (JniType c) AssertValid (); if (c == null) - throw new ArgumentNullException ("c"); + throw new ArgumentNullException (nameof (c)); if (!c.PeerReference.IsValid) - throw new ArgumentException ("'c' has an invalid handle.", "c"); + throw new ArgumentException ("'c' has an invalid handle.", nameof (c)); return JniEnvironment.Types.IsAssignableFrom (c.PeerReference, PeerReference); } @@ -140,7 +140,7 @@ public void RegisterNativeMethods (params JniNativeMethodRegistration[] methods) AssertValid (); if (methods == null) - throw new ArgumentNullException ("methods"); + throw new ArgumentNullException (nameof (methods)); JniEnvironment.Types.RegisterNatives (PeerReference, methods, checked ((int)methods.Length)); // Prevents method delegates from being GC'd so long as this type remains diff --git a/src/Java.Interop/Java.Interop/JniTypeSignature.cs b/src/Java.Interop/Java.Interop/JniTypeSignature.cs index ab3e3657b..b74a8423b 100644 --- a/src/Java.Interop/Java.Interop/JniTypeSignature.cs +++ b/src/Java.Interop/Java.Interop/JniTypeSignature.cs @@ -169,19 +169,19 @@ public override int GetHashCode () return QualifiedReference.GetHashCode (); } - public override bool Equals (object value) + public override bool Equals (object obj) { - var v = value as JniTypeSignature?; + var v = obj as JniTypeSignature?; if (v.HasValue) return Equals (v.Value); return false; } - public bool Equals (JniTypeSignature value) + public bool Equals (JniTypeSignature other) { - return IsKeyword == value.IsKeyword && - SimpleReference == value.SimpleReference && - ArrayRank == value.ArrayRank; + return IsKeyword == other.IsKeyword && + SimpleReference == other.SimpleReference && + ArrayRank == other.ArrayRank; } public override string ToString () diff --git a/src/Java.Interop/Java.Interop/JniTypeSignatureAttribute.cs b/src/Java.Interop/Java.Interop/JniTypeSignatureAttribute.cs index 7bb128013..676476f80 100644 --- a/src/Java.Interop/Java.Interop/JniTypeSignatureAttribute.cs +++ b/src/Java.Interop/Java.Interop/JniTypeSignatureAttribute.cs @@ -28,7 +28,7 @@ public int ArrayRank { get {return arrayRank; } set { if (value < 0) - throw new ArgumentException ("ArrayRank cannot be less than zero.", "value"); + throw new ArgumentException ("ArrayRank cannot be less than zero.", nameof (value)); arrayRank = value; } } diff --git a/src/Java.Interop/Java.Interop/JniValueMarshaler.cs b/src/Java.Interop/Java.Interop/JniValueMarshaler.cs index 71ac13de1..2d856dfd4 100644 --- a/src/Java.Interop/Java.Interop/JniValueMarshaler.cs +++ b/src/Java.Interop/Java.Interop/JniValueMarshaler.cs @@ -91,12 +91,12 @@ public override bool Equals (object obj) return Equals (o.Value); } - public bool Equals (JniValueMarshalerState value) + public bool Equals (JniValueMarshalerState other) { - return JniArgumentValue.Equals (value.JniArgumentValue) && - ReferenceValue.Equals (value.ReferenceValue) && - object.ReferenceEquals (PeerableValue, value.PeerableValue) && - object.ReferenceEquals (Extra, value.Extra); + return JniArgumentValue.Equals (other.JniArgumentValue) && + ReferenceValue.Equals (other.ReferenceValue) && + object.ReferenceEquals (PeerableValue, other.PeerableValue) && + object.ReferenceEquals (Extra, other.Extra); } public static bool operator == (JniValueMarshalerState a, JniValueMarshalerState b) => a.Equals (b); diff --git a/src/Java.Interop/Java.Interop/ManagedPeer.cs b/src/Java.Interop/Java.Interop/ManagedPeer.cs index 59a49f0fc..e754ebe27 100644 --- a/src/Java.Interop/Java.Interop/ManagedPeer.cs +++ b/src/Java.Interop/Java.Interop/ManagedPeer.cs @@ -152,7 +152,7 @@ static Exception CreateMissingConstructorException (Type type, Type[] ptypes) static Type[] GetParameterTypes (string signature) { if (string.IsNullOrEmpty (signature)) - return new Type[0]; + return Array.Empty (); var typeNames = signature.Split (':'); var ptypes = new Type [typeNames.Length]; for (int i = 0; i < typeNames.Length; i++)