Class JavaDocument
java.lang.Object
com.pnfsoftware.jeb.util.events.EventSource
com.pnfsoftware.jeb.core.output.text.impl.AbstractTextDocument
com.pnfsoftware.jeb.core.output.code.CodeDocument
com.pnfsoftware.jeb.core.units.code.java.JavaDocument
- All Implemented Interfaces:
IGenericDocument,ITextDocument,IEventSource
Java AST document used to render a decompiled piece of Java code. These documents are provided by
the
IDexDecompilerUnit or generated by IJavaSourceUnit.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringProperty name for displaying AST element stacks on hover.static final StringProperty name for rendering method internals as comments.static final StringProperty name for rendering private methods last.static final StringProperty name for disregarding item collapse metadata.static final StringProperty name for omittingthiswhen possible.static final StringProperty name for rendering Java annotations.static final StringProperty name for rendering lambdas when possible.static final StringProperty name for generating@Overrideannotations.static final StringProperty name for rendering synthetic fields.static final StringProperty name for rendering synthetic methods.static final StringProperty name for inserting blank lines after compound statements.static final StringProperty name for resolving field-access targets.static final StringProperty name for resolving method-call targets.static final StringProperty name for source-item sorting before rendering.static final StringProperty name for splitting calls with many arguments.static final StringProperty name for using dex debug-information names.static final StringProperty name for using thevarreserved type when possible.Fields inherited from class com.pnfsoftware.jeb.util.events.EventSource
onEventCallCount -
Constructor Summary
ConstructorsConstructorDescriptionCreate a Java document backed by a Java source unit. -
Method Summary
Modifier and TypeMethodDescriptionaddressToCoordinates(String address, CoordinatesConversionPrecision precision) Precision is not used - Use an exact addressstatic voidbuildPDM(IPropertyDefinitionManager unitPDM) Build Java document property definitions.coordinatesToAddress(ICoordinates coordinates, AddressConversionPrecision precision) Convert document-specific text coordinates to a unit-specific address.coordinatesToCodeCoordinates(ICoordinates coordinates) Convert text coordinates in this document to code coordinates.voiddispose()The default implementation does nothing.longGet the range of anchor points in the document.getDocumentPart(long anchorId, int linesAfter, int linesBefore) Retrieve a document part.Retrieve the owning Java source unit.getUnit()If available, retrieve the unit that backs up this document.Methods inherited from class com.pnfsoftware.jeb.core.output.text.impl.AbstractTextDocument
addressToCoordinates, coordinatesToAddress, format, getDocumentPart, getDocumentPart2, getFirstAnchor, getInitialAnchor, getPropertyManager, toString, useDisplayLineNumber, useLineDeltaMethods inherited from class com.pnfsoftware.jeb.util.events.EventSource
addListener, countListeners, getListeners, getParentSource, insertListener, notifyListeners, notifyListeners, notifyListeners, relay, removeListener, setParentSourceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.pnfsoftware.jeb.util.events.IEventSource
addListener, countListeners, getListeners, getParentSource, insertListener, notifyListeners, removeListener, setParentSourceMethods inherited from interface com.pnfsoftware.jeb.core.output.text.ITextDocument
getBinaryRepresentation, hasBinaryRepresentation
-
Field Details
-
propnameSortItemsForRendering
Property name for source-item sorting before rendering.- See Also:
-
propnameUseDebugInfoNames
Property name for using dex debug-information names.- See Also:
-
propnameDisplayMethodInternalsAsComment
Property name for rendering method internals as comments.- See Also:
-
propnameDisplayPrivateMethodsLast
Property name for rendering private methods last.- See Also:
-
propnameInsertBlankLinesAfterCompounds
Property name for inserting blank lines after compound statements.- See Also:
-
propnameGenerateSyntheticFields
Property name for rendering synthetic fields.- See Also:
-
propnameGenerateSyntheticMethods
Property name for rendering synthetic methods.- See Also:
-
propnameGenerateAnnotations
Property name for rendering Java annotations.- See Also:
-
propnameResolveMethodCallTargets
Property name for resolving method-call targets.- See Also:
-
propnameResolveFieldAccessTargets
Property name for resolving field-access targets.- See Also:
-
propnameGenerateOverrideAnnotations
Property name for generating@Overrideannotations.- See Also:
-
propnameGenerateLambdas
Property name for rendering lambdas when possible.- See Also:
-
propnameUseVarReservedType
Property name for using thevarreserved type when possible.- See Also:
-
propnameDisplayASTElementStackOnHover
Property name for displaying AST element stacks on hover.- See Also:
-
propnameSplitCallArgThreshold
Property name for splitting calls with many arguments.- See Also:
-
propnameDoNotGenerateThisIfPossible
Property name for omittingthiswhen possible.- See Also:
-
propnameDisregardCollapse
Property name for disregarding item collapse metadata.- See Also:
-
-
Constructor Details
-
JavaDocument
Create a Java document backed by a Java source unit.- Parameters:
ast- Java source unit
-
-
Method Details
-
buildPDM
Build Java document property definitions.- Parameters:
unitPDM- property definition manager to populate
-
getOwnerUnit
Retrieve the owning Java source unit.- Returns:
- owner unit
-
dispose
public void dispose()Description copied from class:AbstractTextDocumentThe default implementation does nothing.- Specified by:
disposein interfaceIGenericDocument- Overrides:
disposein classAbstractTextDocument
-
getUnit
Description copied from interface:IGenericDocumentIf available, retrieve the unit that backs up this document.- Returns:
- an optional unit reference (may be null)
-
getAnchorCount
public long getAnchorCount()Description copied from interface:ITextDocumentGet the range of anchor points in the document. Returning 1 means that the document returns a single part, holding the entire contents.Note that the anchor at "
ITextDocument.getFirstAnchor()+ITextDocument.getAnchorCount()" is the "end" anchor (one after the last), and lies outside the document. It is not a valid anchor.- Returns:
- the count/range of anchors in this document, must be greater than zero
-
getDocumentPart
Description copied from interface:ITextDocumentRetrieve a document part. Clients call this method to retrieve a document part starting at a specific anchor, and containing the given amount of lines after and before the anchor. It is the responsibility of the implementor to sanitize the input (eg, negative number of lines, invalid anchor, etc.) and provide appropriate response (eg, truncating). It is recommended that implementors try not to raise an exception on error. In the worst case scenario, an empty document can be returned.- Parameters:
anchorId- the anchor identifierlinesAfter- hint lines count to return after the given anchor, could be more or lesslinesBefore- hint lines count to return before the given anchor, could be more or less- Returns:
- a document part containing as many anchors as required to honor the client requests. If linesAfter is non-null, the first anchor within the document part may not be anchorId, but one anchor before that. This method should return null if an invalid anchor was provided
-
coordinatesToAddress
Description copied from interface:ITextDocumentConvert document-specific text coordinates to a unit-specific address.Note: The addressing scheme is unit specific, and defined by the plugin developer. Addresses should not start with the reserved '@' prefix.
- Specified by:
coordinatesToAddressin interfaceITextDocument- Overrides:
coordinatesToAddressin classAbstractTextDocument- Parameters:
coordinates- the coordinatesprecision- indicate the precision of the address (AddressConversionPrecision.COARSEwill return a raw address, with a faster result whileAddressConversionPrecision.FINEwill return a more precise address that can be a bit longer). IfAddressConversionPrecision.COARSEcan not be retrieved, it may return a null result, and the user will need to recall this method with another precision.- Returns:
- the address, null on error
-
coordinatesToCodeCoordinates
Convert text coordinates in this document to code coordinates.- Parameters:
coordinates- text coordinates- Returns:
- code coordinates, or null if conversion failed
-
addressToCoordinates
Description copied from class:AbstractTextDocumentPrecision is not used - Use an exact address- Specified by:
addressToCoordinatesin interfaceITextDocument- Overrides:
addressToCoordinatesin classAbstractTextDocument- Parameters:
address- a textual addressprecision- requested conversion strategy- Returns:
- the text coordinates, null on error
-