Skip to content

Performance issues with a large amount of @Singular annotations within one class #1474

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

Open
robeatoz opened this issue Sep 25, 2017 · 0 comments

Comments

@robeatoz
Copy link

robeatoz commented Sep 25, 2017

Hey guys,

first of all, I'm a big fan of lombok and use it in nearly every of mine private projects.
Unfortunately, I had dramatic performance issues while trying to edit a class with a large amount of @Singular annotations in Intellij Idea and the latest version of the lombok plugin.
I created a small example to demonstrate the problem:

import lombok.Builder;
import lombok.Singular;

import java.util.Collection;

@Builder
public class SingularPerformanceIssueDemo {

	@Singular
	private Collection<String> number_0_strings;

	@Singular
	private Collection<String> number_1_strings;

	@Singular
	private Collection<String> number_2_strings;

	@Singular
	private Collection<String> number_3_strings;

	@Singular
	private Collection<String> number_4_strings;

	@Singular
	private Collection<String> number_5_strings;

	@Singular
	private Collection<String> number_6_strings;

	@Singular
	private Collection<String> number_7_strings;

	@Singular
	private Collection<String> number_8_strings;

	@Singular
	private Collection<String> number_9_strings;

	@Singular
	private Collection<String> number_10_strings;

	@Singular
	private Collection<String> number_11_strings;

	@Singular
	private Collection<String> number_12_strings;

	@Singular
	private Collection<String> number_13_strings;

	@Singular
	private Collection<String> number_14_strings;

	@Singular
	private Collection<String> number_15_strings;

	@Singular
	private Collection<String> number_16_strings;

	@Singular
	private Collection<String> number_17_strings;

	@Singular
	private Collection<String> number_18_strings;

	@Singular
	private Collection<String> number_19_strings;

	public static void main(String[] args) {

		for (int i = 0; i < 20; i++) {

			System.out.println("\t@Singular\n" + "\tprivate Collection<String> number_" + i + "_strings;\n");
		}
	}
}

This is IMHO a bug and need to be fixed.
My current workaround for this problem is to annotate a constructor with @Builder and use Collections.immutableCollection(...) to support the needed feature of @Singular.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant