Skip to content

Commit

Permalink
Fixed annotation values rendering for types on Java 9 VMs.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphw committed Jul 28, 2016
1 parent 20837ee commit 8c4f759
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
Expand Up @@ -803,7 +803,7 @@ public int hashCode() {

@Override
public String toString() {
return type.toString();
return PropertyDispatcher.TYPE_LOADED.toString(type);
}
}
}
Expand Down Expand Up @@ -944,7 +944,7 @@ public int hashCode() {

@Override
public String toString() {
return "AnnotationDescription.AnnotationValue.ForComplexArra{" +
return "AnnotationDescription.AnnotationValue.ForComplexArray{" +
"unloadedComponentType=" + unloadedComponentType +
", componentType=" + componentType +
", annotationValues=" + annotationValues +
Expand Down Expand Up @@ -1031,11 +1031,11 @@ public int hashCode() {

@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder("[");
StringBuilder stringBuilder = new StringBuilder().append(componentType == Class.class ? PropertyDispatcher.TypeRenderer.CURRENT.adjust('[') : '[');
for (AnnotationValue.Loaded<?> value : values) {
stringBuilder.append(value.toString());
}
return stringBuilder.append("]").toString();
return stringBuilder.append(componentType == Class.class ? PropertyDispatcher.TypeRenderer.CURRENT.adjust(']') : ']').toString();
}
}
}
Expand Down Expand Up @@ -1222,9 +1222,7 @@ protected String toStringRepresentation() {
} else {
toString.append(", ");
}
toString.append(entry.getKey().getName());
toString.append('=');
toString.append(entry.getValue().toString());
toString.append(entry.getKey().getName()).append('=').append(entry.getValue().toString());
}
toString.append(')');
return toString.toString();
Expand Down
Expand Up @@ -496,7 +496,7 @@ public String toString() {
* A delegate for rendering a {@link Class} or {@link TypeDescription}. Starting with Java 9, such values are enclosed
* in curly braces and are rendered as class literals to better match the source code.
*/
protected enum TypeRenderer {
public enum TypeRenderer {

/**
* A type renderer for a legacy VM prior to Java 8.
Expand Down Expand Up @@ -536,7 +536,7 @@ protected String render(TypeDescription typeDescription) {
/**
* The type renderer to be used on the current VM.
*/
protected static final TypeRenderer CURRENT = make();
public static final TypeRenderer CURRENT = make();

/**
* Finds the type renderer for the current VM.
Expand Down Expand Up @@ -569,7 +569,7 @@ private static TypeRenderer make() {
* @param delimiter The delimiter being used.
* @return The adjusted delimiter.
*/
protected char adjust(char delimiter) {
public char adjust(char delimiter) {
return (char) (delimiter + offset);
}

Expand Down
Expand Up @@ -454,6 +454,10 @@ public enum SampleEnumeration {
VALUE,
OTHER
}
@Retention(RetentionPolicy.RUNTIME)
public @interface Sample2 {
Class<?> foo();
}

@Retention(RetentionPolicy.RUNTIME)
public @interface Sample {
Expand Down

0 comments on commit 8c4f759

Please sign in to comment.