Skip to content

Commit

Permalink
Code reformatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
david-waltermire committed Nov 9, 2024
1 parent 44a6a83 commit d6296b2
Show file tree
Hide file tree
Showing 74 changed files with 261 additions and 133 deletions.
2 changes: 1 addition & 1 deletion core/metaschema
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ private DataTypeService() {
},
ConcurrentHashMap::new));

@SuppressWarnings({ "unchecked", "null" }) Map<Class<? extends IDataTypeAdapter<?>>,
@SuppressWarnings({ "unchecked", "null" })
Map<Class<? extends IDataTypeAdapter<?>>,
IDataTypeAdapter<?>> typeByClass = dataTypes.stream()
.collect(CustomCollectors.toMap(
dataType -> (Class<? extends IDataTypeAdapter<?>>) dataType.getClass(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ public String asString(Object obj) {
String retval;
if (value.hasTimeZone()) {
@SuppressWarnings("null")
@NonNull String formatted = DateFormats.DATE_WITH_TZ.format(value.getValue());
@NonNull
String formatted = DateFormats.DATE_WITH_TZ.format(value.getValue());
retval = formatted;
} else {
@SuppressWarnings("null")
@NonNull String formatted = DateFormats.DATE_WITHOUT_TZ.format(value.getValue());
@NonNull
String formatted = DateFormats.DATE_WITHOUT_TZ.format(value.getValue());
retval = formatted;
}
return retval;
Expand All @@ -112,7 +114,8 @@ public IDateItem newItem(Object value) {
}

@Override
protected @NonNull IDateItem castInternal(@NonNull IAnyAtomicItem item) {
@NonNull
protected IDateItem castInternal(@NonNull IAnyAtomicItem item) {
IDateItem retval;
if (item instanceof IDateTimeItem) {
ZonedDateTime value = ((IDateTimeItem) item).asZonedDateTime();
Expand All @@ -125,5 +128,4 @@ public IDateItem newItem(Object value) {
}
return retval;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ public String asString(Object obj) {
String retval;
if (value.hasTimeZone()) {
@SuppressWarnings("null")
@NonNull String formatted = DateFormats.DATE_TIME_WITH_TZ.format(value.getValue());
@NonNull
String formatted = DateFormats.DATE_TIME_WITH_TZ.format(value.getValue());
retval = formatted;
} else {
@SuppressWarnings("null")
@NonNull String formatted = DateFormats.DATE_TIME_WITHOUT_TZ.format(value.getValue());
@NonNull
String formatted = DateFormats.DATE_TIME_WITHOUT_TZ.format(value.getValue());
retval = formatted;
}
return retval;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public List<QName> getNames() {
}

@Override
public @NonNull Class<IEmailAddressItem> getItemClass() {
@NonNull
public Class<IEmailAddressItem> getItemClass() {
return IEmailAddressItem.class;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ public List<QName> getNames() {
}

@Override
public @NonNull Class<IHostnameItem> getItemClass() {
public @NonNull
Class<IHostnameItem> getItemClass() {
return IHostnameItem.class;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public List<QName> getNames() {
}

@Override
public @NonNull Class<IIntegerItem> getItemClass() {
@NonNull
public Class<IIntegerItem> getItemClass() {
return IIntegerItem.class;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public Class<IStringItem> getItemClass() {
}

@Override
public @NonNull IStringItem newItem(@NonNull Object value) {
@NonNull
public IStringItem newItem(@NonNull Object value) {
String item = asString(value);
return IStringItem.valueOf(item);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ public MarkupLine parse(XMLEventReader2 eventReader) throws IOException {

@Override
public MarkupLine parse(JsonParser parser) throws IOException {
@SuppressWarnings("null") MarkupLine retval = parse(parser.getValueAsString());
@SuppressWarnings("null")
MarkupLine retval = parse(parser.getValueAsString());
// skip past value
parser.nextToken();
return retval;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public MarkupMultiline parse(XMLEventReader2 eventReader) throws IOException {

@Override
public MarkupMultiline parse(JsonParser parser) throws IOException {
@SuppressWarnings("null") MarkupMultiline retval = parse(parser.getValueAsString());
@SuppressWarnings("null")
MarkupMultiline retval = parse(parser.getValueAsString());
// skip past value
parser.nextToken();
return retval;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ private CodeNodeHtmlRenderer(DataHolder options) {
}

@Override
public @Nullable Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
@Nullable
public Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
return Collections.singleton(
new NodeRenderingHandler<>(Code.class, this::render));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public void extend(FlexmarkHtmlConverter.Builder builder) {
static class QTagNodeRenderer implements NodeRenderer {

@Override
public @Nullable Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
public @Nullable
Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
return Collections.singleton(
new NodeRenderingHandler<>(DoubleQuoteNode.class, this::render));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ public void setIdReference(@NonNull BasedSequence idReference) {
@Override
@NonNull
public BasedSequence[] getSegments() {
@NonNull BasedSequence[] retval = { getType(), getIdReference() };
@NonNull
BasedSequence[] retval = { getType(), getIdReference() };
return retval;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public void extend(HtmlRenderer.Builder rendererBuilder, String rendererType) {
static class PTagNodeRenderer implements NodeRenderer {

@Override
public @Nullable Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
public @Nullable
Set<NodeRenderingHandler<?>> getNodeRenderingHandlers() {
return Collections.singleton(
new NodeRenderingHandler<>(Paragraph.class, this::render));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ R nairyToCollection(
// skip operator, since we know what it is
ParseTree tree = ctx.getChild(idx + 1);
@SuppressWarnings({ "unchecked", "null" })
@NonNull NODE node = (NODE) tree.accept(this);
@NonNull
NODE node = (NODE) tree.accept(this);
return node;
}, supplier);
}
Expand Down Expand Up @@ -238,7 +239,8 @@ R nairyToCollection(

ParseTree leftTree = context.getChild(0);
@SuppressWarnings({ "unchecked", "null" })
@NonNull EXPRESSION leftResult = (EXPRESSION) leftTree.accept(this);
@NonNull
EXPRESSION leftResult = (EXPRESSION) leftTree.accept(this);

IExpression retval;
if (numChildren == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ protected IExpression handleForexpr(ForexprContext ctx) {
// for SimpleForBinding ("," SimpleForBinding)*
int bindingCount = simpleForClause.getChildCount() / 2;

@NonNull IExpression retval = ObjectUtils.notNull(ctx.exprsingle().accept(this));
@NonNull
IExpression retval = ObjectUtils.notNull(ctx.exprsingle().accept(this));

// step through in reverse
for (int idx = bindingCount - 1; idx >= 0; idx--) {
Expand Down Expand Up @@ -236,7 +237,8 @@ protected IExpression handleForexpr(ForexprContext ctx) {

@Override
protected IExpression handleLet(LetexprContext context) {
@NonNull IExpression retval = ObjectUtils.notNull(context.exprsingle().accept(this));
@NonNull
IExpression retval = ObjectUtils.notNull(context.exprsingle().accept(this));

SimpleletclauseContext letClause = context.simpleletclause();
List<SimpleletbindingContext> clauses = letClause.simpleletbinding();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ private static <RESULT_TYPE> Class<? extends RESULT_TYPE> findCommonBase(
@NonNull List<Class<?>> expressionClasses) {
Class<? extends RESULT_TYPE> retval;
if (expressionClasses.size() == 1) {
@SuppressWarnings("unchecked") Class<? extends RESULT_TYPE> result
@SuppressWarnings("unchecked")
Class<? extends RESULT_TYPE> result
= (Class<? extends RESULT_TYPE>) expressionClasses.iterator().next();
assert result != null;
retval = result;
} else {
@SuppressWarnings("unchecked") Class<? extends RESULT_TYPE> first
@SuppressWarnings("unchecked")
Class<? extends RESULT_TYPE> first
= (Class<? extends RESULT_TYPE>) expressionClasses.iterator().next();
assert first != null;
if (baseType.equals(first)) {
Expand All @@ -75,7 +77,8 @@ private static <RESULT_TYPE> Class<? extends RESULT_TYPE> findCommonBase(
baseType,
first,
ObjectUtils.notNull(expressionClasses.subList(1, expressionClasses.size())));
@SuppressWarnings("unchecked") Class<? extends RESULT_TYPE> newBase
@SuppressWarnings("unchecked")
Class<? extends RESULT_TYPE> newBase
= (Class<? extends RESULT_TYPE>) leastCommon;
if (newBase != null) {
retval = newBase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public List<? extends IExpression> getChildren() {
}

@Override
public @NonNull ISequence<? extends IItem> accept(@NonNull DynamicContext dynamicContext,
public @NonNull
ISequence<? extends IItem> accept(@NonNull DynamicContext dynamicContext,
@NonNull ISequence<?> focus) {

ISequence<?> retval = getBase().accept(dynamicContext, focus);
Expand All @@ -83,7 +84,8 @@ public List<? extends IExpression> getChildren() {
return Map.entry(BigInteger.valueOf(index.incrementAndGet()), item);
}).filter(entry -> {
@SuppressWarnings("null")
@NonNull IItem item = entry.getValue();
@NonNull
IItem item = entry.getValue();

// return false if any predicate evaluates to false
return !predicates.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public <RESULT, CONTEXT> RESULT accept(IExpressionVisitor<RESULT, CONTEXT> visit
@Override
public ISequence<?> accept(DynamicContext dynamicContext, ISequence<?> focus) {
List<ISequence<?>> arguments = ObjectUtils.notNull(getChildren().stream().map(expression -> {
@NonNull ISequence<?> result = expression.accept(dynamicContext, focus);
@NonNull
ISequence<?> result = expression.accept(dynamicContext, focus);
return result;
}).collect(Collectors.toList()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public ISequence<?> accept(DynamicContext dynamicContext, ISequence<?> focus) {
focus.getValue();

// now process the union
@NonNull Stream<? extends IItem> retval = ObjectUtils.notNull(getChildren().stream()
@NonNull
Stream<? extends IItem> retval = ObjectUtils.notNull(getChildren().stream()
.flatMap(child -> {
ISequence<?> result = child.accept(dynamicContext, focus);
return result.stream();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ protected Stream<? extends INodeItem> searchExpression(
outerFocus.getValue();

// check the current focus
@SuppressWarnings("unchecked") Stream<? extends INodeItem> nodeMatches
@SuppressWarnings("unchecked")
Stream<? extends INodeItem> nodeMatches
= (Stream<? extends INodeItem>) expression.accept(dynamicContext, outerFocus).stream();

Stream<? extends INodeItem> childMatches = outerFocus.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public List<? extends IExpression> getChildren() {
}

@Override
public final @NonNull Class<INodeItem> getBaseResultType() {
public final @NonNull
Class<INodeItem> getBaseResultType() {
return INodeItem.class;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
public class MetapathFormatter implements IPathFormatter {

@Override
public @NonNull String formatMetaschema(IModuleNodeItem metaschema) {
public @NonNull
String formatMetaschema(IModuleNodeItem metaschema) {
// this will result in a slash being generated using the join in the format
// method
return "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@ public static IBooleanItem compare( // NOPMD - unavoidable
@NonNull IAnyAtomicItem left,
@NonNull Operator operator,
@NonNull IAnyAtomicItem right) {
@NonNull IBooleanItem retval;
@NonNull
IBooleanItem retval;
if (left instanceof IStringItem || right instanceof IStringItem) {
retval = stringCompare(IStringItem.cast(left), operator, IStringItem.cast(right));
} else if (left instanceof INumericItem && right instanceof INumericItem) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ public ISequenceType getResult() {
public static List<ISequence<?>> convertArguments(
@NonNull IFunction function,
@NonNull List<? extends ISequence<?>> parameters) {
@NonNull List<ISequence<?>> retval = new ArrayList<>(parameters.size());
@NonNull
List<ISequence<?>> retval = new ArrayList<>(parameters.size());

Iterator<IArgument> argumentIterator = function.getArguments().iterator();
IArgument argument = null;
Expand Down
Loading

0 comments on commit d6296b2

Please sign in to comment.