Giter VIP home page Giter VIP logo

Comments (2)

timtebeek avatar timtebeek commented on September 25, 2024

Thanks for the helpful sample application @gtiwari333 ! Looks like we're indeed running up against this warning when processing the enum.

private void visitEnumField(@SuppressWarnings("unused") FieldNode fieldNode) {
// Requires refactoring visitClass to use a similar pattern as Java11ParserVisitor.
// Currently, each field is visited one at a time, so we cannot construct the EnumValueSet.
throw new UnsupportedOperationException("enum fields are not implemented.");
}

We can replicate this on a smaller scale by adding this test to

class AutoFormatVisitorTest implements RewriteTest {

@Test
@Issue("https://github.com/openrewrite/rewrite/issues/4252")
void skipEnum() {
    rewriteRun(
      groovy(
        """
          package com.example.demo

          enum Status {
              WaitingToBeProcessed,
              InProcess,
              Complete,
              Failed
          }
          """
      )
    );
}

from rewrite.

timtebeek avatar timtebeek commented on September 25, 2024

There's a hint in visitEnumField on how this could be achieved; you're welcome to give this a go if you'd like. It'd be kind of hard to fit in for me at this moment; we'd mostly added Groovy support for Gradle, such that enums or running autoformat there are rare, which is why you're only encountering this now.

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.