Code Monkey home page Code Monkey logo

Comments (6)

gk5885 avatar gk5885 commented on June 21, 2024

That is very definitely a problem. I'm on it.

from auto.

cypressious avatar cypressious commented on June 21, 2024

A workaround is to explicitely state that the other factories don't need to implement any interface like this: @AutoFactory(implementing = {})

from auto.

adrian-chang avatar adrian-chang commented on June 21, 2024

@cypressious I don't think that's a work around...

If you have two classes like

home package
Person.java -> PersonFactoryImpl implements PersonFactory
Dog.java -> DogFactoryImpl implements DogFactory

The only way to fix the problem it is to move Person / Dog into separate packages if you need to use DI on each factory, pretty hacky work around in my opinion, not really scalable also if you need to generate a factory for each item in a package potentially.....

This really should be fixed ASAP, almost a blocking adoption of this library.

This also applies to extending = ...

from auto.

gjoseph avatar gjoseph commented on June 21, 2024

Hey, I don't know if this is strictly related, but I'm noticing that if I have 2 classes, in different packages, both using the same @AutoFactory(implementing = Foo.class), the second factory to be generated contains the interface's method twice. (and one of those has the signature of the other type)

from auto.

gjoseph avatar gjoseph commented on June 21, 2024

Eh, in fact, both generated factories have the problem. So it goes like this: in my sources:

package foo
public interface Foo {}
public interface FooFactory {
Foo heyDoMe();
}

package foo.bar
@AutoFactory(implementing = FooFactory.class)
public class Bar implements Foo {}

package foo.qux
@AutoFactory(implementing = FooFactory.class)
public class Qux implements Foo {}

Both resulting factories like this, both have these 2 methods, which makes the compiler rather unhappy obviously.

[...]
  @Override
  public foo.bar.Bar heyDoMe() {
    return create(p);
  }
  @Override
  public Qux heyDoMe() {
    return create(p);
  }

from auto.

busybeaver avatar busybeaver commented on June 21, 2024

Sorry for being impatient with an issue opened Feb 2014... but do we already know when this bug will be fixed (and a new version of autofactory will be published)?
This bug makes it autofactory practically unusable... creating for each factory with it's classes (which implements an interface) a separate package results in almost more time lost than saved due to the factory autogeneration.

from auto.

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.