Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apt generator #3

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Apt generator #3

wants to merge 12 commits into from

Conversation

velo
Copy link
Owner

@velo velo commented Apr 22, 2019

No description provided.

* which can be passed to methods that accept TypeReference, or resolved using
* <code>TypeFactory</code> to obtain {@link ResolvedType}.
*/
public abstract class TypeReference<T> implements Comparable<TypeReference<T>> {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this need to be deleted

}

public static void main(String... args) {
final GitHub github = new GitHubFactory(config());
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example on how the generated code would be invoked

import feign.Target.HardCodedTarget;
import feign.example.github.GitHubExample.GitHub;

public class GitHubFactory implements GitHub {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once the generator is implemented, this is the code it would generate

@@ -32,6 +32,11 @@
</properties>

<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"provided" is declared on the parent pom

@SchulteMarkus
Copy link

Thanks for taking care, @velo !
I do not really figure out the important part in this pull request. You are introducing a new module "apt-generator". How would it be used?
As far as I understand, this PR encapsulates more than one relevant change. In my opinion, it should be split. For example, one PR only with the code cleanup (changes to import-statements, finals, visibility of methods, ...). Another PR with the changes to FeignConfig.builder() (if that is possible). Another PR with the relevant changes for the new module.
I am really thankful for your work, and I don't want to cause you more work, but I think it is important to focus in each PR on a specific task.

@velo
Copy link
Owner Author

velo commented May 7, 2019

@SchulteMarkus

"apt-generator". How would it be used?

once implemented (right now is just an example of what the generator would produce)
My plan is to have an APT generator that can be executed using maven, gradle, sbt or javac
https://www.baeldung.com/java-annotation-processing-builder

@velo
Copy link
Owner Author

velo commented May 8, 2019

BTW, can you help me on automating this to run using graal VM?

@SchulteMarkus
Copy link

Ok, I see.

I think, a staring point is to test, if GaalVM-compiler compiles this Java, too.

 feign (apt-generator)$ docker run --rm -v $(pwd):/feign oracle/graalvm-ce:1.0.0-rc16 \
  sh -c "(cd /feign && ./mvnw package -T1C -DskipTests)"

It seems to do so.

For testing, if GaalVM native-image generation actual works with feign as a dependency, we would have to have a concrete application with a Java main class. Hmm, I don't know where to start from here.
The actual build of a native-image should not be that complex, once we have a test application, see https://medium.com/graalvm/simplifying-native-image-generation-with-maven-plugin-and-embeddable-configuration-d5b283b92f57

@velo velo force-pushed the apt-generator branch 4 times, most recently from 4219edf to faaf2ac Compare June 20, 2019 20:56
@velo velo changed the base branch from feign-form to master June 30, 2019 09:26
@velo
Copy link
Owner Author

velo commented Jun 30, 2019

@SchulteMarkus seems this code generation approach would work on graal.

I still wanna get ride of TypeReference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants