Class JavaOutputSink
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
- All Implemented Interfaces:
ICodeDocument
,ITextDocumentPart
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.
-
Nested Class Summary
-
Field Summary
Fields inherited from class com.pnfsoftware.jeb.core.output.code.CppLikeDocumentPart
commentBlockBegin, commentBlockEnd, commentInline
Fields inherited from class com.pnfsoftware.jeb.core.output.code.CodeDocumentPart
indentString, paddingString
-
Constructor Summary
ConstructorDescriptionJavaOutputSink
(int baseAnchorId) JavaOutputSink
(int baseAnchorId, JavaDocument doc, IDexDecompilerUnit dexdec) -
Method Summary
Modifier and TypeMethodDescriptionvoid
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) void
appendAnnotationsList
(List<IJavaAnnotation> annotations, char charAfterAnno, Set<String> skiplist) void
appendKeyword
(JavaKeyword keyword) void
appendKeyword
(JavaKeyword keyword, long itemId) int
astDepth()
Make sure to call beforegenerateEnter
.astPop()
astPush
(IJavaElement elt) void
int
Get the method index of the method being generatedRetrieve the list of addresses of the decompilable (classes, fields, methods) items generated in this part.May be nullint
boolean
boolean
May be nullboolean
boolean
getGeneratedAnon
(IJavaElement container) boolean
boolean
boolean
boolean
boolean
getReplacementFor
(IJavaIdentifier ident) boolean
boolean
int
int
boolean
boolean
void
loadCommentInline
(ICodeCoordinates insnCoord) void
void
void
void
void
pushReplacements
(Map<IJavaIdentifier, IJavaExpression> replmap) void
recordGeneratedDecompilable
(String signature) void
recordIdentifierCoordinates
(long objectId, ICodeCoordinates coordinates) void
renderInlineComment
(ICodeCoordinates coord, boolean appendEOL) void
renderPreComment
(ICodeCoordinates coord) note: EOL always appendedboolean
int
setCurrentMethodIndex
(int index) Set the method index of the method being generatedvoid
void
setGeneratingReplacement
(boolean generatingReplacement) void
validate()
Methods inherited from class com.pnfsoftware.jeb.core.output.code.CppLikeDocumentPart
appendMultiLineComment, appendMultiLineCommentAuto, eol, eol, getEolComment, getEolCoordinates, onEolAddComment, setEolComment, setEolComment, setEolCoordinates
Methods inherited from class com.pnfsoftware.jeb.core.output.code.CodeDocumentPart
append, append, append, appendAndRecord, appendAndRecord, appendAndRecord, appendComment, appendComment, appendCommentAuto, appendKeyword, appendKeyword, appendKeyword, appendMulti, appendParameterSeparator, brace, braceClose, bracket, bracketClose, decrementIndentationLevel, disablePadding, enablePadding, enableTokenFlattening, format, getAnchors, getCurrentAnchor, getCurrentCoordinates, getCurrentLine, getCurrentLineCoordinates, getCurrentLineIndex, getCurrentLineLength, getCurrentMarginLength, getCurrentMostPreciseCodeCoordinates, getIndentationLevel, getIndentationString, getLastLineIndex, getLine, getLineCount, getLines, getObjectLocations, incrementIndentationLevel, indentReset, isCurrentLineEmpty, markCurrentPosition, moveLastLine, moveLine, paren, parenClose, prependCodePart, recordCurrentCoordinates, recordLineCoordinates, recordObjectLocation, registerAnchor, registerAnchor, registerKeyword, resetPaddingString, setIndentationLevel, setIndentationString, setPaddingString, setParameterSeparator, space, space, toString, unrecordCurrentCoordinates, unrecordLineCoordinates
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.pnfsoftware.jeb.core.output.text.ITextDocumentPart
getAnchor
-
Constructor Details
-
JavaOutputSink
public JavaOutputSink(int baseAnchorId) -
JavaOutputSink
-
-
Method Details
-
getDocument
May be null -
getDecompilerUnit
May be null -
getSortItemsForRendering
public int getSortItemsForRendering() -
getUseDebugInfoNames
public boolean getUseDebugInfoNames() -
getDisplayPrivateMethodsLast
public boolean getDisplayPrivateMethodsLast() -
getInsertBlankLinesAfterCompounds
public boolean getInsertBlankLinesAfterCompounds() -
getGenerateSyntheticFields
public boolean getGenerateSyntheticFields() -
getGenerateSyntheticMethods
public boolean getGenerateSyntheticMethods() -
getGenerateAnnotations
public boolean getGenerateAnnotations() -
getDisplayMethodInternalsAsComment
public int getDisplayMethodInternalsAsComment() -
getResolveMethodCallTargets
public boolean getResolveMethodCallTargets() -
getResolveFieldAccessTargets
public boolean getResolveFieldAccessTargets() -
getGenerateOverrideAnnotations
public boolean getGenerateOverrideAnnotations() -
getGenerateLambdas
public boolean getGenerateLambdas() -
getSplitCallArgThreshold
public int getSplitCallArgThreshold() -
getDoNotGenerateThisIfPossible
public boolean getDoNotGenerateThisIfPossible() -
getDisregardCollapse
public boolean getDisregardCollapse() -
pushContainingClass
-
popContainingClass
-
getCurrentContainingClass
-
getTopLevelClass
-
isBeingGenerated
-
astPush
-
astPop
-
astParent
Make sure to call beforegenerateEnter
.- Returns:
- the parent of the element AST about to be rendered or null if there is none or none can be found
-
astDepth
public int astDepth() -
pushContainingMethod
-
popContainingMethod
-
getCurrentContainingMethod
-
getContainingMethods
-
setDynamicContentManager
-
getDynamicContentManager
-
setCurrentMethodIndex
public int setCurrentMethodIndex(int index) Set the method index of the method being generated- Parameters:
index
- the current method index- Returns:
- the previous index
-
getCurrentMethodIndex
public int getCurrentMethodIndex()Get the method index of the method being generated- Returns:
- <0 if cannot be determined or invalid
-
appendKeyword
-
appendKeyword
-
renderPreComment
note: EOL always appended -
renderInlineComment
-
loadCommentInline
-
appendAnnotationsList
-
appendAnnotationsList
public void appendAnnotationsList(List<IJavaAnnotation> annotations, char charAfterAnno, Set<String> skiplist) -
recordIdentifierCoordinates
-
getIdentifierCoordinates
-
pushAnonymousBaseType
-
popAnonymousBaseType
-
getCurrentAnonymousBaseType
-
pushAnonymousCaptureInfo
-
popAnonymousCaptureInfo
-
getCurrentAnonymousCaptureInfo
-
addGeneratedAnon
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 classc
- an anonymous that's about to be generated (recorded to avoid generated it later)
-
getGeneratedAnon
-
pushReplacements
-
popReplacements
-
getReplacementFor
-
setGeneratingReplacement
public void setGeneratingReplacement(boolean generatingReplacement) -
requestGeneratingReplacement
public boolean requestGeneratingReplacement() -
doneGeneratingReplacement
public void doneGeneratingReplacement() -
recordGeneratedDecompilable
-
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
-
validate
public void validate()- Overrides:
validate
in classCppLikeDocumentPart
-