-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#850] Fix bug where
@Mixin
-annotated fields were not included in `…
…reflect-config.json` by `picocli-codegen` annotation processor.
- Loading branch information
Showing
9 changed files
with
309 additions
and
2 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
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
53 changes: 53 additions & 0 deletions
53
picocli-annotation-processing-tests/src/test/resources/picocli/issue850missingmixin/App.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,53 @@ | ||
package picocli.issue850missingmixin; | ||
|
||
import picocli.CommandLine; | ||
import picocli.CommandLine.Command; | ||
import picocli.CommandLine.Mixin; | ||
import picocli.CommandLine.Option; | ||
|
||
import java.util.concurrent.Callable; | ||
|
||
/** | ||
* The entry point to the application. | ||
*/ | ||
@Command( | ||
synopsisSubcommandLabel = "COMMAND", | ||
subcommands = { | ||
// ActivateBitbucketPipelinesCommand.class, | ||
// ActivateTravisCommand.class, | ||
// CreateCommand.class, | ||
// DeactivateBitbucketPipelinesCommand.class, | ||
// DeactivateTravisCommand.class, | ||
// DeleteCommand.class, | ||
// DownCommand.class, | ||
InitCommand.class, | ||
// ListCommand.class, | ||
// MergePullRequestsCommand.class, | ||
// UpCommand.class, | ||
// UpdateLicenseCommand.class | ||
} | ||
) | ||
public class App implements Callable<Integer> { | ||
|
||
@Command | ||
public int commandMethod(@Option(names = "-x") int x, @Mixin ProviderMixin pm) { | ||
return 0; | ||
} | ||
/** | ||
* Runs the application. | ||
* @param args Command line arguments. | ||
*/ | ||
public static void main(String[] args) { | ||
System.exit( | ||
new CommandLine(new App()) | ||
.setCaseInsensitiveEnumValuesAllowed(true) | ||
.execute(args) | ||
); | ||
} | ||
|
||
@Override | ||
public Integer call() { | ||
System.out.println("Missing sub-command"); | ||
return -1; | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...otation-processing-tests/src/test/resources/picocli/issue850missingmixin/InitCommand.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,60 @@ | ||
package picocli.issue850missingmixin; | ||
|
||
import picocli.CommandLine.Command; | ||
import picocli.CommandLine.Mixin; | ||
import picocli.CommandLine.Option; | ||
|
||
import java.util.concurrent.Callable; | ||
|
||
/** | ||
* Initializes an existing git repository. | ||
*/ | ||
@Command( | ||
name = "init", | ||
description = {"Initializes an existing git repository"} | ||
) | ||
class InitCommand implements Callable<Integer> { | ||
@Option( | ||
names = {"--name"}, | ||
required = true, | ||
description = {"The name of the repository"} | ||
) | ||
private String name; | ||
|
||
@Mixin | ||
private ProviderMixin providerMixin; | ||
|
||
@Option( | ||
names = {"--description"}, | ||
required = true, | ||
description = {"The description of the repository"} | ||
) | ||
private String description; | ||
|
||
@Option( | ||
names = {"--language"}, | ||
required = true, | ||
description = {"The language of the repository"} | ||
) | ||
private String language; | ||
|
||
@Option( | ||
names = {"--clone-dir"}, | ||
required = true, | ||
description = {"The directory in which the repository should be cloned"} | ||
) | ||
private String cloneDir; | ||
|
||
@Option( | ||
names = {"--travis-badge"}, | ||
required = false, | ||
description = {"Add the Travis badge in the README file"} | ||
) | ||
private boolean travisBadge; | ||
|
||
@Override | ||
public Integer call() { | ||
System.out.println("hello init"); | ||
return 0; | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
...ation-processing-tests/src/test/resources/picocli/issue850missingmixin/ProviderMixin.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,81 @@ | ||
package picocli.issue850missingmixin; | ||
|
||
import picocli.CommandLine.Option; | ||
|
||
/** | ||
* Reusable options related to a git provider. | ||
*/ | ||
public class ProviderMixin { | ||
@Option( | ||
names = {"--owner"}, | ||
required = true, | ||
description = {"The owner of the repository"} | ||
) | ||
private String owner; | ||
|
||
@Option( | ||
names = {"--username"}, | ||
required = true, | ||
description = {"The username to access the git provider API"} | ||
) | ||
private String username; | ||
|
||
@Option( | ||
names = {"--password"}, | ||
required = true, | ||
description = {"The password to access the git provider API"} | ||
) | ||
private String password; | ||
|
||
@Option( | ||
names = {"--provider"}, | ||
required = true, | ||
description = {"The provider of the git repository (${COMPLETION-CANDIDATES})"} | ||
) | ||
private GitProvider provider; | ||
|
||
public String getOwner() { | ||
return owner; | ||
} | ||
|
||
public void setOwner(String owner) { | ||
this.owner = owner; | ||
} | ||
|
||
public String getUsername() { | ||
return username; | ||
} | ||
|
||
public void setUsername(String username) { | ||
this.username = username; | ||
} | ||
|
||
public String getPassword() { | ||
return password; | ||
} | ||
|
||
public void setPassword(String password) { | ||
this.password = password; | ||
} | ||
|
||
public GitProvider getProvider() { | ||
return provider; | ||
} | ||
|
||
public void setProvider(GitProvider provider) { | ||
this.provider = provider; | ||
} | ||
|
||
static enum GitProvider { | ||
/** | ||
* GitHub. | ||
*/ | ||
GITHUB, | ||
|
||
/** | ||
* Bitbucket Cloud. | ||
*/ | ||
BITBUCKET | ||
} | ||
} | ||
|
61 changes: 61 additions & 0 deletions
61
...essing-tests/src/test/resources/picocli/issue850missingmixin/issue850-reflect-config.json
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,61 @@ | ||
[ | ||
{ | ||
"name" : "java.util.Collections$UnmodifiableRandomAccessList", | ||
"allDeclaredConstructors" : true, | ||
"allPublicConstructors" : true, | ||
"allDeclaredMethods" : true, | ||
"allPublicMethods" : true | ||
}, | ||
{ | ||
"name" : "picocli.issue850missingmixin.App", | ||
"allDeclaredConstructors" : true, | ||
"allPublicConstructors" : true, | ||
"allDeclaredMethods" : true, | ||
"allPublicMethods" : true, | ||
"methods" : [ | ||
{ "name" : "commandMethod", "parameterTypes" : ["int", "picocli.issue850missingmixin.ProviderMixin"] } | ||
] | ||
}, | ||
{ | ||
"name" : "picocli.issue850missingmixin.InitCommand", | ||
"allDeclaredConstructors" : true, | ||
"allPublicConstructors" : true, | ||
"allDeclaredMethods" : true, | ||
"allPublicMethods" : true, | ||
"fields" : [ | ||
{ "name" : "cloneDir" }, | ||
{ "name" : "description" }, | ||
{ "name" : "language" }, | ||
{ "name" : "name" }, | ||
{ "name" : "providerMixin" }, | ||
{ "name" : "travisBadge" } | ||
] | ||
}, | ||
{ | ||
"name" : "picocli.issue850missingmixin.ProviderMixin", | ||
"allDeclaredConstructors" : true, | ||
"allPublicConstructors" : true, | ||
"allDeclaredMethods" : true, | ||
"allPublicMethods" : true, | ||
"fields" : [ | ||
{ "name" : "owner" }, | ||
{ "name" : "password" }, | ||
{ "name" : "provider" }, | ||
{ "name" : "username" } | ||
] | ||
}, | ||
{ | ||
"name" : "picocli.issue850missingmixin.ProviderMixin$GitProvider", | ||
"allDeclaredConstructors" : true, | ||
"allPublicConstructors" : true, | ||
"allDeclaredMethods" : true, | ||
"allPublicMethods" : true | ||
}, | ||
{ | ||
"name" : "picocli.issue850missingmixin.ProviderMixin.GitProvider", | ||
"allDeclaredConstructors" : true, | ||
"allPublicConstructors" : true, | ||
"allDeclaredMethods" : true, | ||
"allPublicMethods" : true | ||
} | ||
] |
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
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
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