[lombok] Don't fail on fake overrides
#KT-47455 Fixes
This commit is contained in:
committed by
teamcityserver
parent
80b81934de
commit
c8fa8b0444
+3
-4
@@ -16,11 +16,10 @@ import org.jetbrains.kotlin.name.Name
|
|||||||
abstract class AbstractConstructorProcessor<A : ConstructorAnnotation> : Processor {
|
abstract class AbstractConstructorProcessor<A : ConstructorAnnotation> : Processor {
|
||||||
|
|
||||||
override fun contribute(classDescriptor: ClassDescriptor, partsBuilder: SyntheticPartsBuilder) {
|
override fun contribute(classDescriptor: ClassDescriptor, partsBuilder: SyntheticPartsBuilder) {
|
||||||
val valueParameters = getPropertiesForParameters(classDescriptor).map { property ->
|
|
||||||
LombokValueParameter(property.name, property.type)
|
|
||||||
}
|
|
||||||
|
|
||||||
getAnnotation(classDescriptor)?.let { annotation ->
|
getAnnotation(classDescriptor)?.let { annotation ->
|
||||||
|
val valueParameters = getPropertiesForParameters(classDescriptor).map { property ->
|
||||||
|
LombokValueParameter(property.name, property.type)
|
||||||
|
}
|
||||||
if (annotation.staticName == null) {
|
if (annotation.staticName == null) {
|
||||||
val constructor = classDescriptor.createJavaConstructor(
|
val constructor = classDescriptor.createJavaConstructor(
|
||||||
valueParameters = valueParameters,
|
valueParameters = valueParameters,
|
||||||
|
|||||||
+1
-1
@@ -24,7 +24,7 @@ class RequiredArgsConstructorProcessor : AbstractConstructorProcessor<RequiredAr
|
|||||||
classDescriptor.getJavaFields().filter(this::isFieldRequired)
|
classDescriptor.getJavaFields().filter(this::isFieldRequired)
|
||||||
|
|
||||||
private fun isFieldRequired(field: PropertyDescriptor): Boolean {
|
private fun isFieldRequired(field: PropertyDescriptor): Boolean {
|
||||||
val psi = field.source.getPsi()!! as PsiField
|
val psi = field.source.getPsi() as? PsiField ?: return false
|
||||||
|
|
||||||
val final = psi.modifierList?.hasModifierProperty(PsiModifier.FINAL) ?: false ||
|
val final = psi.modifierList?.hasModifierProperty(PsiModifier.FINAL) ?: false ||
|
||||||
field.annotations.any { annotation -> LombokNames.NON_NULL_ANNOTATIONS.contains(annotation.fqName) }
|
field.annotations.any { annotation -> LombokNames.NON_NULL_ANNOTATIONS.contains(annotation.fqName) }
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
//KT-47455
|
||||||
|
|
||||||
|
//FILE: ParentClass.java
|
||||||
|
public abstract class ParentClass {
|
||||||
|
int id;
|
||||||
|
}
|
||||||
|
|
||||||
|
//FILE: ChildClass.java
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ChildClass extends ParentClass {}
|
||||||
|
|
||||||
|
|
||||||
|
//FILE: test.kt
|
||||||
|
class Test {
|
||||||
|
fun run() {
|
||||||
|
ChildClass::class
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -129,6 +129,11 @@ public class LombokCompileTestGenerated extends AbstractLombokCompileTest {
|
|||||||
runTest("plugins/lombok/lombok-compiler-plugin/testData/compile/nullability.kt");
|
runTest("plugins/lombok/lombok-compiler-plugin/testData/compile/nullability.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("propertyFromSuper.kt")
|
||||||
|
public void testPropertyFromSuper() throws Exception {
|
||||||
|
runTest("plugins/lombok/lombok-compiler-plugin/testData/compile/propertyFromSuper.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("requiredArgsConstructor.kt")
|
@TestMetadata("requiredArgsConstructor.kt")
|
||||||
public void testRequiredArgsConstructor() throws Exception {
|
public void testRequiredArgsConstructor() throws Exception {
|
||||||
runTest("plugins/lombok/lombok-compiler-plugin/testData/compile/requiredArgsConstructor.kt");
|
runTest("plugins/lombok/lombok-compiler-plugin/testData/compile/requiredArgsConstructor.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user