Skip to content

Commit

Permalink
Import Enum constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
agi committed Nov 22, 2021
1 parent 86a279d commit fb4e598
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions apidoc-plugin/src/main/java/org/mozilla/doclet/ApiDoclet.java
Original file line number Diff line number Diff line change
Expand Up @@ -514,9 +514,10 @@ public String visitType(TypeMirror typeMirror, Writer writer) {

@Override
public String visitEnumConstant(VariableElement variableElement, Writer writer) {
return ((TypeElement) variableElement.getEnclosingElement()).getQualifiedName()
+ "."
+ variableElement.getSimpleName();
String typeName =
writer.import_(
((TypeElement) variableElement.getEnclosingElement()).getQualifiedName().toString());
return typeName + "." + variableElement.getSimpleName();
}

@Override
Expand Down
4 changes: 3 additions & 1 deletion apidoc-plugin/src/test/resources/expected-doclet-output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import java.lang.Long;
import java.lang.Runnable;
import java.lang.String;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.List;
import java.util.Map;
Expand All @@ -30,7 +32,7 @@ package org.mozilla.test {
@Documented public interface C {
}

@Documented @Retention(value=java.lang.annotation.RetentionPolicy.RUNTIME) @Target(value={java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.LOCAL_VARIABLE, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PACKAGE, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.TYPE}) public interface DeprecationSchedule {
@Documented @Retention(value=RetentionPolicy.RUNTIME) @Target(value={ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.METHOD, ElementType.PACKAGE, ElementType.PARAMETER, ElementType.TYPE}) public interface DeprecationSchedule {
element public String id();
element public int version();
}
Expand Down
2 changes: 2 additions & 0 deletions apidoc-plugin/src/test/resources/expected-map-output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@








Expand Down

0 comments on commit fb4e598

Please sign in to comment.