Synthetic fields parsed from classfile are not treated as synthetic

Issue #297 resolved
Jesper Öqvist
created an issue

ExtendJ 8.1.1 Java SE 6

ExtendJ allows synthetic fields like $assertionsDisabled to be accessed in source code. For example:

Bar.java:

public class Bar {
  public static void main(String[] a) {
    assert args.length > 0;
  }
}

Test.java:

public class Test {
  public static void main(String[] a) {
    System.out.println(Bar.$assertionsDisabled);
  }
}

The interesting case happens if Bar.java is compiled first with JavaC (or ExtendJ), then Test.java is compiled with ExtendJ:

Σ 13:59:25 ~/git/regression-tests $ javac -version                                                                                                                                                                                                            
javac 1.6.0_41
Σ 13:59:31 ~/git/regression-tests $ javac Bar.java                                                                                                                                                                                                            
Σ 13:59:33 ~/git/regression-tests $ java -jar extendj.jar Test.java
Σ 13:59:37 ~/git/regression-tests $ java Test
true

Expected: ExtendJ should fail to compile Test.java.

Actual: ExtendJ does not complain about Test.java if Bar.java is compiled separately before compiling Test.java with ExtendJ.

Comments (3)

  1. Log in to comment