Cleanup (formatting)

This commit is contained in:
Roman Shevchenko
2018-11-02 18:09:05 +01:00
parent e34cff38e3
commit 95b4898527
3 changed files with 47 additions and 85 deletions
@@ -1,9 +1,6 @@
// duplicate labels
import java.io.*;
public class a {
class DuplicateSwitchLabels {
final int FI = 4;
void f(final int i) {
@@ -24,43 +21,18 @@ public class a {
case FI - 8: break;
}
final byte b = 127;
switch(i) {
case <error descr="Duplicate label '127'">b</error>:
System.out.println("b=" + b + ";");
case <error descr="Duplicate label '127'">127</error>:
System.out.println("MySwitch.MySwitch");
}
// internalize strings
switch (0) {
case 0:
case "\410" == "!0" ? 1 : 0:
case ""==""+"" ? 3 : 0:
final byte b = 127;
switch (i) {
case <error descr="Duplicate label '127'">b</error>:
System.out.println("b=" + b + ";");
case <error descr="Duplicate label '127'">127</error>:
System.out.println("MySwitch.MySwitch");
}
switch (0) {
case 0:
//case 1./0 == Double.POSITIVE_INFINITY ? 1 : 0:
//case 1./0 == Float.POSITIVE_INFINITY ? 2 : 0:
// commented out ref
// does not work when running under JRE
//case -1./0 == Double.NEGATIVE_INFINITY ? 3 : 0:
//case -1./0 == Float.NEGATIVE_INFINITY ? 4 : 0:
//case Double.POSITIVE_INFINITY == Float.POSITIVE_INFINITY ? 5 : 0:
//case Double.NEGATIVE_INFINITY == Float.NEGATIVE_INFINITY ? 6 : 0:
//case Double.NaN != Float.NaN ? 7 : 0:
//case Integer.MIN_VALUE == -2.147483648e9 ? 8 : 0:
//case Integer.MIN_VALUE == -2.14748365e9f ? 9 : 0:
//case Long.MIN_VALUE == -9.223372036854776e18 ? 10 : 0:
//case Long.MIN_VALUE == -9.223372e18f ? 11 : 0:
}
switch (0) {
case 0:
case "\410" == "!0" ? 1 : 0:
case ""==""+"" ? 3 : 0:
}
}
}
@@ -1,29 +1,30 @@
// constant expressions in switch
import java.util.Date;
class a {
final int f = -3;
class ExpressionsInSwitch {
final int f = -3;
void f1() {
switch (0) {
case <error descr="Constant expression required">new Integer(0).MAX_VALUE</error>:
}
int k=0;
switch (0) {
case <error descr="Constant expression required">false ? k : 0</error>:
case <error descr="Constant expression required">true ? 1 : k</error>:
}
boolean b=true;
switch (0) {
case <error descr="Constant expression required">false && b ? 0 : 1</error>:
case <error descr="Constant expression required">true || b ? 2 : 0</error>:
}
final Object obj="";
switch (0) {
case <error descr="Constant expression required">obj=="" ? 0 : 0</error>:
case <error descr="Constant expression required">this.f</error>:
}
void f1() {
switch (0) {
case <error descr="Constant expression required">new Integer(0).MAX_VALUE</error>:
}
int k = 0;
switch (0) {
case <error descr="Constant expression required">false ? k : 0</error>:
case <error descr="Constant expression required">true ? 1 : k</error>:
}
boolean b = true;
switch (0) {
case <error descr="Constant expression required">false && b ? 0 : 1</error>:
case <error descr="Constant expression required">true || b ? 2 : 0</error>:
}
final Object obj = "";
switch (0) {
case <error descr="Constant expression required">obj=="" ? 0 : 0</error>:
case <error descr="Constant expression required">this.f</error>:
}
int i = 0;
final Integer I = null;
@@ -32,23 +33,22 @@ class a {
case <error descr="Constant expression required">I.MAX_VALUE</error>:
case Integer.MAX_VALUE:
}
}
}
static class b {
static final int c = 8;
}
static class b {
static final int c = 8;
}
void cf1() {
void cf1() {
final int i = 9;
switch (0) {
case i:
case 2+4:
case f:
case a.b.c:
case ExpressionsInSwitch.b.c:
}
switch (0) {
case true ^ true ? 0 : 0:
}
}
switch (0) {
case true ^ true ? 0 : 0:
}
}
}
@@ -1,6 +1,4 @@
// switch statement
class a {
class SwitchStatement {
void m() {
{
<error descr="Case statement outside switch">case 0:</error>
@@ -10,14 +8,6 @@ class a {
<error descr="Case statement outside switch">default:</error>
}
switch (0) {
case 0<error descr="':' expected">;</error>
}
switch (0) {
default<error descr="':' expected">;</error>
}
switch (0) {
////////////////
/** */