Example #1
0
        public void HideInternalConstructor()
        {
            var klass = LoadClassFile("InternalConstructor.class");
            var ctor  = klass.Methods.First(m => m.Name == "<init>");

            Assert.True(ctor.AccessFlags.HasFlag(MethodAccessFlags.Public));

            KotlinFixups.Fixup(new [] { klass });

            Assert.False(ctor.AccessFlags.HasFlag(MethodAccessFlags.Public));

            var output = new XmlClassDeclarationBuilder(klass).ToXElement().ToString();

            Assert.True(output.Contains("visibility=\"kotlin-internal\""));
        }
Example #2
0
        public void HideInternalClass()
        {
            var klass       = LoadClassFile("InternalClass.class");
            var inner_class = klass.InnerClasses.First();

            Assert.True(klass.AccessFlags.HasFlag(ClassAccessFlags.Public));
            Assert.True(inner_class.InnerClassAccessFlags.HasFlag(ClassAccessFlags.Public));

            KotlinFixups.Fixup(new [] { klass });

            Assert.False(klass.AccessFlags.HasFlag(ClassAccessFlags.Public));
            Assert.False(inner_class.InnerClassAccessFlags.HasFlag(ClassAccessFlags.Public));

            var output = new XmlClassDeclarationBuilder(klass).ToXElement().ToString();

            Assert.True(output.Contains("visibility=\"private\""));
        }
Example #3
0
        public void HideInternalProperty()
        {
            var klass  = LoadClassFile("InternalProperty.class");
            var getter = klass.Methods.First(m => m.Name == "getCity$main");
            var setter = klass.Methods.First(m => m.Name == "setCity$main");

            Assert.True(getter.AccessFlags.HasFlag(MethodAccessFlags.Public));
            Assert.True(setter.AccessFlags.HasFlag(MethodAccessFlags.Public));

            KotlinFixups.Fixup(new [] { klass });

            Assert.False(getter.AccessFlags.HasFlag(MethodAccessFlags.Public));
            Assert.False(setter.AccessFlags.HasFlag(MethodAccessFlags.Public));

            var output = new XmlClassDeclarationBuilder(klass).ToXElement().ToString();

            Assert.True(output.Contains("visibility=\"kotlin-internal\""));
        }