public class

JavaOutputSink

extends CppLikeDocumentPart
java.lang.Object
   ↳ com.pnfsoftware.jeb.core.output.code.CodeDocumentPart
     ↳ com.pnfsoftware.jeb.core.output.code.CppLikeDocumentPart
       ↳ com.pnfsoftware.jeb.core.units.code.java.JavaOutputSink

Class Overview

This output sink is the recipient for the generation of a decompiled Java Abstract Syntax Tree (AST). The sink also contains configuration elements that will guide how certain AST elements are generated. Typically, a sink receives the output for a class or a method element.

Generating an AST yields a special type of elements, called items, that a client (such as the decompiler UI) may want to track to achieve higher level purpose such as xrefs building, renaming, easy syntax coloring, etc. Items include keywords, class/field/method/variable names, labels, etc. The type of items generated depends on the item factory provided to JavaOutputSink constructors.

Summary

Nested Classes
class JavaOutputSink.CaptureInfo  
[Expand]
Inherited Fields
From class com.pnfsoftware.jeb.core.output.code.CppLikeDocumentPart
From class com.pnfsoftware.jeb.core.output.code.CodeDocumentPart
Public Constructors
JavaOutputSink(int baseAnchorId)
JavaOutputSink(int baseAnchorId, JavaDocument doc, IDexDecompilerUnit dexdec)
Public Methods
void addGeneratedAnon(IJavaElement container, IJavaClass c)
Register an anonymous type (most likely a class) that's about to be rendered as inline code, inside a method or another class.
void appendAnnotationsList(List<IJavaAnnotation> annotations, char charAfterAnno, Set<String> skiplist)
void appendAnnotationsList(List<IJavaAnnotation> annotations, char charAfterAnno)
void appendKeyword(JavaKeyword keyword, long itemId)
void appendKeyword(JavaKeyword keyword)
int astDepth()
IJavaElement astParent()
Make sure to call before generateEnter.
IJavaElement astPop()
IJavaElement astPush(IJavaElement elt)
void doneGeneratingReplacement()
Collection<IJavaMethod> getContainingMethods()
IJavaType getCurrentAnonymousBaseType()
JavaOutputSink.CaptureInfo getCurrentAnonymousCaptureInfo()
IJavaClass getCurrentContainingClass()
IJavaMethod getCurrentContainingMethod()
int getCurrentMethodIndex()
Get the method index of the method being generated
List<String> getDecompilables()
Retrieve the list of addresses of the decompilable (classes, fields, methods) items generated in this part.
IDexDecompilerUnit getDecompilerUnit()
May be null
int getDisplayMethodInternalsAsComment()
boolean getDisplayPrivateMethodsLast()
boolean getDoNotGenerateThisIfPossible()
JavaDocument getDocument()
May be null
IDynamicContentManager getDynamicContentManager()
boolean getGenerateAnnotations()
boolean getGenerateLambdas()
boolean getGenerateOverrideAnnotations()
boolean getGenerateSyntheticFields()
boolean getGenerateSyntheticMethods()
List<IJavaClass> getGeneratedAnon(IJavaElement container)
Map<Long, List<ICodeCoordinates>> getIdentifierCoordinates()
boolean getInsertBlankLinesAfterCompounds()
IJavaExpression getReplacementFor(IJavaIdentifier ident)
boolean getResolveFieldAccessTargets()
boolean getResolveMethodCallTargets()
int getSortItemsForRendering()
int getSplitCallArgThreshold()
IJavaClass getTopLevelClass()
boolean getUseDebugInfoNames()
boolean isBeingGenerated(IJavaElement elt)
void loadCommentInline(ICodeCoordinates insnCoord)
IJavaType popAnonymousBaseType()
JavaOutputSink.CaptureInfo popAnonymousCaptureInfo()
IJavaClass popContainingClass()
IJavaMethod popContainingMethod()
Map<IJavaIdentifierIJavaExpression> popReplacements()
void pushAnonymousBaseType(IJavaType type)
void pushAnonymousCaptureInfo(JavaOutputSink.CaptureInfo info)
void pushContainingClass(IJavaClass c)
void pushContainingMethod(IJavaMethod m)
void pushReplacements(Map<IJavaIdentifierIJavaExpression> replmap)
void recordGeneratedDecompilable(String signature)
void recordIdentifierCoordinates(long objectId, ICodeCoordinates coordinates)
void renderInlineComment(ICodeCoordinates coord, boolean appendEOL)
void renderPreComment(ICodeCoordinates coord)
note: EOL always appended
boolean requestGeneratingReplacement()
int setCurrentMethodIndex(int index)
Set the method index of the method being generated
void setDynamicContentManager(IDynamicContentManager dcm)
void setGeneratingReplacement(boolean generatingReplacement)
void validate()
[Expand]
Inherited Methods
From class com.pnfsoftware.jeb.core.output.code.CppLikeDocumentPart
From class com.pnfsoftware.jeb.core.output.code.CodeDocumentPart
From class java.lang.Object
From interface com.pnfsoftware.jeb.core.output.code.ICodeDocument
From interface com.pnfsoftware.jeb.core.output.text.ITextDocumentPart

Public Constructors

public JavaOutputSink (int baseAnchorId)

public JavaOutputSink (int baseAnchorId, JavaDocument doc, IDexDecompilerUnit dexdec)

Public Methods

public void addGeneratedAnon (IJavaElement container, IJavaClass c)

Register an anonymous type (most likely a class) that's about to be rendered as inline code, inside a method or another class. We use this multi-map to track anonymous types that were actually rendered, and those that were not. That can happen in obfuscated files where anonymous inner classes are used by third-party (not the container) classes only.

Parameters
container method or class
c an anonymous that's about to be generated (recorded to avoid generated it later)

public void appendAnnotationsList (List<IJavaAnnotation> annotations, char charAfterAnno, Set<String> skiplist)

public void appendAnnotationsList (List<IJavaAnnotation> annotations, char charAfterAnno)

public void appendKeyword (JavaKeyword keyword, long itemId)

public void appendKeyword (JavaKeyword keyword)

public int astDepth ()

public IJavaElement astParent ()

Make sure to call before generateEnter.

Returns
  • the parent of the element AST about to be rendered or null if there is none or none can be found

public IJavaElement astPop ()

public IJavaElement astPush (IJavaElement elt)

public void doneGeneratingReplacement ()

public Collection<IJavaMethod> getContainingMethods ()

public IJavaType getCurrentAnonymousBaseType ()

public JavaOutputSink.CaptureInfo getCurrentAnonymousCaptureInfo ()

public IJavaClass getCurrentContainingClass ()

public IJavaMethod getCurrentContainingMethod ()

public int getCurrentMethodIndex ()

Get the method index of the method being generated

Returns
  • <0 if cannot be determined or invalid

public List<String> getDecompilables ()

Retrieve the list of addresses of the decompilable (classes, fields, methods) items generated in this part.

Returns
  • a list of items, ordered as they appear in the decompiled output

public IDexDecompilerUnit getDecompilerUnit ()

May be null

public int getDisplayMethodInternalsAsComment ()

public boolean getDisplayPrivateMethodsLast ()

public boolean getDoNotGenerateThisIfPossible ()

public JavaDocument getDocument ()

May be null

public IDynamicContentManager getDynamicContentManager ()

public boolean getGenerateAnnotations ()

public boolean getGenerateLambdas ()

public boolean getGenerateOverrideAnnotations ()

public boolean getGenerateSyntheticFields ()

public boolean getGenerateSyntheticMethods ()

public List<IJavaClass> getGeneratedAnon (IJavaElement container)

public Map<Long, List<ICodeCoordinates>> getIdentifierCoordinates ()

public boolean getInsertBlankLinesAfterCompounds ()

public IJavaExpression getReplacementFor (IJavaIdentifier ident)

public boolean getResolveFieldAccessTargets ()

public boolean getResolveMethodCallTargets ()

public int getSortItemsForRendering ()

public int getSplitCallArgThreshold ()

public IJavaClass getTopLevelClass ()

public boolean getUseDebugInfoNames ()

public boolean isBeingGenerated (IJavaElement elt)

public void loadCommentInline (ICodeCoordinates insnCoord)

public IJavaType popAnonymousBaseType ()

public JavaOutputSink.CaptureInfo popAnonymousCaptureInfo ()

public IJavaClass popContainingClass ()

public IJavaMethod popContainingMethod ()

public Map<IJavaIdentifierIJavaExpression> popReplacements ()

public void pushAnonymousBaseType (IJavaType type)

public void pushAnonymousCaptureInfo (JavaOutputSink.CaptureInfo info)

public void pushContainingClass (IJavaClass c)

public void pushContainingMethod (IJavaMethod m)

public void pushReplacements (Map<IJavaIdentifierIJavaExpression> replmap)

public void recordGeneratedDecompilable (String signature)

public void recordIdentifierCoordinates (long objectId, ICodeCoordinates coordinates)

public void renderInlineComment (ICodeCoordinates coord, boolean appendEOL)

public void renderPreComment (ICodeCoordinates coord)

note: EOL always appended

public boolean requestGeneratingReplacement ()

public int setCurrentMethodIndex (int index)

Set the method index of the method being generated

Parameters
index the current method index
Returns
  • the previous index

public void setDynamicContentManager (IDynamicContentManager dcm)

public void setGeneratingReplacement (boolean generatingReplacement)

public void validate ()