Giter Site home page Giter Site logo

Comments (3)

timtebeek avatar timtebeek commented on June 2, 2024

Hi! Thanks for the suggestion and offer to help. As a bit of context let me link you to how for instance the Maven plugin handles generated sources, as that might factor in here as well: https://github.com/openrewrite/rewrite-maven-plugin/blob/09fe6c413311aba7ae160bd4e6e8b38f1d41bad6/src/main/java/org/openrewrite/maven/MavenMojoProjectParser.java#L428-L433

You'll notice that generated sources get a org.openrewrite.marker.Generated marker attached to them, which then later excludes them from showing changes:

if (source.getMarkers().findFirst(Generated.class).isPresent()) {
// skip edits made to generated source files so that they don't show up in a diff
// that later fails to apply on a freshly cloned repository
return source;
}

if (original.getMarkers().findFirst(Generated.class).isPresent()) {
continue;
}

It appears we don't yet take javax.annotation.Generated into account, but I could see a point being made to also add our internal generated marker to classes annotated as generated. Would you want to help explore that option?

from rewrite.

blipper avatar blipper commented on June 2, 2024

That seems pretty straightforward. I assume you would want to use reflection to test or are you okay taking a dependency on the generated class directly?

from rewrite.

timtebeek avatar timtebeek commented on June 2, 2024

Great to hear; elsewhere we use FindAnnotations.find to find annotations on LST elements, with those dependencies only necessary on the projects themselves, not for the recipe development.

if (FindAnnotations.find(method, "@java.lang.Override").isEmpty()) {

from rewrite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.