mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-generator] IDEA-363289 generate text from type directly, non-replace if the type is different
- add test (cherry picked from commit 35ce0439d2a7a7a815e346e7be70c8d5f9fea96a) IJ-CR-149472 GitOrigin-RevId: ea285ba56b6dece1f2a8b3531ba6496cc53706b6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bf7c8f67cb
commit
7f3845bfea
@@ -399,6 +399,41 @@ public class GenerateGetterSetterTest extends LightJavaCodeInsightFixtureTestCas
|
||||
""");
|
||||
}
|
||||
|
||||
public void testPrimitivesWithTypeUseAnnotations() {
|
||||
myFixture.configureByText("a.java", """
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
class TestField {
|
||||
private @Anno int field<caret>;
|
||||
}
|
||||
|
||||
@Target(ElementType.TYPE_USE)
|
||||
@interface Anno {}
|
||||
""");
|
||||
generateGetter();
|
||||
generateSetter();
|
||||
myFixture.checkResult("""
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
class TestField {
|
||||
public void setField(int field) {
|
||||
this.field = field;
|
||||
}
|
||||
|
||||
public int getField() {
|
||||
return field;
|
||||
}
|
||||
|
||||
private @Anno int field;
|
||||
}
|
||||
|
||||
@Target(ElementType.TYPE_USE)
|
||||
@interface Anno {}
|
||||
""");
|
||||
}
|
||||
|
||||
public void testLombokGeneratedFieldsWithoutContainingFile() {
|
||||
ServiceContainerUtil.registerExtension(ApplicationManager.getApplication(), GenerateAccessorProviderRegistrar.EP_NAME,
|
||||
new NotNullFunction<PsiClass, Collection<EncapsulatableClassMember>>() {
|
||||
|
||||
Reference in New Issue
Block a user