Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump mojo.maven.version from 3.9.3 to 3.9.7 #40

Closed
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# To list all file extensions:
# git ls-files | awk -F . {'print $NF'}|sort -u
#
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# files that are binary
*.png
*.jpg
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@

import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.Nullable;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

public class CLIProcessor {
private static final Logger LOGGER = LogManager.getLogger(CLIProcessor.class);
Expand Down Expand Up @@ -195,7 +196,7 @@ private ExitStatus parseCommand(String... args) {
return status;
}

protected List<ICommand> getTopLevelCommands() {
protected final List<ICommand> getTopLevelCommands() {
List<ICommand> retval = Collections.unmodifiableList(commands);
assert retval != null;
return retval;
Expand All @@ -220,7 +221,7 @@ public static void handleQuiet() {

protected void showVersion() {
@SuppressWarnings("resource") PrintStream out = AnsiConsole.out(); // NOPMD - not owner
getVersionInfos().stream().forEach((info) -> {
getVersionInfos().stream().forEach(info -> {
out.println(ansi()
.bold().a(info.getName()).boldOff()
.a(" ")
Expand Down Expand Up @@ -253,6 +254,7 @@ public class CallingContext {
@NonNull
private final List<String> extraArgs;

@SuppressFBWarnings(value = "CT_CONSTRUCTOR_THROW", justification = "Use of final fields")
public CallingContext(@NonNull List<String> args) {
Map<String, ICommand> topLevelCommandMap = getTopLevelCommands().stream()
.collect(Collectors.toUnmodifiableMap(ICommand::getName, Function.identity()));
Expand All @@ -263,35 +265,31 @@ public CallingContext(@NonNull List<String> args) {

boolean endArgs = false;
for (String arg : args) {
if (endArgs) {
if (endArgs || arg.startsWith("-")) {
extraArgs.add(arg);
} else if ("--".equals(arg)) {
endArgs = true;
} else {
if (arg.startsWith("-")) {
ICommand command;
if (calledCommands.isEmpty()) {
command = topLevelCommandMap.get(arg);
} else {
command = calledCommands.getLast();
command = command.getSubCommandByName(arg);
}

if (command == null) {
extraArgs.add(arg);
} else if ("--".equals(arg)) {
endArgs = true;
} else {
ICommand command;
if (calledCommands.isEmpty()) {
command = topLevelCommandMap.get(arg);
} else {
command = calledCommands.getLast();
command = command.getSubCommandByName(arg);
}

if (command == null) {
extraArgs.add(arg);
endArgs = true;
} else {
calledCommands.add(command);
}
calledCommands.add(command);
}
}
}

if (LOGGER.isDebugEnabled()) {
String commandChain = calledCommands.stream()
.map(command -> command.getName())
.map(ICommand::getName)
.collect(Collectors.joining(" -> "));
LOGGER.debug("Processing command chain: {}", commandChain);
}
Expand Down Expand Up @@ -546,7 +544,7 @@ protected String buildHelpCliSyntax() {

// output required options
getOptionsList().stream()
.filter(option -> option.isRequired())
.filter(Option::isRequired)
.forEach(option -> {
builder
.append(' ')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected AbstractParentCommand(boolean subCommandRequired) {
this.subCommandRequired = subCommandRequired;
}

protected void addCommandHandler(ICommand handler) {
protected final void addCommandHandler(ICommand handler) {
String commandName = handler.getName();
this.commandToSubcommandHandlerMap.put(commandName, handler);
}
Expand Down Expand Up @@ -87,7 +87,7 @@ protected ExitStatus executeCommand(
status = ExitCode.INVALID_COMMAND
.exitMessage("Please use one of the following sub-commands: " +
getSubCommands().stream()
.map(command -> command.getName())
.map(ICommand::getName)
.collect(Collectors.joining(", ")));
} else {
status = ExitCode.OK.exit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@

package gov.nist.secauto.metaschema.cli.processor.command;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

public class DefaultExtraArgument implements ExtraArgument {
private final String name;
private final boolean required;
private final int number;

@SuppressFBWarnings(value = "CT_CONSTRUCTOR_THROW", justification = "Use of final fields")
public DefaultExtraArgument(String name, boolean required) {
this(name, required, 1);
}

@SuppressFBWarnings(value = "CT_CONSTRUCTOR_THROW", justification = "Use of final fields")
public DefaultExtraArgument(String name, boolean required, int number) {
if (number < 1) {
throw new IllegalArgumentException("number must be a positive value");
Expand Down
5 changes: 3 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,10 @@
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
gov/nist/secauto/metaschema/core/model/xml/xmlbeans/**/*</exclude>
<!-- filter generated code -->
<exclude>gov/nist/secauto/metaschema/core/model/xml/xmlbeans/**/*</exclude>
<exclude>org/apache/xmlbeans/**/*</exclude>
<exclude>gov/nist/secauto/metaschema/core/metapath/antlr/*</exclude>
</excludes>
</configuration>
</plugin>
Expand Down
28 changes: 12 additions & 16 deletions core/src/main/antlr4/Metapath10.g4
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ metapath : expr EOF ;
// param : DOLLAR eqname typedeclaration? ;
// functionbody : enclosedexpr ;
// [5]
// enclosedexpr : OC expr? CC ;
enclosedexpr : OC expr? CC ;
expr : exprsingle ( COMMA exprsingle)* ;
exprsingle : forexpr | letexpr | quantifiedexpr | ifexpr | orexpr ;
forexpr : simpleforclause KW_RETURN exprsingle ;
Expand Down Expand Up @@ -57,14 +57,11 @@ relativepathexpr : stepexpr (( SLASH | SS) stepexpr)* ;
stepexpr : postfixexpr | axisstep ;
axisstep : (reversestep | forwardstep) predicatelist ;
// [40]
// forwardstep : forwardaxis nodetest | abbrevforwardstep ;
forwardstep : forwardaxis nametest | abbrevforwardstep ;
forwardstep : forwardaxis nodetest | abbrevforwardstep ;
// forwardaxis : KW_CHILD COLONCOLON | KW_DESCENDANT COLONCOLON | KW_ATTRIBUTE COLONCOLON | KW_SELF COLONCOLON | KW_DESCENDANT_OR_SELF COLONCOLON | KW_FOLLOWING_SIBLING COLONCOLON | KW_FOLLOWING COLONCOLON | KW_NAMESPACE COLONCOLON ;
forwardaxis : KW_CHILD COLONCOLON | KW_DESCENDANT COLONCOLON | KW_SELF COLONCOLON | KW_DESCENDANT_OR_SELF COLONCOLON ;
// abbrevforwardstep : AT? nodetest ;
abbrevforwardstep : AT? nametest ;
// reversestep : reverseaxis nodetest | abbrevreversestep ;
reversestep : reverseaxis nametest | abbrevreversestep ;
abbrevforwardstep : AT? nodetest ;
reversestep : reverseaxis nodetest | abbrevreversestep ;
// reverseaxis : KW_PARENT COLONCOLON | KW_ANCESTOR COLONCOLON | KW_PRECEDING_SIBLING COLONCOLON | KW_PRECEDING COLONCOLON | KW_ANCESTOR_OR_SELF COLONCOLON ;
reverseaxis : KW_PARENT COLONCOLON | KW_ANCESTOR COLONCOLON | KW_ANCESTOR_OR_SELF COLONCOLON ;
// [45]
Expand All @@ -73,19 +70,18 @@ abbrevreversestep : DD ;
nodetest : nametest ;
nametest : eqname | wildcard ;
wildcard : STAR | NCName CS | SC NCName | BracedURILiteral STAR ;
// postfixexpr : primaryexpr (predicate | argumentlist | lookup)* ;
postfixexpr : primaryexpr (predicate)* ;
postfixexpr : primaryexpr (predicate | argumentlist | lookup)* ;
// [50]
argumentlist : OP (argument ( COMMA argument)*)? CP ;
predicatelist : predicate* ;
predicate : OB expr CB ;
// lookup : QM keyspecifier ;
// keyspecifier : NCName | IntegerLiteral | parenthesizedexpr | STAR ;
lookup : QM keyspecifier ;
keyspecifier : NCName | IntegerLiteral | parenthesizedexpr | STAR ;
// [55]
//arrowfunctionspecifier : eqname | varref | parenthesizedexpr ;
arrowfunctionspecifier : eqname;
// primaryexpr : literal | varref | parenthesizedexpr | contextitemexpr | functioncall | functionitemexpr | mapconstructor | arrayconstructor | unarylookup ;
primaryexpr : literal | varref | parenthesizedexpr | contextitemexpr | functioncall ;
primaryexpr : literal | varref | parenthesizedexpr | contextitemexpr | functioncall | arrayconstructor | unarylookup;
literal : numericliteral | StringLiteral ;
numericliteral : IntegerLiteral | DecimalLiteral | DoubleLiteral ;
varref : DOLLAR varname ;
Expand All @@ -106,11 +102,11 @@ argument : exprsingle ;
// mapconstructorentry : mapkeyexpr COLON mapvalueexpr ;
// mapkeyexpr : exprsingle ;
// mapvalueexpr : exprsingle ;
// arrayconstructor : squarearrayconstructor | curlyarrayconstructor ;
// squarearrayconstructor : OB (exprsingle ( COMMA exprsingle)*)? CB ;
arrayconstructor : squarearrayconstructor | curlyarrayconstructor ;
squarearrayconstructor : OB (exprsingle ( COMMA exprsingle)*)? CB ;
// [75]
// curlyarrayconstructor : KW_ARRAY enclosedexpr ;
// unarylookup : QM keyspecifier ;
curlyarrayconstructor : KW_ARRAY enclosedexpr ;
unarylookup : QM keyspecifier ;
// singletype : simpletypename QM? ;
// typedeclaration : KW_AS sequencetype ;
// sequencetype : KW_EMPTY_SEQUENCE OP CP | itemtype occurrenceindicator? ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public List<? extends IDataTypeAdapter<?>> getJavaTypeAdapters() {
* if another type adapter has no name
*/
protected void registerDatatype(@NonNull IDataTypeAdapter<?> adapter) {
if (adapter.getNames().size() == 0) {
if (adapter.getNames().isEmpty()) {
throw new IllegalArgumentException("The adapter has no name: " + adapter.getClass().getName());
}
synchronized (this) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public final class DataTypeService {
private static final Logger LOGGER = LogManager.getLogger(DataTypeService.class);
private static final Lazy<DataTypeService> INSTANCE = Lazy.lazy(() -> new DataTypeService());

private Map<String, IDataTypeAdapter<?>> libraryByName;
private Map<Class<? extends IDataTypeAdapter<?>>, IDataTypeAdapter<?>> libraryByClass;
private final Map<String, IDataTypeAdapter<?>> libraryByName;
private final Map<Class<? extends IDataTypeAdapter<?>>, IDataTypeAdapter<?>> libraryByClass;

/**
* Get the singleton service instance, which will be lazy constructed on first
Expand All @@ -67,45 +67,7 @@ public static DataTypeService getInstance() {
}

private DataTypeService() {
load();
}

/**
* Lookup a specific {@link IDataTypeAdapter} instance by its name.
*
* @param name
* the data type name of data type adapter to get the instance for
* @return the instance or {@code null} if the instance is unknown to the type
* system
*/
@Nullable
public IDataTypeAdapter<?> getJavaTypeAdapterByName(@NonNull String name) {
return libraryByName.get(name);
}

/**
* Lookup a specific {@link IDataTypeAdapter} instance by its class.
*
* @param clazz
* the adapter class to get the instance for
* @param <TYPE>
* the type of the requested adapter
* @return the instance or {@code null} if the instance is unknown to the type
* system
*/
@SuppressWarnings("unchecked")
@Nullable
public <TYPE extends IDataTypeAdapter<?>> TYPE getJavaTypeAdapterByClass(@NonNull Class<TYPE> clazz) {
return (TYPE) libraryByClass.get(clazz);
}

/**
* Load available data types registered with the {@link IDataTypeProvider} SPI.
*
* @throws IllegalStateException
* if there are two adapters with the same name
*/
private void load() {
ServiceLoader<IDataTypeProvider> loader = ServiceLoader.load(IDataTypeProvider.class);
List<IDataTypeAdapter<?>> dataTypes = loader.stream()
.map(Provider<IDataTypeProvider>::get)
Expand Down Expand Up @@ -142,10 +104,36 @@ private void load() {
return v1;
},
ConcurrentHashMap::new));
this.libraryByName = libraryByName;
this.libraryByClass = libraryByClass;
}

/**
* Lookup a specific {@link IDataTypeAdapter} instance by its name.
*
* @param name
* the data type name of data type adapter to get the instance for
* @return the instance or {@code null} if the instance is unknown to the type
* system
*/
@Nullable
public IDataTypeAdapter<?> getJavaTypeAdapterByName(@NonNull String name) {
return libraryByName.get(name);
}

synchronized (this) {
this.libraryByName = libraryByName;
this.libraryByClass = libraryByClass;
}
/**
* Lookup a specific {@link IDataTypeAdapter} instance by its class.
*
* @param clazz
* the adapter class to get the instance for
* @param <TYPE>
* the type of the requested adapter
* @return the instance or {@code null} if the instance is unknown to the type
* system
*/
@SuppressWarnings("unchecked")
@Nullable
public <TYPE extends IDataTypeAdapter<?>> TYPE getJavaTypeAdapterByClass(@NonNull Class<TYPE> clazz) {
return (TYPE) libraryByClass.get(clazz);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

import edu.umd.cs.findbugs.annotations.NonNull;

public class MarkupLine
public final class MarkupLine
extends AbstractMarkupString<MarkupLine> {

@NonNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public HtmlNodeRenderer apply(DataHolder options) {
public static class DoubleQuoteNode
extends TypographicQuotes {

@SuppressWarnings("PMD.ConstructorCallsOverridableMethod")
public DoubleQuoteNode(TypographicQuotes node) {
super(node.getOpeningMarker(), node.getText(), node.getClosingMarker());
setTypographicOpening(node.getTypographicOpening());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import com.vladsch.flexmark.parser.ListOptions;

import gov.nist.secauto.metaschema.core.datatype.markup.flexmark.impl.AbstractMarkupWriter;
import gov.nist.secauto.metaschema.core.util.CollectionUtil;
import gov.nist.secauto.metaschema.core.util.ObjectUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

import com.vladsch.flexmark.parser.ListOptions;

import gov.nist.secauto.metaschema.core.datatype.markup.flexmark.impl.AbstractMarkupWriter;

import java.util.Map;

import javax.xml.namespace.QName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR SERVICES PROVIDED HEREUNDER.
*/

package gov.nist.secauto.metaschema.core.datatype.markup.flexmark; // NOPMD AST processor has many members
package gov.nist.secauto.metaschema.core.datatype.markup.flexmark.impl; // NOPMD AST processor has many members

import com.vladsch.flexmark.ast.AutoLink;
import com.vladsch.flexmark.ast.BlockQuote;
Expand Down Expand Up @@ -63,7 +63,9 @@
import com.vladsch.flexmark.util.sequence.BasedSequence;
import com.vladsch.flexmark.util.sequence.Escaping;

import gov.nist.secauto.metaschema.core.datatype.markup.flexmark.IMarkupWriter;
import gov.nist.secauto.metaschema.core.datatype.markup.flexmark.HtmlQuoteTagExtension.DoubleQuoteNode;
import gov.nist.secauto.metaschema.core.datatype.markup.flexmark.IMarkupWriter.ChildHandler;
import gov.nist.secauto.metaschema.core.datatype.markup.flexmark.InsertAnchorExtension.InsertAnchorNode;
import gov.nist.secauto.metaschema.core.util.CollectionUtil;
import gov.nist.secauto.metaschema.core.util.ObjectUtils;
Expand Down Expand Up @@ -111,9 +113,11 @@ public abstract class AbstractMarkupWriter<T, E extends Throwable> // NOPMD not
// normal cases
// ENTITY_MAP.put("&amp;", "&");
/*
* ENTITY_MAP.put("&lsquo;", "‘"); ENTITY_MAP.put("&rsquo;", "’"); ENTITY_MAP.put("&hellip;", "…");
* ENTITY_MAP.put("&mdash;", "—"); ENTITY_MAP.put("&ndash;", "–"); ENTITY_MAP.put("&ldquo;", "“");
* ENTITY_MAP.put("&rdquo;", "”"); ENTITY_MAP.put("&laquo;", "«"); ENTITY_MAP.put("&raquo;", "»");
* ENTITY_MAP.put("&lsquo;", "‘"); ENTITY_MAP.put("&rsquo;", "’");
* ENTITY_MAP.put("&hellip;", "…"); ENTITY_MAP.put("&mdash;", "—");
* ENTITY_MAP.put("&ndash;", "–"); ENTITY_MAP.put("&ldquo;", "“");
* ENTITY_MAP.put("&rdquo;", "”"); ENTITY_MAP.put("&laquo;", "«");
* ENTITY_MAP.put("&raquo;", "»");
*/
}

Expand Down
Loading
Loading