Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing static field Object to super class constructor #167

Closed
nhuttrung opened this issue Dec 6, 2015 · 0 comments
Closed

Passing static field Object to super class constructor #167

nhuttrung opened this issue Dec 6, 2015 · 0 comments
Assignees
Labels

Comments

@nhuttrung
Copy link

Simple test case:

public class MyTest {
  static class SuperClass {
    static final Integer ONE = new Integer(1);

    private Integer value;
    public SuperClass(Integer value){
      this.value = value;
    }

    public Integer getValue() {
      return value;
    }
  }

  static class SubClass extends SuperClass{
    SubClass(){
      super(ONE);
    }
  }

  @Test
  public void testPassingStaticFieldToSuperClassConstructor() throws Exception {
    SubClass obj = new SubClass();
    Assert.assertTrue(obj.getValue() != null);
  }
}

The output Javascript does not make a call to SuperClass_$clinit to initialize the static field ONE, thus ONE is still null and the test failed.

@konsoletyper konsoletyper self-assigned this Dec 8, 2015
konsoletyper added a commit that referenced this issue Dec 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants