Skip to content

[25] ECJ reports a bogus "The final field t may already have been assigned" error #4585

@jarthana

Description

@jarthana

Given the code:

public class X {
	class TestClass<T extends Object> {
		T t;
		TestClass() {}

		TestClass(T v) {
			switch (0) {
				case 2:
					t = v;
					break;
			}
			this(); // Error here
		}
	}
}

Now, I don't know why the T t is considered to be final. But the question is, can the possible assignment inside one case make the flow analysis report this error?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions