-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix process EachProperty configurations with abstract class for KSP (#…
- Loading branch information
Showing
11 changed files
with
348 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...java/src/test/groovy/io/micronaut/inject/configproperties/inheritance/AbstractConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package io.micronaut.inject.configproperties.inheritance; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
public abstract class AbstractConfig { | ||
@NotNull | ||
private final String value; | ||
@NotNull | ||
private String notThing; | ||
|
||
public AbstractConfig(@NotNull String value) { | ||
this.value = value; | ||
this.notThing = "def notThing"; | ||
} | ||
|
||
@NotNull | ||
public final String getValue() { | ||
return this.value; | ||
} | ||
|
||
@NotNull | ||
public final String getNotThing() { | ||
return this.notThing; | ||
} | ||
|
||
public final void setNotThing(@NotNull String notThing) { | ||
this.notThing = notThing; | ||
} | ||
|
||
@NotNull | ||
public abstract String getThing(); | ||
} |
49 changes: 49 additions & 0 deletions
49
.../src/test/groovy/io/micronaut/inject/configproperties/inheritance/AbstractConfigImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package io.micronaut.inject.configproperties.inheritance; | ||
|
||
import io.micronaut.context.annotation.ConfigurationInject; | ||
import io.micronaut.context.annotation.EachProperty; | ||
import io.micronaut.context.annotation.Parameter; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
@EachProperty("teams") | ||
public class AbstractConfigImpl extends AbstractConfig { | ||
@NotNull | ||
private final String name; | ||
@Nullable | ||
private String childThing; | ||
@NotNull | ||
private String thing; | ||
|
||
@ConfigurationInject | ||
public AbstractConfigImpl(@Parameter("name") @NotNull String name, @NotNull String value) { | ||
super(value); | ||
this.name = name; | ||
this.childThing = "def childThing"; | ||
this.thing = "thing"; | ||
} | ||
|
||
@NotNull | ||
public final String getName() { | ||
return this.name; | ||
} | ||
|
||
@Nullable | ||
public final String getChildThing() { | ||
return this.childThing; | ||
} | ||
|
||
public final void setChildThing(@Nullable String childThing) { | ||
this.childThing = childThing; | ||
} | ||
|
||
@Override | ||
@NotNull | ||
public String getThing() { | ||
return this.thing; | ||
} | ||
|
||
public void setThing(@NotNull String thing) { | ||
this.thing = thing; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
...a/src/test/groovy/io/micronaut/inject/configproperties/inheritance/NotAbstractConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package io.micronaut.inject.configproperties.inheritance; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class NotAbstractConfig { | ||
@NotNull | ||
private final String value; | ||
@Nullable | ||
private String superValue; | ||
@Nullable | ||
private String superValueWithOverride; | ||
|
||
public NotAbstractConfig(@NotNull String value) { | ||
this.value = value; | ||
this.superValue = ""; | ||
this.superValueWithOverride = "this is "; | ||
} | ||
|
||
@NotNull | ||
public final String getValue() { | ||
return this.value; | ||
} | ||
|
||
@Nullable | ||
public final String getSuperValue() { | ||
return this.superValue; | ||
} | ||
|
||
public final void setSuperValue(@Nullable String var1) { | ||
this.superValue = var1; | ||
} | ||
|
||
@Nullable | ||
public String getSuperValueWithOverride() { | ||
return this.superValueWithOverride; | ||
} | ||
|
||
public void setSuperValueWithOverride(@Nullable String var1) { | ||
this.superValueWithOverride = var1; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
...c/test/groovy/io/micronaut/inject/configproperties/inheritance/NotAbstractConfigImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package io.micronaut.inject.configproperties.inheritance; | ||
|
||
import io.micronaut.context.annotation.ConfigurationInject; | ||
import io.micronaut.context.annotation.EachProperty; | ||
import io.micronaut.context.annotation.Parameter; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
@EachProperty("teams") | ||
public class NotAbstractConfigImpl extends NotAbstractConfig { | ||
@NotNull | ||
private final String name; | ||
@NotNull | ||
private final String thing; | ||
@Nullable | ||
private String childThing; | ||
@Nullable | ||
private String superValueWithOverride; | ||
|
||
@ConfigurationInject | ||
public NotAbstractConfigImpl(@Parameter("name") @NotNull String name, @NotNull String value, @NotNull String thing) { | ||
super(value); | ||
this.name = name; | ||
this.thing = thing; | ||
this.childThing = "def childThing"; | ||
this.superValueWithOverride = "my defaultValue"; | ||
} | ||
|
||
@NotNull | ||
public final String getName() { | ||
return this.name; | ||
} | ||
|
||
@NotNull | ||
public final String getThing() { | ||
return this.thing; | ||
} | ||
|
||
@Nullable | ||
public final String getChildThing() { | ||
return this.childThing; | ||
} | ||
|
||
public final void setChildThing(@Nullable String var1) { | ||
this.childThing = var1; | ||
} | ||
|
||
@Override | ||
@Nullable | ||
public String getSuperValueWithOverride() { | ||
return this.superValueWithOverride; | ||
} | ||
|
||
@Override | ||
public void setSuperValueWithOverride(@Nullable String var1) { | ||
this.superValueWithOverride = var1; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...otlin/io/micronaut/kotlin/processing/beans/configproperties/inheritance/AbstractConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package io.micronaut.kotlin.processing.beans.configproperties.inheritance | ||
|
||
abstract class AbstractConfig( | ||
val value: String = "" | ||
) { | ||
var notThing: String = "def notThing" | ||
abstract val thing: String | ||
} |
Oops, something went wrong.