@@ -943,7 +943,7 @@ else if(instance != null && instance.hasJavaClass() && instance.getJavaClass() !
943943 if (c != null ) {
944944 return new StaticFieldExpr (line , column , c , munge (sym .name ), tag );
945945 } else
946- return new InstanceFieldExpr (line , column , instance , munge (sym .name ), tag );
946+ return new InstanceFieldExpr (line , column , instance , munge (sym .name ), tag , ((( Symbol ) RT . third ( form )). name . charAt ( 0 ) == '-' ) );
947947 }
948948 else
949949 {
@@ -1081,18 +1081,20 @@ static class InstanceFieldExpr extends FieldExpr implements AssignableExpr{
10811081 public final int line ;
10821082 public final int column ;
10831083 public final Symbol tag ;
1084- final static Method invokeNoArgInstanceMember = Method .getMethod ("Object invokeNoArgInstanceMember(Object,String)" );
1084+ public final boolean requireField ;
1085+ final static Method invokeNoArgInstanceMember = Method .getMethod ("Object invokeNoArgInstanceMember(Object,String,boolean)" );
10851086 final static Method setInstanceFieldMethod = Method .getMethod ("Object setInstanceField(Object,String,Object)" );
10861087
10871088
1088- public InstanceFieldExpr (int line , int column , Expr target , String fieldName , Symbol tag ) {
1089+ public InstanceFieldExpr (int line , int column , Expr target , String fieldName , Symbol tag , boolean requireField ) {
10891090 this .target = target ;
10901091 this .targetClass = target .hasJavaClass () ? target .getJavaClass () : null ;
10911092 this .field = targetClass != null ? Reflector .getField (targetClass , fieldName , false ) : null ;
10921093 this .fieldName = fieldName ;
10931094 this .line = line ;
10941095 this .column = column ;
10951096 this .tag = tag ;
1097+ this .requireField = requireField ;
10961098 if (field == null && RT .booleanCast (RT .WARN_ON_REFLECTION .deref ()))
10971099 {
10981100 if (targetClass == null )
@@ -1111,7 +1113,7 @@ public InstanceFieldExpr(int line, int column, Expr target, String fieldName, Sy
11111113 }
11121114
11131115 public Object eval () {
1114- return Reflector .invokeNoArgInstanceMember (target .eval (), fieldName );
1116+ return Reflector .invokeNoArgInstanceMember (target .eval (), fieldName , requireField );
11151117 }
11161118
11171119 public boolean canEmitPrimitive (){
@@ -1149,6 +1151,7 @@ public void emit(C context, ObjExpr objx, GeneratorAdapter gen){
11491151 {
11501152 target .emit (C .EXPRESSION , objx , gen );
11511153 gen .push (fieldName );
1154+ gen .push (requireField );
11521155 gen .invokeStatic (REFLECTOR_TYPE , invokeNoArgInstanceMember );
11531156 if (context == C .STATEMENT )
11541157 gen .pop ();
0 commit comments