Write protected keyword overriding java package protected function
This commit is contained in:
@@ -271,6 +271,9 @@ public abstract class OverrideImplementMethodsHandler implements LanguageCodeIns
|
|||||||
if (visibility == JavaDescriptorResolver.PACKAGE_VISIBILITY) {
|
if (visibility == JavaDescriptorResolver.PACKAGE_VISIBILITY) {
|
||||||
return "internal ";
|
return "internal ";
|
||||||
}
|
}
|
||||||
|
if (visibility == JavaDescriptorResolver.PROTECTED_AND_PACKAGE) {
|
||||||
|
return "protected ";
|
||||||
|
}
|
||||||
return visibility.toString() + " ";
|
return visibility.toString() + " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
import foo.Intf
|
||||||
|
|
||||||
|
class Impl(): Intf() {
|
||||||
|
<caret>
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
import foo.Intf
|
||||||
|
|
||||||
|
class Impl(): Intf() {
|
||||||
|
|
||||||
|
protected override fun getFooBar(): String? {
|
||||||
|
return super<Intf>.getFooBar()
|
||||||
|
}
|
||||||
|
}
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
package foo;
|
||||||
|
|
||||||
|
public class Intf {
|
||||||
|
protected String getFooBar() {
|
||||||
|
return "OK";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -142,6 +142,10 @@ public class OverrideImplementTest extends LightCodeInsightFixtureTestCase {
|
|||||||
doOverrideDirectoryTest("getFooBar");
|
doOverrideDirectoryTest("getFooBar");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testJavaMethodWithPackageProtectedVisibility() {
|
||||||
|
doOverrideDirectoryTest("getFooBar");
|
||||||
|
}
|
||||||
|
|
||||||
public void testInheritVisibilities() {
|
public void testInheritVisibilities() {
|
||||||
doMultiOverrideFileTest();
|
doMultiOverrideFileTest();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user