Git Product home page Git Product logo

Comments (8)

Zidane avatar Zidane commented on May 25, 2024

Honestly, this seems like the best way to approach this.

from mixin.

Mumfrey avatar Mumfrey commented on May 25, 2024

Since it's the one outstanding issue but nobody's commented, I was thinking of just either going ahead with this plan or just closing the issue until an actual use-case appeared and I got bugged into adding something like this anyway.

The two choices for implementation basically are:

  • Add an extra array of strings to the @Mixin annotation
  • Add an alternate version of @Mixin (eg. @PrivateMixin) which is identical in every way but just takes strings instead of class references.

from mixin.

ryantheleach avatar ryantheleach commented on May 25, 2024

Would PrivateMixin error if a mixin could have been used instead?

from mixin.

Mumfrey avatar Mumfrey commented on May 25, 2024

That would make sense.

from mixin.

simon816 avatar simon816 commented on May 25, 2024

I think a String[] targets() would be fine here, unless private-class specific parameters are needed there's not much reason to use another annotation.

from mixin.

Mumfrey avatar Mumfrey commented on May 25, 2024

No particular reason, and programmatically it makes no odds either way, the complexity is pretty much exactly equal whether it's an extra property or an extra annotation.

Really it's just nicer that the value property is default if no other properties are specified and just leads to the slightly nicer

@PrivateMixin("some.target.Clazz")
public abstract class SomeClazzMixin {

versus

@Mixin(targets = "some.target.Clazz")
public abstract class SomeClazzMixin {

So there's that. Basically since annotation properties when being parsed with ASM or AP are all dynamic lookups anyway, it doesn't really make any odds either way since neither code will actually care what the actual annotation passed in is, as long as it has the relevant keys.

from mixin.

bloodmc avatar bloodmc commented on May 25, 2024

Lets go with option 2 for the sake of the users

@Mixin(targets = "some.target.Clazz")
public abstract class SomeClazzMixin {

from mixin.

Mumfrey avatar Mumfrey commented on May 25, 2024

Alrighty then!

from mixin.

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.