Skip to content

Commit

Permalink
Delete test cases that used to test non-JsConstructor extending JsCon…
Browse files Browse the repository at this point in the history
…structor

This likely dated back to GWT as the code has been updated to mark it with a
JsConstructor, despite the comment still stating that it isn't.

This ultimately duplicates another case and thus can simply be deleled.

PiperOrigin-RevId: 592572217
  • Loading branch information
kevinoconnor7 authored and copybara-github committed Dec 20, 2023
1 parent 80caec8 commit c50b1c4
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ public B(int x, int y) {
}
}

/**
* A regular class (no JsConstructor), which extends a JsConstructor class.
*/
/** A class with JsConstructor, which extends a JsConstructor class. */
public static class C extends B {
public int fC = 1;

Expand All @@ -71,48 +69,4 @@ public C(int x, int y) {
this.fC += 7;
}
}

/**
* A class with JsConstructor, which extends a JsConstructor class.
*/
public static class D extends B {
public int fD = 8;

@JsConstructor
public D() {
super(9); // must call super(int), cannot call super().
this.fD += 10;
}

public D(int x) {
this(); // must call this().
this.fD += x;
}
}

/**
* A regular class (no JsConstructor), which extends a subclass of a JsConstructor class.
*/
public static class E extends C {
public int fE = 11;

@JsConstructor
public E() {
super(10); // must call super(int), cannot call super(int, int).
this.fE += 12;
}
}

/**
* A JsConstructor class, which extends a subclass of a JsConstructor class.
*/
public static class F extends C {
public int fF = 13;

@JsConstructor
public F(int x) {
super(x + 2); // must call super(int), cannot call super(int, int).
this.fF += x + 3;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
import jsconstructor.JsConstructorClass.A;
import jsconstructor.JsConstructorClass.B;
import jsconstructor.JsConstructorClass.C;
import jsconstructor.JsConstructorClass.D;
import jsconstructor.JsConstructorClass.E;
import jsconstructor.JsConstructorClass.F;

public class Main {
public static void main(String... args) {
Expand All @@ -47,24 +44,6 @@ public static void main(String... args) {
assertEquals(61, c2.fA);
assertEquals(5, c2.fB);
assertEquals(14, c2.fC);
D d1 = new D();
assertEquals(10, d1.fA);
assertEquals(5, d1.fB);
assertEquals(18, d1.fD);
D d2 = new D(11);
assertEquals(10, d2.fA);
assertEquals(5, d2.fB);
assertEquals(29, d2.fD);
E e = new E();
assertEquals(21, e.fA);
assertEquals(5, e.fB);
assertEquals(7, e.fC);
assertEquals(23, e.fE);
F f = new F(12);
assertEquals(29, f.fA);
assertEquals(5, f.fB);
assertEquals(7, f.fC);
assertEquals(28, f.fF);

InstanceInitOrder.test();
StaticInitOrder.test();
Expand Down

0 comments on commit c50b1c4

Please sign in to comment.