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

Bad redundant cast removal for @Nullable array #752

Open
ewillink opened this issue Feb 15, 2023 · 2 comments
Open

Bad redundant cast removal for @Nullable array #752

ewillink opened this issue Feb 15, 2023 · 2 comments

Comments

@ewillink
Copy link

ewillink commented Feb 15, 2023

Using Eclipse 4.25, the following code when saved by the JDT editor wth redundant cast removal active loses its cast and consequently acquires a compilation error.

package bug;

import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;

public class NonNullBug
{
	class InstanceClass
	{
		InstanceClass(@NonNull Object @NonNull [] boxedValues) {}
	}

	class FactoryClass
	{
		@SuppressWarnings("null")
		Object newInstance(@Nullable Object @NonNull [] boxedValues) {
			return new InstanceClass((@NonNull Object @NonNull [])boxedValues);
		}
	}
}

@iloveeclipse
Copy link
Member

I assume you use some specific project compilation settings, because I can't see compilation errors reported after save/cast removal. Please attach the sample project including all settings you have.

@ewillink
Copy link
Author

JavaBug.zip

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

2 participants