~ubuntu-branches/ubuntu/wily/proguard/wily

« back to all changes in this revision

Viewing changes to src/proguard/obfuscate/MappingPrinter.java

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg
  • Date: 2014-04-10 13:58:11 UTC
  • mfrom: (1.2.5)
  • Revision ID: package-import@ubuntu.com-20140410135811-ddwzt2avu94rnolt
Tags: 4.11-1
* Team upload.
* New upstream release
* Removed the non-free documentation from the package (Closes: #719706)
* Removed the pre-built jars from the upstream tarball
* debian/control:
  - The package is now co-maintained with the Java Team
  - Standards-Version updated to 3.9.5 (no changes)
  - Added the Vcs-* fields
  - Added the Homepage field
* Switch to debhelper level 9
* Use XZ compression for the upstream tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * ProGuard -- shrinking, optimization, obfuscation, and preverification
3
3
 *             of Java bytecode.
4
4
 *
5
 
 * Copyright (c) 2002-2012 Eric Lafortune (eric@graphics.cornell.edu)
 
5
 * Copyright (c) 2002-2013 Eric Lafortune (eric@graphics.cornell.edu)
6
6
 *
7
7
 * This program is free software; you can redistribute it and/or modify it
8
8
 * under the terms of the GNU General Public License as published by the Free
21
21
package proguard.obfuscate;
22
22
 
23
23
import proguard.classfile.*;
 
24
import proguard.classfile.attribute.*;
 
25
import proguard.classfile.attribute.visitor.AttributeVisitor;
24
26
import proguard.classfile.util.*;
25
27
import proguard.classfile.visitor.*;
26
28
 
38
40
public class MappingPrinter
39
41
extends      SimplifiedVisitor
40
42
implements   ClassVisitor,
41
 
             MemberVisitor
 
43
             MemberVisitor,
 
44
             AttributeVisitor
42
45
{
43
46
    private final PrintStream ps;
44
47
 
80
83
    }
81
84
 
82
85
 
83
 
    public void visitLibraryClass(LibraryClass libraryClass)
84
 
    {
85
 
    }
86
 
 
87
 
 
88
86
    // Implementations for MemberVisitor.
89
87
 
90
88
    public void visitProgramField(ProgramClass programClass, ProgramField programField)
93
91
        if (newName != null)
94
92
        {
95
93
            ps.println("    " +
96
 
                       //lineNumberRange(programClass, programField) +
97
94
                       ClassUtil.externalFullFieldDescription(
98
95
                           0,
99
96
                           programField.getName(programClass),
118
115
        String newName = MemberObfuscator.newMemberName(programMethod);
119
116
        if (newName != null)
120
117
        {
121
 
            ps.println("    " +
122
 
                       lineNumberRange(programClass, programMethod) +
123
 
                       ClassUtil.externalFullMethodDescription(
 
118
            ps.print("    ");
 
119
            programMethod.attributesAccept(programClass, this);
 
120
            ps.println(ClassUtil.externalFullMethodDescription(
124
121
                           programClass.getName(),
125
122
                           0,
126
123
                           programMethod.getName(programClass),
131
128
    }
132
129
 
133
130
 
134
 
    // Small utility methods.
135
 
 
136
 
    /**
137
 
     * Returns the line number range of the given class member, followed by a
138
 
     * colon, or just an empty String if no range is available.
139
 
     */
140
 
    private static String lineNumberRange(ProgramClass programClass, ProgramMember programMember)
141
 
    {
142
 
        String range = programMember.getLineNumberRange(programClass);
143
 
        return range != null ?
144
 
            (range + ":") :
145
 
            "";
 
131
    // Implementations for AttributeVisitor.
 
132
 
 
133
    public void visitAnyAttribute(Clazz clazz, Attribute attribute) {}
 
134
 
 
135
 
 
136
    public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
 
137
    {
 
138
        codeAttribute.attributesAccept(clazz, method, this);
 
139
    }
 
140
 
 
141
 
 
142
    public void visitLineNumberTableAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute, LineNumberTableAttribute lineNumberTableAttribute)
 
143
    {
 
144
        ps.print(lineNumberTableAttribute.getLowestLineNumber() + ":" +
 
145
                 lineNumberTableAttribute.getHighestLineNumber() + ":");
146
146
    }
147
147
}