Skip to content

Commit eba35bd

Browse files
committed
[#1444] separate tests for compiling only the concrete subclass or both subclass and superclass
1 parent 6266598 commit eba35bd

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

picocli-annotation-processing-tests/src/test/java/picocli/annotation/processing/tests/Issue1444Test.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void testIssue1444() {
2929

3030
@Ignore
3131
@Test
32-
public void testGenerateReflectConfigIssue1444() {
32+
public void testGenerateReflectConfigIssue1444CompileOnlyConcreteSubclass() {
3333
NativeImageConfigGeneratorProcessor processor = new NativeImageConfigGeneratorProcessor();
3434
Compilation compilation =
3535
javac()
@@ -46,4 +46,24 @@ public void testGenerateReflectConfigIssue1444() {
4646
assertThat(compilation).hadWarningCount(0); // #826 version warnings are now suppressed
4747
}
4848

49+
@Test
50+
public void testGenerateReflectConfigIssue1444CompileBoth() {
51+
NativeImageConfigGeneratorProcessor processor = new NativeImageConfigGeneratorProcessor();
52+
Compilation compilation =
53+
javac()
54+
.withProcessors(processor)
55+
.withOptions("-A" + OPTION_PROJECT + "=issue1444super")
56+
.compile(JavaFileObjects.forSourceLines(
57+
"picocli.issue1444super.ConcreteCommand",
58+
slurp("/picocli/issue1444super/ConcreteCommand.java")),
59+
JavaFileObjects.forSourceLines(
60+
"picocli.issue1444super.AbstractCommand",
61+
slurp("/picocli/issue1444super/AbstractCommand.java"))//,
62+
);
63+
assertThat(compilation).succeeded();
64+
assertThat(compilation)
65+
.generatedFile(StandardLocation.CLASS_OUTPUT, "META-INF/native-image/picocli-generated/issue1444super/reflect-config.json")
66+
.contentsAsUtf8String().isEqualTo(slurp("/picocli/issue1444super/issue1444-reflect-config.json"));
67+
assertThat(compilation).hadWarningCount(0); // #826 version warnings are now suppressed
68+
}
4969
}

picocli-annotation-processing-tests/src/test/resources/picocli/issue1444super/AbstractCommand.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import picocli.CommandLine.Option;
66
import picocli.CommandLine.ArgGroup;
77

8+
//@Command
89
public abstract class AbstractCommand implements Runnable {
910
@ArgGroup(heading = "Optional login session name:%n", order = 1000)
1011
protected LoginSessionNameOptions loginSessionNameOptions;

0 commit comments

Comments
 (0)