Package cuchaz.enigma.mapping

Examples of cuchaz.enigma.mapping.ClassEntry


   
    // reconstruct inner classes
    new InnerClassWriter( m_jarIndex ).write( c );
   
    // re-get the javassist handle since we changed class names
    ClassEntry obfClassEntry = new ClassEntry( Descriptor.toJvmName( c.getName() ) );
    String javaClassReconstructedName = Descriptor.toJavaName( obfClassEntry.getName() );
    ClassPool classPool = new ClassPool();
    classPool.insertClassPath( new ByteArrayClassPath( javaClassReconstructedName, c.toBytecode() ) );
    c = classPool.get( javaClassReconstructedName );
   
    // check that the file is correct after inner class reconstruction (ie cause Javassist to fail fast if something is wrong)
View Full Code Here


      List<MethodEntry> methodInterfaces = Lists.newArrayList();
      for( String interfaceName : getInterfaces( obfMethodEntry.getClassName() ) )
      {
        // is this method defined in this interface?
        MethodEntry methodInterface = new MethodEntry(
          new ClassEntry( interfaceName ),
          obfMethodEntry.getName(),
          obfMethodEntry.getSignature()
        );
        if( containsObfBehavior( methodInterface ) )
        {
View Full Code Here

  }
 
  public String getOuterClass( String obfInnerClassName )
  {
    // make sure we use the right name
    if( new ClassEntry( obfInnerClassName ).getPackageName() != null )
    {
      throw new IllegalArgumentException( "Don't reference obfuscated inner classes using packages: " + obfInnerClassName );
    }
    return m_outerClasses.get( obfInnerClassName );
  }
View Full Code Here

 
  public String getNamableName( )
  {
    if( getNameableEntry() instanceof ClassEntry )
    {
      ClassEntry classEntry = (ClassEntry)getNameableEntry();
      if( classEntry.isInnerClass() )
      {
        // make sure we only rename the inner class name
        return classEntry.getInnerClassName();
      }
    }
   
    return getNameableEntry().getName();
  }
View Full Code Here

{
  @Override
  public Void visitTypeDeclaration( TypeDeclaration node, SourceIndex index )
  {
    TypeDefinition def = node.getUserData( Keys.TYPE_DEFINITION );
    ClassEntry classEntry = new ClassEntry( def.getInternalName() );
    index.addDeclaration( node.getNameToken(), classEntry );
   
    return node.acceptVisitor( new SourceIndexClassVisitor( classEntry ), index );
  }
View Full Code Here

    for( ClassEntry classEntry : JarClassIterator.getClassEntries( jar ) )
    {
      if( classEntry.isInDefaultPackage() )
      {
        // move out of default package
        classEntry = new ClassEntry( Constants.NonePackage + "/" + classEntry.getName() );
      }
      m_obfClassEntries.add( classEntry );
    }
   
    // step 2: index field/method/constructor access
    for( CtClass c : JarClassIterator.classes( jar ) )
    {
      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 ) );
      }
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" ) )
    {
      ClassEntry fieldTypeEntry = new ClassEntry( field.getSignature().substring( 1, field.getSignature().length() - 1 ) );
      m_fieldClasses.put( fieldEntry, fieldTypeEntry );
    }
  }
View Full Code Here

        @Override
        public void edit( MethodCall call )
        {
          String className = Descriptor.toJvmName( call.getClassName() );
          MethodEntry calledMethodEntry = new MethodEntry(
            new ClassEntry( className ),
            call.getMethodName(),
            call.getSignature()
          );
          ClassEntry resolvedClassEntry = resolveEntryClass( calledMethodEntry );
          if( resolvedClassEntry != null && !resolvedClassEntry.equals( calledMethodEntry.getClassEntry() ) )
          {
            calledMethodEntry = new MethodEntry(
              resolvedClassEntry,
              call.getMethodName(),
              call.getSignature()
            );
          }
          EntryReference<BehaviorEntry,BehaviorEntry> reference = new EntryReference<BehaviorEntry,BehaviorEntry>(
            calledMethodEntry,
            call.getMethodName(),
            behaviorEntry
          );
          m_behaviorReferences.put( calledMethodEntry, reference );
        }
       
        @Override
        public void edit( FieldAccess call )
        {
          String className = Descriptor.toJvmName( call.getClassName() );
          FieldEntry calledFieldEntry = new FieldEntry(
            new ClassEntry( className ),
            call.getFieldName()
          );
          ClassEntry resolvedClassEntry = resolveEntryClass( calledFieldEntry );
          if( resolvedClassEntry != null && !resolvedClassEntry.equals( calledFieldEntry.getClassEntry() ) )
          {
            calledFieldEntry = new FieldEntry(
              resolvedClassEntry,
              call.getFieldName()
            );
          }
          EntryReference<FieldEntry,BehaviorEntry> reference = new EntryReference<FieldEntry,BehaviorEntry>(
            calledFieldEntry,
            call.getFieldName(),
            behaviorEntry
          );
          m_fieldReferences.put( calledFieldEntry, reference );
        }
       
        @Override
        public void edit( ConstructorCall call )
        {
          String className = Descriptor.toJvmName( call.getClassName() );
          ConstructorEntry calledConstructorEntry = new ConstructorEntry(
            new ClassEntry( className ),
            call.getSignature()
          );
          EntryReference<BehaviorEntry,BehaviorEntry> reference = new EntryReference<BehaviorEntry,BehaviorEntry>(
            calledConstructorEntry,
            call.getMethodName(),
            behaviorEntry
          );
          m_behaviorReferences.put( calledConstructorEntry, reference );
        }
       
        @Override
        public void edit( NewExpr call )
        {
          String className = Descriptor.toJvmName( call.getClassName() );
          ConstructorEntry calledConstructorEntry = new ConstructorEntry(
            new ClassEntry( className ),
            call.getSignature()
          );
          EntryReference<BehaviorEntry,BehaviorEntry> reference = new EntryReference<BehaviorEntry,BehaviorEntry>(
            calledConstructorEntry,
            call.getClassName(),
View Full Code Here

        // we can't trace the implementation up any higher unless we index the library
        return null;
      }
     
      // move up to the parent class
      obfEntry = obfEntry.cloneToNewClass( new ClassEntry( superclassName ) );
    }
    return obfEntry.getClassEntry();
  }
View Full Code Here

      if( !isIllegalConstructor( syntheticFieldTypes, constructor ) )
      {
        continue;
      }
     
      ClassEntry classEntry = new ClassEntry( Descriptor.toJvmName( c.getName() ) );
      ConstructorEntry constructorEntry = new ConstructorEntry( classEntry, constructor.getMethodInfo().getDescriptor() );
     
      // gather the classes from the illegally-set synthetic fields
      Set<ClassEntry> illegallySetClasses = Sets.newHashSet();
      for( String type : syntheticFieldTypes )
      {
        if( type.startsWith( "L" ) )
        {
          ClassEntry outerClassEntry = new ClassEntry( type.substring( 1, type.length() - 1 ) );
          if( isSaneOuterClass( outerClassEntry, classEntry ) )
          {
            illegallySetClasses.add( outerClassEntry );
          }
        }
View Full Code Here

TOP

Related Classes of cuchaz.enigma.mapping.ClassEntry

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.