Skip to content

Commit

Permalink
8163229: several regression tests have a main method that is never ex…
Browse files Browse the repository at this point in the history
…ecuted

Reviewed-by: vromero
  • Loading branch information
archiecobbs authored and TheShermanTanker committed Jan 17, 2023
1 parent 06f9374 commit 382fe51
Show file tree
Hide file tree
Showing 129 changed files with 119 additions and 191 deletions.
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/4980495/static/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

public class Test {

public static void main(String argv[]) {
public static void meth() {
f = 1;
}
}
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/4980495/std/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

public class Test {

public static void main(String argv[]) {
public static void meth() {
new f();
}
}
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/6491592/T6491592.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

public class T6491592 {
public static void main(String... args) {
public static void meth() {
Object o = null;
o += null;
}
Expand Down
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/6857948/T6857948.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Foo {
};

class Test {
public static void main() {
public static void meth() {
Foo f = new Foo("Hello!",nosuchfunction()) {};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

public class UnresolvableClassNPEInAttrTest {
public static void main(String[] args) {
public static void meth() {
new Undefined() {
void test() {
new Object() {};
Expand Down
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/8161985/T8161985a.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

class T8161985 {
public static void main(String [] arg) {
public static void meth() {
T8161985 t = new T8161985();
t.getClass();

Expand Down
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/8238735/T8238735.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

class T8238735 {
public static void main(String[] args) {
public static void meth() {
boolean first = true;
first = first ? false : (boolean)(() -> false) ;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,4 @@ void foo() {
}
}); }
}

public static void main(String[] args) {
new JavacBug();
}
}
}
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/BreakAcrossClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

class BreakAcrossClass {
public static void main(String argv[]) {
public static void meth() {
final int i = 6;
M: {
class A {
Expand Down
10 changes: 0 additions & 10 deletions test/langtools/tools/javac/CaptureInSubtype.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,4 @@ public static class ShowFlaw extends SuperOfShowFlaw {

Flaw<?> m(){return fn;}
}

public static void main(String[] args) {
SuperOfShowFlaw sosf = new ShowFlaw();
SuperOfFlaw<List<?>> sof = sosf.m();
List<String> ls = new ArrayList<String>();
ls.add("Smalltalk rules!");
sof.put(ls);
Number n = ShowFlaw.fn.get().get(0);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

public class DASwitch {
public static void main(final String[] args) {
public static void meth() {
int t = 1;
{
final int x;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

public class DUParam1 {
public static void main(final String[] args) {
public static void meth(final String[] args) {
// 8.4.1 makes it illegal to assign to a final parameter.
if (false) args = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class E1 extends Exception {}
class E2 extends Exception {}

public class DefAssignAfterTry1 {
public static void main(String argv[]) {
public static void meth() {
boolean t = true;
E1 se1 = new E1();
E2 se2 = new E2();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class E1 extends Exception {}
class E2 extends Exception {}

public class DefAssignAfterTry2 {
public static void main(String argv[]) {
public static void meth() {
boolean t = true;
E1 se1 = new E1();
E2 se2 = new E2();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class E1 extends Exception {}
class E2 extends Exception {}

public class DefAssignAfterTry3 {
public static void main(String argv[]) {
public static void meth() {
boolean t = true;
E1 se1 = new E1();
E2 se2 = new E2();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

class T4717164 {
public static void main(String[] args) {
public static void meth() {
try {
try {
throw new ClassNotFoundException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ static class E extends Exception {}
static void thr() throws E {
throw new E();
}
public static void main(String[] args) {
public static void meth() {
int count = 0;
final int i;
while (true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

class T4718142a {
public static void main(String[] args) {
public static void meth() {
final int i;
for (int n=0; n<10; n++) {
b: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,4 @@ class B extends A implements I {
}

public class UncaughtException {
public static void main (String[] args) {
I b = new B();
b.throwCheckedException();
}
}
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/OverrideChecks/T4721069.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ static void f(I i) {
x.getClass();
}
}
public static void main(String[] args) {
public static void meth() {
f(null);
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/ParseConditional.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/

public class ParseConditional {
public static void main(String[] args) {
public static void meth() {
boolean condition = true;
int a = 1;
int b = 2;
Expand Down
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/SwitchScope.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

public class SwitchScope {
public static void main(String[] args) {
public static void meth(String[] args) {
switch (args.length) {
case 0:
final int k;
Expand Down
2 changes: 1 addition & 1 deletion test/langtools/tools/javac/SynthName2.java