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

Static builder method conflicts with record method in the EnchantmentActiveCheckLootCondition class #3867

Closed
haykam821 opened this issue May 12, 2024 · 0 comments · Fixed by #3878
Labels
bug Fixes or discusses a bug within the mappings

Comments

@haykam821
Copy link
Contributor

The EnchantmentActiveCheckLootCondition class contains an active record component of boolean type, which produces a method with the same name. In addition, this class contains a method mapped as active returning an instance of the LootCondition.Builder class. These methods cannot coexist, so one should be renamed.

To illustrate this issue, the method conflict can be reproduced with a simpler example. The following class does not compile:

public record TestClass(boolean active) {
	public static TestClass active() {
		return new TestClass(true);
	}
}

For example, javac will produce the following error:

TestClass.java:2: error: invalid accessor method in record TestClass
        public static TestClass active() {
                                ^
  (return type of accessor method active() must match the type of record component active)
@haykam821 haykam821 added the bug Fixes or discusses a bug within the mappings label May 12, 2024
@apple502j apple502j mentioned this issue May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes or discusses a bug within the mappings
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant