Package cuchaz.enigma.mapping

Examples of cuchaz.enigma.mapping.FieldEntry


      {
        throw new Error( "Expected a field here! got " + ref );
      }
     
      ClassEntry classEntry = new ClassEntry( ref.getDeclaringType().getInternalName() );
      FieldEntry fieldEntry = new FieldEntry( classEntry, ref.getName() );
      index.addReference( node.getMemberNameToken(), fieldEntry, m_behaviorEntry );
    }
   
    return recurse( node, index );
  }
View Full Code Here


  {
    MemberReference ref = node.getUserData( Keys.MEMBER_REFERENCE );
    if( ref != null )
    {
      ClassEntry classEntry = new ClassEntry( ref.getDeclaringType().getInternalName() );
      FieldEntry fieldEntry = new FieldEntry( classEntry, ref.getName() );
      index.addReference( node.getIdentifierToken(), fieldEntry, m_behaviorEntry );
    }
   
    return recurse( node, index );
  }
View Full Code Here

  @Override
  public Void visitFieldDeclaration( FieldDeclaration node, SourceIndex index )
  {
    FieldDefinition def = node.getUserData( Keys.FIELD_DEFINITION );
    ClassEntry classEntry = new ClassEntry( def.getDeclaringType().getInternalName() );
    FieldEntry fieldEntry = new FieldEntry( classEntry, def.getName() );
    assert( node.getVariables().size() == 1 );
    VariableInitializer variable = node.getVariables().firstOrNullObject();
    index.addDeclaration( variable.getNameToken(), fieldEntry );
   
    return recurse( node, index );
View Full Code Here

  public Void visitEnumValueDeclaration( EnumValueDeclaration node, SourceIndex index )
  {
    // treat enum declarations as field declarations
    FieldDefinition def = node.getUserData( Keys.FIELD_DEFINITION );
    ClassEntry classEntry = new ClassEntry( def.getDeclaringType().getInternalName() );
    FieldEntry fieldEntry = new FieldEntry( classEntry, def.getName() );
    index.addDeclaration( node.getNameToken(), fieldEntry );
   
    return recurse( node, index );
  }
View Full Code Here

      ClassEntry obfClassEntry = new ClassEntry( classMapping.getObfName() );
     
      // fields
      for( FieldMapping fieldMapping : Lists.newArrayList( classMapping.fields() ) )
      {
        FieldEntry fieldEntry = new FieldEntry( obfClassEntry, fieldMapping.getObfName() );
        ClassEntry resolvedObfClassEntry = m_jarIndex.resolveEntryClass( fieldEntry );
        if( resolvedObfClassEntry != null && !resolvedObfClassEntry.equals( fieldEntry.getClassEntry() ) )
        {
          boolean wasMoved = renamer.moveFieldToObfClass( classMapping, fieldMapping, resolvedObfClassEntry );
          if( wasMoved )
          {
            System.out.println( String.format( "Moved field %s to class %s", fieldEntry, resolvedObfClassEntry ) );
View Full Code Here

    }
   
    // check the fields
    for( FieldMapping fieldMapping : Lists.newArrayList( classMapping.fields() ) )
    {
      FieldEntry fieldEntry = new FieldEntry( classEntry, fieldMapping.getObfName() );
      if( !m_jarIndex.containsObfField( fieldEntry ) )
      {
        System.err.println( "WARNING: unable to find field " + fieldEntry + ". dropping mapping." );
        classMapping.removeFieldMapping( fieldMapping );
      }
View Full Code Here

 
  @Test
  @SuppressWarnings( "unchecked" )
  public void fieldReferences( )
  {
    FieldEntry source = newField( "none/a", "a" );
    Collection<EntryReference<FieldEntry,BehaviorEntry>> references = m_index.getFieldReferences( source );
    assertThat( references, containsInAnyOrder(
      newFieldReferenceByConstructor( source, "none/a", "(Ljava/lang/String;)V" ),
      newFieldReferenceByMethod( source, "none/a", "a", "()Ljava/lang/String;" )
    ) );
View Full Code Here

    return new ClassEntry( name );
  }
 
  public static FieldEntry newField( String className, String fieldName )
  {
    return new FieldEntry( newClass( className ), fieldName );
  }
View Full Code Here

    {
      ClassRenamer.moveAllClassesOutOfDefaultPackage( c, Constants.NonePackage );
      ClassEntry classEntry = new ClassEntry( Descriptor.toJvmName( c.getName() ) );
      for( CtField field : c.getDeclaredFields() )
      {
        FieldEntry fieldEntry = new FieldEntry( classEntry, field.getName() );
        m_access.put( fieldEntry, Access.get( field ) );
      }
      for( CtMethod method : c.getDeclaredMethods() )
      {
        MethodEntry methodEntry = new MethodEntry( classEntry, method.getName(), method.getSignature() );
View Full Code Here

 
  private void indexField( CtField field )
  {
    // get the field entry
    String className = Descriptor.toJvmName( field.getDeclaringClass().getName() );
    FieldEntry fieldEntry = new FieldEntry( new ClassEntry( className ), field.getName() );
   
    m_translationIndex.addField( className, field.getName() );
   
    // is the field a class type?
    if( field.getSignature().startsWith( "L" ) )
View Full Code Here

TOP

Related Classes of cuchaz.enigma.mapping.FieldEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.