Skip to content

Commit

Permalink
Remove deprecation
Browse files Browse the repository at this point in the history
- Mark both interface and implementation as deprecated with @deprecated
- Remove deprecated usage
- Code cleanup (diamond operator, remove unnecessary/redundant code)
- Add two Gradle options to show deprecations and unchecked
  • Loading branch information
ggrossetie committed Nov 24, 2018
1 parent 3ce454b commit 01f15a9
Show file tree
Hide file tree
Showing 34 changed files with 204 additions and 159 deletions.
2 changes: 2 additions & 0 deletions asciidoctorj-api/src/main/java/org/asciidoctor/ast/Block.java
Expand Up @@ -7,6 +7,7 @@ public interface Block extends StructuralNode {
* @deprecated Please use {@link #getLines}
* @return The original content of this block
*/
@Deprecated
List<String> lines();

/**
Expand All @@ -24,6 +25,7 @@ public interface Block extends StructuralNode {
* @deprecated Please use {@link #getSource}
* @return the String containing the lines joined together or null if there are no lines
*/
@Deprecated
String source();

/**
Expand Down
Expand Up @@ -83,7 +83,7 @@ public interface Cell extends ContentNode {
Document getInnerDocument();

/**
* @see {@link #getInnerDocument()}
* @see #getInnerDocument()
*/
void setInnerDocument(Document document);

Expand Down
Expand Up @@ -43,42 +43,42 @@
* </pre>
* </p>
*/
public static final String KEY = "content_model";
String KEY = "content_model";

/**
* Predefined constant to let Asciidoctor know that this BlockProcessor creates zero or more child blocks.
*/
public static final String COMPOUND = ":compound";
String COMPOUND = ":compound";

/**
* Predefined constant to let Asciidoctor know that this BlockProcessor creates simple paragraph content.
*/
public static final String SIMPLE = ":simple";
String SIMPLE = ":simple";

/**
* Predefined constant to let Asciidoctor know that this BlockProcessor creates literal content.
*/
public static final String VERBATIM = ":verbatim";
String VERBATIM = ":verbatim";

/**
* Predefined constant to make Asciidoctor pass through the content unprocessed.
*/
public static final String RAW = ":raw";
String RAW = ":raw";

/**
* Predefined constant to make Asciidoctor drop the content.
*/
public static final String SKIP = ":skip";
String SKIP = ":skip";

/**
* Predefined constant to make Asciidoctor not expect any content.
*/
public static final String EMPTY = ":empty";
String EMPTY = ":empty";

/**
* Predefined constant to make Asciidoctor parse content as attributes.
*/
public static final String ATTRIBUTES = ":attributes";
String ATTRIBUTES = ":attributes";

/**
* See the constants defined in this enumeration for possible values.
Expand Down
Expand Up @@ -9,6 +9,7 @@ public interface ContentNode {
* @deprecated Please use {@link #getId()}
* @return A unique ID for this node
*/
@Deprecated
String id();

/**
Expand All @@ -22,16 +23,19 @@ public interface ContentNode {
/**
* @deprecated Use {@linkplain #getParent()} instead.
*/
@Deprecated
ContentNode parent();
ContentNode getParent();
/**
* @deprecated Use {@linkplain #getContext()} instead.
*/
@Deprecated
String context();
String getContext();
/**
* @deprecated Use {@linkplain #getDocument()} instead.
*/
@Deprecated
Document document();
Document getDocument();
boolean isInline();
Expand All @@ -46,6 +50,7 @@ public interface ContentNode {
* @return
* @deprecated Use {@link #getAttribute(Object, Object, boolean)} instead
*/
@Deprecated
Object getAttr(Object name, Object defaultValue, boolean inherit);

/**
Expand All @@ -55,13 +60,15 @@ public interface ContentNode {
* @return
* @deprecated Use {@link #getAttribute(Object, Object)} instead
*/
@Deprecated
Object getAttr(Object name, Object defaultValue);

/**
* @param name
* @return
* @deprecated Use {@link #getAttribute(Object)} instead
*/
@Deprecated
Object getAttr(Object name);

Object getAttribute(Object name, Object defaultValue, boolean inherit);
Expand All @@ -75,6 +82,7 @@ public interface ContentNode {
* @return {@code true} if this node or the document has an attribute with the given name
* @deprecated Use {@link #hasAttribute(Object)} instead
*/
@Deprecated
boolean hasAttr(Object name);

/**
Expand All @@ -84,6 +92,7 @@ public interface ContentNode {
* @return {@code true} if the current node or depending on the inherited parameter the document has an attribute with the given name.
* @deprecated Use {@link #hasAttribute(Object, boolean)} instead
*/
@Deprecated
boolean hasAttr(Object name, boolean inherited);

/**
Expand All @@ -107,6 +116,7 @@ public interface ContentNode {
* @return
* @deprecated Use {@link #isAttribute(Object, Object)} instead.
*/
@Deprecated
boolean isAttr(Object name, Object expected);

/**
Expand All @@ -117,6 +127,7 @@ public interface ContentNode {
* @return
* @deprecated Use {@link #isAttribute(Object, Object, boolean)} instead.
*/
@Deprecated
boolean isAttr(Object name, Object expected, boolean inherit);

/**
Expand Down Expand Up @@ -144,6 +155,7 @@ public interface ContentNode {
* @return
* @deprecated Use {@link #setAttribute(Object, Object, boolean)} instead.
*/
@Deprecated
boolean setAttr(Object name, Object value, boolean overwrite);

boolean setAttribute(Object name, Object value, boolean overwrite);
Expand All @@ -158,6 +170,7 @@ public interface ContentNode {
/**
* @deprecated Use {@linkplain #getRole()} instead.
*/
@Deprecated
String role();
List<String> getRoles();

Expand All @@ -174,5 +187,4 @@ public interface ContentNode {
String readAsset(String path, Map<Object, Object> opts);
String normalizeWebPath(String path, String start, boolean preserveUriTarget);


}
Expand Up @@ -6,6 +6,10 @@ public interface DescriptionList extends StructuralNode {

boolean hasItems();

/**
* @deprecated Please use {@link #convert()}
* @return
*/
@Deprecated
String render();

Expand Down
Expand Up @@ -21,6 +21,7 @@ public interface Document extends StructuralNode {
* @return The title as a String.
* @see Title
*/
@Deprecated
String doctitle();

/**
Expand All @@ -32,6 +33,7 @@ public interface Document extends StructuralNode {
* @deprecated Please use {@link #isBasebackend(String)}
* @return basebackend attribute value
*/
@Deprecated
boolean basebackend(String backend);

/**
Expand Down
4 changes: 4 additions & 0 deletions asciidoctorj-api/src/main/java/org/asciidoctor/ast/List.java
Expand Up @@ -6,6 +6,10 @@ public interface List extends StructuralNode {

boolean hasItems();

/**
* @deprecated Please use {@link #convert()}
* @return
*/
@Deprecated
String render();

Expand Down
Expand Up @@ -6,7 +6,7 @@ public interface ListItem extends StructuralNode {

/**
* @return The text of the cell including substitutions being applied.
* @throws Exception when no text is set. Consider calling {@link #hasText()} before calling this method.
* @throws RuntimeException when no text is set. Consider calling {@link #hasText()} before calling this method.
*/
String getText();

Expand Down
Expand Up @@ -2,6 +2,9 @@

public interface PhraseNode extends ContentNode {

/**
* @deprecated Please use {@link #convert()}
*/
@Deprecated
String render();

Expand Down
Expand Up @@ -6,6 +6,7 @@ public interface Section extends StructuralNode {
* @deprecated Please use {@link #getIndex()}
* @return the 0-based index order of this section within the parent block
*/
@Deprecated
int index();

/**
Expand All @@ -17,6 +18,7 @@ public interface Section extends StructuralNode {
* @deprecated Please use {@link #getNumber()}
* @return the number of this section within the parent block
*/
@Deprecated
int number();

/**
Expand All @@ -28,6 +30,7 @@ public interface Section extends StructuralNode {
* @deprecated Please use {@link #getSectionName()}
* @return the section name of this section
*/
@Deprecated
String sectname();

/**
Expand All @@ -39,6 +42,7 @@ public interface Section extends StructuralNode {
* @deprecated Please use {@link #isSpecial()}
* @return Get the flag to indicate whether this is a special section or a child of one
*/
@Deprecated
boolean special();

/**
Expand All @@ -50,6 +54,7 @@ public interface Section extends StructuralNode {
* @deprecated Please use {@link #isNumbered()}
* @return the state of the numbered attribute at this section (need to preserve for creating TOC)
*/
@Deprecated
boolean numbered();

/**
Expand Down
Expand Up @@ -9,41 +9,42 @@ public interface StructuralNode extends ContentNode {
* Constant for special character replacement substitution like {@code <} to {@code &amp;lt;}.
* @see <a href="http://asciidoctor.org/docs/user-manual/#special-characters">Asciidoctor User Manual</a>
*/
public static final String SUBSTITUTION_SPECIAL_CHARACTERS = "specialcharacters";
String SUBSTITUTION_SPECIAL_CHARACTERS = "specialcharacters";

/**
* Constant for quote replacements like {@code *bold*} to <b>{@code bold}</b>.
* @see <a href="http://asciidoctor.org/docs/user-manual/#quotes">Asciidoctor User Manual</a>
*/
public static final String SUBSTITUTION_QUOTES = "quotes";
String SUBSTITUTION_QUOTES = "quotes";

/**
* Constant for attribute replacements like {@code {foo}}.
* @see <a href="http://asciidoctor.org/docs/user-manual/#attributes-2">Asciidoctor User Manual</a>
*/
public static final String SUBSTITUTION_ATTRIBUTES = "attributes";
String SUBSTITUTION_ATTRIBUTES = "attributes";

/**
* Constant for replacements like {@code (C)} to {@code &#169;}.
* @see <a href="http://asciidoctor.org/docs/user-manual/#replacements">Asciidoctor User Manual</a>
*/
public static final String SUBSTITUTION_REPLACEMENTS = "replacements";
String SUBSTITUTION_REPLACEMENTS = "replacements";

/**
* Constant for macro replacements like {@code mymacro:target[]}.
* @see <a href="http://asciidoctor.org/docs/user-manual/#subs-mac">Asciidoctor User Manual</a>
*/
public static final String SUBSTITUTION_MACROS = "macros";
String SUBSTITUTION_MACROS = "macros";

/**
* Constant for post replacements like creating line breaks from a trailing {@code +} in a line.
* @see <a href="http://asciidoctor.org/docs/user-manual/#post-replacements">Asciidoctor User Manual</a>
*/
public static final String SUBSTITUTION_POST_REPLACEMENTS = "post_replacements";
String SUBSTITUTION_POST_REPLACEMENTS = "post_replacements";

/**
* @deprecated Please use {@linkplain #getTitle()} instead
*/
@Deprecated
String title();
String getTitle();
void setTitle(String title);
Expand All @@ -54,6 +55,7 @@ public interface StructuralNode extends ContentNode {
/**
* @deprecated Please use {@linkplain #getStyle()} instead
*/
@Deprecated
String style();
String getStyle();

Expand All @@ -63,6 +65,7 @@ public interface StructuralNode extends ContentNode {
* @return The list of child blocks of this block
* @deprecated Please use {@linkplain #getBlocks()} instead
*/
@Deprecated
List<StructuralNode> blocks();

/**
Expand All @@ -79,6 +82,7 @@ public interface StructuralNode extends ContentNode {
/**
* @deprecated Please use {@linkplain #getContent()} instead
*/
@Deprecated
Object content();
Object getContent();
String convert();
Expand Down
4 changes: 2 additions & 2 deletions asciidoctorj-api/src/main/java/org/asciidoctor/ast/Table.java
Expand Up @@ -4,11 +4,11 @@

public interface Table extends StructuralNode {

public static enum HorizontalAlignment {
enum HorizontalAlignment {
LEFT, CENTER, RIGHT
}

public static enum VerticalAlignment {
enum VerticalAlignment {
TOP, BOTTOM, MIDDLE
}

Expand Down
Expand Up @@ -9,12 +9,11 @@ public interface PreprocessorReader extends Reader {
void push_include(String data, String file, String path, int lineNumber, Map<String, Object> attributes);

/**
*
* @return
* @deprecated Please use {@link #getDocument()}
*/
@Deprecated
Document document();

Document getDocument();

}
Expand Up @@ -10,6 +10,7 @@ public interface Reader {
* @return 1-based offset.
* @deprecated Please use {@link #getLineNumber()}
*/
@Deprecated
int getLineno();

/**
Expand Down

0 comments on commit 01f15a9

Please sign in to comment.