Examples of ClassEntry


Examples of cuchaz.enigma.mapping.ClassEntry

  @Override
  public Void visitTypeDeclaration( TypeDeclaration node, SourceIndex index )
  {
    // is this this class, or a subtype?
    TypeDefinition def = node.getUserData( Keys.TYPE_DEFINITION );
    ClassEntry classEntry = new ClassEntry( def.getInternalName() );
    if( !classEntry.equals( m_classEntry ) )
    {
      // it's a sub-type, recurse
      index.addDeclaration( node.getNameToken(), classEntry );
      return node.acceptVisitor( new SourceIndexClassVisitor( classEntry ), index );
    }
View Full Code Here

Examples of cuchaz.enigma.mapping.ClassEntry

  public Void visitSimpleType( SimpleType node, SourceIndex index )
  {
    TypeReference ref = node.getUserData( Keys.TYPE_REFERENCE );
    if( node.getIdentifierToken().getStartLocation() != TextLocation.EMPTY )
    {
      ClassEntry classEntry = new ClassEntry( ref.getInternalName() );
      index.addReference( node.getIdentifierToken(), classEntry, m_classEntry );
    }
   
    return recurse( node, index );
  }
View Full Code Here

Examples of cuchaz.enigma.mapping.ClassEntry

 
  @Override
  public Void visitMethodDeclaration( MethodDeclaration node, SourceIndex index )
  {
    MethodDefinition def = node.getUserData( Keys.METHOD_DEFINITION );
    ClassEntry classEntry = new ClassEntry( def.getDeclaringType().getInternalName() );
    BehaviorEntry behaviorEntry = BehaviorEntryFactory.create( classEntry, def.getName(), def.getSignature() );
    AstNode tokenNode = node.getNameToken();
    if( behaviorEntry instanceof ConstructorEntry )
    {
      ConstructorEntry constructorEntry = (ConstructorEntry)behaviorEntry;
View Full Code Here

Examples of cuchaz.enigma.mapping.ClassEntry

 
  @Override
  public Void visitConstructorDeclaration( ConstructorDeclaration node, SourceIndex index )
  {
    MethodDefinition def = node.getUserData( Keys.METHOD_DEFINITION );
    ClassEntry classEntry = new ClassEntry( def.getDeclaringType().getInternalName() );
    ConstructorEntry constructorEntry = new ConstructorEntry( classEntry, def.getSignature() );
    index.addDeclaration( node.getNameToken(), constructorEntry );
    return node.acceptVisitor( new SourceIndexBehaviorVisitor( constructorEntry ), index );
  }
View Full Code Here

Examples of cuchaz.enigma.mapping.ClassEntry

 
  @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 );
   
View Full Code Here

Examples of cuchaz.enigma.mapping.ClassEntry

  @Override
  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

Examples of cuchaz.enigma.mapping.ClassEntry

    // pass 1: look for any classes that got moved to inner classes
    Map<String,String> renames = Maps.newHashMap();
    for( ClassMapping classMapping : val.classes() )
    {
      // make sure we strip the packages off of obfuscated inner classes
      String innerClassName = new ClassEntry( classMapping.getObfName() ).getSimpleName();
      String outerClassName = m_jarIndex.getOuterClass( innerClassName );
      if( outerClassName != null )
      {
        // build the composite class name
        String newName = outerClassName + "$" + innerClassName;
       
        // add a rename
        renames.put( classMapping.getObfName(), newName );
       
        System.out.println( String.format( "Converted class mapping %s to %s", classMapping.getObfName(), newName ) );
      }
    }
    for( Map.Entry<String,String> entry : renames.entrySet() )
    {
      val.renameObfClass( entry.getKey(), entry.getValue() );
    }
   
    // pass 2: look for fields/methods that are actually declared in superclasses
    MappingsRenamer renamer = new MappingsRenamer( m_jarIndex, val );
    for( ClassMapping classMapping : val.classes() )
    {
      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 ) );
          }
          else
          {
            System.err.println( String.format( "WARNING: Would move field %s to class %s but the field was already there. Dropping instead.", fieldEntry, resolvedObfClassEntry ) );
          }
        }
      }
     
      // methods
      for( MethodMapping methodMapping : Lists.newArrayList( classMapping.methods() ) )
      {
        // skip constructors
        if( methodMapping.isConstructor() )
        {
          continue;
        }
       
        MethodEntry methodEntry = new MethodEntry( obfClassEntry, methodMapping.getObfName(), methodMapping.getObfSignature() );
        ClassEntry resolvedObfClassEntry = m_jarIndex.resolveEntryClass( methodEntry );
        if( resolvedObfClassEntry != null && !resolvedObfClassEntry.equals( methodEntry.getClassEntry() ) )
        {
          boolean wasMoved = renamer.moveMethodToObfClass( classMapping, methodMapping, resolvedObfClassEntry );
          if( wasMoved )
          {
            System.out.println( String.format( "Moved method %s to class %s", methodEntry, resolvedObfClassEntry ) );
View Full Code Here

Examples of cuchaz.enigma.mapping.ClassEntry

  }
 
  private void checkClassMapping( List<ClassEntry> unknownClasses, ClassMapping classMapping )
  {
    // check the class
    ClassEntry classEntry = new ClassEntry( classMapping.getObfName() );
    String outerClassName = m_jarIndex.getOuterClass( classEntry.getSimpleName() );
    if( outerClassName != null )
    {
      classEntry = new ClassEntry( outerClassName + "$" + classMapping.getObfName() );
    }
    if( !m_jarIndex.getObfClassEntries().contains( classEntry ) )
    {
      unknownClasses.add( classEntry );
    }
View Full Code Here

Examples of nginx.clojure.wave.MethodDatabase.ClassEntry

    }
    return ce;
  }
 
  public static ClassEntry buildClassEntryFamily(MethodDatabase db, String name) {
    ClassEntry ce = db.getClasses().get(name);
    if (ce == null) {
      CheckInstrumentationVisitor civ = db.checkClass(name);
      if (civ == null) {
        return null;
      }
View Full Code Here

Examples of nginx.clojure.wave.MethodDatabase.ClassEntry

    static byte[] instrumentClass(MethodDatabase db, byte[] data, boolean check) {
        ClassReader r = new ClassReader(data);
        ClassWriter cw = new DBClassWriter(db, r);
        ClassVisitor cv = check ? new CheckClassAdapter(cw) : cw;
        ClassEntry ce = MethodDatabaseUtil.buildClassEntryFamily(db, r);
        if(db.shouldIgnore(r.getClassName())) {
            return null;
        }
        db.trace("TRANSFORM: %s", r.getClassName());
        InstrumentClass ic = new InstrumentClass(r.getClassName(), ce, cv, db, false);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.