Better assertion messages in TypeParameterDescriptor
This commit is contained in:
+12
-9
@@ -95,25 +95,28 @@ public class TypeParameterDescriptor extends DeclarationDescriptorImpl implement
|
|||||||
upperBounds);
|
upperBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInitialized() {
|
|
||||||
if (initialized) {
|
|
||||||
throw new IllegalStateException();
|
|
||||||
}
|
|
||||||
initialized = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkInitialized() {
|
private void checkInitialized() {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException("Type parameter descriptor in not initialized: " + nameForAssertions());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkUninitialized() {
|
private void checkUninitialized() {
|
||||||
if (initialized) {
|
if (initialized) {
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException("Type parameter descriptor is already initialized: " + nameForAssertions());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String nameForAssertions() {
|
||||||
|
DeclarationDescriptor owner = getContainingDeclaration();
|
||||||
|
return getName() + " declared in " + (owner == null ? "<no owner>" : owner.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInitialized() {
|
||||||
|
checkUninitialized();
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isReified() {
|
public boolean isReified() {
|
||||||
checkInitialized();
|
checkInitialized();
|
||||||
return reified;
|
return reified;
|
||||||
|
|||||||
Reference in New Issue
Block a user