Coder Social home page Coder Social logo

isEnum method for JavaClass about archunit HOT 4 CLOSED

tng avatar tng commented on August 20, 2024
isEnum method for JavaClass

from archunit.

Comments (4)

codecholeric avatar codecholeric commented on August 20, 2024

Hey,

glad it helps you :-) I actually thought about this myself in the past, the reason it's not in, is simply, that I wanted to wait, if this is really relevant in daily life. Which you just proved it is ;-)
I think this should be part of JavaClass, so performance is better, and it's decoupled from the classpath.

A PR would be highly appreciated of course :-) In case it helps to get started, I think this would involve

  • Adding a test to ClassFileImporterTest
  • In JavaClassProcessor check the access parameter for org.objectweb.asm.Opcodes.ACC_ENUM (similar to Opcodes.ACC_INTERFACE, which is already checked)

I wonder, if it would make sense, to support List<JavaEnumConstant> getEnumConstants() as well (or List<String> getEnumConstants()?)...
What do you think?

from archunit.

storozhukBM avatar storozhukBM commented on August 20, 2024

I've made some simple changes in PR #6
As for getEnumConstants() I'm also not sure about it, currently I don't have such use case.

from archunit.

codecholeric avatar codecholeric commented on August 20, 2024

Thanks a lot, I've merged your PR :-) If you want to try the current 0.5.0-SNAPSHOT version with your changes, you can include the Sonatype snapshot repo

<repository>
    <id>sonatype-snapshots</id>
    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>

(note that there is a breaking change where @AnalyzeClasses(importOption = ...) became @AnalyzeClasses(importOptions = ...))

As for getEnumConstants(), guess I'll handle that like isEnum() and wait, if anybody ever really needs this feature.

Anyway, thanks for contributing, I'll close this issue.

from archunit.

storozhukBM avatar storozhukBM commented on August 20, 2024

Thank you too, @codecholeric.

from archunit.

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.