Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions packages/prettier-plugin-java/src/printers/classes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,19 @@ export class ClassesPrettierVisitor extends BaseCstPrettierPrinter {
typeParameters(ctx: TypeParametersCtx) {
const typeParameterList = this.visit(ctx.typeParameterList);

return rejectAndConcat([ctx.Less[0], typeParameterList, ctx.Greater[0]]);
return putIntoBraces(
typeParameterList,
softline,
ctx.Less[0],
ctx.Greater[0]
);
}

typeParameterList(ctx: TypeParameterListCtx) {
const typeParameter = this.mapVisit(ctx.typeParameter);
const commas = ctx.Comma ? ctx.Comma.map(elt => concat([elt, " "])) : [];
const commas = ctx.Comma ? ctx.Comma.map(elt => concat([elt, line])) : [];

return rejectAndJoinSeps(commas, typeParameter);
return group(rejectAndJoinSeps(commas, typeParameter));
}

superclass(ctx: SuperclassCtx) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,9 @@ public void addAll(final Collection<? extends E> c) {
}

}

public abstract class AbstractGenericClass<Value extends AbstractValue, Value1 extends AbstractValue, Value2 extends AbstractValue, Value3 extends AbstractValue, Value4 extends AbstractValue, Value5 extends AbstractValue> {
public Value getValue() {
return new Value();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,17 @@ public void addAll(final Collection<? extends E> c) {
}
}
}

public abstract class AbstractGenericClass<
Value extends AbstractValue,
Value1 extends AbstractValue,
Value2 extends AbstractValue,
Value3 extends AbstractValue,
Value4 extends AbstractValue,
Value5 extends AbstractValue
> {

public Value getValue() {
return new Value();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ public <T> T doSomething(T t) {
}
}

public class ComplexGenericClass<BEAN extends AbstractBean & BeanItemSelect<BEANTYPE>, BEANTYPE, CONFIG extends BeanConfig<BEAN, BEANTYPE, CONFIG>>
public class ComplexGenericClass<
BEAN extends AbstractBean & BeanItemSelect<BEANTYPE>,
BEANTYPE,
CONFIG extends BeanConfig<BEAN, BEANTYPE, CONFIG>
>
extends AbstractBeanConfig<BEAN, CONFIG> {

public <BEAN> List<? super BEAN> getBean(final Class<BEAN> beanClass) {
Expand Down