mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8267670: Update java.io, java.math, and java.text to use switch expressions
Reviewed-by: darcy, chegar, naoto, iris, dfuchs, lancea, vtewari
This commit is contained in:
parent
f5634fe39d
commit
4eb216824f
11 changed files with 161 additions and 349 deletions
|
@ -110,19 +110,18 @@ public class ObjectStreamField
|
|||
this.unshared = unshared;
|
||||
this.field = null;
|
||||
|
||||
switch (signature.charAt(0)) {
|
||||
case 'Z': type = Boolean.TYPE; break;
|
||||
case 'B': type = Byte.TYPE; break;
|
||||
case 'C': type = Character.TYPE; break;
|
||||
case 'S': type = Short.TYPE; break;
|
||||
case 'I': type = Integer.TYPE; break;
|
||||
case 'J': type = Long.TYPE; break;
|
||||
case 'F': type = Float.TYPE; break;
|
||||
case 'D': type = Double.TYPE; break;
|
||||
case 'L':
|
||||
case '[': type = Object.class; break;
|
||||
default: throw new IllegalArgumentException("illegal signature");
|
||||
}
|
||||
type = switch (signature.charAt(0)) {
|
||||
case 'Z' -> Boolean.TYPE;
|
||||
case 'B' -> Byte.TYPE;
|
||||
case 'C' -> Character.TYPE;
|
||||
case 'S' -> Short.TYPE;
|
||||
case 'I' -> Integer.TYPE;
|
||||
case 'J' -> Long.TYPE;
|
||||
case 'F' -> Float.TYPE;
|
||||
case 'D' -> Double.TYPE;
|
||||
case 'L', '[' -> Object.class;
|
||||
default -> throw new IllegalArgumentException("illegal signature");
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue