문제

I decompiled a DLL that originally came from J#. I see the following attributes that are absent from the original code:

[JavaFlags(0)]
public ToolBarButton toolBarButtonProg;

[JavaFlags(8)]
public static int lastClass;

I see that those JavaFlags are defined in the following J# namespace.

namespace com.ms.vjsharp.cor
{
  [AttributeUsage(AttributeTargets.All, AllowMultiple = false)]
  public class JavaFlags : Attribute
  {
    public int attr;

    public JavaFlags(int attr)
    {
      this.attr = attr;
    }
  }
}

But what is the purpose of these attributes?

도움이 되었습니까?

해결책

This attribute is likely added by the J# compiler to represent Java constructs which are not directly represented in the CLR. For example, there is no visibility modifier in the CLR which exactly mirrors the protected modifier in Java, so the compiler produces a method that is public in the CLR along with a [JavaFlags(4)] attribute so the J# compiler knows to treat the method as protected when compiling other Java code.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top