[lombok] Support for class level @Getter
This commit is contained in:
committed by
TeamCityServer
parent
e4bd33eb4f
commit
5ceefa3e3b
@@ -0,0 +1,46 @@
|
|||||||
|
//FILE: ClassLevelGetterTest.java
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public class ClassLevelGetterTest {
|
||||||
|
private int age = 10;
|
||||||
|
|
||||||
|
@Getter(AccessLevel.PROTECTED) private String name;
|
||||||
|
|
||||||
|
private boolean primitiveBoolean;
|
||||||
|
|
||||||
|
private Boolean boxedBoolean;
|
||||||
|
|
||||||
|
void test() {
|
||||||
|
getAge();
|
||||||
|
isPrimitiveBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//FILE: test.kt
|
||||||
|
|
||||||
|
object Test {
|
||||||
|
fun usage() {
|
||||||
|
val obj = ClassLevelGetterTest()
|
||||||
|
val getter = obj.getAge()
|
||||||
|
val property = obj.age
|
||||||
|
|
||||||
|
obj.isPrimitiveBoolean()
|
||||||
|
|
||||||
|
obj.boxedBoolean
|
||||||
|
obj.getBoxedBoolean()
|
||||||
|
|
||||||
|
//shouldn't be accesible from here
|
||||||
|
// obj.getName()
|
||||||
|
}
|
||||||
|
|
||||||
|
class OverridenGetterTest : ClassLevelGetterTest() {
|
||||||
|
fun usage() {
|
||||||
|
getName()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -29,6 +29,11 @@ public class LombokCompileTestGenerated extends AbstractLombokCompileTest {
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/lombok/lombok-compiler-plugin/testData/compile"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/lombok/lombok-compiler-plugin/testData/compile"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("gettersClassLevel.kt")
|
||||||
|
public void testGettersClassLevel() throws Exception {
|
||||||
|
runTest("plugins/lombok/lombok-compiler-plugin/testData/compile/gettersClassLevel.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("gettersFluent.kt")
|
@TestMetadata("gettersFluent.kt")
|
||||||
public void testGettersFluent() throws Exception {
|
public void testGettersFluent() throws Exception {
|
||||||
runTest("plugins/lombok/lombok-compiler-plugin/testData/compile/gettersFluent.kt");
|
runTest("plugins/lombok/lombok-compiler-plugin/testData/compile/gettersFluent.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user