ensure primitive names are zero-terminated in Class.getName

This commit is contained in:
Joel Dice 2009-08-28 16:17:23 -06:00
parent 4df81911fe
commit cd41751912

View File

@ -67,23 +67,23 @@ public final class Class <T> implements Type, GenericDeclaration {
if (name == null) { if (name == null) {
if ((vmFlags & PrimitiveFlag) != 0) { if ((vmFlags & PrimitiveFlag) != 0) {
if (this == primitiveClass('V')) { if (this == primitiveClass('V')) {
name = "void".getBytes(); name = "void\0".getBytes();
} else if (this == primitiveClass('Z')) { } else if (this == primitiveClass('Z')) {
name = "boolean".getBytes(); name = "boolean\0".getBytes();
} else if (this == primitiveClass('B')) { } else if (this == primitiveClass('B')) {
name = "byte".getBytes(); name = "byte\0".getBytes();
} else if (this == primitiveClass('C')) { } else if (this == primitiveClass('C')) {
name = "char".getBytes(); name = "char\0".getBytes();
} else if (this == primitiveClass('S')) { } else if (this == primitiveClass('S')) {
name = "short".getBytes(); name = "short\0".getBytes();
} else if (this == primitiveClass('I')) { } else if (this == primitiveClass('I')) {
name = "int".getBytes(); name = "int\0".getBytes();
} else if (this == primitiveClass('F')) { } else if (this == primitiveClass('F')) {
name = "float".getBytes(); name = "float\0".getBytes();
} else if (this == primitiveClass('J')) { } else if (this == primitiveClass('J')) {
name = "long".getBytes(); name = "long\0".getBytes();
} else if (this == primitiveClass('D')) { } else if (this == primitiveClass('D')) {
name = "double".getBytes(); name = "double\0".getBytes();
} else { } else {
throw new AssertionError(); throw new AssertionError();
} }