Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cease reading supertypes for java.lang #712

Merged
merged 2 commits into from
Oct 28, 2024
Merged

Conversation

SentryMan
Copy link
Collaborator

Currently, the processor adds the supertypes of java.lang classes as keys for wiring. When beans are supplied manually this can cause issues.

Given:

public enum State {
    ON, OFF
}

@Factory
public class Configuration {

    @Bean
    public State state() {
        return State.ON;
    }
}

Before:

  public static void build_state(Builder builder) {
    if (builder.isAddBeanFor(State.class, TYPE_EnumState, Constable.class, Comparable.class, Serializable.class)) {
      var factory = builder.get(Configuration.class);
      var bean = factory.state();
      builder.register(bean);
    }
  }

After:

  public static void build_state(Builder builder) {
    if (builder.isAddBeanFor(State.class)) {
      var factory = builder.get(Configuration.class);
      var bean = factory.state();
      builder.register(bean);
    }
  }

Fixes #710

@SentryMan SentryMan added the bug Something isn't working label Oct 27, 2024
@SentryMan SentryMan added this to the 10.5 milestone Oct 27, 2024
@SentryMan SentryMan self-assigned this Oct 27, 2024
@SentryMan SentryMan requested a review from rbygrave October 27, 2024 18:53
@rbygrave rbygrave merged commit 8544e40 into avaje:master Oct 28, 2024
7 checks passed
@SentryMan SentryMan deleted the fix-enum branch October 28, 2024 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A @Bean of Enum injection
2 participants