@ -25,6 +25,7 @@ import jode.expr.Expression;
import jode.expr.ThisOperator ;
import jode.expr.ThisOperator ;
import jode.expr.LocalLoadOperator ;
import jode.expr.LocalLoadOperator ;
import jode.expr.ConstOperator ;
import jode.expr.ConstOperator ;
import jode.expr.OuterLocalOperator ;
public class FieldAnalyzer implements Analyzer {
public class FieldAnalyzer implements Analyzer {
ClassAnalyzer clazz ;
ClassAnalyzer clazz ;
@ -86,9 +87,14 @@ public class FieldAnalyzer implements Analyzer {
if ( isSynthetic & & isFinal ( )
if ( isSynthetic & & isFinal ( )
& & ( fieldName . startsWith ( "this$" )
& & ( fieldName . startsWith ( "this$" )
| | fieldName . startsWith ( "val$" ) ) )
| | fieldName . startsWith ( "val$" ) ) ) {
if ( fieldName . startsWith ( "val$" ) & & fieldName . length ( ) > 4
& & expr instanceof OuterLocalOperator ) {
LocalInfo li = ( ( OuterLocalOperator ) expr ) . getLocalInfo ( ) ;
li . addHint ( fieldName . substring ( 4 ) , type ) ;
}
analyzedSynthetic ( ) ;
analyzedSynthetic ( ) ;
else
} else
expr . makeInitializer ( ) ;
expr . makeInitializer ( ) ;
constant = expr ;
constant = expr ;
@ -108,6 +114,9 @@ public class FieldAnalyzer implements Analyzer {
public void analyze ( ) {
public void analyze ( ) {
imports . useType ( type ) ;
imports . useType ( type ) ;
}
public void makeDeclaration ( ) {
if ( constant ! = null )
if ( constant ! = null )
constant = constant . simplify ( ) ;
constant = constant . simplify ( ) ;
}
}
@ -126,7 +135,20 @@ public class FieldAnalyzer implements Analyzer {
}
}
if ( isSynthetic )
if ( isSynthetic )
writer . print ( "/*synthetic*/ " ) ;
writer . print ( "/*synthetic*/ " ) ;
String modif = Modifier . toString ( modifiers ) ;
int modifiedModifiers = modifiers ;
/ *
* JLS - 1 . 0 , section 9 . 3 :
*
* Every field declaration in the body of an interface is
* implicitly public , static , and final . It is permitted , but
* strongly discouraged as a matter of style , to redundantly
* specify any or all of these modifiers for such fields .
* /
if ( clazz . getClazz ( ) . isInterface ( ) )
modifiedModifiers & = ~ ( Modifier . PUBLIC
| Modifier . STATIC
| Modifier . FINAL ) ;
String modif = Modifier . toString ( modifiedModifiers ) ;
if ( modif . length ( ) > 0 )
if ( modif . length ( ) > 0 )
writer . print ( modif + " " ) ;
writer . print ( modif + " " ) ;