@SuppressWarnings("unchecked")
    private void addPrivateFieldsAccessors(ClassNode node) {
        Set<ASTNode> accessedFields = (Set<ASTNode>) node.getNodeMetaData(StaticTypesMarker.PV_FIELDS_ACCESS);
        if (accessedFields==null) return;
        Map<String, MethodNode> privateConstantAccessors = (Map<String, MethodNode>) node.getNodeMetaData(PRIVATE_FIELDS_ACCESSORS);
        if (privateConstantAccessors!=null) {
            // already added
            return;
        }
        int acc = -1;
        privateConstantAccessors = new HashMap<String, MethodNode>();
        final int access = Opcodes.ACC_STATIC | Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC;
        for (FieldNode fieldNode : node.getFields()) {
            if (accessedFields.contains(fieldNode)) {

                acc++;
                Parameter param = new Parameter(node.getPlainNodeReference(), "$that");
                Expression receiver = fieldNode.isStatic()?new ClassExpression(node):new VariableExpression(param);
                Statement stmt = new ExpressionStatement(new PropertyExpression(
                        receiver,
                        fieldNode.getName()
                ));
                MethodNode accessor = node.addMethod("pfaccess$"+acc, access, fieldNode.getOriginType(), new Parameter[]{param}, ClassNode.EMPTY_ARRAY, stmt);
                privateConstantAccessors.put(fieldNode.getName(), accessor);
            }
        }
        node.setNodeMetaData(PRIVATE_FIELDS_ACCESSORS, privateConstantAccessors);
    }
@ SuppressWarnings ( "unchecked" ) private void addPrivateFieldsAccessors ( ClassNode node ) { Set < ASTNode > accessedFields = ( Set < ASTNode > ) node . getNodeMetaData ( StaticTypesMarker . PV_FIELDS_ACCESS ) ; if ( accessedFields == null ) return ; Map < String , MethodNode > privateConstantAccessors = ( Map < String , MethodNode > ) node . getNodeMetaData ( PRIVATE_FIELDS_ACCESSORS ) ; if ( privateConstantAccessors != null ) { return ; } int acc = - 1 ; privateConstantAccessors = new HashMap < String , MethodNode > ( ) ; final int access = Opcodes . ACC_STATIC | Opcodes . ACC_PUBLIC | Opcodes . ACC_SYNTHETIC ; for ( FieldNode fieldNode : node . getFields ( ) ) { if ( accessedFields . contains ( fieldNode ) ) { acc ++ ; Parameter param = new Parameter ( node . getPlainNodeReference ( ) , "$that" ) ; Expression receiver = fieldNode . isStatic ( ) ? new ClassExpression ( node ) : new VariableExpression ( param ) ; Statement stmt = new ExpressionStatement ( new PropertyExpression ( receiver , fieldNode . getName ( ) ) ) ; MethodNode accessor = node . addMethod ( "pfaccess$" + acc , access , fieldNode . getOriginType ( ) , new Parameter [ ] { param } , ClassNode . EMPTY_ARRAY , stmt ) ; privateConstantAccessors . put ( fieldNode . getName ( ) , accessor ) ; } } node . setNodeMetaData ( PRIVATE_FIELDS_ACCESSORS , privateConstantAccessors ) ; }
Adds special accessors for private constants so that inner classes can retrieve them.